conflict resolution

parents a11d79ca 4d0e3dd0
......@@ -141,7 +141,7 @@ epal.ministry.log_out_go:
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.general_report:
path: '/ministry/general-report/{regionId}/{adminId}/{schId}'
path: '/ministry/general-report'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -157,7 +157,7 @@ epal.ministry.report-completeness:
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.report-all-stat:
path: '/ministry/report-all-stat/{regionId}/{adminId}/{schId}'
path: '/ministry/report-all-stat/{regionId}/{adminId}/{schId}/{classId}/{sectorId}/{courseId}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -188,3 +188,19 @@ coursesperschools:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements:
_user_is_logged_in: 'TRUE'
critirioschosen:
path: '/epal/critiriachosen/{studentId}/{type}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SubmitedApplications::getCritiria'
requirements:
_user_is_logged_in: 'TRUE'
findcapacity:
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::findCapacity'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -209,9 +209,13 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
$epalStudent = reset($epalStudents);
if ($epalStudents) {
$studentIdNew = $epalStudent -> id();
$checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array( 'student_id'=> $studentIdNew));
$checkstudentstatus = reset($checkstatus);
if ($i >= $limitdown && $i < $limitup)
{
$newstatus = $checkstudentstatus -> directorconfirm-> getValue();
$list[] = array(
'i' => $i,
'id' => $epalStudent -> id(),
......@@ -221,7 +225,17 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
'fathersurname' =>$epalStudent -> fathersurname ->value,
'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->value,
'guardianfirstname' =>$epalUser -> name ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'regionaddress' =>$epalStudent -> regionaddress ->value,
'regiontk' =>$epalStudent -> regiontk ->value,
'regionarea' =>$epalStudent -> regionarea ->value,
'certificatetype' =>$epalStudent -> certificatetype ->value,
'telnum' =>$epalStudent -> telnum ->value,
'relationtostudent' =>$epalStudent -> relationtostudent ->value,
'birthdate' =>$epalStudent -> birthdate ->value,
'checkstatus' =>$newstatus[0][value],
);
}
$i++;
......@@ -282,13 +296,19 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
{
$postData = json_decode($content);
$arr = $postData->students;
$type = $postData ->type;
foreach ($arr as $value) {
$valnew = intval($value);
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew ));
$studentConfirm = reset($studentForConfirm);
if ($studentConfirm) {
if ($type == 1)
$studentConfirm->set('directorconfirm', true);
if ($type == 2)
$studentConfirm->set('directorconfirm', false);
if ($type == 3)
unset($studentConfirm->{directorconfirm});
$studentConfirm->save();
}
}
......@@ -318,6 +338,8 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
......@@ -575,6 +597,96 @@ public function returnstatus($id)
}
public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
$tomeasnew = intval($tomeas);
$specialitnew = intval($specialitnew) ;
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $this->testSchoolId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
$response = new Response();
$response->setContent('No access to this school');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
$list = array();
if (($tomeasnew == 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'capacity' => $classcapacity -> capacity_class_a -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $tomeasnew ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'capacity' => $classcapacity -> capacity_class_sector -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew != 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialitnew));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' =>$taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'tomeas' => $classcapacity -> specialty_id -> value,
'capacity' => $classcapacity -> capacity_class_specialty -> value ,
);
}
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} else {
return $this->respondWithStatus([
'message' => t("EPAL user not found"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -95,8 +95,16 @@ class SubmitedApplications extends ControllerBase
'fathersurname' =>$object -> fathersurname ->value,
'motherfirstname' => $object -> motherfirstname ->value,
'mothersurname' =>$object -> mothersurname ->value,
'guardianfirstname' =>$epalUser -> name ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'regionaddress' =>$object -> regionaddress ->value,
'regiontk' =>$object -> regiontk ->value,
'regionarea' =>$object -> regionarea ->value,
'certificatetype' =>$object -> certificatetype ->value,
'telnum' =>$object -> telnum ->value,
'relationtostudent' =>$object -> relationtostudent ->value,
'birthdate' =>$object -> birthdate ->value,
);
);
$i++;
}
......@@ -115,7 +123,7 @@ class SubmitedApplications extends ControllerBase
} else {
return $this->respondWithStatus([
'message' => t("User not found"),
'message' => t("User not found!!!!"),
], Response::HTTP_FORBIDDEN);
}
......@@ -166,6 +174,67 @@ public function getEpalChosen(Request $request, $studentId)
}
public function getCritiria(Request $request, $studentId, $type)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser -> user_id -> entity -> id();
$studentIdNew = intval($studentId) ;
$critiriaChosen = $this->entityTypeManager->getStorage('epal_student_moria')->loadByProperties(array( 'user_id'=>$userid,'student_id'=> $studentIdNew));
$i = 0;
if ($critiriaChosen) {
$list = array();
foreach ($critiriaChosen as $object) {
$critirio_id = $object -> criterio_id ->entity -> id();
$critiriatype = $this->entityTypeManager->getStorage('epal_criteria')->loadByProperties(array( 'id'=>$critirio_id ));
$typeofcritiria = reset($critiriatype);
$typecrit = $typeofcritiria -> category -> value;
if ($typecrit == "Κοινωνικό" && $type == 1){
$list[] = array(
'critirio' => $object -> criterio_id ->entity->get('name')->value ,
'critirio_id' => $critirio_id ,
);
$i++;
}
if ($typecrit == "Εισοδηματικό" && $type == 2){
$list[] = array(
'critirio' => $object -> criterio_id ->entity->get('name')->value ,
'critirio_id' => $critirio_id ,
);
$i++;
}
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
}
else {
return $this->respondWithStatus([
'message' => t("EPAL chosen not found!!!"),
], Response::HTTP_FORBIDDEN);
}
} else {
return $this->respondWithStatus([
'message' => t("User not found"),
], Response::HTTP_FORBIDDEN);
}
}
......
......@@ -5,6 +5,9 @@ dependencies:
- user.role.administrator
- user.role.applicant
- user.role.authenticated
- user.role.eduadmin
- user.role.ministry
- user.role.regioneduadmin
module:
- basic_auth
- epalreadydata
......@@ -12,7 +15,7 @@ dependencies:
- serialization
- user
_core:
default_config_hash: x1x9jIC8SmXp0wDILOEs5_1lxH47q3VCokKYxEu4U-8
default_config_hash: YTXNI4Qb3Jgg7KwwlzgRShhY83j2js-q24x9a-SgLgg
id: coursefields
label: coursefields
module: views
......@@ -35,6 +38,9 @@ display:
authenticated: authenticated
administrator: administrator
applicant: applicant
ministry: ministry
eduadmin: eduadmin
regioneduadmin: regioneduadmin
cache:
type: tag
options: { }
......@@ -220,7 +226,46 @@ display:
footer: { }
empty: { }
relationships: { }
arguments: { }
arguments:
sector_id:
id: sector_id
table: eepal_specialty_field_data
field: sector_id
relationship: none
group_type: group
admin_label: ''
default_action: default
exception:
value: all
title_enable: false
title: All
title_enable: false
title: ''
default_argument_type: query_parameter
default_argument_options:
query_param: sector_id
fallback: ''
multiple: and
default_argument_skip_url: false
summary_options:
base_path: ''
count: true
items_per_page: 25
override: false
summary:
sort_order: asc
number_of_records: 0
format: default_summary
specify_validation: false
validate:
type: none
fail: 'not found'
validate_options: { }
break_phrase: false
not: false
entity_type: eepal_specialty
entity_field: sector_id
plugin_id: numeric
display_extenders: { }
cache_metadata:
max-age: -1
......@@ -228,6 +273,7 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- request_format
- url
- url.query_args
- user.roles
tags: { }
......@@ -259,6 +305,9 @@ display:
name:
alias: ''
raw_output: true
sector_id:
alias: ''
raw_output: true
auth:
- basic_auth
cache_metadata:
......@@ -267,5 +316,6 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- request_format
- url
- user.roles
tags: { }
......@@ -5,6 +5,9 @@ dependencies:
- user.role.administrator
- user.role.applicant
- user.role.authenticated
- user.role.eduadmin
- user.role.ministry
- user.role.regioneduadmin
module:
- basic_auth
- epalreadydata
......@@ -13,7 +16,7 @@ dependencies:
- serialization
- user
_core:
default_config_hash: 5rM-pSfc1ywl4-ufHeAQsKiVGcBMDcz4RLfYmMeVGfo
default_config_hash: 2Ow8_rRpftR4qqbwfsr6yc_XMzbRKZjHSEuFzrXvzV8
id: sectorlist
label: sectorList
module: views
......@@ -36,6 +39,9 @@ display:
authenticated: authenticated
administrator: administrator
applicant: applicant
ministry: ministry
eduadmin: eduadmin
regioneduadmin: regioneduadmin
cache:
type: tag
options: { }
......
......@@ -36,16 +36,30 @@ import {
</select>
</div>
<div class="form-group">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" formControlName="specialit">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" (change)="checkcclass(tmop,txoption,spop)" formControlName="specialit">
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select>
</div>
<div *ngIf="(retrievedStudent | async) && (modify === false)">
<strong>Δυναμική σε τμήματα:</strong>
<div *ngFor="let classCapac$ of classCapacity$ | async;" >
<div><label for="capc">Τρέχουσα Δυναμική:</label> <p class="form-control" id = "capc" style="border:1px solid #eceeef;"> {{classCapac$.capacity}} </p></div>
</div>
<p style="margin-top: 20px; line-height: 2em;"> Αν θέλετε να αλλάξετε τη δυναμική σε τμήματα για τη συγκεκριμένή επιλογή συνέχεια επιλέξτε <i>Τροποποίηση</i>.</p>
<button type="button" class="btn-primary btn-sm pull-right" (click) ="modifyCapacity()">
Τροποποίηση
</button>
</div>
<div *ngIf="(modify === true)">
<input type="number" formControlName="capacity" min="1" max="10">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()">
Αποθήκευση
</button>
</div>
`
})
......@@ -60,6 +74,10 @@ import {
private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147 ;
private currentclass: Number;
private classCapacity$: BehaviorSubject<any>;
private classCapacitySub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>;
private modify = false;
......@@ -70,8 +88,10 @@ import {
{
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.classCapacity$ = new BehaviorSubject([{}]);
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
this.retrievedStudent = new BehaviorSubject(false);
this.formGroup = this.fb.group({
tomeas: ['', []],
taxi: ['', []],
......@@ -91,17 +111,21 @@ import {
this.selectionBClass.unsubscribe();
if (this.selectionCClass)
this.selectionCClass.unsubscribe();
if (this.classCapacitySub)
this.classCapacitySub.unsubscribe();
if (this.retrievedStudent)
this.retrievedStudent.unsubscribe();
}
ngOnInit() {
this.retrievedStudent.next(false);
}
verifyclass(txop)
{
this.modify = false;
console.log(this.formGroup.value.specialit, "speciality");
if (txop.value === "1")
{
this.selectionBClass.next(false);
......@@ -110,6 +134,15 @@ import {
tomeas: '',
specialit: '',
});
console.log("a class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,0,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
else if (txop.value === "2")
......@@ -136,20 +169,61 @@ import {
this.selectionCClass.next(true);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
}
}
checkbclass(tmop,txop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint,"tomeas");
if (txop.value === "2")
{
console.log("b class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
if (txop.value === "3")
{
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
}
}
checkcclass(tmop,txop,spop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
var specialint = +this.formGroup.value.specialit;
if (txop.value === "3")
{
console.log("c class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,specialint,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
}
......@@ -165,4 +239,9 @@ saveCapacity()
}
modifyCapacity(){
this.modify = true;
}
}
\ No newline at end of file
This diff is collapsed.
import {Router, ActivatedRoute, Params} from '@angular/router';
import {OnInit, Component} from '@angular/core';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { NgRedux, select } from 'ng2-redux';
import { Observable } from 'rxjs/Rx';
import { IAppState } from '../../store/store';
import { HelperDataService } from '../../services/helper-data-service';
import { CookieService } from 'ngx-cookie';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray
} from '@angular/forms';
import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../../app.settings';
@Component({
selector: 'director-buttons',
template: `
<div>
<form>
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="navigatedirector()">
Επιλεχθέντες Μαθητές<span class="glyphicon glyphicon-menu-right"></span>
</button>
<br>
<br>
<button type="submit" class="btn-primary btn-lg" (click)="navigatecapacity()">
Δυναμική Τμημάτων<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
<br>
<br>
<br>
<br>
<br>
</form>
</div>
`
})
export default class DirectorButtom implements OnInit {
constructor(
private router: Router,
)
{
};
ngOnInit() {
}
navigatedirector(){
this.router.navigate(['/school/director-view']);
}
navigatecapacity(){
this.router.navigate(['/school/director-classcapacity']);
}
}
......@@ -27,6 +27,7 @@ export class reportsSchema {
genReportSchema = {
actions: false,
noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης',
columns: {
name: {
title: 'Κατηγορία',
......@@ -45,6 +46,7 @@ reportAllStatSchema = {
display : true,
perPage:10
},
noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης',
columns: {
name: {
title: 'Σχολείο',
......@@ -65,6 +67,14 @@ reportAllStatSchema = {
num: {
title: 'Αριθμός Μαθητών',
filter: false
},
capacity: {
title: 'Χωρ/κα',
filter: false
},
percentage: {