Fairoj : vendor status related changes

This commit is contained in:
venbatechnologies@gmail.com 2020-10-09 18:34:50 +05:30
parent 66bcb27c16
commit cd6b8ad9c5
11 changed files with 180 additions and 23 deletions

View File

@ -116,7 +116,7 @@
</span>
<span class="fontsize" *ngIf="details.vendor_status=='QC_COMPLETED'" matTooltip="QC Completed" matTooltipPosition="above">{{ (details.updatedon)? (details.updatedon | slice:0:10):(details.updatedon) }}
</span>
<span class="fontsize" *ngIf="details.vendor_status=='SCHEDULED'" [matTooltip]="details.vendor_status | titlecase" matTooltipPosition="above">{{details.scheduled_on}}
<span class="fontsize" *ngIf="details.vendor_status=='SCHEDULED'" [matTooltip]="details.vendor_status | titlecase" matTooltipPosition="above">{{details.vendor_scheduled_on}}
</span>
</mat-cell>
</ng-container>

View File

@ -0,0 +1,28 @@
<mat-card>
<div fxLayout="row">
<div align="end" fxFlex="100" fxLayoutAlign="flex-end" style="padding-top: 5px !important;">
<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">
<mat-icon>close</mat-icon>
</button>
</div>
</div>
<!-- <div fxLayout="column" fxLayout.xs="column"> -->
<mat-card-header>
<mat-card-title><h5>{{data.title}}</h5></mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field appearance="outline" style="width:100%">
<mat-label>{{data.input_label}}</mat-label>
<textarea matInput type="text" [formControl]="textInput"></textarea>
<mat-error align="end" *ngIf="textInput.hasError('required')">Required</mat-error>
</mat-form-field>
</mat-card-content>
<div align="end" style="padding: 10px !important;">
<button mat-raised-button class="mr-1 mb-1 hover-icon" (click)="onSubmit()" type="button" color="primary">
{{data.btn_name}}
</button>
</div>
</mat-card>
<!-- </div> -->

View File

@ -0,0 +1,4 @@
::ng-deep {.mat-dialog-container {
padding: 0px !important;
}
}

View File

@ -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<InputDialogComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InputDialogComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InputDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -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<InputDialogComponent>,
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})
}
}

View File

@ -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() {

View File

@ -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();
}

View File

@ -149,7 +149,7 @@
<div fxFlex="40" align="left" style="color: #e00201">
{{master.vendor_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.vendor_status==pdStatusCheck.ADD_ON_PENDING ? 'Completed' : master.vendor_status | titlecase}}
</div>
<div fxFlex="60" align="right">
<div fxFlex="60" align="right" *ngIf="addresses.addtional_pd_data[0].pd_status != 'ALLOCATED_TO_FIA' && addresses.addtional_pd_data[0].pd_status != 'FIA_REJECTED'">
<!-- <span><button mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" [matTooltip]="master.fk_primary_address_id ? 'Initiate PD for this address' : 'Initiate Address for PD Process'" matTooltipPosition="above" (click)="initiateAddtionalPD(master,addresses,master.fk_primary_address_id ? true : false)"><mat-icon>where_to_vote</mat-icon></button></span> -->
<button *ngIf="VendorRoleID != 22" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="pdAllocationTo(master,addresses)"><mat-icon>verified_user</mat-icon></button>
<span><button mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Schedule" matTooltipPosition="above" (click)="scheduleDetails(master,addresses)"><mat-icon>schedule</mat-icon></button></span>
@ -170,8 +170,8 @@
{{master.centralofficer | titlecase}}
</div>
</div>
<div fxFlex="60" align="right" style="color: #e00201" *ngIf="master.scheduled_on">
{{master.scheduled_on}}
<div fxFlex="60" align="right" style="color: #e00201" *ngIf="master.vendor_scheduled_on">
{{master.vendor_scheduled_on}}
</div>
</div>
</div>
@ -191,7 +191,7 @@
<div fxFlex="40" align="left" style="color: #e00201">
{{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}}
</div>
<div fxFlex="60" align="right">
<div fxFlex="60" align="right" *ngIf="addresses.addtional_pd_data[0].pd_status != 'ALLOCATED_TO_FIA' && addresses.addtional_pd_data[0].pd_status != 'FIA_REJECTED'">
<span><button *ngIf="VendorRoleID != 22" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Allocate" matTooltipPosition="above" (click)="pdAllocationTo(master,addresses)"><mat-icon>verified_user</mat-icon></button></span>
<span><button mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Schedule" matTooltipPosition="above" (click)="scheduleDetails(master,addresses)"><mat-icon>schedule</mat-icon></button></span>
<span *ngIf="VendorRoleID != 22 && addresses.addtional_pd_data[0].is_qc_enabled == '1'"><button *ngIf="roleAccessDetails.discussions && addresses.assigned_pd && addresses.addtional_pd_data[0].pd_type_name && addresses.addtional_pd_data[0].vendor_status!=pdStatusCheck.DRAFT && addresses.addtional_pd_data[0].vendor_status!=pdStatusCheck.TRIGGERED && addresses.addtional_pd_data[0].vendor_status!=pdStatusCheck.QC_COMPLETED" mat-raised-button mat-button-md mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Discussion" matTooltipPosition="above" (click)="getPDStart(addresses,addresses.addtional_pd_data[0].vendor_status)"><mat-icon>question_answer</mat-icon></button></span>
@ -209,8 +209,8 @@
{{addresses.addtional_pd_data[0].centralofficer | titlecase}}
</div>
</div>
<div fxFlex="60" align="right" style="color: #e00201" *ngIf="addresses.addtional_pd_data[0].scheduled_on">
{{addresses.addtional_pd_data[0].scheduled_on}}
<div fxFlex="60" align="right" style="color: #e00201" *ngIf="addresses.addtional_pd_data[0].vendor_scheduled_on">
{{addresses.addtional_pd_data[0].vendor_scheduled_on}}
</div>
</div>
</div>
@ -257,11 +257,13 @@
</div>
</div>
<div fxLayout="row">
<div fxLayout="row" *ngIf="VendorRoleID != 22 && master.pd_status != 'FIA_REJECTED'">
<div fxFlex="100">
<mat-card fxFlex="100" class="p-2" style="box-shadow: 0 0 1px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.15) !important">
<div class="mat-button-div" style="text-align: right;">
<button *ngIf="VendorRoleID != 22 && master.is_qc_enabled == '1'" mat-raised-button color="primary" class="mr-1 mb-1 hover-icon" type="button" matTooltip="QC COMPLETE" matTooltipPosition="above" (click)="onClickQCCompleted(master)" [disabled]="master.vendor_status != 'COMPLETED'">QC COMPLETE</button>
<button *ngIf="VendorRoleID != 22 && master.pd_status == 'ALLOCATED_TO_FIA'" mat-raised-button style="background-color: #0f9c0f;color: white" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Accept" matTooltipPosition="above" (click)="vendorApproval(master,'accept')"><mat-icon>check_circle</mat-icon><strong>Accept</strong></button>
<button *ngIf="VendorRoleID != 22 && master.vendor_status != 'INPROGRESS' && master.vendor_status != 'COMPLETED' && master.vendor_status != 'QC_COMPLETED'" mat-stroked-button color="primary" class="mr-1 mb-1 hover-icon" type="button" matTooltip="Reject" matTooltipPosition="above" (click)="vendorApproval(master,'reject')" ><mat-icon>cancel</mat-icon><strong>Reject</strong></button>
<button *ngIf="VendorRoleID != 22 && master.is_qc_enabled == '1' && master.pd_status != 'ALLOCATED_TO_FIA'" mat-raised-button color="primary" class="mr-1 mb-1 hover-icon" type="button" matTooltip="QC COMPLETE" matTooltipPosition="above" (click)="onClickQCCompleted(master)" [disabled]="master.vendor_status != 'COMPLETED'">QC COMPLETE</button>
</div>
</mat-card>
</div>

View File

@ -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 {
}
}

View File

@ -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 {
}

View File

@ -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', []))