clent form change : kms

This commit is contained in:
gandhimathi 2019-01-23 17:49:03 +05:30
parent 013551d366
commit ba2c490974
6 changed files with 278 additions and 105 deletions

View File

@ -744,16 +744,20 @@
<mat-form-field style="width:35%;">
<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>
<div fxLayout="row" class="tab_class">
<div fxFlex="100" align="center">
<button type="button" mat-flat-button (click)="addWholesaleMoreState(w,'2')"
matTooltip="Add More Country" matTooltipPosition="right" color="primary">
<strong>Add More Country</strong>
</button>
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="wholesale.value.countries_where_export_done !=undefined && wholesale.value.india_where_sale_done !=undefined">
@ -1130,6 +1134,21 @@
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card *ngIf="businessForm.controls['applicant_use_mobile_wallets'] || businessForm.controls['applicant_use_pos_machines']">
<mat-card-header>
<!-- <mat-card-title></mat-card-title> -->
</mat-card-header>
<mat-card-content>
<mat-form-field style="width:84%;" *ngIf="businessForm.controls['applicant_use_mobile_wallets']">
<input matInput placeholder="Does the Applicant Use Mobile Wallets / UPI Apps" formControlName="applicant_use_mobile_wallets">
</mat-form-field>
<mat-form-field style="width:84%;" *ngIf="businessForm.controls['applicant_use_pos_machines']">
<input matInput placeholder="Does the Applicant Use POS Machines in His Business / Profession" formControlName="applicant_use_pos_machines">
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-title>Seasonality</mat-card-title>
@ -1291,16 +1310,24 @@
<input matInput placeholder="Specify Document Details"
formControlName="document">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="addDocuments()"
matTooltip="Add More Document Details" matTooltipPosition="above" color="primary" *ngIf="i==0">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="deleteDocuments(i)"
matTooltip="Delete" matTooltipPosition="above" *ngIf="i>0">
<mat-icon>delete</mat-icon>
</button>
</div>
<div fxLayout="row">
<div fxFlex="100" align="center">
<button type="button" class="mr-1 mb-1 hover-icon" mat-flat-button (click)="addDocuments()"
matTooltip="Add More" matTooltipPosition="above">
<strong>Add More Document</strong>
</button>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
<mat-card>

View File

@ -324,6 +324,8 @@ export class BusinessInfoComponent implements OnInit {
});
if(selectedRetail.length > 0) {
selectedRetail.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert');
selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets');
selectedRetail.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines');
selectedRetail.forEach((element,index)=>{
retailControl.push(this.createActivity());
if(element.area_of_sale=='Within India'){
@ -383,6 +385,8 @@ export class BusinessInfoComponent implements OnInit {
});
if(selectedWholesale.length > 0) {
selectedWholesale.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('export_import_cert');
selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets');
selectedWholesale.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines');
selectedWholesale.forEach((element,index)=>{
wholesaleControl.push(this.createActivity());
if(element.area_of_sale=='Within India'){
@ -444,7 +448,8 @@ export class BusinessInfoComponent implements OnInit {
});
if(selectedService.length > 0) {
selectedService.length > 0 ? this.businessForm.addControl('practice_cert', new FormControl('', Validators.required)) : this.businessForm.removeControl('practice_cert');
selectedService.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl('')) : this.businessForm.removeControl('applicant_use_mobile_wallets');
selectedService.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl('')) : this.businessForm.removeControl('applicant_use_pos_machines');
selectedService.forEach((element,index)=>{
serviceProviderControl.push(this.createServiceActivity());
if(element.area_of_sale=='Within India'){
@ -659,6 +664,12 @@ export class BusinessInfoComponent implements OnInit {
this.businessForm.value.manufacturing_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0 ? this.businessForm.addControl('export_import_cert', new FormControl(this.businessForm.value.export_import_cert, Validators.required)) : this.businessForm.removeControl('export_import_cert');
this.businessForm.value.manufacturing_activity_details.length > 0 ? this.businessForm.addControl('factory_cert', new FormControl(this.businessForm.value.factory_cert, Validators.required)) : this.businessForm.removeControl('factory_cert');
this.businessForm.value.service_provider_activity_details.length > 0 ? this.businessForm.addControl('practice_cert', new FormControl(this.businessForm.value.practice_cert, Validators.required)) : this.businessForm.removeControl('practice_cert');
// check activity for extra question make dynamic
this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0 ? this.businessForm.addControl('applicant_use_mobile_wallets', new FormControl(this.businessForm.value.applicant_use_mobile_wallets)) : this.businessForm.removeControl('applicant_use_mobile_wallets');
this.businessForm.value.service_provider_activity_details.length > 0 || this.businessForm.value.retail_trading_activity_details.length > 0 || this.businessForm.value.wholesale_trading_activity_details.length > 0 ? this.businessForm.addControl('applicant_use_pos_machines', new FormControl(this.businessForm.value.applicant_use_pos_machines)) : this.businessForm.removeControl('applicant_use_pos_machines');
}
// change area of sale options in manufacturing

View File

@ -16,35 +16,60 @@
<div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Product #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<!--<pre>{{m_manufacturingProducts[0] | json}}</pre>-->
<mat-form-field style="width:30%">
<!--{{m_manufacturingProducts[0] | json}}-->
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<mat-select placeholder="Manufacturing Product Name" formControlName="manufacturing_product_name">
<mat-option *ngFor="let pm of m_manufacturingProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<!--<mat-form-field style="width: 100%">
<input matInput placeholder="Raw Material Name" formControlName="manufacturing_raw_material_name">
</mat-form-field>-->
<mat-form-field style="width: 30%">
<mat-form-field style="width: 45%">
<input matInput placeholder="Client Name" formControlName="manufacturing_client_name">
</mat-form-field>
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name">
</div>
<div fxLayout="row nowrap">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Name" formControlName="manufacturing_contact_person_name">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<mat-option value="1" > Not Applicable </mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="manufacturing_contact_person_mobile_number">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number" formControlName="manufacturing_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 30%">
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode" type="text" (keypress)="keyPress($event)">
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number" formControlName="person_landline" type="text" (keypress)="keyPress($event)">
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Type" formControlName="manufacturing_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 30%" *ngIf="items.get('manufacturing_payment_type').value == 3">
<input matInput placeholder="Number of days of credit provided" formControlName="manufacturing_credit_days">
<mat-form-field style="width: 45%" *ngIf="items.get('manufacturing_payment_type').value == 3">
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="manufacturing_credit_days">
</mat-form-field>
</div>
<div align="end">
@ -55,17 +80,20 @@
</mat-card>
</div>
</div>
<div>
<mat-form-field style="width: 100%">
<input matInput placeholder="% of total manufacturing raw materials credit values" formControlName="main_raw_materials_total_payments_percent_on_credit"
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More" matTooltipPosition="above" type="button"
class="mr-1 mb-1 hover-icon" (click)="addMoreRawMaterials($event); false"><strong>Add More Client</strong></button>
</div>
</div>
<div fxlayout="row">
<mat-form-field style="width: 80%">
<input matInput placeholder="% of Total Manufacturing Raw Materials Credit Values" formControlName="main_raw_materials_total_payments_percent_on_credit"
type="number">
</mat-form-field>
<div fxFlex="100" align="end">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Supplier Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addMoreRawMaterials($event); false"><mat-icon>add</mat-icon></button>
</div>
</div>
</div>
</div>
</div>
</mat-card>
<mat-card *ngIf="tradingForm">
@ -76,8 +104,8 @@
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Trading Product #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 30%">
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Trading Product Name" formControlName="trade_product_name">
<mat-option *ngFor="let pm of m_tradingProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select>
@ -85,24 +113,51 @@
<!--<mat-form-field style="width: 100%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field>-->
<mat-form-field style="width: 30%">
<mat-form-field style="width: 45%">
<input matInput placeholder="Client Name" formControlName="trade_client_name">
</mat-form-field>
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Name" formControlName="trade_product_contact_person_name">
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Name" formControlName="trade_product_contact_person_name">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<mat-option value="1" > Not Applicable </mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="trade_product_contact_person_mobile_number" (keypress)="keyPress($event)">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number" formControlName="trade_product_contact_person_mobile_number" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field style="width: 30%">
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode" type="text" (keypress)="keyPress($event)">
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number" formControlName="person_landline" type="text" (keypress)="keyPress($event)">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Type" formControlName="trade_product_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 30%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="Number of days of credit provided" formControlName="trade_product_credit_days">
<mat-form-field style="width: 45%" *ngIf="items.get('trade_product_payment_type').value == 3">
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="trade_product_credit_days">
</mat-form-field>
</div>
<div align="end">
@ -113,16 +168,18 @@
</mat-card>
</div>
</div>
<div>
<mat-form-field style="width: 100%">
<input matInput placeholder="% of total trading product credit values" formControlName="trading_products_total_payments_percent_on_credit"
type="number">
</mat-form-field>
<div fxFlex="100" align="end">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Supplier Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addMoretradeProduct($event); false"><mat-icon>add</mat-icon></button>
</div>
</div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More" matTooltipPosition="above" type="button"
class="mr-1 mb-1 hover-icon" (click)="addMoretradeProduct($event); false"><strong>Add More Client</strong></button>
</div>
</div>
<div fxlayout="row">
<mat-form-field style="width: 80%">
<input matInput placeholder="% of Total Trading Product Credit Values" formControlName="trading_products_total_payments_percent_on_credit"
type="number">
</mat-form-field>
</div>
</div>
</div>
</mat-card>
@ -136,32 +193,58 @@
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;padding:10px !important;">Service Provided #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<mat-form-field style="width: 45%">
<mat-select placeholder="Select the Service Provided" formControlName="service_provider_product_name">
<mat-option *ngFor="let pm of m_suplierProducts[0]" [value]="pm.name">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%">
<input matInput placeholder="Client Name" formControlName="service_provider_client_name">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<!--<mat-form-field style="width: 100%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field>-->
<mat-form-field style="width: 30%">
<input matInput placeholder="Client Name" formControlName="service_provider_client_name">
</mat-form-field>
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Name" formControlName="service_provider_product_contact_person_name">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="person_title_name">
<mat-option *ngFor="let tl of titleList" [value]="tl.title_id">
{{tl.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Name" formControlName="service_provider_product_contact_person_name">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation">
<mat-option>Select</mat-option>
<mat-option *ngFor="let comrelShip of companyRelationShipList" [value]="comrelShip.company_relationship_id">
{{comrelShip.name}}
</mat-option>
<mat-option value="1" > Not Applicable </mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 30%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="service_provider_product_contact_person_mobile_number">
<mat-form-field style="width: 35%">
<input matInput placeholder="Client Contact Person Mobile Number" formControlName="service_provider_product_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 30%">
<mat-form-field style="width: 15%">
<input matInput autocomplete="off" placeholder="STD Code" formControlName="person_stdcode" type="text" (keypress)="keyPress($event)">
</mat-form-field> &nbsp; - &nbsp;
<mat-form-field style="width: 35%">
<input matInput autocomplete="off" placeholder="Client Contact Person Landline Number" formControlName="person_landline" type="text" (keypress)="keyPress($event)">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 45%">
<mat-select placeholder="Payment Type" formControlName="service_provider_product_payment_type">
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 100%" *ngIf="items.get('service_provider_product_payment_type').value == 3">
<input matInput placeholder="Number of days of credit provided" formControlName="service_provider_product_credit_days">
<mat-form-field style="width: 45%" *ngIf="items.get('service_provider_product_payment_type').value == 3">
<input matInput placeholder="No. of Days of Credit Given for Payment Receipt" formControlName="service_provider_product_credit_days">
</mat-form-field>
</div>
<div align="end">
@ -172,17 +255,20 @@
</mat-card>
</div>
</div>
<div>
<mat-form-field style="width: 100%">
<input matInput placeholder="What % of total services provided are on credit?" formControlName="service_products_total_payments_percent_on_credit"
type="number">
</mat-form-field>
<div fxFlex="100" align="end">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Supplier Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addMoreServiceProduct($event); false"><mat-icon>add</mat-icon></button>
</div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More" matTooltipPosition="above" type="button"
class="mr-1 mb-1 hover-icon" (click)="addMoreServiceProduct($event); false"><strong>Add More Client</strong></button>
</div>
</div>
<div fxlayout="row">
<mat-form-field style="width: 80%">
<input matInput placeholder="What % of Total Services Provided Are on Credit?" formControlName="service_products_total_payments_percent_on_credit"
type="number">
</mat-form-field>
</div>
</div>
</div>
</div>
</mat-card>
<mat-card *ngIf="retaildTradingForm">

View File

@ -41,7 +41,8 @@ export class ClientInfoComponent implements OnInit {
public m_paymentModeType = [];
private notifier: NotifierService;
companyRelationShipList: any=[];
titleList: any=[];
public m_manufacturingProducts = [
{
@ -75,7 +76,7 @@ export class ClientInfoComponent implements OnInit {
notifier: NotifierService,
private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
@Inject(MAT_DIALOG_DATA) public pd_all_details: any, private dialogRef: MatDialogRef<ClientInfoComponent>) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 2;
this.company_id = this.pd_all_details.company_id;
@ -128,9 +129,9 @@ export class ClientInfoComponent implements OnInit {
// ]
// };
let datas = data.records;
this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 1 ){return data}}).map(data=> [...data.prodcuts]);
this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 3 ){return data}}).map(data=> [...data.prodcuts]);
this.m_suplierProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 4 ){return data}}).map(data=> [...data.prodcuts]);
this.m_manufacturingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 2 ){return data}}).map(data=> [...data.prodcuts]);
this.m_tradingProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 4){return data}}).map(data=> [...data.prodcuts]);
this.m_suplierProducts = datas.type_of_activity.filter(data=>{if(data.type_of_activity_id == 5 ){return data}}).map(data=> [...data.prodcuts]);
// alert(JSON.stringify(this.m_manufacturingProducts[0]));
this.initFormLoadDetails(datas.type_of_activity);
}else {
@ -147,6 +148,8 @@ export class ClientInfoComponent implements OnInit {
// this.getM_FreqOfPurchase();
this.getM_PaymentModeType();
// this.getPdSupplierFormDetails();
this.getMasterDetails('COMPANYRELATIONSHIPS',1);
this.getMasterDetails('TITLES',2);
}
retaildTradingForm: Boolean = false;
@ -171,7 +174,7 @@ export class ClientInfoComponent implements OnInit {
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
// Load form details for manufacturing
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if (arr.length > 0) {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key];
@ -183,7 +186,7 @@ export class ClientInfoComponent implements OnInit {
}
// Load form details for the wholeshale trading details
let arr1 = record.filter(data => data.type_of_activity_id == 3);
let arr1 = record.filter(data => data.type_of_activity_id == 4);
if (arr1.length > 0) {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key];
@ -195,7 +198,7 @@ export class ClientInfoComponent implements OnInit {
}
// Load form details for the service provider prduct details
let arr2 = record.filter(data => data.type_of_activity_id == 4);
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
// let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
// return dataForm.service_products[key];
@ -205,7 +208,7 @@ export class ClientInfoComponent implements OnInit {
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
}
// Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id == 2);
let arr3 = record.filter(data => data.type_of_activity_id == 3);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
@ -214,23 +217,24 @@ export class ClientInfoComponent implements OnInit {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['2'],
company_id:[this.company_id],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if (arr.length > 0) {
this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
}
let arr1 = record.filter(data => data.type_of_activity_id == 3);
let arr1 = record.filter(data => data.type_of_activity_id == 4);
if (arr1.length > 0) {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
let arr2 = record.filter(data => data.type_of_activity_id == 4);
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
return dataForm.service_products[key];
@ -239,7 +243,7 @@ export class ClientInfoComponent implements OnInit {
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null);
}
// Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id == 2);
let arr3 = record.filter(data => data.type_of_activity_id == 3);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
@ -256,23 +260,23 @@ export class ClientInfoComponent implements OnInit {
supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id == 1);
let arr = record.filter(data => data.type_of_activity_id == 2);
if (arr.length > 0) {
this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
}
let arr1 = record.filter(data => data.type_of_activity_id == 3);
let arr1 = record.filter(data => data.type_of_activity_id == 4);
if (arr1.length > 0) {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
let arr2 = record.filter(data => data.type_of_activity_id == 4);
let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) {
this.initServiceProviderProductsDetails(null);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null);
}
// Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id == 2);
let arr3 = record.filter(data => data.type_of_activity_id == 3);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
@ -287,7 +291,7 @@ export class ClientInfoComponent implements OnInit {
manufacturingForm: Boolean = false;
manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 1);
let arr = val.filter(data => data.type_of_activity_id == 2);
if (arr.length > 0) {
this.manufacturingForm = true;
return this._formBuilder.group({
@ -302,7 +306,7 @@ export class ClientInfoComponent implements OnInit {
tradingForm: Boolean = false;
tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 3);
let arr = val.filter(data => data.type_of_activity_id == 4);
if (arr.length > 0) {
this.tradingForm = true;
return this._formBuilder.group({
@ -316,7 +320,7 @@ export class ClientInfoComponent implements OnInit {
serviceProviderForm: Boolean = false;
serviceProviderFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 4);
let arr = val.filter(data => data.type_of_activity_id == 5);
if (arr.length > 0) {
this.serviceProviderForm = true;
return this._formBuilder.group({
@ -345,18 +349,26 @@ export class ClientInfoComponent implements OnInit {
manufacturing_product_name: [''],
manufacturing_client_name: [''],
manufacturing_contact_person_name: [''],
manufacturing_contact_person_mobile_number: [''],
manufacturing_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
manufacturing_payment_type: [''],
manufacturing_credit_days: [''],
person_title_name:[''],
person_designation:[''],
person_stdcode:['', Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:['', Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
} else {
return this._formBuilder.group({
manufacturing_product_name: [records.manufacturing_product_name || null],
manufacturing_client_name: [records.manufacturing_client_name || null],
manufacturing_contact_person_name: [records.manufacturing_contact_person_name || null],
manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null],
manufacturing_contact_person_mobile_number: [records.manufacturing_contact_person_mobile_number || null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
manufacturing_payment_type: [records.manufacturing_payment_type || null],
manufacturing_credit_days: [records.manufacturing_credit_days || null],
person_title_name:[records.person_title_name || null],
person_designation:[records.person_designation || null],
person_stdcode:[records.person_stdcode || null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:[records.person_landline || null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
}
}
@ -378,20 +390,28 @@ export class ClientInfoComponent implements OnInit {
trade_product_name: [''],
trade_client_name: [''],
trade_product_contact_person_name: [''],
trade_product_contact_person_mobile_number: [''],
trade_product_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
trade_product_payment_type: [''],
trade_product_frequency_of_purchase: [''],
trade_product_credit_days: [''],
person_title_name:[''],
person_designation:[''],
person_stdcode:['', Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:['', Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
} else {
return this._formBuilder.group({
trade_product_name: [records.trade_product_name],
trade_client_name: [records.trade_client_name],
trade_product_contact_person_name: [records.trade_product_contact_person_name],
trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number],
trade_product_contact_person_mobile_number: [records.trade_product_contact_person_mobile_number,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
trade_product_payment_type: [records.trade_product_payment_type],
trade_product_frequency_of_purchase: [records.trade_product_frequency_of_purchase],
trade_product_credit_days: [records.trade_product_credit_days],
person_title_name:[records.person_title_name || null],
person_designation:[records.person_designation || null],
person_stdcode:[records.person_stdcode || null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:[records.person_landline || null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
}
}
@ -413,20 +433,28 @@ export class ClientInfoComponent implements OnInit {
service_provider_product_name: [''],
service_provider_client_name: [''],
service_provider_product_contact_person_name: [''],
service_provider_product_contact_person_mobile_number: [''],
service_provider_product_contact_person_mobile_number: ['',Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
service_provider_product_payment_type: [''],
service_provider_product_frequency_of_purchase: [''],
service_provider_product_credit_days: [''],
person_title_name:[''],
person_designation:[''],
person_stdcode:['', Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:['', Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
} else {
return this._formBuilder.group({
service_provider_product_name: [records.service_provider_product_name],
service_provider_client_name: [records.service_provider_client_name],
service_provider_product_contact_person_name: [records.service_provider_product_contact_person_name],
service_provider_product_contact_person_mobile_number: [records.service_provider_product_contact_person_mobile_number],
service_provider_product_contact_person_mobile_number: [records.service_provider_product_contact_person_mobile_number,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
service_provider_product_payment_type: [records.service_provider_product_payment_type],
service_provider_product_frequency_of_purchase: [records.service_provider_product_frequency_of_purchase],
service_provider_product_credit_days: [records.service_provider_product_credit_days],
person_title_name:[records.person_title_name || null],
person_designation:[records.person_designation || null],
person_stdcode:[records.person_stdcode || null, Validators.compose([Validators.minLength(3),Validators.maxLength(5),Validators.pattern('^[0-9]*$')])],
person_landline:[records.person_landline || null, Validators.compose([Validators.minLength(6),Validators.maxLength(8),Validators.pattern('^[0-9]*$')])],
})
}
}
@ -494,6 +522,25 @@ export class ClientInfoComponent implements OnInit {
)
}
// get all master details
getMasterDetails(table:string,type:number){
this.pdTrigerService.getAllMasterDatas(table).subscribe(
data => {
if (data.dataStatus) {
if(type==1){
this.companyRelationShipList=data.records.filter(item => item.name != 'Others');
}
if(type==2){
this.titleList=data.records.filter(val=>val.isactive==1);
}
}
}, error => this.errorMessage = <any> error);
}
// ==================
@ -502,6 +549,7 @@ export class ClientInfoComponent implements OnInit {
this.submitted = true;
// stop here if form is invalid
if (this._supplierQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Check All Mandatory Fields.!');
return;
} else {
var answerFormValues = this._supplierQuesFrom.value;
@ -522,7 +570,10 @@ export class ClientInfoComponent implements OnInit {
dataresult => {
if (dataresult.status == 200) {
// console.log(dataresult);
this.notifier.notify('success', 'Record Saved Successfully.!');
this.notifier.notify('success', 'Saved Successfully.!');
setTimeout(() =>{
this.dialogRef.close();
},3000);
// this.dialogRef.close();
// alert("sample alert for Saving");
}

View File

@ -34,7 +34,7 @@
</mat-select>
</mat-form-field>
<mat-form-field style="width: 35%">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name" maxlength="10">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name">
</mat-form-field>
<mat-form-field style="width: 35%">
<mat-select placeholder="Contact Person Designation" formControlName="person_designation">
@ -65,7 +65,7 @@
</mat-select>
</mat-form-field>
<mat-form-field style="width: 45%" *ngIf="items.get('manufacturing_payment_type').value == 3">
<input matInput placeholder="No.of days of Credit provided by Supplier" formControlName="manufacturing_credit_days">
<input matInput placeholder="No.of days of Credit Provided by Supplier" formControlName="manufacturing_credit_days">
</mat-form-field>
</div>
@ -77,7 +77,6 @@
</mat-card>
</div>
</div>
<div>
<div fxLayout="row">
<div fxFlex="100" align="center">
<button color="primary" mat-flat-button matTooltip="Add More" matTooltipPosition="above" type="button"
@ -91,7 +90,6 @@
</mat-form-field>
</div>
</div>
</div>
</div>
</mat-card>
@ -162,7 +160,6 @@
</mat-card>
</div>
</div>
<div>
<div fxlayout="row">
<div fxFlex="100" align="center">
<button mat-flat-button color="primary" matTooltip="Add More" matTooltipPosition="above" type="button"
@ -171,12 +168,11 @@
</div>
<div fxlayout="row">
<mat-form-field style="width: 90%">
<input matInput placeholder="% of total trading product credit values" formControlName="trading_products_total_payments_percent_on_credit"
<input matInput placeholder="% of Total Trading Product Credit Values" formControlName="trading_products_total_payments_percent_on_credit"
type="number" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
</mat-card>

View File

@ -412,6 +412,8 @@ export class SupplierInfoComponent implements OnInit {
this.submitted = true;
// stop here if form is invalid
if (this._supplierQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Check All Mandatory Fields.!');
return;
} else {
var answerFormValues = this._supplierQuesFrom.value;