+
+
+
+
+

+
+
-
-
-
-
-
-
- picture_as_pdf
- {{doc.document_title}}
-
-
-
-
+
+
+
+
+
+
+
+
+ picture_as_pdf
+ {{doc.document_title}}
+
+
+
-
-
- No Files
-
-
+
+
+
+ No Files
+
+
@@ -429,12 +505,13 @@
Remarks
-
+
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
index 404f65282..0d605734c 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-assets-info/business-assets-info.component.ts
@@ -44,12 +44,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
yearErrorMessage: any = [];
monthErrorMessage: any = [];
currentYear: any = new Date().getFullYear();
- addressLabel: any = [];
+ // addressLabel: any = [];
+ addressList: any = [];
/**Declaration of Dropdown And Array */
public applicants: any;
- public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" },
- { 'value': "no", 'viewValue': "No" }]
+ public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" }, { 'value': "no", 'viewValue': "No" }]
public m_assets_type = [];
public m_propertyType = [];
public m_address_type = [];
@@ -63,7 +63,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
existCompanyList: any = [];
mergeCompanyApplicant: any = [];
endUserList = [];
- address_type : any ;
+ address_type: any;
/**Constructor of the class */
constructor(
notifier: NotifierService,
@@ -89,7 +89,8 @@ export class BusinessAssetsInfoComponent implements OnInit {
documentsAndFilesList: any = [];
/** init Function */
ngOnInit() {
- console.clear();
+
+ console.clear();
// this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => {
// this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ;
// });
@@ -114,7 +115,8 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList })
}
- })
+ });
+
this.getM_State_For_Address();
this.getPdSupplierFormDetails();
this.getM_Assets_Type();
@@ -122,29 +124,32 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.getM_Address_Type();
this.getM_Vehicle_Type();
this.getM_Address_Type();
- this.pdTrigerService.retriveFile(this.pdid,'22',this.company_id).subscribe(data => {
- if (data.status == 200) {
- if(data.records.length>0){
- data.records.forEach((val, index) => {
- let splitted = val.pd_document_name.split(".");
- let DocumentsAndFiles = {
- 'document_name': val.pd_document_name,
- 'document_title': val.pd_document_title,
- 'document': val.doc_url,
- 'document_type' : splitted[1] == 'pdf'?'pdf':'image'
- }
- this.documentsAndFilesList.push(DocumentsAndFiles);
- });
- }
- }
- else{
- this.documentsAndFilesList = [];
- }
- });
-
- }
- getM_State_For_Address(){
+ this.pdTrigerService.retriveFile(this.pdid, '22', this.company_id).subscribe(data => {
+ if (data.status == 200) {
+ if (data.records.length > 0) {
+ data.records.forEach((val, index) => {
+ let splitted = val.pd_document_name.split(".");
+ let DocumentsAndFiles = {
+ 'document_name': val.pd_document_name,
+ 'document_title': val.pd_document_title,
+ 'document': val.doc_url,
+ 'document_type': splitted[1] == 'pdf' ? 'pdf' : 'image'
+ }
+ this.documentsAndFilesList.push(DocumentsAndFiles);
+ });
+ }
+ }
+ else {
+ this.documentsAndFilesList = [];
+ }
+ });
+
+ }
+ /** init Function Ends Here */
+
+ /** State Master For Addresses */
+ getM_State_For_Address() {
this.pdTrigerService.getAllMasterDatas('STATE').subscribe(
data => {
this.m_state_for_address = data.records.filter(data => data.isactive == 1);
@@ -192,9 +197,10 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.m_vehicle_type = data.records.filter(data => data.is_active == 1);
})
}
-
+
//Get Data Based on PDID and FORMID
apiLoadFinish: boolean = false;
+
getPdSupplierFormDetails() {
let reqparams: any = {};
reqparams.parent_pdid = this.parent_pdid;
@@ -214,10 +220,10 @@ export class BusinessAssetsInfoComponent implements OnInit {
} else {
// this.noRecordFound = true;
}
- }
- );
+ });
}
- loadaddresses() {
+
+ loadaddresses(flag) {
let params: any = {};
params.parent_pdid = this.parent_pdid;
@@ -227,71 +233,118 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.pdTrigerService.retriveForm(params).subscribe(data => {
if (data.status == 200) {
+ if(flag == 1){
+ let initiated_address_check = data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true;
+ this.addressList.push({ key_name: 'initiate_address', value: data.records.addresses[0].address, description: 'Initiated Address' });
+ if (initiated_address_check == false ) {
+ this.addressList.push({ key_name: 'alternative_addresses', value: data.records.alternative_addresses[0].alternative_address, description: 'Alternative Address' });
+ }
+ }
+ else if(flag == 2){
let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1);
-
+ this.addressList.push({ key_name: 'initiate_address', value: data.records.addresses[0].address, description: 'Initiated Address' });
+ let initiated_address_check = data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true;
// // const control =
this._businessAssetsQuesFrom.controls['business_assets_for_address'];
-
- if (data.records.addresses.length > 0) {
+ if (initiated_address_check == true && data.records.addresses.length > 0) {
data.records.addresses.forEach((dataValue, inx) => {
-
- this.addressLabel[inx] = '';
this.pdTrigerService.getStateWiseCities(dataValue.state).subscribe(data => {
if (data.status == 200) {
-
- this.cityArr = data.records.cities;
- this.pinArr = data.records.pincode;
-
- let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0];
- let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.state)[0];
- let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.city)[0];
- let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.pincode)[0];
-
- let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
- this.address_type = addressType;
- let address = dataValue.address + ' , ' + selectedCity.city_name + ','+selectedState.name +'-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode);
-
- this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
- let addressLabel = address + ' / ' + addressType;
- let vals = {
- address_label: addressLabel,
- business_years: '',
- business_month: '',
- business_address_availability: '',
- business_is_pd_visited: '',
- business_pd_visited_remark: '',
- business_approximate_market_value: '',
- business_ownership_type: '',
- business_monthly_rented_amt: '',
- business_name_of_the_owner: '',
- business_name_of_the_other_owner: '',
- business_vintage: '',
- business_purchase_year: '',
- business_emi: ''
- }
- const control = this._businessAssetsQuesFrom.controls['business_assets_for_address'];
- control.push(this.initBusinessAddressDetailsWithdata(vals));
+
+ this.cityArr = data.records.cities;
+ this.pinArr = data.records.pincode;
+
+ let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0];
+ let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.state)[0];
+ let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.city)[0];
+ let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.pincode)[0];
+
+ let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
+ this.address_type = addressType;
+ let address = dataValue.address + ' , ' + selectedCity.city_name + ',' + selectedState.name + '-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode);
+
+ this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
+ let addressLabel = address + ' / ' + addressType;
+ let vals = {
+ address_label: addressLabel,
+ business_years: '',
+ business_month: '',
+ business_address_availability: '',
+ business_is_pd_visited: '',
+ business_pd_visited_remark: '',
+ business_approximate_market_value: '',
+ business_ownership_type: '',
+ business_monthly_rented_amt: '',
+ business_name_of_the_owner: '',
+ business_name_of_the_other_owner: '',
+ business_vintage: '',
+ business_purchase_year: '',
+ business_emi: ''
+ }
+ const control = this._businessAssetsQuesFrom.controls['business_assets_for_address'];
+ control.push(this.initBusinessAddressDetailsWithdata(vals));
}
});
});
- }
- else {
+
+ } else if (initiated_address_check == false && data.records.alternative_addresses.length > 0) {
+ this.addressList.push({ key_name: 'alternative_addresses', value: data.records.alternative_addresses[0].alternative_address, description: 'Alternative Address' });
+ data.records.alternative_addresses.forEach((dataValue, inx) => {
+ this.pdTrigerService.getStateWiseCities(dataValue.alternative_state).subscribe(data => {
+ if (data.status == 200) {
+
+ this.cityArr = data.records.cities;
+ this.pinArr = data.records.pincode;
+
+ let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0];
+ let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.alternative_state)[0];
+ let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.alternative_city)[0];
+ let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.alternative_pincode)[0];
+
+ let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
+ this.address_type = addressType;
+ let address = dataValue.alternative_address + ' , ' + selectedCity.city_name + ',' + selectedState.name + '-' + (dataValue.alternative_pincode == 1 ? dataValue.alternative_pincode_others : selectedPincode.pincode);
+
+ this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
+ let addressLabel = address + ' / ' + addressType;
+ let vals = {
+ address_label: addressLabel,
+ business_years: '',
+ business_month: '',
+ business_address_availability: '',
+ business_is_pd_visited: '',
+ business_pd_visited_remark: '',
+ business_approximate_market_value: '',
+ business_ownership_type: '',
+ business_monthly_rented_amt: '',
+ business_name_of_the_owner: '',
+ business_name_of_the_other_owner: '',
+ business_vintage: '',
+ business_purchase_year: '',
+ business_emi: ''
+ }
+ const control = this._businessAssetsQuesFrom.controls['business_assets_for_address'];
+ control.push(this.initBusinessAddressDetailsWithdata(vals));
+ }
+ });
+ });
+ } else {
const control = this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails());
}
- }
+ }}
else {
const control = this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails());
}
});
}
+
// business_years: [value.business_years],
// business_month: [value.business_month],
// business_address_availability: [value.business_address_availability],
// business_is_pd_visited: [value.business_is_pd_visited],
// business_pd_visited_remark: [value.business_pd_visited_remark],
// business_assets_for_address: this._formBuilder.array([]),
-
// business_years: [''],
// business_month: [''],
// business_address_availability: [''],
@@ -303,6 +356,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
formLoadData(val) {
if (val !== null) {
let value = val;
+ this.loadaddresses(1);
this._businessAssetsQuesFrom = this._formBuilder.group({
parent_pdid: [this.parent_pdid],
pdid: [this.pdid],
@@ -333,7 +387,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
business_assets_details: this._formBuilder.array([this.initBusinessDetails()]),
business_assets_form_remark: ['']
});
- this.loadaddresses();
+ this.loadaddresses(2);
}
this.loadDetails = true;
}
@@ -364,7 +418,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
address_label: [''],
business_years: [''],
business_month: [''],
- business_address_availability: ['',Validators.compose([Validators.required])],
+ business_address_availability: ['', Validators.compose([Validators.required])],
business_is_pd_visited: [''],
business_pd_visited_remark: [''],
// this.createBusinessAssetsForAddress()
@@ -438,6 +492,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
break;
}
}
+ this.removeOptionOnAutoComplete(i);
}
loadEquipmentManufacturingDescription() {
@@ -459,17 +514,15 @@ export class BusinessAssetsInfoComponent implements OnInit {
manufacturer_model_vehicle: [''],
vehicle_type: [''],
other_vehicle_type: ['']
-
});
}
otherBusinessAssetsDescription() {
return this._formBuilder.group({
- any_other_assets: ['',Validators.compose([Validators.required])],
+ any_other_assets: ['', Validators.compose([Validators.required])],
});
}
-
loadPropertyWithData(data) {
return this._formBuilder.group({
property_type: [data.property_type],
@@ -486,7 +539,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
otherBusinessAssetsDescriptionWithData(data) {
return this._formBuilder.group({
- any_other_assets: [data.any_other_assets,Validators.compose([Validators.required])],
+ any_other_assets: [data.any_other_assets, Validators.compose([Validators.required])],
});
}
@@ -595,29 +648,31 @@ export class BusinessAssetsInfoComponent implements OnInit {
var result = Object.keys(data).map(function (key) {
return data[key];
});
+
if (result.length > 0) {
result.forEach((datas, index) => {
-
+
let Avaliablity = 1;
if (datas.business_name_of_the_owner !== null) {
- if (datas.business_name_of_the_owner.length > 0) {
- datas.business_name_of_the_owner.forEach(option => {
- if (option.id == 0 && option.group_id == 2) {
- Avaliablity = option.id;
- }
- });
- }}
+ if (datas.business_name_of_the_owner.length > 0) {
+ datas.business_name_of_the_owner.forEach(option => {
+ if (option.id == 0 && option.group_id == 2) {
+ Avaliablity = option.id;
+ }
+ });
+ }
+ }
this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false;
});
// for (let val of result) {
result.forEach((val, index) => {
-
- var splitted_label = val.address_label.split("/", 2);
+
+ var splitted_label = val.address_label.split("/", 2);
let addressType = splitted_label[1] != '' ? splitted_label[1] : 'Address Type';
- this.placeholderName[index] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
- this.address_type = addressType;
+ this.placeholderName[index] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
+ this.address_type = addressType;
let vals = {
address_label: val.address_label,
business_years: val.business_years,
@@ -652,18 +707,17 @@ export class BusinessAssetsInfoComponent implements OnInit {
if (result.length > 0) {
result.forEach((datas, index) => {
-
let Avaliablity = 1;
-if(datas.business_name_of_the_owner !== null){
- if (datas.business_name_of_the_owner.length > 0) {
- datas.business_name_of_the_owner.forEach(option => {
- if (option.id == 0 && option.group_id == 2) {
- Avaliablity = option.id;
- }
- });
- }}
+ if (datas.business_name_of_the_owner !== null) {
+ if (datas.business_name_of_the_owner.length > 0) {
+ datas.business_name_of_the_owner.forEach(option => {
+ if (option.id == 0 && option.group_id == 2) {
+ Avaliablity = option.id;
+ }
+ });
+ }
+ }
this.isOtherOwner[index] = Avaliablity == 0 ? true : false;
-
});
for (let val of result) {
@@ -688,7 +742,6 @@ if(datas.business_name_of_the_owner !== null){
}
setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
-
let val = i;
let data = datas;
@@ -709,6 +762,7 @@ if(datas.business_name_of_the_owner !== null){
let business_property_datas: any;
data.forEach((datas, i) => {
business_property_datas = { 'property_type': datas.property_type, 'other_property_type': datas.other_property_type, 'address_of_the_property': datas.address_of_the_property };
+ this.addOptionOnAutoComplete(datas.property_type, datas.address_of_the_property, val);
});
const control = (this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
control.push(this.loadPropertyWithData(business_property_datas));
@@ -738,6 +792,39 @@ if(datas.business_name_of_the_owner !== null){
}
}
+ addOptionOnAutoComplete(property_id, event, i) {
+ if(event != ''){
+ let getList = this.addressList.map(dval => dval.value.replace(/\s/g, "").toLowerCase());
+ let getkeyname = this.addressList.map(dval => dval.key_name);
+ let findName = this.m_address_type.find(x => x.address_type_id == property_id);
+ // console.log(getkeyname.indexOf(i));
+ let evt = event.replace(/\s/g, "").toLowerCase();
+
+ let keyexist = this.addressList.find(ob => ob['key_name'] === i);
+
+ if (keyexist === undefined || keyexist === null && !getList.includes(evt)) {
+ console.log('push on this');
+ this.addressList.push({ key_name: i, value: event, description: findName.address_type + ' At Index ' + i });
+ }
+ else {
+ let Index = getkeyname.indexOf(i);
+ this.addressList[Index] = { key_name: i, value: event, description: findName.address_type + ' At Index ' + i }
+ console.log('update on this => Index', Index);
+ }
+
+ console.log('at Final add or update ', this.addressList);
+ }
+ }
+
+ removeOptionOnAutoComplete(i) {
+ let getkeyname = this.addressList.map(dval => dval.key_name);
+ let Index = getkeyname.indexOf(i);
+ if (Index !== -1) {
+ this.addressList.splice(Index, 1);
+ }
+ console.log('at Final remove', this.addressList);
+ }
+
/** Add More Asset using Flag Both "Other Asset" And "Business Asset" */
addAssetDetails(e) {
@@ -890,9 +977,9 @@ if(datas.business_name_of_the_owner !== null){
let ParCtrls = this._businessAssetsQuesFrom.controls.business_assets_details;
let ChdCtrls: any = ParCtrls.controls[ParInx];
-
- let Avaliablity = 1;
- if (value !== null ) {
+
+ let Avaliablity = 1;
+ if (value !== null) {
if (value.length > 0) {
value.forEach(option => {
@@ -902,23 +989,23 @@ if(datas.business_name_of_the_owner !== null){
});
}
}
-
- if (Avaliablity == 0) {
-
- ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
- this.isOtherOwner[ParInx] = true;
-
-
-
-
- } else if (Avaliablity == 1) {
-
- ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
- ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
- this.isOtherOwner[ParInx] = false;
- }
- ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
+ if (Avaliablity == 0) {
+
+ ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
+ this.isOtherOwner[ParInx] = true;
+
+
+
+
+ } else if (Avaliablity == 1) {
+
+ ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
+ ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
+ this.isOtherOwner[ParInx] = false;
+ }
+
+ ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
@@ -926,12 +1013,12 @@ if(datas.business_name_of_the_owner !== null){
setOtherOwnerOfAddress(value, ParInx) {
let ParCtrls = this._businessAssetsQuesFrom.controls.business_assets_for_address;
-
+
let ChdCtrls: any = ParCtrls.controls[ParInx];
-
+
let Avaliablity = 1;
-
- if (value !== null ) {
+
+ if (value !== null) {
if (value.length > 0) {
value.forEach(option => {
@@ -939,23 +1026,23 @@ if(datas.business_name_of_the_owner !== null){
Avaliablity = option.id;
}
});
-
- }
- }
- if (Avaliablity == 0) {
-
- ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
- this.isOtherOwnerForAddress[ParInx] = true;
-
- } else if (Avaliablity == 1) {
-
- ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
- ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
- this.isOtherOwnerForAddress[ParInx] = false;
}
-
- ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
+ }
+ if (Avaliablity == 0) {
+
+ ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
+ this.isOtherOwnerForAddress[ParInx] = true;
+
+ } else if (Avaliablity == 1) {
+
+ ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
+ ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
+ this.isOtherOwnerForAddress[ParInx] = false;
+
+ }
+
+ ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
@@ -969,13 +1056,13 @@ if(datas.business_name_of_the_owner !== null){
item.controls.business_ownership_type.setValidators([Validators.required]);
}
else {
-
+
item.controls.business_years.setValue('');
item.controls.business_month.setValue('');
item.controls.business_is_pd_visited.setValue('');
- item.controls.business_pd_visited_remark.setValue('');
+ item.controls.business_pd_visited_remark.setValue('');
item.controls.business_ownership_type.setValue('');
-
+
item.controls.business_years.clearValidators();
item.controls.business_is_pd_visited.clearValidators();
item.controls.business_pd_visited_remark.clearValidators();
@@ -1006,12 +1093,14 @@ if(datas.business_name_of_the_owner !== null){
item.controls.business_ownership_type.updateValueAndValidity();
}
- if(flag == 2){
- if(value != ''){
- item.controls.business_ownership_type.setValidators([Validators.required]);}
- else{
- item.controls.business_ownership_type.setValue('');
- item.controls.business_ownership_type.clearValidators();}
+ if (flag == 2) {
+ if (value != '') {
+ item.controls.business_ownership_type.setValidators([Validators.required]);
+ }
+ else {
+ item.controls.business_ownership_type.setValue('');
+ item.controls.business_ownership_type.clearValidators();
+ }
item.controls.business_ownership_type.updateValueAndValidity();
}
if (flag == 3) {
@@ -1072,10 +1161,9 @@ if(datas.business_name_of_the_owner !== null){
selectedAddressType(e: any) {
this.placeholderName = 'Was any business activity seen at the ' + e + ' during PD visit?';
}
- pdf(fileURL){
+ pdf(fileURL) {
window.open(fileURL);
-}
-
+ }
/** For Docs Tab */
public viewerOptions: any = {
navbar: false,