conflict resolution

parents f5c46168 43b77c51
...@@ -310,4 +310,4 @@ class CASLogin extends ControllerBase ...@@ -310,4 +310,4 @@ class CASLogin extends ControllerBase
return false; return false;
} }
} }
\ No newline at end of file
...@@ -152,4 +152,4 @@ class CASLogout extends ControllerBase ...@@ -152,4 +152,4 @@ class CASLogout extends ControllerBase
return new RedirectResponseWithCookieExt($this->redirectUrl .'&error_code=' . $errorCode, 302, []); return new RedirectResponseWithCookieExt($this->redirectUrl .'&error_code=' . $errorCode, 302, []);
} }
} }
} }
\ No newline at end of file
...@@ -46,5 +46,11 @@ function epal_mail($key, &$message, $params) { ...@@ -46,5 +46,11 @@ function epal_mail($key, &$message, $params) {
$message['subject'] = t('Σύστημα υποβολής αιτήσεων εγγραφής σε ΕΠΑΛ: Επιβεβαίωση e-mail', $options); $message['subject'] = t('Σύστημα υποβολής αιτήσεων εγγραφής σε ΕΠΑΛ: Επιβεβαίωση e-mail', $options);
$message['body'][] = $params['message']; $message['body'][] = $params['message'];
break; break;
case 'massive_mail':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ', $options);
$message['body'][] = $params['message'];
break;
} }
} }
...@@ -206,3 +206,12 @@ findcapacity: ...@@ -206,3 +206,12 @@ findcapacity:
_controller: '\Drupal\epal\Controller\DirectorView::findCapacity' _controller: '\Drupal\epal\Controller\DirectorView::findCapacity'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
findschoolid:
path: '/epal/getschool'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolID'
requirements:
_user_is_logged_in: 'TRUE'
...@@ -687,6 +687,48 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -687,6 +687,48 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
} }
public function getSchoolID(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schid = intval($user -> init -> value );
$list = array();
$list[] = array(
'id' => $schid
);
$i++;
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} else {
return $this->respondWithStatus([
'message' => t("User not found!"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) { private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr); $res = new JsonResponse($arr);
$res->setStatusCode($s); $res->setStatusCode($s);
......
...@@ -108,7 +108,8 @@ class Distribution extends ControllerBase { ...@@ -108,7 +108,8 @@ class Distribution extends ControllerBase {
try { try {
//initialize/empty epal_student_class if there are already data in it! //initialize/empty epal_student_class if there are already data in it!
$this->connection->delete('epal_student_class')->execute(); //$this->connection->delete('epal_student_class')->execute();
$this->initializeResults();
//$limitUp_class = $this->retrieveCapacityLimitUp("Α"); //$limitUp_class = $this->retrieveCapacityLimitUp("Α");
$limitUp_class = $this->retrieveCapacityLimitUp("1"); $limitUp_class = $this->retrieveCapacityLimitUp("1");
...@@ -509,9 +510,27 @@ class Distribution extends ControllerBase { ...@@ -509,9 +510,27 @@ class Distribution extends ControllerBase {
return $res; return $res;
} }
private function initializeResults() {
//initialize/empty epal_student_class if there are already data in it!
try {
$this->connection->delete('epal_student_class')->execute();
}
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during initializeResults Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
/*
public function makegGeneralReport(Request $request) { public function makegGeneralReport(Request $request) {
try { try {
...@@ -574,15 +593,7 @@ class Distribution extends ControllerBase { ...@@ -574,15 +593,7 @@ class Distribution extends ControllerBase {
->condition('eStudent.id', $studentIds, 'NOT IN'); ->condition('eStudent.id', $studentIds, 'NOT IN');
$numNoAllocated = $sCon->countQuery()->execute()->fetchField(); $numNoAllocated = $sCon->countQuery()->execute()->fetchField();
/*
$list[] = array(
'num_applications' => $numTotal,
'numchoice1' => $numData[0],
'numchoice2' => $numData[1],
'numchoice3' => $numData[2],
'num_noallocated' => $numNoAllocated,
);
*/
...@@ -616,73 +627,11 @@ class Distribution extends ControllerBase { ...@@ -616,73 +627,11 @@ class Distribution extends ControllerBase {
} }
} }
*/
/*
public function makeReport1(Request $request) {
try {
if (!$request->isMethod('GET')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
], Response::HTTP_METHOD_NOT_ALLOWED);
}
//user validation
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if (!$user) {
return $this->respondWithStatus([
'message' => t("User not found"),
], Response::HTTP_FORBIDDEN);
}
//user role validation
$roles = $user->getRoles();
$validRole = false;
foreach ($roles as $role)
if ($role === "ministry") {
$validRole = true;
break;
}
if (!$validRole) {
return $this->respondWithStatus([
'message' => t("User Invalid Role"),
], Response::HTTP_FORBIDDEN);
}
$list = array();
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'name'));
$epalSchools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
//$schoolIds = array();
foreach ($epalSchools as $epalSchool) {
//array_push($schoolIds, $schoolId->id);
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('id', 'epal_id'))
->condition('eStudent.epal_id', $epalSchool->id , '=');
$num = $sCon->countQuery()->execute()->fetchField();
if ($num !== "0")
array_push($list,(object) array('schoolName' => $epalSchool->name, 'numStudents' => $num));
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} //end try
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured in makeReport1 Method")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
*/
......
...@@ -166,7 +166,10 @@ class InformUnlocatedStudents extends ControllerBase { ...@@ -166,7 +166,10 @@ class InformUnlocatedStudents extends ControllerBase {
.t(' δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης, .t(' δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης,
στην οποία ανήκετε, ώστε να διερευνηθεί η δυνατότητα εγγραφής σας σε αντίστοιχο ΕΠΑΛ'); //e-mail body στην οποία ανήκετε, ώστε να διερευνηθεί η δυνατότητα εγγραφής σας σε αντίστοιχο ΕΠΑΛ'); //e-mail body
//add new lines with SENDER name - check it //add new lines with SENDER name - check it
$params['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ'); //$params['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ');
//$this->logger->warning($params['message']);
//$langcode = $user->getPreferredLangcode(); //$langcode = $user->getPreferredLangcode();
$send = true; $send = true;
......
...@@ -156,6 +156,8 @@ import { ...@@ -156,6 +156,8 @@ import {
public formGroup: FormGroup; public formGroup: FormGroup;
private StudentSelected$: BehaviorSubject<any>; private StudentSelected$: BehaviorSubject<any>;
private StudentSelectedSub: Subscription; private StudentSelectedSub: Subscription;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
private StudentInfo$: BehaviorSubject<any>; private StudentInfo$: BehaviorSubject<any>;
private StudentInfoSub: Subscription; private StudentInfoSub: Subscription;
private StudentsSize$: BehaviorSubject<any>; private StudentsSize$: BehaviorSubject<any>;
...@@ -167,7 +169,7 @@ import { ...@@ -167,7 +169,7 @@ import {
private retrievedStudent: BehaviorSubject<boolean>; private retrievedStudent: BehaviorSubject<boolean>;
private selectionBClass: BehaviorSubject<boolean>; private selectionBClass: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>; private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147; private SchoolId ;
private currentclass: Number; private currentclass: Number;
private saved: Array<number> = new Array(); private saved: Array<number> = new Array();
private limitdown = 0; private limitdown = 0;
...@@ -192,6 +194,9 @@ import { ...@@ -192,6 +194,9 @@ import {
this.retrievedStudent = new BehaviorSubject(false); this.retrievedStudent = new BehaviorSubject(false);
this.selectionBClass = new BehaviorSubject(false); this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false); this.selectionCClass = new BehaviorSubject(false);
this.School$ = new BehaviorSubject([{}]);
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
tomeas: ['', []], tomeas: ['', []],
taxi: ['', []], taxi: ['', []],
...@@ -220,10 +225,24 @@ import { ...@@ -220,10 +225,24 @@ import {
ngOnInit() { ngOnInit() {
} this.SchoolSub = this._hds.getSchoolId().subscribe(x => {
this.School$.next(x);
console.log(x[0].id, "schoolid!");
this.SchoolId = x[0].id;
},
error => {
this.School$.next([{}]);
console.log("Error Getting School");
},
() => console.log("Getting School "));
}
verifyclass(txop) { verifyclass(txop) {
console.log(this.SchoolId,"schoolida");
this.pageno = 1; this.pageno = 1;
this.retrievedStudent.next(false); this.retrievedStudent.next(false);
if (txop.value === "1") { if (txop.value === "1") {
...@@ -275,6 +294,7 @@ import { ...@@ -275,6 +294,7 @@ import {
checkbclass(tmop, txop) { checkbclass(tmop, txop) {
console.log(this.SchoolId,"schoolidn");
this.pageno = 1; this.pageno = 1;
this.retrievedStudent.next(false); this.retrievedStudent.next(false);
var sectorint = +this.formGroup.value.tomeas; var sectorint = +this.formGroup.value.tomeas;
...@@ -321,8 +341,6 @@ import { ...@@ -321,8 +341,6 @@ import {
} }
// this.StudentInfo$ = new BehaviorSubject([{}]);
// this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass).subscribe(this.StudentInfo$);
this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => { this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
this.StudentInfo$.next(data); this.StudentInfo$.next(data);
this.retrievedStudent.next(true); this.retrievedStudent.next(true);
...@@ -363,9 +381,6 @@ import { ...@@ -363,9 +381,6 @@ import {
confirmStudent() { confirmStudent() {
this._hds.saveConfirmStudents(this.saved, this.type); this._hds.saveConfirmStudents(this.saved, this.type);
let event = new MouseEvent('click', { bubbles: true });
this.fileInput.nativeElement.dispatchEvent(event);
} }
checkcclass() { checkcclass() {
......
...@@ -55,8 +55,11 @@ import { ...@@ -55,8 +55,11 @@ import {
private CoursesPerPerfSub: Subscription; private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>; private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription; private StudentsSizeSub: Subscription;
public perfecture = 1; public perfecture ;
private regionActive = <number>-1; private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
...@@ -67,6 +70,7 @@ import { ...@@ -67,6 +70,7 @@ import {
this.LimitPerCateg$ = new BehaviorSubject([{}]); this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]); this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({}); this.StudentsSize$ = new BehaviorSubject({});
this.School$ = new BehaviorSubject([{}]);
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
}); });
...@@ -77,6 +81,19 @@ import { ...@@ -77,6 +81,19 @@ import {
ngOnInit() { ngOnInit() {
this.SchoolSub = this._hds.getSchoolId().subscribe(x => {
this.School$.next(x);
console.log(x[0].id, "perfectureID");
this.perfecture = x[0].id;
},
error => {
this.School$.next([{}]);
console.log("Error Getting School");
},
() => console.log("Getting School "));
this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(this.perfecture).subscribe(data => { this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(this.perfecture).subscribe(data => {
this.SchoolsPerPerf$.next(data); this.SchoolsPerPerf$.next(data);
......
...@@ -10,15 +10,6 @@ import { Router, ActivatedRoute, Params} from '@angular/router'; ...@@ -10,15 +10,6 @@ import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx'; import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types'; import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state'; import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray,
} from '@angular/forms';
import { API_ENDPOINT } from '../../app.settings'; import { API_ENDPOINT } from '../../app.settings';
@Component({ @Component({
...@@ -29,68 +20,25 @@ import { API_ENDPOINT } from '../../app.settings'; ...@@ -29,68 +20,25 @@ import { API_ENDPOINT } from '../../app.settings';
class = "loading" *ngIf="successSending == -2" > class = "loading" *ngIf="successSending == -2" >
</div> </div>
<div id="mailSuccessNotice" (onHidden)="onHidden('#mailSuccessNotice')" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> <div id="emaiSentNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header {{modalHeader}}" >
<h4 class="modal-title pull-left">Κατανομή μαθητών</h4> <h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;{{ modalTitle | async }}</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#mailSuccessNotice')"> <button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">
<span aria-hidden="true">&times;</span> <span aria-hidden="true"><i class="fa fa-times"></i></span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Έγινε αποστολή {{numSuccessMails}} e-mails!</p> <p>{{ modalText | async }}</p>
</div> </div>
</div> <div class="modal-footer">
</div> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
</div>
<div id="mailFailureNotice" (onHidden)="onHidden('#mailFailureNotice')" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title pull-left">Κατανομή μαθητών</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#mailFailureNotice')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Αποτυχία αποστολής e-mails!</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div id="mailNonSendingNotice" (onHidden)="onHidden('#mailNonSendingNotice')" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title pull-left">Κατανομή μαθητών</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#mailNonSendingNotice')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Κάποια e-mail δεν έχουν σταλεί.
Δεν ήταν δυνατή η αποστολή {{numFailMails}} e-mails!</p>
</div>
</div>
</div>
</div>
<!--
<div class="alert alert-success" *ngIf="successSending == 1 ">
Έγινε αποστολή {{numSuccessMails}} e-mails!
</div>
<div class="alert alert-warning" *ngIf="successSending == 0">
Αποτυχία αποστολής e-mails!
</div>
<div class="alert alert-warning" *ngIf="numFailMails != 0">
Κάποια e-mail δεν έχουν σταλεί.
Δεν ήταν δυνατή η αποστολή {{numFailMails}} e-mails!
</div>
-->
<br><br> <br><br>
<div class="col-md-12"> <div class="col-md-12">
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents()" > <button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents()" >
...@@ -98,17 +46,16 @@ import { API_ENDPOINT } from '../../app.settings'; ...@@ -98,17 +46,16 @@ import { API_ENDPOINT } from '../../app.settings';
</button> </button>
</div> </div>
` `
}) })
@Injectable() export default class InformStudents implements OnInit, OnDestroy { @Injectable() export default class InformStudents implements OnInit, OnDestroy {
public formGroup: FormGroup;
//private loginInfo$: Observable<ILoginInfo>;
loginInfo$: BehaviorSubject<ILoginInfo>; loginInfo$: BehaviorSubject<ILoginInfo>;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
//public isModalShown: BehaviorSubject<boolean>;
public modalHeader: string;
loginInfoSub: Subscription; loginInfoSub: Subscription;
private numSuccessMails:number; private numSuccessMails:number;
private numFailMails:number; private numFailMails:number;
...@@ -117,26 +64,22 @@ import { API_ENDPOINT } from '../../app.settings'; ...@@ -117,26 +64,22 @@ import { API_ENDPOINT } from '../../app.settings';
private minedu_userName: string; private minedu_userName: string;
private minedu_userPassword: string; private minedu_userPassword: string;
constructor(private fb: FormBuilder, constructor(
// private _ata: LoginInfoActions,
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService, private _hds: HelperDataService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router) { private router: Router) {
this.formGroup = this.fb.group({
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
//this.isModalShown = new BehaviorSubject(false);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
} }
ngOnInit() { ngOnInit() {
(<any>$('#mailSuccessNotice')).appendTo("body"); (<any>$('#emaiSentNotice')).appendTo("body");
(<any>$('#mailFailureNotice')).appendTo("body");
(<any>$('#mailNonSendingNotice')).appendTo("body");