Fairoj : smart PD Data Fetching and video call enabled for smart pd

This commit is contained in:
venbatechnologies@gmail.com 2020-06-26 17:42:59 +05:30
parent 828ea54971
commit 4287a99485
10 changed files with 223 additions and 17 deletions

View File

@ -171,8 +171,9 @@ export class AddressComponent implements OnInit {
ChildCtrl.controls['pincode_others'].updateValueAndValidity();
}
this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : '');
if(datas.pd_location) {
this.addressForm.controls.pd_location.setValue(datas.pd_location);
}
this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : '');
if (datas.address_type) {
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
@ -187,7 +188,9 @@ export class AddressComponent implements OnInit {
}
this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : '');
if(datas.comment_locality) {
this.addressForm.controls.comment_locality.setValue(datas.comment_locality);
}
this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : '');
if (datas.locality) {
@ -746,8 +749,9 @@ export class AddressComponent implements OnInit {
}
if (initiated_address_check === true) {
this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : '');
if(datas.pd_location) {
this.addressForm.controls.pd_location.setValue(datas.pd_location);
}
this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : '');
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
@ -760,8 +764,9 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.address_type_others.setValue(datas.address_type_others);
this.selectedAddressType(datas.address_type_others);
}
this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : '');
if(datas.comment_locality) {
this.addressForm.controls.comment_locality.setValue(datas.comment_locality);
}
this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : '');
this.setOthers(datas.locality, '', 4);
@ -863,9 +868,28 @@ export class AddressComponent implements OnInit {
// else {
// control.push(this.createAddresses(null));
// }
});
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED' ) {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
});
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this._pd.getVendorDatas('address',this.pdid).subscribe(result=>{
if(result) {
this.addressForm.patchValue(result.records);
// console.log(this.addressForm.value,this.commentData,this.locationdata);
// console.log(this.a.value)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
// retriveFile(){
// this._pd.retriveFile(this.pdid, '5', null).subscribe(data => {

View File

@ -220,8 +220,39 @@ export class BusinessAssetsInfoComponent implements OnInit {
} else {
// this.noRecordFound = true;
}
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
setTimeout(()=>{
this.getDataFromVendor()
},1000)
}
});
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this.pdTrigerService.getVendorDatas('business_assets',this.pdid).subscribe(result=>{
if(result) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_for_address;
let assetCtrl: any = <FormArray>ParCtrls.controls[0];
result.records.business_address_availability ='yes'
console.log("Vendor Datas",result.records)
console.log(assetCtrl);
// assetCtrl = assetCtrl.at(0) as FormArray
// assetCtrl = assetCtrl['controls']
this.setRequiredValidation('yes',assetCtrl,1);
assetCtrl.patchValue(result.records);
// console.log(this._generalForm.value)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
loadaddresses(flag) {

View File

@ -656,6 +656,10 @@ export class BusinessInfoComponent implements OnInit {
});
}
}
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
});
// Desgn.push(this.createDesignation());
@ -683,6 +687,36 @@ export class BusinessInfoComponent implements OnInit {
// this.retriveFile();
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this._pd.getVendorDatas('business_info',this.pdid).subscribe(result=>{
if(result) {
let individualsControl = <FormArray>this.businessForm.controls['individuals'];
console.log("Vendor Datas",result.records)
// individualsControl.patchValue(result.records.individuals);
result.records.documents_info.forEach(val=>{
if(val) {
if(this.businessForm.value[val.document_name] != 'yes') {
this.businessForm.addControl(val.document_name+'_pic', new FormControl(val.document_image));
}
// result.records[val.document_name+'_pic'] =val.document_image
result.records[val.document_name] = 'yes'
}
})
delete result.records.documents_info
this.businessForm.patchValue(result.records);
console.log(this.businessForm.value,result.records)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
public initBusinessForm(): void {
this.businessForm = this.fb.group({
parent_pdid: this.parent_pdid,

View File

@ -283,12 +283,40 @@ export class FinalRemarksComponent implements OnInit {
recommendationReferToCredit.push(this.CreateRecommendationReferToCredit(null));
this.noRecordsFound = true;
}
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') {
if((this.lender_short_name == 'CLIX' || this.lender_short_name == 'MWISE' || this.prod_catagory == 'LAEP')) {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
}
}, err => {
})
// this.retriveFile();
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this.pdTrigerService.getVendorDatas('final_remarks',this.pdid).subscribe(result=>{
if(result) {
// let individualsControl = <FormArray>this._finalRemarkForm.controls['individuals'];
console.log("Vendor Datas",result.records)
this.clixChange(result.records.is_competition,1)
this.clixChange(result.records.demolition_activity,2)
this.clixChange(result.records.sealing_activity,3)
this._finalRemarkForm.patchValue(result.records);
console.log(this._finalRemarkForm.value)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
getM_Recommendation() {
this.pdTrigerService.getAllMasterDatas('PDOFFICERRECOMMENDATIONS').subscribe(
data => {

View File

@ -98,18 +98,17 @@
</ng-container>
<ng-container matColumnDef="actions">
<mat-header-cell *matHeaderCellDef> </mat-header-cell>
<mat-cell *matCellDef="let details;let i =index;"
[style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<mat-cell *matCellDef="let details;let i =index;">
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button (click)="editIndividuals(details,i)"
matTooltip="Edit " matTooltipPosition="below">
matTooltip="Edit " matTooltipPosition="below" [style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<mat-icon>edit</mat-icon>
</button>
<button type="button" class="mr-1 hover-icon" mat-raised-button mat-icon-button
(click)="removeIndividuals(i,details)" matTooltip="Remove Individuals"
matTooltipPosition="below">
matTooltipPosition="below" [style.visibility]="_generalForm.controls.individuals.value[i].is_main_applicant == true ? 'hidden':'visible'">
<mat-icon>delete</mat-icon>
</button>
<div *ngIf="_generalForm.controls.individuals.value[i].is_person_met_pic ">
<div *ngIf="_generalForm.controls.individuals.value[i].is_person_met_pic " >
<img mat-card-avatar
src="{{_generalForm.controls.individuals.value[i].is_person_met_pic}}"
class="ml-0 mt-0 mb-0 mr-2 " ngxViewer>

View File

@ -366,11 +366,31 @@ export class GeneralInfoComponent implements OnInit {
}
}
if(this.pd_all_details.pdmaster_details.fk_pd_type == '2' && this.pd_all_details.pdmaster_details.hasOwnProperty('vendor_status') && this.pd_all_details.pdmaster_details.vendor_status == 'COMPLETED') {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
}, error => this.errorMessage = <any>error);
}
/******************************* load form data Ends Here *************************/
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this._pd.getVendorDatas('general',this.pdid).subscribe(result=>{
if(result) {
let individualsControl = <FormArray>this._generalForm.controls['individuals'];
console.log("Vendor Datas",result.records)
individualsControl.patchValue(result.records.individuals);
console.log(this._generalForm.value)
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
// create individuals
createIndividulas(elementValue: any) {

View File

@ -179,10 +179,45 @@ pdf(fileURL){
neighbourhoodControl.push(this.createNeighbourhood(this.default_neighbourhood_details));
referencecheckControl.push(this.createReerenceCheck(this.default_reference_details));
}
if(this.data.pdmaster_details.fk_pd_type == '2' && this.data.pdmaster_details.hasOwnProperty('vendor_status') && this.data.pdmaster_details.vendor_status == 'COMPLETED') {
console.log(this.data.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
}, error => this.errorMessage = <any> error);
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this._pd.getVendorDatas('neighbourhood_details',this.pdid).subscribe(result => {
if (result) {
const neighbourhoodControl = <FormArray>this._neighbourhoodForm.controls['neighbourhood_list'];
console.log("Vendor Datas", result.records)
if (result.records.hasOwnProperty('neighbourhood_list') && result.records.neighbourhood_list.length > 0) {
// result.records.neighbourhood_list.forEach(neighbour_obj => {
this.toggleVisibility(result.records.neighbourhood_list[0].did_not_know_the_business_operation,0,1)
this.toggleVisibility(result.records.neighbourhood_list[0].did_not_know_the_owner,0,2)
for (let i = 1; i <= result.records.neighbourhood_list.length; i++) {
let neighbour_obj = result.records.neighbourhood_list[i]
if (neighbour_obj) {
this.toggleVisibility(neighbour_obj.did_not_know_the_business_operation,i,1)
this.toggleVisibility(neighbour_obj.did_not_know_the_owner,i,2)
neighbourhoodControl.push(this.createNeighbourhood(neighbour_obj))
}
// })
}
console.log(this._neighbourhoodForm.value)
neighbourhoodControl.patchValue(result.records.neighbourhood_list);
console.log(this._neighbourhoodForm.value)
}
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/
// get all master details
getMasterDetails(table:string,type:number){
this._pd.getAllMasterDatas(table).subscribe(

View File

@ -126,9 +126,13 @@
</div>
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="60" fxFlex.lg="70" fxFlex.xl="70" class="content-data" *ngFor="let master of pdMasterData">
<div fxLayout="row" fxLayoutAlign="flex-end" fxLayoutGap="68px" fxLayoutGap.xs="8px">
<!-- ENABLING THE FAB COPY LINK IMAGE CAPTURE AND VIDEO CALL BUTTON FOR TELE PD -->
<div fxLayout="column">
<app-speed-dial-fab fxFlex="30" class="fab-group" *ngIf="master.fk_pd_type == '3'" [options]="FabOptions" (fabClick)="copyCusURL($event)"></app-speed-dial-fab>
</div>
<!-- END OF COPY LINK IMAGE CAPTURE AND VIDEO CALL BUTTON FOR TELE PD -->
<div align="right" >
<!-- <button mat-raised-button class="mr-1 mb-1" color="primary" style="cursor: not-allowed !important;">
<strong> {{master.pd_status==pdStatusCheck.QC_COMPLETED ? 'QC Completed' : master.pd_status==pdStatusCheck.ADD_ON_PENDING ? 'Addon Pending' : master.pd_status | titlecase}}</strong>
@ -139,20 +143,32 @@
<mat-icon>link</mat-icon>
</button></span> -->
<!-- <app-speed-dial-fab class="fab-group" *ngIf="master.fk_pd_type == '3'" [options]="FabOptions" (fabClick)="copyCusURL($event)"></app-speed-dial-fab> -->
<span> <button *ngIf="master.fk_pd_type == '3'"
<!-- ENABLING THE SINGLE COPY LINK VIDEO CALL BUTTON FOR SMART PD -->
<span> <button *ngIf="master.fk_pd_type == '2'"
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="copyCusURL({
placeholder:'Video Chat',
btnValue:'video'
})"
matTooltip="Copy Video Chat Customer Link" matTooltipPosition="above">
<mat-icon>link</mat-icon>
</button></span>
<!-- END OF COPY LINK VIDEO CALL BUTTON FOR SMART PD -->
<span> <button *ngIf="master.fk_pd_type == '3' || master.fk_pd_type == '2'"
mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" (click)="onClickSmsLink(master)"
matTooltip="Send Link Via SMS" matTooltipPosition="above">
matTooltip="Send Link Via SMS" matTooltipPosition="above" [disabled] = "master.fk_pd_type == '2'">
<mat-icon>sms</mat-icon>
</button>&nbsp;&nbsp;</span>
<!-- <div class="fab-group" *ngIf="master.fk_pd_type == '3'"> -->
<!-- </div> -->
<span matTooltip="{{!videoplayback.enableBtn ? 'Recorded video is available after the PD is completed' : 'Play Recorded Video'}}" matTooltipPosition="above">
<button *ngIf="master.fk_pd_type == '3'" mat-stroked-button class="mr-1 mb-1" color="primary" (click)="openPlayer()" [disabled]="!videoplayback.enableBtn" >
<button *ngIf="master.fk_pd_type == '3' || master.fk_pd_type == '2'" mat-stroked-button class="mr-1 mb-1" color="primary" (click)="openPlayer()" [disabled]="!videoplayback.enableBtn" >
<mat-icon>play_circle_filled</mat-icon>&nbsp;
<strong>Play</strong>
</button>
</span>
<button *ngIf="master.fk_pd_type == '3'" mat-button mat-raised-button class="mr-1 mb-1" color="primary" (click)="openVideoChat()">
<button *ngIf="master.fk_pd_type == '3' || master.fk_pd_type == '2'" mat-button mat-raised-button class="mr-1 mb-1" color="primary" (click)="openVideoChat()">
<mat-icon>videocam</mat-icon>&nbsp;
<strong>Call</strong>
</button>

View File

@ -614,6 +614,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
pd_id: master.pd_id,
mobile_no: this.pdApplicantData[0].mobile_no,
random_string: master.random_string,
// pd_type:master.fk_pd_type
}
this._pd.smsLink(param).subscribe(res=>{
if(res['dataStatus']){

View File

@ -905,4 +905,22 @@ export class PdTrigerService {
getRecordedPlaybackUrl(params){
return this._http.post(this.apiUrl+'getVideoURL',params)
}
/*************************** Dummy Datas *********************/
getVendorDatas(form_name,pd_id?) {
let formsDet = [{form_name:"general",form_id:"18"},{form_name:"address",form_id:"5"},{form_name:"business_info",form_id:"13"},
{form_name:"business_assets",form_id:"22"},{form_name:"neighbourhood_details",form_id:"19"},
{form_name:"final_remarks",form_id:"20"}
]
// let records = {"records":data[form_name]}
let form_id = formsDet.filter(val=>val.form_name == form_name).map(r=>r.form_id)[0];
return this.getVendorAnswers({fk_pd_id:pd_id,fk_form_id:form_id})
console.log(form_id)
// return of(records)
}
getVendorAnswers(params):Observable<any> {
return this._http.post(this.apiUrl+'getVendorAnswers',params)
}
}