Complete Anyway feature added

This commit is contained in:
sriram-at-840620226347 2020-10-29 17:40:09 +05:30
parent 0519812d85
commit f9c55c8e11
7 changed files with 117 additions and 16 deletions

View File

@ -1,3 +1,4 @@
<div *ngIf="!data.hasOwnProperty('isCompleteAnywaydialog')">
<h2 mat-dialog-title>{{data.title}}</h2>
<mat-dialog-content>
<div fxFlex="100">
@ -27,4 +28,37 @@
</mat-dialog-actions>
<!-- <mat-dialog-actions align="end" *ngIf="!CompletenessCheck">
<button mat-raised-button mat-dialog-close><strong> Ok </strong></button>
</mat-dialog-actions> -->
</mat-dialog-actions> -->
</div>
<div *ngIf="data.hasOwnProperty('isCompleteAnywaydialog') && data.isCompleteAnywaydialog == true">
<h2 mat-dialog-title>{{data.title}}</h2>
<mat-dialog-content>
<div fxFlex="100">
<p align="center">
{{data.msg}}
</p>
<!-- <span *ngIf="!CompletenessCheck">
<span *ngIf="!Loading">
<p align="center" style="color: red !important;"> {{completeness_message}} </p>
<ul><li *ngFor="let forms of dialoge_subcontent" style="color: red !important;">
{{ forms }}
</li></ul>
</span>
<span *ngIf="Loading">
<div fxLayoutAlign="center">
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
</div>
</span>
</span> -->
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<!-- <button *ngIf="enableAddonPD===true" mat-raised-button color="primary" (click)="changeCompletePDStatus(addonStatus)"><strong> Yes / Allow Addon PD</strong></button> -->
<button mat-raised-button mat-dialog-close><strong> OK </strong></button>
<button mat-raised-button color="primary" *ngIf="data.iscompleteenable == true" (click)="completeAnyway()"><strong>Complete Anyway</strong></button>
</mat-dialog-actions>
<!-- <mat-dialog-actions align="end" *ngIf="!CompletenessCheck">
<button mat-raised-button mat-dialog-close><strong> Ok </strong></button>
</mat-dialog-actions> -->
</div>

View File

@ -22,6 +22,7 @@ export class PdCompleteStatusDialogueComponent implements OnInit {
constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef<PdCompleteStatusDialogueComponent>,@Inject(MAT_DIALOG_DATA) public data: any)
{
console.log(data);
// this.notifier = notifier;
// this.dialoge_title_content = this.data.vendor_status=='INPROGRESS' ? 'Start Discussion' : this.data.vendor_status=='COMPLETED' ? 'Complete Discussion' : 'Change Discussion';
// this.dialoge_content = this.data.vendor_status=='INPROGRESS' ? 'Are you starting the Discussion ?' : this.data.vendor_status=='COMPLETED' ? 'Please confirm you are completing the Discussion and forwarding for Quality Check ?' : 'Change Discussion';
@ -37,4 +38,7 @@ export class PdCompleteStatusDialogueComponent implements OnInit {
changeCompletePDStatus(){
this.dialogRef.close('COMPLETED')
}
completeAnyway(){
this.dialogRef.close('COMPLETED')
}
}

View File

@ -1008,6 +1008,7 @@
<div class="mat-button-div">
<button mat-stroked-button matStepperPrevious>Back</button>
<!-- <button mat-stroked-button (click)="stepper.reset();firstFormGroup.reset()">Reset</button> -->
<button *ngIf="!spinner_access" mat-stroked-button (click)="onSubmit('go_back')" >Save as Draft</button>
<button mat-raised-button (click)="onSubmit()"><span *ngIf="!spinner_access">Submit</span> <span *ngIf="spinner_access"> Submitting...
<!-- <ion-spinner color="light" name="dots" ></ion-spinner> -->
<!-- <mat-spinner diameter="5"></mat-spinner> -->

View File

@ -1390,16 +1390,16 @@ onSubmit(flag?) {
records.is_form_validated = flag == 'go_back' ? '0' : '1'
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
if(result['dataStatus']) {
if(flag != 'go_back') {
// if(flag != 'go_back') {
this.notifier.notify('success',"Saved Successfully...",);
}
// }
this.firstFormGroup.markAsPristine();
this.firstFormGroup.markAsUntouched();
if(flag != 'go_back') {
// if(flag != 'go_back') {
setTimeout(()=>{
this.dialogRef.close()
},3000)
}
// }
}
else {
this.notifier.notify('warning',"Something went wrong");
@ -1418,7 +1418,7 @@ canDeactivate(){
// this.timer.unsubscribe();
console.log(this.firstFormGroup.dirty)
if(this.firstFormGroup.dirty){
this.onSubmit('go_back');
// this.onSubmit('go_back');
// return this.constant.chekAlertOnLeave().then(res=>{
// console.log(res)
// return res
@ -1654,7 +1654,7 @@ dynamicOnChangeValidations(choosed_value,controls_arr,value_compare) {
ngOnDestroy() {
console.log("Common ques component destroyed");
if(this.firstFormGroup.dirty){
this.onSubmit('go_back');
// this.onSubmit('go_back');
// return this.constant.chekAlertOnLeave().then(res=>{
// console.log(res)
// return res

View File

@ -1115,6 +1115,7 @@ Image </mat-label> -->
<div class="mat-button-div">
<button mat-stroked-button matStepperPrevious>Back</button>
<!-- <button mat-stroked-button (click)="stepper.reset();firstFormGroup.reset()">Reset</button> -->
<button *ngIf="!spinner_access" mat-stroked-button (click)="onSubmit('go_back')" >Save as Draft</button>
<button mat-raised-button (click)="onSubmit()"><span *ngIf="!spinner_access">Submit</span> <span *ngIf="spinner_access"> Submitting...
<!-- <ion-spinner color="light" name="dots" ></ion-spinner> -->
<!-- <mat-spinner diameter="5"></mat-spinner> -->

View File

@ -1494,16 +1494,16 @@ records.questions = records.questions.filter(v=>v.form_id != '12.1' && v.form_id
records.is_form_validated = flag == 'go_back' ? '0' : '1'
this.quesService.savePDFormDetailsWithID(records).subscribe(result=>{
if(result['dataStatus']) {
if(flag != 'go_back') {
// if(flag != 'go_back') {
this.notifier.notify('success',"Saved Successfully...");
}
// }
this.employerForm.markAsPristine();
this.employerForm.markAsUntouched();
if(flag != 'go_back') {
// if(flag != 'go_back') {
setTimeout(()=>{
this.dialogRef.close()
},3000)
}
// }
}
else {
this.notifier.notify('info',"Something went wrong");
@ -1797,11 +1797,11 @@ records.questions = records.questions.filter(v=>v.form_id != '12.1' && v.form_id
// return true
// // }
// }
ngOnDestroy() {
if(this.employerForm.dirty){
this.onSubmit('go_back');
}
}
// ngOnDestroy() {
// if(this.employerForm.dirty){
// this.onSubmit('go_back');
// }
// }
formDate(value){

View File

@ -592,6 +592,67 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// this.gpsService.getGeoTag().then(geoCords=>{
let data = {'pd_id':this.viewID,'vendor_status':status,'fk_updatedby':'','updatedon':currentdate,'random_string':this.masterRandomString.random_string,link:''};
this._pd.updateStatus(data).subscribe(res=>
{
let updateStatus:any = res;
if(updateStatus.dataStatus == true )
{
if(updateStatus.status == 200) {
this.notifier.notify("info","Completed Successfully !!!")
this.viewPdDetails(this.viewID)
// this.getNewpdupdate();
// setTimeout(()=>{
// this.navCtrl.pop()
// },3000)
}
else if(updateStatus.status == 304) {
let msg = updateStatus.hasOwnProperty('msg') && updateStatus.msg ? updateStatus.msg : "Form not filled yet. Please do this first !!"
let enable_complete = updateStatus.hasOwnProperty('enable_complete') && updateStatus.enable_complete ? updateStatus.enable_complete : false;
// Swal(msg);
const dialogRef = this.dialog.open(PdCompleteStatusDialogueComponent, {
data: {msg: msg,iscompleteenable: enable_complete,isCompleteAnywaydialog:true},
disableClose: true,
minWidth: '30%',
maxWidth: '40%',
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult == 'COMPLETED'){
this.saveAsDraftPD('COMPLETED')
}
});
}
}else
{
}
})
// },err=>{
// console.log("Problem while getting geo location.",err)
// alert("Problem getting geolocation. Make sure the location is turned on")
// })
// })
}
saveAsDraftPD(status:string)
{
// let params = {
// 'parent_pdid':this.master.parent_pd_id,
// 'pd_id':this.viewID,
// 'pd_form_id':"25"
// }
// this.quesService.retiverForm(params).subscribe(form_check=>{
// if(form_check && form_check['dataStatus'] == false) {
// this.toastProvider.setAlertwithOKButton("Unable to complete the PD","Please complete the form and try again !!");
// return;
// }
//alert.present();
// let users = localStorage.getItem('pd_user_details')
// users=JSON.parse(users).userid
// this.gpsService.getGeoTag().then(geoCords=>{
let data = {'pd_id':this.viewID,'vendor_status':status,'fk_updatedby':'','updatedon':currentdate,'random_string':this.masterRandomString.random_string,link:'','complete_override_data':'1'};
this._pd.updateStatus(data).subscribe(res=>
{
let updateStatus:any = res;