diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.html new file mode 100644 index 0000000..1752bba --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.html @@ -0,0 +1,25 @@ +

PD Cancel

+ +
+

Are you going to cancel this PD

+ +
+ +
+
+
+ + Remarks + + Remarks required + +
+
+ +
+ + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.spec.ts new file mode 100644 index 0000000..466617a --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PdCancellationDialogueComponent } from './pd-cancellation-dialogue.component'; + +describe('PdCancellationDialogueComponent', () => { + let component: PdCancellationDialogueComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdCancellationDialogueComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdCancellationDialogueComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.ts new file mode 100644 index 0000000..ca8dcfa --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core'; +import { NotifierService } from "angular-notifier"; +import {MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material'; +import { PdTrigerService } from '../../../pd-service/pd-triger.service'; +import { FormControl, Validators } from '@angular/forms'; + +@Component({ + selector: 'app-pd-cancellation-dialogue', + templateUrl: './pd-cancellation-dialogue.component.html', + styleUrls: ['./pd-cancellation-dialogue.component.scss'] +}) +export class PdCancellationDialogueComponent implements OnInit { + + //Declaration + private notifier: NotifierService; + public Loading: boolean; + public masterRandomString : string; + + fk_pd_type: any; + is_remarks_enabled:boolean = false; + remarks:FormControl = new FormControl('',Validators.compose([Validators.required])); + + constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data: any) + { + this.notifier = notifier; + this.Loading = false; + this.masterRandomString = this.data.random_string; + this.fk_pd_type = this.data.pd_type + this.is_remarks_enabled = true + } + + ngOnInit() {} + + + + changePDStatus(status: string): void { + let update_status : any= { + "pd_id":this.data.pdid, + "random_string":this.data.random_string, + "remark":this.remarks.value + }; + if(this.is_remarks_enabled) { + console.log(this.remarks); + if(this.remarks.invalid) { + this.notifier.notify("warning","Remarks is Required"); + return; + } + } + this.pd.editPdMasterDetails(update_status, status).subscribe(result => { + if (result.status == 200) { + this.dialogRef.close({update_status:true}); + this.notifier.notify('success', 'PD Cancelled Successfully'); + } + else { + this.dialogRef.close({update_status:false}); + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, error => { + this.dialogRef.close({update_status:false}); + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); + + } + + + } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html index d9d6bee..c2321fe 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.html @@ -17,13 +17,6 @@ -
- - Remarks - - Remarks required - -
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts index e29d908..e486cd6 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-status-change-dialogue/pd-status-change-dialogue.component.ts @@ -3,7 +3,7 @@ import { NotifierService } from "angular-notifier"; import {MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material'; import { PdTrigerService } from '../../../pd-service/pd-triger.service'; import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component'; -import { FormControl, Validators } from '@angular/forms'; + @Component({ selector: 'app-pd-status-change-dialogue', @@ -26,24 +26,15 @@ export class PdStatusChangeDialogueComponent implements OnInit { usertype: string; vendorOfficerList: any; errorMessage: any; - public masterRandomString : string; - fk_pd_type: any; - pd_completeness_override: String = '0'; - is_remarks_enabled:boolean = false - remarks:FormControl = new FormControl('',Validators.compose([Validators.required])) constructor(notifier: NotifierService , private pd: PdTrigerService,private dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data: any) { - console.log('sankrish',this.data); this.notifier = notifier; - this.dialoge_title_content = this.data.pd_status=='INPROGRESS' ? 'Start Discussion' : this.data.pd_status=='COMPLETED' ? 'Complete Discussion' : this.data.pd_status=='ALLOCATED' ? 'Send Back to CPA' : this.data.pd_status=='BOUNCED' ? 'PD Reject' : this.data.pd_status == 'CM_ALLOCATED' ? 'Self Allocate' : this.data.pd_status=='CANCELLED' ? 'PD Cancel': 'Change Discussion'; - this.dialoge_content = this.data.pd_status=='INPROGRESS' ? 'Are you starting the Discussion ?' : this.data.pd_status=='COMPLETED' ? 'Please confirm you are completing the Discussion' : this.data.pd_status=='ALLOCATED' ? 'Do you want to Send back the PD to CPA ?' : this.data.pd_status=='BOUNCED' ? 'Do you want to reject this PD' : this.data.pd_status == 'CM_ALLOCATED' ? 'Do you want to Allocate the PD to yourself' : this.data.pd_status=='CANCELLED' ? 'Are you going to cancel this PD' : 'Change Discussion'; + this.dialoge_title_content = this.data.pd_status=='INPROGRESS' ? 'Start Discussion' : this.data.pd_status=='COMPLETED' ? 'Complete Discussion' : this.data.pd_status=='ALLOCATED' ? 'Send Back to CPA' : this.data.pd_status=='BOUNCED' ? 'PD Reject' : this.data.pd_status == 'CM_ALLOCATED' ? 'Self Allocate' : 'Change Discussion'; + this.dialoge_content = this.data.pd_status=='INPROGRESS' ? 'Are you starting the Discussion ?' : this.data.pd_status=='COMPLETED' ? 'Please confirm you are completing the Discussion' : this.data.pd_status=='ALLOCATED' ? 'Do you want to Send back the PD to CPA ?' : this.data.pd_status=='BOUNCED' ? 'Do you want to reject this PD' : this.data.pd_status == 'CM_ALLOCATED' ? 'Do you want to Allocate the PD to yourself' : 'Change Discussion'; this.enableAddonPD = false; this.CompletenessCheck = this.data.pd_status=='INPROGRESS' ? true : this.data.pd_status=='COMPLETED' ? false : true; this.Loading = this.data.pd_status=='INPROGRESS' ? false : this.data.pd_status=='COMPLETED' ? true : false; this.dialogType = this.data.dialogType; - this.masterRandomString = this.data.random_string; - this.fk_pd_type = this.data.pd_type - this.is_remarks_enabled = this.data.pd_status == 'CANCELLED' } ngOnInit() { @@ -132,22 +123,14 @@ export class PdStatusChangeDialogueComponent implements OnInit { else { - let update_status : any= { + let update_status = { "pd_id":this.data.pdid, "random_string":this.data.random_string }; - if(this.is_remarks_enabled) { - console.log(this.remarks); - if(this.remarks.invalid) { - this.notifier.notify("warning","Remarks is Required"); - return; - } - update_status.remark = this.remarks.value - } this.pd.editPdMasterDetails(update_status, status).subscribe(result => { if (result.status == 200) { this.dialogRef.close({update_status:true}); - this.notifier.notify('success', this.data.pd_status=='INPROGRESS' ? 'Discussions Started Successfully' : this.data.pd_status=='COMPLETED' ? 'Completed Successfully' : this.data.pd_status=='BOUNCED' ? 'PD Rejected Successfully' :this.data.pd_status=='CANCELLED' ? 'PD Cancelled Successfully' : 'Discussions Updated Successfully'); + this.notifier.notify('success', this.data.pd_status=='INPROGRESS' ? 'Discussions Started Successfully' : this.data.pd_status=='COMPLETED' ? 'Completed Successfully' : this.data.pd_status=='BOUNCED' ? 'PD Rejected Successfully' :'Discussions Updated Successfully'); } else { this.dialogRef.close({update_status:false}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index 13356ee..558c802 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -216,17 +216,17 @@
- - + + - + - + - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index d3eafa0..40c7fde 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -14,6 +14,7 @@ import { EditPdMasterComponent } from '../edit-pd-master/edit-pd-master.componen import { PdRequirementComponent } from '../pd-requirement/pd-requirement.component'; import { PdStatusChangeDialogueComponent } from './../pd-status-change-dialogue/pd-status-change-dialogue.component'; import { InitiateAdditionalPdComponent } from './../initiate-additional-pd/initiate-additional-pd.component'; +import { PdCancellationDialogueComponent } from './../pd-cancellation-dialogue/pd-cancellation-dialogue.component'; /**sweet alert */ import Swal from 'sweetalert2'; @@ -718,7 +719,7 @@ dialogRef1.afterClosed().subscribe(rr=>{ cancelPD(pdDetails: any){ console.log("cancelPD fns entered"); - const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, { + const dialogRef = this.dialog.open(PdCancellationDialogueComponent, { data: { pdid: pdDetails.assigned_pd, pd_status: this.pdStatusCheck.CANCELLED ,random_string:this.masterRandomString}, disableClose: true, minWidth: '30%', diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index c653977..5256db7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -128,6 +128,7 @@ import { SpeedDialFabComponent } from './list-pd/view-pd/speed-dial-fab/speed-di import { VideoPlayerComponent } from 'app/video-player/video-player.component'; import { MatVideoModule } from 'mat-video'; import { PdAllocationComponent } from './list-pd/pd-allocation/pd-allocation.component'; +import { PdCancellationDialogueComponent } from './list-pd/pd-cancellation-dialogue/pd-cancellation-dialogue.component'; /** * Custom angular notifier options @@ -175,7 +176,7 @@ const pdCustomNotifierOptions: NotifierOptions = { @NgModule({ declarations: [TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, ExcelUploadDialogComponent, - SpeedDialFabComponent,VideoPlayerComponent,PdAllocationComponent], + SpeedDialFabComponent,VideoPlayerComponent,PdAllocationComponent, PdCancellationDialogueComponent], imports: [ CommonModule, ManagePdRoutingModule, @@ -212,13 +213,13 @@ const pdCustomNotifierOptions: NotifierOptions = { MatVideoModule ], - exports: [PdLocatedMapViewDirective, SmartPdAllocationComponent, TelePdAllocationComponent ,EditPdApplicantComponent, EditPdMasterComponent, CompletedPdComponent, QcCompletedPdComponent, PdRequirementComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent], + exports: [PdLocatedMapViewDirective, SmartPdAllocationComponent, TelePdAllocationComponent ,EditPdApplicantComponent, EditPdMasterComponent, CompletedPdComponent, QcCompletedPdComponent, PdRequirementComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent,PdCancellationDialogueComponent], providers: [PdTrigerService, GetGeometricLocationService,{provide: MAT_DATE_LOCALE, useValue: 'en-GB'}, {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective], entryComponents: [SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent,ExcelUploadDialogComponent,VideoPlayerComponent, - PdAllocationComponent], + PdAllocationComponent,PdCancellationDialogueComponent], }) export class ManagePdModule { } \ No newline at end of file