Auto save option with loader while closing the form implemented
This commit is contained in:
parent
3498c83fd5
commit
ca4f932bcf
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
|
||||||
matTooltipPosition="right" mat-dialog-close style="color:#e24533;background: white">
|
matTooltipPosition="right" (click)="saveWithoutValidation();" style="color:#e24533;background: white">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1408,6 +1408,9 @@ onSubmit(flag?) {
|
|||||||
records.formid = "25";
|
records.formid = "25";
|
||||||
records.fk_createdby = this.users;
|
records.fk_createdby = this.users;
|
||||||
records.is_form_validated = flag == 'go_back' ? '0' : '1'
|
records.is_form_validated = flag == 'go_back' ? '0' : '1'
|
||||||
|
if(flag == 'go_back') {
|
||||||
|
this.loaderService.showMatSpinnerDialog("Partial data save is in progress. Please wait...");
|
||||||
|
}
|
||||||
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
|
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
|
||||||
if(result['dataStatus']) {
|
if(result['dataStatus']) {
|
||||||
// if(flag != 'go_back') {
|
// if(flag != 'go_back') {
|
||||||
@ -1424,10 +1427,12 @@ onSubmit(flag?) {
|
|||||||
else {
|
else {
|
||||||
this.notifier.notify('warning',"Something went wrong");
|
this.notifier.notify('warning',"Something went wrong");
|
||||||
}
|
}
|
||||||
|
this.loaderService.closeMatSpinnerDialog()
|
||||||
this.spinner_access = false
|
this.spinner_access = false
|
||||||
},err=>{
|
},err=>{
|
||||||
console.log("Error in savePDFormDetails",err);
|
console.log("Error in savePDFormDetails",err);
|
||||||
this.notifier.notify('danger',"Network Error");
|
this.notifier.notify('danger',"Network Error");
|
||||||
|
this.loaderService.closeMatSpinnerDialog()
|
||||||
this.spinner_access = false
|
this.spinner_access = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1671,6 +1676,15 @@ dynamicOnChangeValidations(choosed_value,controls_arr,value_compare) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
saveWithoutValidation() {
|
||||||
|
if(this.firstFormGroup.dirty){
|
||||||
|
this.onSubmit('go_back');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.dialogRef.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
console.log("Common ques component destroyed");
|
console.log("Common ques component destroyed");
|
||||||
if(this.firstFormGroup.dirty){
|
if(this.firstFormGroup.dirty){
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
<div fxFlex="30" align="end" style="padding: 10px !important;">
|
||||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
|
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
|
||||||
matTooltipPosition="right" mat-dialog-close style="color:#e24533;background: white">
|
matTooltipPosition="right" (click)="saveWithoutValidation();" style="color:#e24533;background: white">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1505,6 +1505,9 @@ records.questions = records.questions.filter(v=>v.form_id != '12.1' && v.form_id
|
|||||||
records.formid = "25";
|
records.formid = "25";
|
||||||
records.fk_createdby = this.users;
|
records.fk_createdby = this.users;
|
||||||
records.is_form_validated = flag == 'go_back' ? '0' : '1'
|
records.is_form_validated = flag == 'go_back' ? '0' : '1'
|
||||||
|
if(flag == 'go_back') {
|
||||||
|
this.loaderService.showMatSpinnerDialog("Partial data save is in progress. Please wait...");
|
||||||
|
}
|
||||||
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
|
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
|
||||||
if(result['dataStatus']) {
|
if(result['dataStatus']) {
|
||||||
// if(flag != 'go_back') {
|
// if(flag != 'go_back') {
|
||||||
@ -1521,10 +1524,12 @@ records.questions = records.questions.filter(v=>v.form_id != '12.1' && v.form_id
|
|||||||
else {
|
else {
|
||||||
this.notifier.notify('info',"Something went wrong");
|
this.notifier.notify('info',"Something went wrong");
|
||||||
}
|
}
|
||||||
|
this.loaderService.closeMatSpinnerDialog()
|
||||||
this.spinner_access = false
|
this.spinner_access = false
|
||||||
},err=>{
|
},err=>{
|
||||||
console.log("Error in savePDFormDetails",err);
|
console.log("Error in savePDFormDetails",err);
|
||||||
this.notifier.notify('info',"Network Error");
|
this.notifier.notify('info',"Network Error");
|
||||||
|
this.loaderService.closeMatSpinnerDialog()
|
||||||
this.spinner_access = false
|
this.spinner_access = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1816,6 +1821,15 @@ records.questions = records.questions.filter(v=>v.form_id != '12.1' && v.form_id
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
saveWithoutValidation() {
|
||||||
|
if(this.employerForm.dirty){
|
||||||
|
this.onSubmit('go_back');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.dialogRef.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
formDate(value){
|
formDate(value){
|
||||||
// console.log('to',this.todate)
|
// console.log('to',this.todate)
|
||||||
|
|||||||
@ -36,9 +36,10 @@ export class LoaderService {
|
|||||||
hide() {
|
hide() {
|
||||||
this.loaderSubject.next(<LoaderState>{ show: false });
|
this.loaderSubject.next(<LoaderState>{ show: false });
|
||||||
}
|
}
|
||||||
showMatSpinnerDialog() {
|
showMatSpinnerDialog(message = '') {
|
||||||
this.spinnerdialogRef = this.dialog.open(ProgressSpineerDialogComponent, {
|
this.spinnerdialogRef = this.dialog.open(ProgressSpineerDialogComponent, {
|
||||||
panelClass: 'transparent',
|
panelClass: 'transparent',
|
||||||
|
data:message,
|
||||||
// minHeight:'20%',
|
// minHeight:'20%',
|
||||||
minWidth:'20%',
|
minWidth:'20%',
|
||||||
disableClose: true
|
disableClose: true
|
||||||
|
|||||||
@ -1 +1,4 @@
|
|||||||
<mat-spinner></mat-spinner>
|
<div fxLayout="column" fxLayoutAlign="center">
|
||||||
|
<mat-spinner style="text-align: center;" fxLayoutAlign="center center"></mat-spinner>
|
||||||
|
<p style="font-weight: bold;color: white;text-align: center;"> {{spinnerMsg}}</p>
|
||||||
|
</div>
|
||||||
@ -2,4 +2,9 @@
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
background: rgba(0, 0, 0, 0.0);
|
background: rgba(0, 0, 0, 0.0);
|
||||||
}
|
}
|
||||||
|
mat-spinner {
|
||||||
|
@media(min-width:600px) {
|
||||||
|
// margin-left: 75px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
|
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-progress-spineer-dialog',
|
selector: 'app-progress-spineer-dialog',
|
||||||
@ -6,8 +7,11 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./progress-spineer-dialog.component.scss']
|
styleUrls: ['./progress-spineer-dialog.component.scss']
|
||||||
})
|
})
|
||||||
export class ProgressSpineerDialogComponent implements OnInit {
|
export class ProgressSpineerDialogComponent implements OnInit {
|
||||||
|
spinnerMsg: any;
|
||||||
|
|
||||||
constructor() { }
|
constructor(@Inject(MAT_DIALOG_DATA) private data) {
|
||||||
|
this.spinnerMsg= this.data
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export const environment = {
|
|||||||
},
|
},
|
||||||
credential:{
|
credential:{
|
||||||
uname:"officerbot@sine.com",
|
uname:"officerbot@sine.com",
|
||||||
pwd:"bot1234"
|
pwd:"bot12345"
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue
Block a user