business label change and validation : ps
This commit is contained in:
parent
d01c979582
commit
3b6117a0b2
@ -342,7 +342,13 @@
|
|||||||
<div fxLayout="row nowrap" *ngFor="let countryList of manufacturing.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" *ngFor="let countryList of manufacturing.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
|
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
{{country}}
|
||||||
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -419,7 +425,12 @@
|
|||||||
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
||||||
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of manufacturing.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of manufacturing.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -446,8 +457,8 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<mat-form-field style="width: 92%">
|
<mat-form-field style="width: 92%">
|
||||||
<mat-label>Description of Manufacturing</mat-label>
|
<mat-label>Description of Manufacturing Product</mat-label>
|
||||||
<textarea matInput placeholder="Description of Manufacturing" formControlName="description"></textarea>
|
<textarea matInput placeholder="Description of Manufacturing Product" formControlName="description"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
@ -537,7 +548,12 @@
|
|||||||
<div fxLayout="row nowrap" *ngFor="let countryList of retail.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" *ngFor="let countryList of retail.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
|
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -616,7 +632,12 @@
|
|||||||
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
||||||
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of retail.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of retail.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -644,8 +665,8 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<mat-form-field style="width: 92%">
|
<mat-form-field style="width: 92%">
|
||||||
<mat-label>Description of Retail Trading</mat-label>
|
<mat-label>Description of Retail Trading Product</mat-label>
|
||||||
<textarea matInput placeholder="Description of Retail Trading" formControlName="description"></textarea>
|
<textarea matInput placeholder="Description of Retail Trading Product" formControlName="description"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
@ -736,7 +757,12 @@
|
|||||||
<div fxLayout="row nowrap" *ngFor="let countryList of wholesale.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" *ngFor="let countryList of wholesale.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
|
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -813,7 +839,12 @@
|
|||||||
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
||||||
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of wholesale.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of wholesale.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
|
||||||
@ -841,8 +872,8 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<mat-form-field style="width: 92%">
|
<mat-form-field style="width: 92%">
|
||||||
<mat-label>Description of Wholesale Trade</mat-label>
|
<mat-label>Description of Wholesale Trade Product</mat-label>
|
||||||
<textarea matInput placeholder="Description of Wholesale Trade" formControlName="description"></textarea>
|
<textarea matInput placeholder="Description of Wholesale Trade Product" formControlName="description"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
@ -933,7 +964,12 @@
|
|||||||
<div fxLayout="row nowrap" *ngFor="let countryList of serviceprovider.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" *ngFor="let countryList of serviceprovider.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
|
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where Services Are Being Exported" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where Services Are Being Exported" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Revenue From Service" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Revenue From Service" formControlName="approx_sale" required>
|
||||||
@ -1012,7 +1048,12 @@
|
|||||||
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
<mat-tab label="Export" formArrayName="countries_where_export_done">
|
||||||
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of serviceprovider.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
<div fxLayout="row nowrap" class="tab_class" *ngFor="let countryList of serviceprovider.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
|
||||||
<mat-form-field style="width:35%;">
|
<mat-form-field style="width:35%;">
|
||||||
<input matInput placeholder="Countries Where Services Are Being Exported" formControlName="country_name" >
|
<!-- <input matInput placeholder="Countries Where Services Are Being Exported" formControlName="country_name" > -->
|
||||||
|
<mat-select placeholder="Countries Where The Export Is Being Done" formControlName="country_name">
|
||||||
|
<mat-option *ngFor="let CL of countryDataList" [value]="CL.state_id">
|
||||||
|
{{CL.state_name}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field style="width:45%;">
|
<mat-form-field style="width:45%;">
|
||||||
<input matInput placeholder="Approx % of Revenue From Service" formControlName="approx_sale" required>
|
<input matInput placeholder="Approx % of Revenue From Service" formControlName="approx_sale" required>
|
||||||
|
|||||||
@ -41,6 +41,7 @@ export class BusinessInfoComponent implements OnInit {
|
|||||||
//industryData: any = [];
|
//industryData: any = [];
|
||||||
activityData: any = [];
|
activityData: any = [];
|
||||||
stateList: any = [];
|
stateList: any = [];
|
||||||
|
countryDataList : any = [];
|
||||||
relativeNames: any;
|
relativeNames: any;
|
||||||
applicants: any;
|
applicants: any;
|
||||||
public businessForm: FormGroup;
|
public businessForm: FormGroup;
|
||||||
@ -96,6 +97,7 @@ export class BusinessInfoComponent implements OnInit {
|
|||||||
//this.getIndustry();
|
//this.getIndustry();
|
||||||
this.getActivity();
|
this.getActivity();
|
||||||
this.getStateCityList();
|
this.getStateCityList();
|
||||||
|
this.getCountryDataList();
|
||||||
this.initBusinessForm();
|
this.initBusinessForm();
|
||||||
this.getCompanyRelation();
|
this.getCompanyRelation();
|
||||||
this.getCompanyListForBusiness();
|
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
|
// add and create person with relationship details
|
||||||
createPersonRelationhip(details: any):FormGroup {
|
createPersonRelationhip(details: any):FormGroup {
|
||||||
return this.fb.group({
|
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() {
|
submitDetails() {
|
||||||
// let family: any = [];
|
// let family: any = [];
|
||||||
|
//console.log(this.businessForm.value);
|
||||||
|
|
||||||
if (!this.businessForm.valid) {
|
if (!this.businessForm.valid) {
|
||||||
|
//console.log(' Requried validation error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// let design: any;
|
// let design: any;
|
||||||
let records = this.businessForm.value;
|
let records = this.businessForm.value;
|
||||||
|
|
||||||
|
//to check the Appx. sale validation.
|
||||||
|
this.validateAppxSales(records);
|
||||||
|
|
||||||
if (records.other_documents == 'no') {
|
if (records.other_documents == 'no') {
|
||||||
delete records.documents;
|
delete records.documents;
|
||||||
}
|
}
|
||||||
@ -1269,6 +1377,7 @@ export class BusinessInfoComponent implements OnInit {
|
|||||||
|
|
||||||
// filter max sale options
|
// filter max sale options
|
||||||
filterMaxSaleState(datasource: any,filterValues:any){
|
filterMaxSaleState(datasource: any,filterValues:any){
|
||||||
|
console.log('filterMaxSaleState',filterValues);
|
||||||
if(filterValues){
|
if(filterValues){
|
||||||
let getOriginalStateList = datasource.map(dval => dval.state_id);
|
let getOriginalStateList = datasource.map(dval => dval.state_id);
|
||||||
let getStateValues = filterValues.filter(val =>val.state_name).map(mapVal => mapVal.state_name);
|
let getStateValues = filterValues.filter(val =>val.state_name).map(mapVal => mapVal.state_name);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user