From cd6b8ad9c59a735b3c32425a5fd4bf079f3324a9 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Fri, 9 Oct 2020 18:34:50 +0530 Subject: [PATCH] Fairoj : vendor status related changes --- .../list-pd/all-pd/all-pd.component.html | 2 +- .../input-dialog/input-dialog.component.html | 28 +++++++++ .../input-dialog/input-dialog.component.scss | 4 ++ .../input-dialog.component.spec.ts | 25 ++++++++ .../input-dialog/input-dialog.component.ts | 29 +++++++++ .../common-ques/common-ques.component.ts | 11 +++- .../schedule-pd/schedule-pd.component.ts | 19 +++--- .../list-pd/view-pd/view-pd.component.html | 18 +++--- .../list-pd/view-pd/view-pd.component.ts | 61 ++++++++++++++++++- .../manage-pd/manage-pd.module.ts | 5 +- .../pd-service/pd-triger.service.ts | 1 + 11 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.ts diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html index a3afc80..d37beb8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/all-pd/all-pd.component.html @@ -116,7 +116,7 @@ {{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }} - {{details.scheduled_on}} + {{details.vendor_scheduled_on}} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.html new file mode 100644 index 0000000..769dd0e --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.html @@ -0,0 +1,28 @@ + +
+
+ +
+
+ + + +
{{data.title}}
+
+ + + {{data.input_label}} + + Required + + +
+ +
+
+ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.scss new file mode 100644 index 0000000..b07837e --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.scss @@ -0,0 +1,4 @@ +::ng-deep {.mat-dialog-container { + padding: 0px !important; +} +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.spec.ts new file mode 100644 index 0000000..17691ab --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InputDialogComponent } from './input-dialog.component'; + +describe('InputDialogComponent', () => { + let component: InputDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InputDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InputDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.ts new file mode 100644 index 0000000..3b78f59 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/input-dialog/input-dialog.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { FormControl, Validators } from '@angular/forms'; +import { NotifierService } from 'angular-notifier'; + +@Component({ + selector: 'app-input-dialog', + templateUrl: './input-dialog.component.html', + styleUrls: ['./input-dialog.component.scss'] +}) +export class InputDialogComponent implements OnInit { + textInput:FormControl = new FormControl('',Validators.required) + notifier: NotifierService; + constructor(@Inject(MAT_DIALOG_DATA)public data,private dialogRef:MatDialogRef, + notifier:NotifierService) { + this.notifier = notifier + } + + ngOnInit() { + } + onSubmit() { + if(this.textInput.invalid) { + this.notifier.notify("info","Please Fill the Reason") + return + } + this.dialogRef.close({data:this.textInput.value}) + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts index edef034..e032f62 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-questions/common-ques/common-ques.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Inject, ViewChild } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, RouterEvent, NavigationStart } from '@angular/router'; import { PdTrigerService } from 'app/personal-discussion/pd-service/pd-triger.service'; import { MAT_DIALOG_DATA, MatStepper, MatDialogRef } from '@angular/material'; import { NotifierService } from 'angular-notifier'; @@ -7,7 +7,7 @@ import { AwsService } from 'app/AwsService/aws.service'; import { FormBuilder, FormControl, Validators, FormArray } from '@angular/forms'; import { ReplaySubject, Subject } from 'rxjs'; import { DatePipe } from '@angular/common'; -import { takeUntil } from 'rxjs/operators'; +import { takeUntil, filter, tap, take } from 'rxjs/operators'; @Component({ selector: 'app-common-ques', @@ -185,6 +185,13 @@ export class CommonQuesComponent implements OnInit { } } this.users = this._awsService.getlocale() + // Close dialog ref on route changes + // router.events.pipe( + // filter((event: RouterEvent) => event instanceof NavigationStart), + // tap(() =>{ + // console.log("Router event",event); this.dialogRef.close()}), + // take(1), + // ).subscribe(); } filterList() { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts index 335b445..1a4cf91 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/schedule-pd/schedule-pd.component.ts @@ -85,15 +85,20 @@ export class SchedulePdComponent implements OnInit, OnDestroy { let myFormattedDate = this.pipe.transform(date, 'yyyy-MM-dd HH:mm'); - let updateData = { - "fk_pd_id":this.data.pd_id, - "schedule_time":myFormattedDate, - "app_client":"3", + // let updateData = { + // "fk_pd_id":this.data.pd_id, + // "schedule_time":myFormattedDate, + // "app_client":"3", - } - this._pd.updateSchedule(updateData).subscribe( + // } + let param={ + pd_id: this.data.pd_id, + vendor_status: 'SCHEDULED', + vendor_scheduled_on:myFormattedDate + } + this._pd.updateStatus(param).subscribe( result => { - if (result.status == 200) { + if (result['status'] == 200) { this.notifier.notify('success', 'PD Scheduled.!'); this.dialogRef.close(); } 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 561d371..710c340 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 @@ -149,7 +149,7 @@
{{master.vendor_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.vendor_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.vendor_status | titlecase}}
-
+
@@ -170,8 +170,8 @@ {{master.centralofficer | titlecase}}
-
- {{master.scheduled_on}} +
+ {{master.vendor_scheduled_on}}
@@ -191,7 +191,7 @@
{{addresses.addtional_pd_data[0].vendor_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : addresses.addtional_pd_data[0].vendor_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : addresses.addtional_pd_data[0].vendor_status | titlecase}}
-
+
@@ -209,8 +209,8 @@ {{addresses.addtional_pd_data[0].centralofficer | titlecase}}
-
- {{addresses.addtional_pd_data[0].scheduled_on}} +
+ {{addresses.addtional_pd_data[0].vendor_scheduled_on}}
@@ -257,11 +257,13 @@ -
+
- + + +
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 afdd3db..3e769ec 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 @@ -20,7 +20,9 @@ import Swal from 'sweetalert2'; import { SchedulePdComponent } from '../schedule-pd/schedule-pd.component'; import { CommonQuesComponent } from '../pd-questions/common-ques/common-ques.component'; import { EmployerInfoComponent } from '../pd-questions/employer-info/employer-info.component'; +import { InputDialogComponent } from '../input-dialog/input-dialog.component'; +const currentdate = new Date().toJSON().slice(0,19); @Component({ selector: 'app-view-pd', templateUrl: './view-pd.component.html', @@ -398,10 +400,15 @@ export class ViewPdComponent implements OnInit, OnDestroy { maxHeight: '100vh', height: '100%', width: '100%', - disableClose: true + disableClose: false, + closeOnNavigation:true, }); dialogRef.afterClosed() .subscribe(dataresult => { + console.log("cloesed",dataresult) + if(dataresult == undefined) { + this.ListPdComponent.viewPDDetails({id:this.viewID,string:this.masterRandomString}) + } // this.notifier.notify('success', 'Successfully allocated.!'); // this.loadTemplates(this.startPD,2,this.randomString); }); @@ -503,8 +510,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { console.log('qccompleted',master); let param={ pd_id: master.pd_id, - vendor_status: 'QC_COMPLETED', - fk_updatedby: master.fk_updatedby, + vendor_status: 'QC_COMPLETED', } this._pd.updateStatus(param).subscribe(res=>{ if(res['status'] == '200'){ @@ -519,6 +525,54 @@ export class ViewPdComponent implements OnInit, OnDestroy { } }) } + vendorApproval(pd_info,flag) { + // FIA_REJECTED + + if(flag == 'accept') { + let param = {pd_id:this.viewID,'updatedon':currentdate,'random_string':pd_info.random_string,'pd_status':'FIA_ACCEPTED'} + this.acceptORrejectPD(param) + } + else { + const dialogRef = this.dialog.open(InputDialogComponent, { + data: {title:"Reason for Rejection",input_label:"Please Specify the resason",btn_name:"Submit"}, + disableClose: true, + // position: { right: '0' }, + minWidth: '55vh', + // maxWidth: '60%', + minHeight:'60vh', + // margin: '0 auto', + }); + dialogRef.afterClosed() + .subscribe(dataresult => { + if (dataresult.hasOwnProperty('data') && dataresult.data) { + let param = {pd_id:this.viewID,'updatedon':currentdate,'random_string':pd_info.random_string,'pd_status':'FIA_REJECTED',vendor_manager_reject:''} + param.vendor_manager_reject = dataresult.data + console.log(dataresult.data) + this.acceptORrejectPD(param) + } + }); + } + } + acceptORrejectPD(params) { + this._pd.initiateAddressPdProcess(params).subscribe(rr=>{ + if(rr['dataStatus']){ + this.notifier.notify("info","PD Updated Successfully") + if(params.pd_status == 'FIA_REJECTED') { + this.loadPdListCompoent() + } + else { + this.viewPdDetails(this.viewID) + } + + } + else{ + this.notifier.notify("warning",'Something went Wrong') + } + },err=>{ + console.log("Error",err); + this.notifier.notify("error",'Network Error !!') + }) + } // updateViewComponent(editBack:string) { @@ -540,4 +594,5 @@ export class ViewPdComponent implements OnInit, OnDestroy { } + } \ No newline at end of file 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 ebe1480..1b22ba8 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 @@ -126,6 +126,7 @@ import {AngularSplitModule} from 'angular-split' import { CommonQuesComponent } from './list-pd/pd-questions/common-ques/common-ques.component'; import { EmployerInfoComponent } from './list-pd/pd-questions/employer-info/employer-info.component'; import { DynamicDocsFormComponent } from './list-pd/pd-questions/dynamic-docs-form/dynamic-docs-form.component'; +import { InputDialogComponent } from './list-pd/input-dialog/input-dialog.component'; /** * Custom angular notifier options @@ -173,7 +174,7 @@ const pdCustomNotifierOptions: NotifierOptions = { @NgModule({ declarations: [SchedulePdComponent,PdAllocationComponent,TelePdAllocationComponent, ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, PdReportComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, SearchRelationPipe, RupeeCurrencyFormatPipe, NumberToWordsPipe, DeleteRecordsCountPipe, PdLocatedMapViewDirective, ViewLocationComponent, GetAnswerableFormsPipe,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, - CommonQuesComponent,EmployerInfoComponent,DynamicDocsFormComponent + CommonQuesComponent,EmployerInfoComponent,DynamicDocsFormComponent, InputDialogComponent ], imports: [ CommonModule, @@ -215,7 +216,7 @@ const pdCustomNotifierOptions: NotifierOptions = { {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}, PdLocatedMapViewDirective], entryComponents: [SchedulePdComponent,PdAllocationComponent,SmartPdAllocationComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, PdRequirementComponent, ModelEditPdReportComponent, DialogChangeCurrentVenrsion, QcReviewComponent, ViewLocationComponent,PdStatusChangeDialogueComponent,InitiateAdditionalPdComponent, - CommonQuesComponent,EmployerInfoComponent], + CommonQuesComponent,EmployerInfoComponent,InputDialogComponent], }) export class ManagePdModule { } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 59431be..e819bdf 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -376,6 +376,7 @@ export class PdTrigerService { } updateStatus(params){ + params.fk_updatedby = this._aws.getlocale(); return this._http.post(this.apiUrl + 'updateVendorStatus', {"records": params}) .pipe( catchError(this.handleError('role', []))