business form changes

This commit is contained in:
gandhimathi 2018-12-24 19:45:30 +05:30
parent 34a3b0da66
commit 62f354fd4a
3 changed files with 309 additions and 13 deletions

View File

@ -249,10 +249,10 @@
<mat-select formControlName="area_of_sale" placeholder="Area of Sale" (selectionChange)="changeManufacturingAreaSale(manufacturing,m)" required>
<mat-option value="Within India">Within India</mat-option>
<mat-option value="Export">Export</mat-option>
<!-- <mat-option value="Both">Both</mat-option> -->
<mat-option value="Both">Both</mat-option>
</mat-select>
</mat-form-field>
<ng-container *ngIf="manufacturing.value.india_where_sale_done !=undefined">
<ng-container *ngIf="manufacturing.value.india_where_sale_done !=undefined && manufacturing.value.countries_where_export_done ==undefined">
<div formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" *ngFor="let saleList of manufacturing.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
@ -283,7 +283,7 @@
</div>
</ng-container>
<ng-container *ngIf="manufacturing.value.countries_where_export_done !=undefined">
<ng-container *ngIf="manufacturing.value.countries_where_export_done !=undefined && manufacturing.value.india_where_sale_done ==undefined">
<div formArrayName="countries_where_export_done">
<div fxLayout="row nowrap" *ngFor="let countryList of manufacturing.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
@ -305,6 +305,58 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="manufacturing.value.countries_where_export_done !=undefined && manufacturing.value.india_where_sale_done !=undefined">
<mat-tab-group>
<mat-tab label="Within India" formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" class="tab_class" *ngFor="let saleList of manufacturing.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
<mat-form-field style="width:35%;">
<mat-select placeholder="State" formControlName="state_name" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select multiple formControlName="city_name" placeholder="City" required>
<mat-option *ngFor="let CL of filterCity(stateList,saleList.value.state_name)" [value]="CL.city_id">{{CL.city_name}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addMoreState(m,'1')" *ngIf="s==0"
matTooltip="Add More State" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeState(m,s,'1')" *ngIf="s>0"
matTooltip="Remove State" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
<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">
<mat-form-field style="width:35%;">
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
</mat-form-field>
<mat-form-field style="width:45%;">
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addMoreState(m,'2')" *ngIf="c==0"
matTooltip="Add More Country" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeState(m,c,'2')" *ngIf="c>0"
matTooltip="Remove Country" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
</mat-tab-group>
</ng-container>
</mat-card-content>
<mat-card-actions>
@ -337,10 +389,10 @@
<mat-select formControlName="area_of_sale" placeholder="Area of Sale" (selectionChange)="changeRetailAreaSale(retail,r)" required>
<mat-option value="Within India">Within India</mat-option>
<mat-option value="Export">Export</mat-option>
<!-- <mat-option value="Both">Both</mat-option> -->
<mat-option value="Both">Both</mat-option>
</mat-select>
</mat-form-field>
<ng-container *ngIf="retail.value.india_where_sale_done !=undefined">
<ng-container *ngIf="retail.value.india_where_sale_done !=undefined && retail.value.countries_where_export_done ==undefined">
<div formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" *ngFor="let saleList of retail.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
@ -371,7 +423,7 @@
</div>
</ng-container>
<ng-container *ngIf="retail.value.countries_where_export_done !=undefined">
<ng-container *ngIf="retail.value.india_where_sale_done ==undefined && retail.value.countries_where_export_done !=undefined">
<div formArrayName="countries_where_export_done">
<div fxLayout="row nowrap" *ngFor="let countryList of retail.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
@ -394,6 +446,59 @@
</div>
</ng-container>
<ng-container *ngIf="retail.value.countries_where_export_done !=undefined && retail.value.india_where_sale_done !=undefined">
<mat-tab-group>
<mat-tab label="Within India" formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" class="tab_class" *ngFor="let saleList of retail.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
<mat-form-field style="width:35%;">
<mat-select placeholder="State" formControlName="state_name" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select multiple formControlName="city_name" placeholder="City" required>
<mat-option *ngFor="let CL of filterCity(stateList,saleList.value.state_name)" [value]="CL.city_id">{{CL.city_name}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addRetailMoreState(r,'1')" *ngIf="s==0"
matTooltip="Add More State" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeRetailState(r,s,'1')" *ngIf="s>0"
matTooltip="Remove State" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
<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">
<mat-form-field style="width:35%;">
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
</mat-form-field>
<mat-form-field style="width:45%;">
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addRetailMoreState(r,'2')" *ngIf="c==0"
matTooltip="Add More Country" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeRetailState(r,c,'2')" *ngIf="c>0"
matTooltip="Remove Country" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
</mat-tab-group>
</ng-container>
</mat-card-content>
<mat-card-actions>
<mat-form-field style="width: 92%">
@ -425,10 +530,10 @@
<mat-select formControlName="area_of_sale" placeholder="Area of Sale" (selectionChange)="changeWholesaleAreaSale(wholesale,w)" required>
<mat-option value="Within India">Within India</mat-option>
<mat-option value="Export">Export</mat-option>
<!-- <mat-option value="Both">Both</mat-option> -->
<mat-option value="Both">Both</mat-option>
</mat-select>
</mat-form-field>
<ng-container *ngIf="wholesale.value.india_where_sale_done !=undefined">
<ng-container *ngIf="wholesale.value.india_where_sale_done !=undefined && wholesale.value.countries_where_export_done ==undefined">
<div formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" *ngFor="let saleList of wholesale.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
@ -459,7 +564,7 @@
</div>
</ng-container>
<ng-container *ngIf="wholesale.value.countries_where_export_done !=undefined">
<ng-container *ngIf="wholesale.value.india_where_sale_done ==undefined && wholesale.value.countries_where_export_done !=undefined">
<div formArrayName="countries_where_export_done">
<div fxLayout="row nowrap" *ngFor="let countryList of wholesale.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
@ -481,6 +586,58 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="wholesale.value.countries_where_export_done !=undefined && wholesale.value.india_where_sale_done !=undefined">
<mat-tab-group>
<mat-tab label="Within India" formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" class="tab_class" *ngFor="let saleList of wholesale.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
<mat-form-field style="width:35%;">
<mat-select placeholder="State" formControlName="state_name" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select multiple formControlName="city_name" placeholder="City" required>
<mat-option *ngFor="let CL of filterCity(stateList,saleList.value.state_name)" [value]="CL.city_id">{{CL.city_name}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addWholesaleMoreState(w,'1')" *ngIf="s==0"
matTooltip="Add More State" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeWholesaleState(w,s,'1')" *ngIf="s>0"
matTooltip="Remove State" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
<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">
<mat-form-field style="width:35%;">
<input matInput placeholder="Countries Where The Export Is Being Done" formControlName="country_name" >
</mat-form-field>
<mat-form-field style="width:45%;">
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addWholesaleMoreState(w,'2')" *ngIf="c==0"
matTooltip="Add More Country" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeWholesaleState(w,c,'2')" *ngIf="c>0"
matTooltip="Remove Country" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
</mat-tab-group>
</ng-container>
</mat-card-content>
<mat-card-actions>
@ -513,10 +670,10 @@
<mat-select formControlName="area_of_sale" placeholder="Area of Service" (selectionChange)="changeServiceArea(serviceprovider,sp)" required>
<mat-option value="Within India">Within India</mat-option>
<mat-option value="Export">Export</mat-option>
<!-- <mat-option value="Both">Both</mat-option> -->
<mat-option value="Both">Both</mat-option>
</mat-select>
</mat-form-field>
<ng-container *ngIf="serviceprovider.value.india_where_sale_done !=undefined">
<ng-container *ngIf="serviceprovider.value.india_where_sale_done !=undefined && serviceprovider.value.countries_where_export_done ==undefined">
<div formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" *ngFor="let saleList of serviceprovider.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
@ -547,7 +704,7 @@
</div>
</ng-container>
<ng-container *ngIf="serviceprovider.value.countries_where_export_done !=undefined">
<ng-container *ngIf="serviceprovider.value.countries_where_export_done !=undefined && serviceprovider.value.india_where_sale_done ==undefined">
<div formArrayName="countries_where_export_done">
<div fxLayout="row nowrap" *ngFor="let countryList of serviceprovider.get('countries_where_export_done').controls; let c = index" [formGroupName]="c">
@ -569,6 +726,59 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="serviceprovider.value.countries_where_export_done !=undefined && serviceprovider.value.india_where_sale_done !=undefined">
<mat-tab-group>
<mat-tab label="Within India" formArrayName="india_where_sale_done">
<div fxLayout="row nowrap" class="tab_class" *ngFor="let saleList of serviceprovider.get('india_where_sale_done').controls; let s = index" [formGroupName]="s">
<mat-form-field style="width:35%;">
<mat-select placeholder="Where, In India, Is The Service Provided" formControlName="state_name" required>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:45%;">
<mat-select multiple formControlName="city_name" placeholder="City" required>
<mat-option *ngFor="let CL of filterCity(stateList,saleList.value.state_name)" [value]="CL.city_id">{{CL.city_name}}</mat-option>
</mat-select>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addServiceMoreState(sp,'1')" *ngIf="s==0"
matTooltip="Add More State" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeServiceState(sp,s,'1')" *ngIf="s>0"
matTooltip="Remove State" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
<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">
<mat-form-field style="width:35%;">
<input matInput placeholder="Countries Where Services Are Being Exported" formControlName="country_name" >
</mat-form-field>
<mat-form-field style="width:45%;">
<input matInput placeholder="Approx % of Sale" formControlName="approx_sale" required>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addServiceMoreState(sp,'2')" *ngIf="c==0"
matTooltip="Add More Country" matTooltipPosition="right" color="primary">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeServiceState(sp,c,'2')" *ngIf="c>0"
matTooltip="Remove Country" matTooltipPosition="right">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-tab>
</mat-tab-group>
</ng-container>
</mat-card-content>
<mat-card-actions>

View File

@ -132,4 +132,7 @@ mat-header-cell mat-cell {
.example-margin {
margin: 0 10px;
}
.tab_class {
margin-top: 3%;
}

View File

@ -247,6 +247,19 @@ export class BusinessInfoComponent implements OnInit {
innercontrol.push(this.createCountrySale())
});
}
else if(element.area_of_sale=='Both'){
manufacturingControl.controls[index].addControl('india_where_sale_done', this.fb.array([]));
element.india_where_sale_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = manufacturingControl.controls[index].get('india_where_sale_done') as FormArray;
innercontrol.push(this.createStateSale())
});
manufacturingControl.controls[index].addControl('countries_where_export_done', this.fb.array([]));
element.countries_where_export_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = manufacturingControl.controls[index].get('countries_where_export_done') as FormArray;
innercontrol.push(this.createCountrySale())
});
}
});
businessVal.manufacturing_activity_details=selectedManufacturing;
}
@ -280,6 +293,18 @@ export class BusinessInfoComponent implements OnInit {
innercontrol.push(this.createCountrySale())
});
}
else if(element.area_of_sale=='Both'){
retailControl.controls[index].addControl('india_where_sale_done', this.fb.array([]));
element.india_where_sale_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = retailControl.controls[index].get('india_where_sale_done') as FormArray;
innercontrol.push(this.createStateSale())
});
retailControl.controls[index].addControl('countries_where_export_done', this.fb.array([]));
element.countries_where_export_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = retailControl.controls[index].get('countries_where_export_done') as FormArray;
innercontrol.push(this.createCountrySale())
});
}
});
businessVal.retail_trading_activity_details=selectedRetail;
}
@ -314,6 +339,19 @@ export class BusinessInfoComponent implements OnInit {
innercontrol.push(this.createCountrySale())
});
}
else if(element.area_of_sale=='Both'){
wholesaleControl.controls[index].addControl('india_where_sale_done', this.fb.array([]));
element.india_where_sale_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = wholesaleControl.controls[index].get('india_where_sale_done') as FormArray;
innercontrol.push(this.createStateSale())
});
wholesaleControl.controls[index].addControl('countries_where_export_done', this.fb.array([]));
element.countries_where_export_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = wholesaleControl.controls[index].get('countries_where_export_done') as FormArray;
innercontrol.push(this.createCountrySale())
});
}
});
businessVal.wholesale_trading_activity_details=selectedWholesale;
}
@ -348,6 +386,18 @@ export class BusinessInfoComponent implements OnInit {
innercontrol.push(this.createCountrySale())
});
}
else if(element.area_of_sale=='Both'){
serviceProviderControl.controls[index].addControl('india_where_sale_done', this.fb.array([]));
element.india_where_sale_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = serviceProviderControl.controls[index].get('india_where_sale_done') as FormArray;
innercontrol.push(this.createStateSale())
});
serviceProviderControl.controls[index].addControl('countries_where_export_done', this.fb.array([]));
element.countries_where_export_done.forEach((innerElement,innerIndex) => {
let innercontrol:any = serviceProviderControl.controls[index].get('countries_where_export_done') as FormArray;
innercontrol.push(this.createCountrySale())
});
}
});
businessVal.service_provider_activity_details=selectedService;
}
@ -566,12 +616,20 @@ export class BusinessInfoComponent implements OnInit {
if(getDetails.value.area_of_sale=="Within India"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
}
else if(getDetails.value.area_of_sale=="Export"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
else if(getDetails.value.area_of_sale=="Both") {
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
}
// change retail options
@ -580,10 +638,18 @@ export class BusinessInfoComponent implements OnInit {
if(getDetails.value.area_of_sale=="Within India"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
}
else if(getDetails.value.area_of_sale=="Export"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
else if(getDetails.value.area_of_sale=="Both"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
}
@ -594,12 +660,20 @@ export class BusinessInfoComponent implements OnInit {
if(getDetails.value.area_of_sale=="Within India"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
}
else if(getDetails.value.area_of_sale=="Export"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
else if(getDetails.value.area_of_sale=="Both"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
}
// change service provider
changeServiceArea(getDetails: any, getIndex) {
@ -607,11 +681,19 @@ export class BusinessInfoComponent implements OnInit {
if(getDetails.value.area_of_sale=="Within India"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
}
else if(getDetails.value.area_of_sale=="Export"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createCountrySale()]));
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
else if(getDetails.value.area_of_sale=="Both"){
control.controls[getIndex].removeControl('countries_where_export_done');
control.controls[getIndex].removeControl('india_where_sale_done');
control.controls[getIndex].addControl('india_where_sale_done', this.fb.array([this.createStateSale()]));
control.controls[getIndex].addControl('countries_where_export_done', this.fb.array([this.createCountrySale()]));
}
}
@ -715,6 +797,7 @@ export class BusinessInfoComponent implements OnInit {
control = control.controls[windex].get('countries_where_export_done') as FormArray;
control.push(this.createCountrySale())
}
}
// remove for whole sale
removeWholesaleState(mindex,sindex,type) {