Fairoj : Vendor DI related changes

This commit is contained in:
venbatechnologies@gmail.com 2020-09-26 10:11:03 +05:30
parent d9bd3c29da
commit a7559c0ca7
9 changed files with 146 additions and 11 deletions

View File

@ -86,7 +86,7 @@
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
"with": "src/environments/environment.prod.ts"
}]
}
}

View File

@ -237,7 +237,18 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.pdTrigerService.getVendorDatas('business_assets',this.pdid).subscribe(result=>{
if(result) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_for_address;
let business_is_pd_visited_yes_value:String=''
if(result.records.business_is_pd_visited == 'yes') {
if(result.records.business_is_pd_visited_yes.length>0) {
business_is_pd_visited_yes_value = result.records.business_is_pd_visited_yes.toString();
console.log("bb",business_is_pd_visited_yes_value.includes('Others'))
if(business_is_pd_visited_yes_value.includes('Others')) {
business_is_pd_visited_yes_value = business_is_pd_visited_yes_value.replace('Others (Please specify)',result.records.specify_pd_visited)
console.log(business_is_pd_visited_yes_value)
}
this._businessAssetsQuesFrom.controls.business_assets_form_remark.setValue(business_is_pd_visited_yes_value);
}
}
let assetCtrl: any = <FormArray>ParCtrls.controls[0];
result.records.business_address_availability ='yes'
console.log("Vendor Datas",result.records)

View File

@ -2033,6 +2033,23 @@
</span>
</span>
</div>
<div fxLayout="row" *ngIf="businessForm.controls['rent_agreement']">
<mat-form-field>
<mat-select placeholder="Rent Agreement" formControlName="rent_agreement" (selectionChange)="radioChange($event,10)">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="not applicable">Not Applicable</mat-option>
</mat-select>
<mat-error *ngIf="businessForm.controls['rent_agreement'].hasError('required')">Rent Agreement Required</mat-error>
</mat-form-field>
<span *ngIf="businessForm.controls['rent_agreement'].value == 'yes'">
<span class="carbon-wrap" *ngIf="businessForm.controls['rent_agreement_pic'] && businessForm.controls['rent_agreement_pic'].value != ''" >
<img src="{{businessForm.controls['rent_agreement_pic'].value}}" alt="" border="0" height="100" width="130" style="max-width: 130px;" ngxViewer >
<p class="carbon-text" > Rent Agreement Image </p>
</span>
</span>
</div>
<div [ngClass]="{'smartPd':fk_pd_type == '2'}">
<mat-form-field>
<mat-select placeholder="Do You Want to Add Other Documents?" formControlName="other_documents"

View File

@ -192,6 +192,9 @@ export class BusinessInfoComponent implements OnInit {
params.pd_form_id = this.form_id;
params.company_id = this.company_id;
this._pd.retriveForm(params).subscribe(data => {
if(this.fk_pd_type == '2') {
this.businessForm.addControl('rent_agreement',new FormControl('',Validators.compose([Validators.required])))
}
let businessVal = data.records;
let constVal: any;
@ -647,6 +650,7 @@ export class BusinessInfoComponent implements OnInit {
if(data.records.export_import_cert =='yes'){ this.businessForm.addControl('export_import_cert_pic', new FormControl('')); }else{ this.businessForm.removeControl('export_import_cert_pic');}
if(data.records.fire_noc =='yes'){ this.businessForm.addControl('fire_noc_pic', new FormControl('')); }else{ this.businessForm.removeControl('fire_noc_pic');}
if(data.records.eb_bill =='yes' && data.records.manufacturing_activity_details.length > 0){ this.businessForm.addControl('eb_bill_pic', new FormControl('')); }else{ this.businessForm.removeControl('eb_bill_pic');}
if(data.records.rent_agreement =='yes' && this.fk_pd_type == '2'){ this.businessForm.addControl('rent_agreement_pic', new FormControl('')); }else{ this.businessForm.removeControl('rent_agreement_pic');}
this.businessForm.patchValue(businessVal);
// console.log('this.businessForm',this.businessForm);
} else {
@ -717,9 +721,13 @@ export class BusinessInfoComponent implements OnInit {
// individualsControl.patchValue(result.records.individuals);
result.records.documents_info.forEach(val=>{
if(val) {
if(this.businessForm.value[val.document_name] != 'yes') {
if(!this.businessForm.value[val.document_name] || this.businessForm.value[val.document_name] != 'yes') {
this.businessForm.addControl(val.document_name+'_pic', new FormControl(val.document_image));
}
else {
console.log("Else part",val.document_name)
this.businessForm.controls[val.document_name+'_pic'].patchValue(val.document_image)
}
// result.records[val.document_name+'_pic'] =val.document_image
result.records[val.document_name] = 'yes'
}
@ -2127,6 +2135,7 @@ export class BusinessInfoComponent implements OnInit {
if(Flag == 3) {event.value =='yes' ? this.businessForm.addControl('export_import_cert_pic', new FormControl('')) : this.businessForm.removeControl('export_import_cert_pic');}
if(Flag == 8) {event.value =='yes' ? this.businessForm.addControl('fire_noc_pic', new FormControl('')) : this.businessForm.removeControl('fire_noc_pic');}
if(Flag == 9) {event.value =='yes' ? this.businessForm.addControl('eb_bill_pic', new FormControl('')) : this.businessForm.removeControl('eb_bill_pic');}
if(Flag == 10) {event.value =='yes' ? this.businessForm.addControl('rent_agreement_pic', new FormControl('')) : this.businessForm.removeControl('rent_agreement_pic');}
}
/* imageCrop(pic) {

View File

@ -31,7 +31,7 @@
<mat-card>
<mat-card-content>
<mat-card-subtitle>Location</mat-card-subtitle>
<mat-form-field style="width:94%;" *ngIf="fk_pd_type != '3'">
<mat-form-field style="width:94%;" *ngIf="fk_pd_type != '3' && fk_pd_type != '2'">
<mat-select placeholder="Is the location of the business / profession suited to the nature of business / service provided? "
formControlName="is_service_provided" >
<mat-option>Select</mat-option>
@ -141,7 +141,7 @@
<mat-label>Any additional visit (Godown /multiple rental properties)</mat-label>&nbsp;&nbsp;
<mat-slide-toggle formControlName="was_the_pd_address_ogl" color="primary"></mat-slide-toggle>
</div>
<mat-form-field style="width:50%;" *ngIf="fk_pd_type != '3'">
<mat-form-field style="width:50%;" *ngIf="fk_pd_type != '3' && fk_pd_type != '2'">
<mat-select placeholder="Mode of Transport Used to Visit the PD address" formControlName="mode_of_transport_during_visit"
>
<mat-option>Select</mat-option>

View File

@ -330,7 +330,12 @@ export class FinalRemarksComponent implements OnInit {
// FOR GETTING THE COMMENTS API CALL
getVendorComments() {
this.pdTrigerService.getVendorDatas('COMMENTS',this.pdid).subscribe(result=>{
this._finalRemarkForm.controls.final_form_remarks.patchValue(result.records.final_comments);
if(result.dataStatus) {
let comments:String ='';
comments = result.records.hasOwnProperty('final_visit_status') && result.records.final_visit_status != '' ? "Final Status of visit : "+result.records.final_visit_status+'\n' : ''
comments += result.records.final_comments
this._finalRemarkForm.controls.final_form_remarks.patchValue(comments);
}
})
}
/************************* END OF VENDOR FORM DATAS *********************************/

View File

@ -433,9 +433,26 @@ export class GeneralInfoComponent implements OnInit {
let individualsControl = <FormArray>this._generalForm.controls['individuals'];
console.log("Vendor Datas",result.records)
individualsControl.patchValue(result.records.individuals);
if(result.records.general_remark) {
this._generalForm.controls.general_remark.patchValue(result.records.general_remark)
// if(result.records.general_remark) {
// this._generalForm.controls.general_remark.patchValue(result.records.general_remark)
// }
let newPersonMet:any = result.records
if(this.customer_segment_abbr == 'SAL') {
if(newPersonMet.person_met_entered) {
let commonRemarks = "Met "+newPersonMet.person_met_entered +", at the time of FI visit."
this._generalForm.controls.general_remark.patchValue(commonRemarks)
}
else if(newPersonMet.is_met_during_visit == 'no') {
let commonRemarks = " No one was met at the time of FI visit."
this._generalForm.controls.general_remark.patchValue(commonRemarks)
}
}
else {
if(newPersonMet.person_met_entered && newPersonMet.designation_entered && newPersonMet.relation_entered && newPersonMet.relation_to) {
let commonRemarks = "Met "+newPersonMet.person_met_entered +" during visit, who is "+newPersonMet.designation_entered+" and "+newPersonMet.relation_entered+" of "+newPersonMet.relation_to
this._generalForm.controls.general_remark.patchValue(commonRemarks)
}
}
console.log(this._generalForm.value)
}
})

View File

@ -208,9 +208,12 @@ export class StockComponent implements OnInit {
}
if (val.type_of_activity_id == 3) {
if (val.products) {
let retail_temparr = [];
if(dataForm.retail_details[0]) {
let retail_temparr = []
retail_temparr['retail_traded_goods'] = dataForm.retail_details[0].retail_traded_goods;
this.initRetailDetails(retail_temparr);
}
else {this.initRetailDetails(null);}
}
}
if (val.type_of_activity_id == 4) {
@ -221,13 +224,14 @@ export class StockComponent implements OnInit {
trading_temparr['trading_traded_goods'] = dataForm.trade_details[0].trading_traded_goods ;
this.initTradingDetails(trading_temparr);
}
else {this.initTradingDetails(null);}
}
}
if (val.type_of_activity_id == 5) {
if (val.products) {
// this.serviceProviderForm = true;
let servicing_temparr = [];
if(dataForm.hasOwnProperty('servicing_details')){
if(dataForm.hasOwnProperty('servicing_details') && dataForm.servicing_details[0]){
servicing_temparr['service_provider'] = dataForm.servicing_details[0].service_provider;
this.initServicingDetails(servicing_temparr);
}
@ -348,9 +352,79 @@ export class StockComponent implements OnInit {
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' && this.pd_all_details.pdmaster_details.curr_vendor_ans_fetch_status == '0') {
console.log(this.pd_all_details.pdmaster_details.vendor_status);
this.getDataFromVendor()
}
})
}
/************************* START OF VENDOR FORM DATAS *********************************/
getDataFromVendor() {
this._pd.getVendorDatas('stock',this.pdid).subscribe(result=>{
if(result && result['dataStatus']) {
// let individualsControl = <FormArray>this._generalForm.controls['individuals'];
console.log("Vendor Datas",result.records)
if(result.records.is_stock_photo) {
let manufacturingArray = this.stockForms.get('manufacturing_details') as FormArray
console.log("Check1",manufacturingArray)
let raw_mat_manu = manufacturingArray.at(0).get('manufacturing_raw_materials')
console.log("Check2",raw_mat_manu)
if(raw_mat_manu != null && raw_mat_manu) {
this.setStockObserveValue(raw_mat_manu['controls'],'stock_observed')
}
let finished_mat_manu =manufacturingArray.at(0).get('manufacturing_finished_goods')
if(finished_mat_manu != null && finished_mat_manu) {
this.setStockObserveValue(finished_mat_manu['controls'],'goods_observed')
}
let retailformArray = this.stockForms.get('retail_details') as FormArray
console.log("Check1stock",retailformArray)
let retail_trade = retailformArray.at(0).get('retail_traded_goods')
console.log("Check2stock",retail_trade)
if(retail_trade != null && retail_trade) {
this.setStockObserveValue(retail_trade['controls'],'traded_goods_observed')
}
let wholeSaleFormArray = this.stockForms.get('trade_details') as FormArray
console.log("Check1stock",wholeSaleFormArray)
let wholeSalesTrading = wholeSaleFormArray.at(0).get('trading_traded_goods')
console.log("Check2stock",wholeSalesTrading)
if(wholeSalesTrading != null && wholeSalesTrading) {
this.setStockObserveValue(wholeSalesTrading['controls'],'traded_goods_observed')
}
let serviceFormArray = this.stockForms.get('servicing_details') as FormArray
console.log("Check1stock",serviceFormArray)
let serviceTrading = serviceFormArray.at(0).get('service_provider')
console.log("Check2stock",serviceTrading)
if(serviceTrading != null && serviceTrading) {
this.setStockObserveValue(serviceTrading['controls'],'service_provider_observed')
}
}
// individualsControl.patchValue(result.records.individuals);
// if(result.records.general_remark) {
// this._generalForm.controls.general_remark.patchValue(result.records.general_remark)
// }
}
})
}
setStockObserveValue(controls,key_name) {
if(controls && controls.length > 0) {
controls.forEach(form_obj=>{
form_obj.controls[key_name].patchValue('yes')
})
}
}
/************************* END OF VENDOR FORM DATAS *********************************/
manufacturingForm: Boolean = false;
manufacturingFormCreation(record) {

View File

@ -963,7 +963,9 @@ export class PdTrigerService {
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:"business_assets",form_id:"22"},
{form_name:"stock",form_id:"11"},
{form_name:"neighbourhood_details",form_id:"19"},
{form_name:"final_remarks",form_id:"20"},
{form_name:"queries_form",form_id:"24"},
{form_name:"COMMENTS",form_id:"COMMENTS"}