added minister-informstudents component, added new reports, added d3 data chart support

parent adc40507
......@@ -12,6 +12,7 @@
"typings": "rimraf typings/ && typings install"
},
"devDependencies": {
"@types/d3": "^4.8.0",
"@types/node": "^6.0.48",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
......@@ -53,7 +54,7 @@
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.4.1",
"css-loader": "^0.25.0",
"d3": "^3.5.16",
"d3": "^4.4.0",
"es6-promise": "^4.0.5",
"es6-shim": "^0.35.0",
"file-loader": "^0.9.0",
......
export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/drupal';
export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/drupal-8.2.6';
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
export class AppSettings {
public static get API_ENDPOINT(): string {
return 'http://eduslim2.minedu.gov.gr/drupal';
return 'http://eduslim2.minedu.gov.gr/drupal-8.2.6';
// return 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
}
}
......@@ -25,6 +25,19 @@ import { API_ENDPOINT } from '../../app.settings';
selector: 'minister-informstudents',
template: `
<div class="alert alert-success" *ngIf="successSending == 1">
Έγινε αποστολή {{numSuccessMails}} e-mails!
</div>
<div class="alert alert-warning" *ngIf="successSending == 0">
Κάποια e-mail δεν έχουν σταλεί. Έγινε αποστολή {{numSuccessMails}} e-mails!
</div>
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-md" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents()" >
Μαζική αποστολή e-mail στους μαθητές που δεν τοποθετήθηκαν<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
`
......@@ -36,6 +49,8 @@ import { API_ENDPOINT } from '../../app.settings';
//private loginInfo$: Observable<ILoginInfo>;
loginInfo$: BehaviorSubject<ILoginInfo>;
loginInfoSub: Subscription;
private numSuccessMails:number;
private successSending:number;
private apiEndPoint = API_ENDPOINT;
private minedu_userName: string;
private minedu_userPassword: string;
......@@ -75,6 +90,41 @@ import { API_ENDPOINT } from '../../app.settings';
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.numSuccessMails = 0;
this.successSending = -1;
}
informUnlocatedStudents() {
/*
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword)
.catch(err => {console.log(err); })
.then(msg => {
console.log("Success");
});
*/
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword).subscribe(data => {
//this.data = data;
//this.successSending = 0;
this.numSuccessMails = data.num_success_mail;
console.log("HERE!");
console.log(this.numSuccessMails);
//console.log(this.data[0].num_success_mail);
//console.log(this.data.length);
},
error => {
console.log("Error");
this.successSending = 0;
},
() => {
console.log("Success");
this.successSending = 1;
//this.validCreator = true;
}
)
}
......
......@@ -9,6 +9,7 @@ import { IAppState } from '../../store/store';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { ModalDirective } from 'ng2-bootstrap/modal';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
......@@ -26,31 +27,64 @@ import { API_ENDPOINT } from '../../app.settings';
selector: 'minister-view',
template: `
<div
class = "loading" *ngIf=" distStatus === 'STARTED'" >
<!--
<div *ngIf="(isModalShownMy)" [config]="{ show: true }" (onHidden)="onHidden()" bsModal #autoShownModal="bs-modal" 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">Auto shown modal</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Καλημέρα σας.</p>
<p>Αυτό είναι ένα μήνυμα</p>
<p>από το ng2-bootstrap/modal</p>
</div>
</div>
</div>
</div>
-->
<div
class = "loading" *ngIf=" distStatus === 'STARTED'" >
</div>
<div class="alert alert-info" *ngIf="distStatus === 'STARTED'">
Παρακαλώ περιμένετε...Η εκτέλεση της κατανομής ενδέχεται να διαρκέσει μερικά λεπτά. Παρακαλώ μην εκτελείται οποιαδήποτε ενέργεια μετακίνησης στον φυλλομετρητή σας, μέχρι να ολοκληρωθεί η κατανομή.
</div>
<div class="alert alert-info" *ngIf="distStatus === 'FINISHED'">
<div class="alert alert-success" *ngIf="distStatus === 'FINISHED'">
Η κατανομή ολοκληρώθηκε με επιτυχία!
</div>
<div class="alert alert-info" *ngIf="distStatus === 'ERROR'">
<div class="alert alert-warning" *ngIf="distStatus === 'ERROR'">
Αποτυχία κατανομής!
</div>
<div>
<!--
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/epal/distribution" #form>
-->
<div>
<form [formGroup]="formGroup" #form>
<!--<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>-->
<!--<button type="submit" class="btn-primary btn-md" (click)="form.submit()" >-->
<button type="submit" class="btn-primary btn-md" *ngIf="(loginInfo$ | async).size !== 0" (click)="runDistribution()" >
Εκτέλεση Κατανομής Μαθητών
</button>
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-md" *ngIf="(loginInfo$ | async).size !== 0" (click)="runDistribution()" >
Εκτέλεση Κατανομής Μαθητών<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</form>
<button type="button" class="btn-primary btn-md" (click)="testModal()" >
Test Modal
</button>
</div>
`
})
......@@ -58,9 +92,12 @@ import { API_ENDPOINT } from '../../app.settings';
@Injectable() export default class MinisterView implements OnInit, OnDestroy {
public formGroup: FormGroup;
//private loginInfo$: Observable<ILoginInfo>;
loginInfo$: BehaviorSubject<ILoginInfo>;
loginInfoSub: Subscription;
@ViewChild('autoShownModal') public autoShownModal: ModalDirective;
@ViewChild('bootstrapModal') public bootstrapModal:ModalDirective;
public isModalShown: BehaviorSubject<boolean>;
public isModalShownMy: boolean;
private apiEndPoint = API_ENDPOINT;
private minedu_userName: string;
private minedu_userPassword: string;
......@@ -79,8 +116,38 @@ import { API_ENDPOINT } from '../../app.settings';
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.isModalShown = new BehaviorSubject(false);
}
/*
public showModal():void {
console.log("about to show modal");
this.isModalShown.next(true);
this.isModalShownMy = true;
}
public hideModal():void {
this.autoShownModal.hide();
}
public onHidden():void {
this.isModalShown.next(false);
this.isModalShownMy = false;
}
*/
showModal(){
this.bootstrapModal.show();
}
closeModal(){
this.bootstrapModal.hide();
}
ngOnDestroy() {
if (this.loginInfoSub) this.loginInfoSub.unsubscribe();
......@@ -109,14 +176,19 @@ import { API_ENDPOINT } from '../../app.settings';
runDistribution() {
this.distStatus = "STARTED";
this._hds.makeDistribution(this.minedu_userName, this.minedu_userPassword)
.catch(err => {console.log(err); this.distStatus = "ERROR"; })
.catch(err => {console.log(err); this.distStatus = "ERROR"; })
.then(msg => {
console.log("KATANOMH TELEIOSE");
//this.showModal();
if (this.distStatus !== "ERROR")
this.distStatus = "FINISHED";
});
}
testModal() {
this.showModal();
}
}
......@@ -39,6 +39,24 @@ genReportSchema = {
}
};
reportAllStatSchema = {
actions: false,
columns: {
name: {
title: 'Σχολείο',
filter: false
},
section: {
title: 'Τάξη/Τομέας/Ειδικότητα',
filter: false
},
num: {
title: 'Αριθμός Μαθητών',
filter: false
}
}
};
reportCompletenessSchemaFull = {
actions: false,
......@@ -105,8 +123,7 @@ reportCompletenessSchema = {
columns: {
name: {
title: 'Σχολείο',
filter: false,
hide: true
filter: false
},
percTotal: {
title: 'Πληρότητα Σχολείου',
......
......@@ -76,18 +76,25 @@
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
<!--
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης</label>
<input class="form-control" type="text" formControlName="studentbirthdate">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').pristine ">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').dirty && studentDataGroup.get('studentbirthdate').hasError('pattern')">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
-->
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης</label>
<input class="form-control" type="date" formControlName="studentbirthdate">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').touched && studentDataGroup.get('studentbirthdate').hasError('required')">
Συμπληρώστε την ημερομηνία γέννησης του μαθητή!
</div>
......
......@@ -55,8 +55,8 @@ import {
epaluser_id: [,[]],
name: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentsurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
//studentbirthdate: [this.sdate, [Validators.required]],
studentbirthdate: ['', [Validators.pattern(VALID_DATE_PATTERN),Validators.required]],
studentbirthdate: ['', [Validators.required]],
//studentbirthdate: ['', [Validators.pattern(VALID_DATE_PATTERN),Validators.required]],
fatherfirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
fathersurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
motherfirstname: ['ΚΑΤΕΡΙΝΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
......
......@@ -9,7 +9,7 @@
</button>
</div>
<div class="modal-body">
<p>-------------------------</p>
<p>Hello!</p>
<p>-------------------------</p>
<p>-------------------------</p>
</div>
......
......@@ -112,7 +112,7 @@ import {AppSettings} from '../../app.settings';
this.verificationCodeSent.next(true);
this.verificationCodeVerified.next(false);
this.disableUserEmail();
// this.showModal();
//this.showModal();
})
.catch(err => {console.log(err)});
}
......@@ -122,7 +122,7 @@ import {AppSettings} from '../../app.settings';
.then(res => {
this.verificationCodeVerified.next((<any>res).verificationCodeVerified);
this.formGroup.value.userEmail=(<any>res).userEmail;
// this.showModal();
//this.showModal();
})
.catch(err => {console.log(err)});
}
......
......@@ -195,3 +195,17 @@
.reportScroll {
overflow-x: scroll;
}
.d3-chart {
width: 100%;
height: 400px;
}
.d3-chart .axis path,
.d3-chart .axis line {
stroke: #999;
}
.d3-chart .axis text {
fill: #999;
}
......@@ -679,6 +679,30 @@ export class HelperDataService implements OnInit, OnDestroy {
}
informUnlocatedStudents(username, userpassword) {
let headers = new Headers({
"Content-Type": "application/json",
});
this.createMinistryAuthorizationHeader(headers, username, userpassword );
let options = new RequestOptions({ headers: headers });
/*
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/ministry/send-massive-mail`, {username: username, userpassword: userpassword}, options)
.map(response => response.json())
.subscribe(data => {
resolve(data);
},
error => {
reject("Error POST in informUnlocatedStudents");
},
() => console.log(""));
});
*/
return this.http.get(`${AppSettings.API_ENDPOINT}/ministry/send-massive-mail` , options)
.map(response => response.json());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment