-
+
+
+
+ {{CL.state_name}}
+
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
index 3b57ff65a..40851a41a 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts
@@ -41,6 +41,7 @@ export class BusinessInfoComponent implements OnInit {
//industryData: any = [];
activityData: any = [];
stateList: any = [];
+ countryDataList : any = [];
relativeNames: any;
applicants: any;
public businessForm: FormGroup;
@@ -96,6 +97,7 @@ export class BusinessInfoComponent implements OnInit {
//this.getIndustry();
this.getActivity();
this.getStateCityList();
+ this.getCountryDataList();
this.initBusinessForm();
this.getCompanyRelation();
this.getCompanyListForBusiness();
@@ -1106,6 +1108,17 @@ export class BusinessInfoComponent implements OnInit {
});
}
+ getCountryDataList(){
+ let master_name = 'STATE';
+ this._pd.getAllMasterDatas(master_name).subscribe(data => {
+ data.records.forEach(val => {
+ if (val.isactive == 1) {
+ this.countryDataList.push(val);
+ }
+ })
+ });
+ }
+
// add and create person with relationship details
createPersonRelationhip(details: any):FormGroup {
return this.fb.group({
@@ -1198,13 +1211,108 @@ export class BusinessInfoComponent implements OnInit {
}
}
+
+ /**
+ * This Function For validate For Appx. sale based on Type OF Activities
+ */
+ validateAppxSales(records){
+
+ console.log(records.manufacturing_activity_details.length);
+
+ //this Variable For Validation
+ let validationFlag : number = 0;
+
+ //type 1: Checking manufacturing_activity_details
+ if(records.manufacturing_activity_details.length > 0){
+
+ records.manufacturing_activity_details.forEach((val,index) => {
+
+ let ManufacturingArray = Object.keys(val.countries_where_export_done).map(function (key) {
+ return val.countries_where_export_done[key];
+ });
+ let total = ManufacturingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+ if(total > 100 || total < 100){
+ validationFlag++;
+ }
+
+ });
+
+ }
+
+ //type 3 checking wholesale_trading_activity_details
+ if(records.wholesale_trading_activity_details.length > 0){
+
+ records.wholesale_trading_activity_details.forEach((val,index) => {
+
+ let WholesaleTradingArray = Object.keys(val.countries_where_export_done).map(function (key) {
+ return val.countries_where_export_done[key];
+ });
+ let total = WholesaleTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+ if(total > 100 || total < 100){
+ validationFlag++;
+ }
+
+ });
+
+ }
+
+ //type 2 checking retail_trading_activity_details
+ if(records.retail_trading_activity_details.length > 0){
+
+ records.retail_trading_activity_details.forEach((val,index) => {
+
+ let RetailTradingArray = Object.keys(val.countries_where_export_done).map(function (key) {
+ return val.countries_where_export_done[key];
+ });
+ let total = RetailTradingArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+ if(total > 100 || total < 100){
+ validationFlag++;
+ }
+
+ });
+
+ }
+
+
+ //type 4 checking service_provider_activity_details
+ if(records.service_provider_activity_details.length > 0){
+
+ records.service_provider_activity_details.forEach((val,index) => {
+
+ let ServiceProviderArray = Object.keys(val.countries_where_export_done).map(function (key) {
+ return val.countries_where_export_done[key];
+ });
+ let total = ServiceProviderArray.reduce((sum, item) => sum + +item.approx_sale, 0);
+ if(total > 100 || total < 100){
+ validationFlag++;
+ }
+
+ });
+
+ }
+
+ //validationFlag is greater then 0 means its display the notifer as warning
+ if(validationFlag > 0){
+ this.notifier.notify('warning',"Approximate sales doesn't add upto 100%");
+ return;
+ }
+
+ }
+
submitDetails() {
// let family: any = [];
+ //console.log(this.businessForm.value);
+
if (!this.businessForm.valid) {
+ //console.log(' Requried validation error');
return;
}
// let design: any;
let records = this.businessForm.value;
+
+ //to check the Appx. sale validation.
+ this.validateAppxSales(records);
+
if (records.other_documents == 'no') {
delete records.documents;
}
@@ -1269,6 +1377,7 @@ export class BusinessInfoComponent implements OnInit {
// filter max sale options
filterMaxSaleState(datasource: any,filterValues:any){
+ console.log('filterMaxSaleState',filterValues);
if(filterValues){
let getOriginalStateList = datasource.map(dval => dval.state_id);
let getStateValues = filterValues.filter(val =>val.state_name).map(mapVal => mapVal.state_name);