updated MinisterInformStudents Component

parent ee2aa780
......@@ -42,8 +42,14 @@ import { API_ENDPOINT } from '../../app.settings';
<h5> >Αποστολή ειδοποιήσεων <br></h5>
<br><br>
<div class="col-md-12">
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents()" >
Μαζική αποστολή e-mail στους μαθητές που δεν τοποθετήθηκαν<span class="glyphicon glyphicon-menu-right"></span>
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents(true)" >
Μαζική αποστολή e-mail στους μαθητές που ΔΕΝ τοποθετήθηκαν<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
<br>
<div class="col-md-12">
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="informUnlocatedStudents(false)" >
Μαζική αποστολή e-mail στους μαθητές που τοποθετήθηκαν<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
......@@ -124,13 +130,13 @@ import { API_ENDPOINT } from '../../app.settings';
//this.isModalShown.next(false);
}
informUnlocatedStudents() {
informUnlocatedStudents(unallocated) {
this.successSending = -2;
this.numSuccessMails = 0;
this.numFailMails = 0;
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword).subscribe(data => {
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword, unallocated).subscribe(data => {
this.numSuccessMails = data.num_success_mail;
this.numFailMails = data.num_fail_mail;
//console.log("HERE!");
......@@ -142,20 +148,17 @@ import { API_ENDPOINT } from '../../app.settings';
this.modalTitle.next("Κατανομή Μαθητών");
this.modalText.next("Αποτυχία αποστολής e-mails!");
//this.modalHeader = "modal-header-warning";
this.modalHeader.next("modal-header-warning");
this.showModal();
},
() => {
console.log("Success");
console.log("Επιτυχής αποστολή e-mails!");
this.successSending = 1;
//this.modalHeader = "modal-header-success";
this.modalHeader.next("modal-header-success");
this.modalTitle.next("Κατανομή Μαθητών");
let txtModal = "Έγινε αποστολή " + this.numSuccessMails + " e-mails! ";
if (this.numFailMails != 0) {
//this.modalHeader = "modal-header-warning";
this.modalHeader.next("modal-header-warning");
txtModal += "Κάποια e-mail δεν έχουν σταλεί. Δεν ήταν δυνατή η αποστολή " + this.numFailMails + " e-mails!";
}
......
......@@ -729,27 +729,19 @@ export class HelperDataService implements OnInit, OnDestroy {
}
informUnlocatedStudents(username, userpassword) {
informUnlocatedStudents(username, userpassword, unallocated) {
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)
let route="";
if (unallocated == true)
route = "ministry/send-unallocated-massive-mail";
else
route = "ministry/send-located-massive-mail";
return this.http.get(`${AppSettings.API_ENDPOINT}/` + route , 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