Commit dfd635fe authored by Χάρης Παπαδόπουλος's avatar Χάρης Παπαδόπουλος
Browse files

bug fixes, added modal to application.submit

parent 83569662
...@@ -70,12 +70,6 @@ epal.application_submit: ...@@ -70,12 +70,6 @@ epal.application_submit:
_controller: '\Drupal\epal\Controller\ApplicationSubmit::appSubmit' _controller: '\Drupal\epal\Controller\ApplicationSubmit::appSubmit'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
epal.demo_data:
path: '/epal/demodata'
defaults:
_controller: '\Drupal\epal\Controller\CreateDemoData::createData'
requirements:
_access: 'TRUE'
epal.allocation: epal.allocation:
path: '/epal/distribution' path: '/epal/distribution'
options: options:
......
...@@ -87,5 +87,5 @@ class MyLocalization extends NgLocalization { ...@@ -87,5 +87,5 @@ class MyLocalization extends NgLocalization {
}) })
class AppModule {} class AppModule {}
// enableProdMode(); enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule); platformBrowserDynamic().bootstrapModule(AppModule);
import { Component, OnInit, OnDestroy,ElementRef, ViewChild} from "@angular/core"; import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings'; import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service'; import { HelperDataService } from '../../services/helper-data-service';
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
@Component({ @Component({
selector: 'director-classcapacity', selector: 'director-classcapacity',
template: ` template: `
<div style="min-height: 500px;">
<form [formGroup]="formGroup"> <form [formGroup]="formGroup">
<label for="taxi">Τάξη</label><br/> <label for="taxi">Τάξη</label><br/>
<div class="form-group"> <div class="form-group">
...@@ -28,7 +29,7 @@ import { ...@@ -28,7 +29,7 @@ import {
<option value="2" >Β' Λυκείου</option> <option value="2" >Β' Λυκείου</option>
<option value="3" >Γ' Λυκείου</option> <option value="3" >Γ' Λυκείου</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<select #tmop class="form-control" *ngIf="(selectionBClass | async)" (change)="checkbclass(tmop,txoption)" formControlName="tomeas"> <select #tmop class="form-control" *ngIf="(selectionBClass | async)" (change)="checkbclass(tmop,txoption)" formControlName="tomeas">
...@@ -40,14 +41,14 @@ import { ...@@ -40,14 +41,14 @@ import {
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option> <option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select> </select>
</div> </div>
<div *ngIf="(retrievedStudent | async) && (modify === false)"> <div *ngIf="(retrievedStudent | async) && (modify === false)">
<strong>Δυναμική σε τμήματα:</strong> <strong>Δυναμική σε τμήματα:</strong>
<div *ngFor="let classCapac$ of classCapacity$ | async;" > <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><label for="capc">Τρέχουσα Δυναμική:</label> <p class="form-control" id = "capc" style="border:1px solid #eceeef;"> {{classCapac$.capacity}} </p></div>
</div> </div>
<p style="margin-top: 20px; line-height: 2em;"> Αν θέλετε να αλλάξετε τη δυναμική σε τμήματα για τη συγκεκριμένή επιλογή συνέχεια επιλέξτε <i>Τροποποίηση</i>.</p> <p style="margin-top: 20px; line-height: 2em;"> Αν θέλετε να αλλάξετε τη δυναμική σε τμήματα για τη συγκεκριμένή επιλογή συνέχεια επιλέξτε <i>Τροποποίηση</i>.</p>
<button type="button" class="btn-primary btn-sm pull-right" (click) ="modifyCapacity()"> <button type="button" class="btn-primary btn-sm pull-right" (click) ="modifyCapacity()">
Τροποποίηση Τροποποίηση
...@@ -55,15 +56,17 @@ import { ...@@ -55,15 +56,17 @@ import {
</div> </div>
<div *ngIf="(modify === true)"> <div *ngIf="(modify === true)">
<input type="number" formControlName="capacity" min="1" max="10"> <input type="number" formControlName="capacity" min="1" max="10">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()"> <button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()">
Αποθήκευση Αποθήκευση
</button> </button>
</div> </div>
</form>
</div>
` `
}) })
@Injectable() export default class DirectorClassCapacity implements OnInit , OnDestroy{ @Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy {
public formGroup: FormGroup; public formGroup: FormGroup;
private StudentSelected$: BehaviorSubject<any>; private StudentSelected$: BehaviorSubject<any>;
...@@ -72,37 +75,35 @@ import { ...@@ -72,37 +75,35 @@ import {
private StudentSelectedSpecialSub: Subscription; private StudentSelectedSpecialSub: Subscription;
private selectionBClass: BehaviorSubject<boolean>; private selectionBClass: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>; private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147 ; private SchoolId = 147;
private currentclass: Number; private currentclass: Number;
private classCapacity$: BehaviorSubject<any>; private classCapacity$: BehaviorSubject<any>;
private classCapacitySub: Subscription; private classCapacitySub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>; private retrievedStudent: BehaviorSubject<boolean>;
private modify = false; private modify = false;
constructor( private fb: FormBuilder, constructor(private fb: FormBuilder,
private _hds: HelperDataService, private _hds: HelperDataService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router ) private router: Router) {
{ this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelected$ = new BehaviorSubject([{}]); this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]); this.classCapacity$ = new BehaviorSubject([{}]);
this.classCapacity$ = new BehaviorSubject([{}]); this.selectionBClass = new BehaviorSubject(false);
this.selectionBClass = new BehaviorSubject(false); this.selectionCClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false); this.retrievedStudent = new BehaviorSubject(false);
this.retrievedStudent = new BehaviorSubject(false); this.formGroup = this.fb.group({
this.formGroup = this.fb.group({ tomeas: ['', []],
tomeas: ['', []], taxi: ['', []],
taxi: ['', []], specialit: ['', []],
specialit: ['', []], capacity: ['', []],
capacity: ['', []], });
});
} }
ngOnDestroy() ngOnDestroy() {
{
if (this.StudentSelectedSub) if (this.StudentSelectedSub)
this.StudentSelectedSub.unsubscribe(); this.StudentSelectedSub.unsubscribe();
if (this.StudentSelectedSpecialSub) if (this.StudentSelectedSpecialSub)
...@@ -110,117 +111,110 @@ import { ...@@ -110,117 +111,110 @@ import {
if (this.selectionBClass) if (this.selectionBClass)
this.selectionBClass.unsubscribe(); this.selectionBClass.unsubscribe();
if (this.selectionCClass) if (this.selectionCClass)
this.selectionCClass.unsubscribe(); this.selectionCClass.unsubscribe();
if (this.classCapacitySub) if (this.classCapacitySub)
this.classCapacitySub.unsubscribe(); this.classCapacitySub.unsubscribe();
if (this.retrievedStudent) if (this.retrievedStudent)
this.retrievedStudent.unsubscribe(); this.retrievedStudent.unsubscribe();
} }
ngOnInit() { ngOnInit() {
this.retrievedStudent.next(false); this.retrievedStudent.next(false);
} }
verifyclass(txop) verifyclass(txop) {
{ this.modify = false;
this.modify = false; console.log(this.formGroup.value.specialit, "speciality");
console.log(this.formGroup.value.specialit, "speciality"); if (txop.value === "1") {
if (txop.value === "1") this.selectionBClass.next(false);
{ this.selectionCClass.next(false);
this.selectionBClass.next(false); this.formGroup.patchValue({
this.selectionCClass.next(false); tomeas: '',
this.formGroup.patchValue({ specialit: '',
tomeas: '', });
specialit: '', console.log("a class");
}); this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi, 0, 0, this.SchoolId).subscribe(data => {
console.log("a class"); this.classCapacity$.next(data);
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,0,0,this.SchoolId ).subscribe(data => { this.retrievedStudent.next(true);
this.classCapacity$.next(data); },
this.retrievedStudent.next(true); }, error => {
error => { this.classCapacity$.next([{}]);
this.classCapacity$.next([{}]); console.log("Error Getting Capacity");
console.log("Error Getting Capacity"); },
}, () => console.log("Getting Capacity"));
() => console.log("Getting Capacity"));
}
else if (txop.value === "2") {
this.formGroup.patchValue({
specialit: '',
});
this.selectionBClass.next(true);
this.selectionCClass.next(false);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
else if (txop.value === "3") {
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint, "test");
if (this.formGroup.value.tomeas != '') {
var sectorint = +this.formGroup.value.tomeas;
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
} }
else if (txop.value === "2") this.selectionBClass.next(true);
{ this.selectionCClass.next(true);
this.formGroup.patchValue({ this.StudentSelected$ = new BehaviorSubject([{}]);
specialit: '', this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}); }
this.selectionBClass.next(true);
this.selectionCClass.next(false);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
else if (txop.value === "3")
{
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint,"test");
if (this.formGroup.value.tomeas != '')
{
var sectorint = +this.formGroup.value.tomeas;
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
}
this.selectionBClass.next(true);
this.selectionCClass.next(true);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
} }
checkbclass(tmop,txop) checkbclass(tmop, txop) {
{ this.modify = false;
this.modify = false;
var sectorint = +this.formGroup.value.tomeas; var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint,"tomeas"); console.log(sectorint, "tomeas");
if (txop.value === "2") if (txop.value === "2") {
{ console.log("b class");
console.log("b class"); this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi, sectorint, 0, this.SchoolId).subscribe(data => {
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,0,this.SchoolId ).subscribe(data => { this.classCapacity$.next(data);
this.classCapacity$.next(data); this.retrievedStudent.next(true);
this.retrievedStudent.next(true); }, },
error => { error => {
this.classCapacity$.next([{}]); this.classCapacity$.next([{}]);
console.log("Error Getting Capacity"); console.log("Error Getting Capacity");
}, },
() => console.log("Getting Capacity")); () => console.log("Getting Capacity"));
} }
if (txop.value === "3") if (txop.value === "3") {
{
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]); this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$); this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
} }
} }
checkcclass(tmop,txop,spop) checkcclass(tmop, txop, spop) {
{ this.modify = false;
this.modify = false; var sectorint = +this.formGroup.value.tomeas;
var sectorint = +this.formGroup.value.tomeas;
var specialint = +this.formGroup.value.specialit; var specialint = +this.formGroup.value.specialit;
if (txop.value === "3") if (txop.value === "3") {
{ console.log("c class");
console.log("c class"); this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi, sectorint, specialint, this.SchoolId).subscribe(data => {
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,specialint,this.SchoolId ).subscribe(data => { this.classCapacity$.next(data);
this.classCapacity$.next(data); this.retrievedStudent.next(true);
this.retrievedStudent.next(true); }, },
error => { error => {
this.classCapacity$.next([{}]); this.classCapacity$.next([{}]);
console.log("Error Getting Capacity"); console.log("Error Getting Capacity");
}, },
() => console.log("Getting Capacity")); () => console.log("Getting Capacity"));
} }
...@@ -229,19 +223,18 @@ import { ...@@ -229,19 +223,18 @@ import {
saveCapacity() saveCapacity() {
{
var tomeas = +this.formGroup.value.tomeas; var tomeas = +this.formGroup.value.tomeas;
var specialit = +this.formGroup.value.specialit; var specialit = +this.formGroup.value.specialit;
console.log(tomeas, specialit); console.log(tomeas, specialit);
this._hds.saveCapacity(this.formGroup.value.taxi,tomeas,specialit, this.formGroup.value.capacity, this.SchoolId ); this._hds.saveCapacity(this.formGroup.value.taxi, tomeas, specialit, this.formGroup.value.capacity, this.SchoolId);
} }
modifyCapacity(){ modifyCapacity() {
this.modify = true; this.modify = true;
} }
} }
\ No newline at end of file
...@@ -20,8 +20,9 @@ import { ...@@ -20,8 +20,9 @@ import {
@Component({ @Component({
selector: 'director-view', selector: 'director-view',
template: ` template: `
<div style="min-height: 500px;">
<form [formGroup]="formGroup"> <form [formGroup]="formGroup">
<label for="taxi">Τάξη</label><br/> <label for="taxi">Τάξη</label><br/>
<div class="form-group"> <div class="form-group">
...@@ -71,12 +72,12 @@ import { ...@@ -71,12 +72,12 @@ import {
<table> <table>
<tr><td> <tr><td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' "> <div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p> <label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p>
</div> </div>
</td> </td>
<td> <td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' "> <div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p> <label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p>
</div> </div>
</td></tr> </td></tr>
</table> </table>
...@@ -85,8 +86,8 @@ import { ...@@ -85,8 +86,8 @@ import {
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.fatherfirstname}} </p></div> <div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.fathersurname}} </p></div> <div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.motherfirstname}} </p></div> <div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div> <div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div> <div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
<table> <table>
...@@ -108,12 +109,14 @@ import { ...@@ -108,12 +109,14 @@ import {
</td> </td>
</tr> </tr>
</table> </table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div> <div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div> <div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div> <div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
</div> </div>
<!-- </div> --> <!-- </div> -->
</div> </div>
</div>
</ul>
<br> <br>
<br> <br>
...@@ -121,11 +124,11 @@ import { ...@@ -121,11 +124,11 @@ import {
Βρίσκεστε στη σελίδα: Βρίσκεστε στη σελίδα:
<div class="col-1"> <div class="col-1">
<input #pageno type="text" class="form-control" placeholder=".col-1" formControlName="pageno"> <input #pageno type="text" class="form-control" placeholder=".col-1" formControlName="pageno">
</div> </div>
απο απο
<div class="col-1"> <div class="col-1">
<input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage"> <input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage">
</div> </div>
</div> </div>
<br> <br>
...@@ -138,10 +141,11 @@ import { ...@@ -138,10 +141,11 @@ import {
<button class="page-link" (click) ="nextpage(txoption,maxpage) ">Επόμενη</button> <button class="page-link" (click) ="nextpage(txoption,maxpage) ">Επόμενη</button>
</li> </li>
</ul> </ul>
</nav> </nav>
</form>
</div>
` `
}) })
...@@ -166,20 +170,20 @@ import { ...@@ -166,20 +170,20 @@ import {
private SchoolId = 147; private SchoolId = 147;
private currentclass: Number; private currentclass: Number;
private saved: Array<number> = new Array(); private saved: Array<number> = new Array();
private limitdown = 0; private limitdown = 0;
private limitup= 25; private limitup = 25;
private pageno = 1; private pageno = 1;
private userActive = <number>-1; private userActive = <number>-1;
private type: Number; private type: Number;
@ViewChild('fileInput') fileInput:ElementRef; @ViewChild('fileInput') fileInput: ElementRef;
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,