Commit 900b7c2a authored by Δάρα Κατερίνα's avatar Δάρα Κατερίνα 👀

minor fix in minister/admin-minister-settings in order to hide results upon new search

parent 1addafc4
This diff is collapsed.
......@@ -16,7 +16,8 @@ import { IAppState } from "../../store/store";
<div
class = "loading" *ngIf="(dataRetrieved == -1 || (showLoader | async) === true)" >
</div>
<div id="configNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
......@@ -43,7 +44,7 @@ import { IAppState } from "../../store/store";
<div class="row">
<div class="col-md-9">
<input class="form-control" type="text" placeholder="Αναζήτηση με ΑΦΜ..." formControlName="taxisuserid" (keydown.enter)="onSearch()">
<input class="form-control" type="text" placeholder="Αναζήτηση με ΑΦΜ..." formControlName="taxisuserid" (keydown)="onKeydown($event)">
<div class="alert alert-danger" *ngIf="(formSearch.get('taxisuserid').dirty || formSearch.get('taxisuserid').touched) && formSearch.get('taxisuserid').invalid">
<p *ngFor="let validation of validation_messages.taxisuserid">
......@@ -58,14 +59,14 @@ import { IAppState } from "../../store/store";
<div class="col-md-3">
<button type="submit" class="btn btn-md pull-left" (click)="onSearch()" [disabled] = "formSearch.get('taxisuserid').hasError('required')">Αναζήτηση</button>
<button type="submit" class="btn btn-md pull-left" (click)="onSearch()" [disabled] = "formSearch.invalid">Αναζήτηση</button>
</div>
</div>
</form>
<br><br>
<div *ngIf="userid!=null">
<div *ngIf="(showResults | async) === true">
<form novalidate [formGroup]="formApplicant" >
<p *ngIf="name"><b>Όνομα:</b> {{name}} </p>
......@@ -96,7 +97,7 @@ import { IAppState } from "../../store/store";
</form>
</div>
<div class="alert alert-warning text-center" style="width:90%" [hidden]="rslts">
<div class="alert alert-warning text-center" style="width:90%" *ngIf="(dataRetrieved == 0 && (showResults | async) === false )">
<h6>Δεν βρέθηκαν χρήστες με αυτό το ΑΦΜ</h6>
</div>
......@@ -117,8 +118,7 @@ import { IAppState } from "../../store/store";
private applicantSub: Subscription;
private dataRetrieved: number;
private rslts: boolean = true;
private showResults: BehaviorSubject<boolean>;
private taxisuserid:string;
......@@ -145,8 +145,7 @@ import { IAppState } from "../../store/store";
this.modalHeader = new BehaviorSubject("");
this.settings$ = new BehaviorSubject([{}]);
this.showLoader = new BehaviorSubject(false);
this.rslts = true;
this.showResults = new BehaviorSubject(false);
this.createSearchForm();
this.createApplicantForm();
......@@ -181,7 +180,6 @@ import { IAppState } from "../../store/store";
// this.isModalShown.next(false);
}
ngOnDestroy() {
(<any>$("#configNotice")).remove();
......@@ -210,8 +208,18 @@ import { IAppState } from "../../store/store";
}
onSearch() {
if (this.formSearch.invalid) return;
this.retrieveApplicantUser(this.formSearch.get('taxisuserid').value);
if (this.formSearch.invalid){
return;
}else this.retrieveApplicantUser(this.formSearch.get('taxisuserid').value);
}
onKeydown(event) {
if (event.key === "Enter") {
this.onSearch();
}else{
this.dataRetrieved = 1;
this.showResults.next(false);
}
}
onSave() {
......@@ -225,6 +233,7 @@ import { IAppState } from "../../store/store";
.subscribe(data => {
this.settings$.next(data);
this.dataRetrieved = 1;
this.showResults.next(true);
this.modalTitle.next("Ρύθμιση Παραμέτρων Εξιουσιοδότησης Διευθυντή");
this.modalText.next("Έγινε εφαρμογή των νέων σας ρυθμίσεων.");
......@@ -234,6 +243,7 @@ import { IAppState } from "../../store/store";
error => {
this.settings$.next([{}]);
this.dataRetrieved = 0;
this.showResults.next(false);
console.log("Error Getting MinisterStoreSettings");
this.modalTitle.next("Ρύθμιση Παραμέτρων Εξιουσιοδότησης Διευθυντή");
......@@ -251,7 +261,6 @@ import { IAppState } from "../../store/store";
retrieveApplicantUser(taxisid) {
this.dataRetrieved = -1;
this.rslts = true;
this.applicantSub = this._hds.getApplicantUserByTaxisId(this.minedu_userName, this.minedu_userPassword, taxisid).subscribe(data => {
this.settings$.next(data);
......@@ -268,12 +277,12 @@ import { IAppState } from "../../store/store";
this.formApplicant.patchValue({numchildren:this.numchildren, representative:this.representative});
this.dataRetrieved = 1;
this.showResults.next(true);
},
error => {
this.settings$.next([{}]);
this.dataRetrieved = 0;
this.rslts = false;
this.userid = null;
this.showResults.next(false);
console.log("Error Getting ApplicantUserRetrieveData");
});
}
......
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