client , supplier form details changes: kdk

This commit is contained in:
dineshkumarkannan 2018-12-19 17:29:31 +05:30
parent b9c4076d87
commit b4dedbd792
5 changed files with 1066 additions and 927 deletions

View File

@ -1,313 +1,203 @@
<form *ngIf="apiLoadFinish" [formGroup]="_clientQuesFrom" (submit)="onSubmit()" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">{{pageTitle}}</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-tab-group>
<mat-tab label="Questions">
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card>
<mat-card>
<!-- <mat-card-title></mat-card-title> -->
<mat-card-content formArrayName="client_details" fxFill>
<div *ngFor="let sup of _clientQuesFrom.controls.client_details['controls']; let i=index" [formGroupName]="i">
<!-- <div [formGroupName]="i"> -->
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Client Name" formControlName="client_name" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Person Name" formControlName="contact_person" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Mobile Number" formControlName="mobile_number" (keypress)="keyPress($event)" minlength=10 maxlength=10 required>
<!-- <mat-error *ngIf="sup.controls['mobile_number'].hasError('requried') && sup.controls['mobile_number'].touched" class="mat-text-warn">Mobile Number Requried</mat-error> -->
<mat-error *ngIf="sup.controls['mobile_number'].hasError('minlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
<mat-error *ngIf="sup.controls['mobile_number'].hasError('maxlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field>
<mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode" required>
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment" type="number" min="0">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 2 || sup.get('payment_mode').value == 3">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Credit Period" formControlName="credit_period">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field>
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase" required>
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('frequency_of_purchase').value == 8">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>-->
</mat-form-field>
</div>
<div fxFlex="20">
<span *ngIf="_clientQuesFrom.controls.client_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
<!-- </div> -->
</div>
</mat-card-content>
<mat-card-actions align="end">
<!-- <span *ngIf="_supplierQuesFrom.controls.supplier_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span> -->
</mat-card-actions>
</mat-card>
<mat-dialog-actions>
<div fxFlex="100" align="end">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Client Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">{{pageTitle}}</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right"
mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
<form [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<mat-dialog-content>
<mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.manufacturing_details['controls']; let i=index" [formGroupName]="i">
<div formArrayName="main_raw_materials">
<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;">Raw Material #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<mat-select placeholder="Manufacturing Product Name" formControlName="manufacturing_product_name">
<mat-option *ngFor="let pm of m_manufacturingProducts" [value]="pm.id">{{ 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: 100%">
<input matInput placeholder="Client Name" formControlName="manufacturing_client_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name">
</mat-form-field>
</div>
</mat-dialog-actions>
</mat-card>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="manufacturing_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 100%">
<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: 100%" *ngIf="items.get('manufacturing_payment_type').value == 3">
<input matInput placeholder="Number of days of credit provided" formControlName="manufacturing_credit_days">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.main_raw_materials.controls.length > 1" (click)="removeRawMaterials(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</mat-card>
</div>
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent>
<div fxLayout="row wrap" style="padding:20px;">
<div fxFlex="100">
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
</div>
</div>
</div>
</div>
<div fxFlex="row">
<div fxFlex="100" class="m-gap p-gap">
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
</div>
</div>
</div>
</div>
</ng-template>
</mat-tab>
</mat-tab-group>
</mat-dialog-content>
<mat-dialog-actions>
</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"
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>
</mat-card>
<mat-card *ngIf="tradingForm">
<h5 style="margin: 12px;">Trading Product Details</h5>
<div formArrayName="trade_details">
<div *ngFor="let item of _supplierQuesFrom.controls.trade_details['controls']; let i=index" [formGroupName]="i">
<div formArrayName="trading_products">
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;">Trading Product #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<mat-select placeholder="Trading Product Name" formControlName="trade_product_name">
<mat-option *ngFor="let pm of m_tradingProducts" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<!--<mat-form-field style="width: 100%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field>-->
<mat-form-field style="width: 100%">
<input matInput placeholder="Client Name" formControlName="trade_client_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="trade_product_contact_person_name">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="trade_product_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 100%">
<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: 100%" *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>
</div>
<div align="end">
<span *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</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>
</div>
</mat-card>
<!--===========================: service provider details : START-->
<mat-card *ngIf="serviceProviderForm">
<h5 style="margin: 12px;">Service Provider Product Details</h5>
<div formArrayName="service_provider_details">
<div *ngFor="let item of _supplierQuesFrom.controls.service_provider_details['controls']; let i=index" [formGroupName]="i">
<div formArrayName="service_products">
<div *ngFor="let items of item.controls.service_products['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;">Service Provider Product #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<mat-select placeholder="Service Provider Product Name" formControlName="service_provider_product_name">
<mat-option *ngFor="let pm of m_suplierProducts" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
<!--<mat-form-field style="width: 100%">
<input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
</mat-form-field>-->
<mat-form-field style="width: 100%">
<input matInput placeholder="Client Name" formControlName="service_provider_client_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="service_provider_product_contact_person_name">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="service_provider_product_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 100%">
<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>
</div>
<div align="end">
<span *ngIf="item.controls.service_products.controls.length > 1" (click)="removeServiceProduct(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</mat-card>
</div>
</div>
<div>
<mat-form-field style="width: 100%">
<input matInput placeholder="% of total service provider products credit values" 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>
</div>
</div>
</mat-card>
<mat-card *ngIf="retaildTradingForm">
<h5 style="margin: 12px;">Retail Trading Product Details</h5>
<div style="text-align: center; margin: 12px;">Retail Trading Details Not applicable here !!</div>
</mat-card>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
<!-- <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="personal_info_form_remark" required></textarea>
</mat-form-field> -->
</div>
<div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
</form>
<notifier-container></notifier-container>
<!--<pre> {{ m_group | json}}</pre>--
<mat-card style="padding: 12px;">
<p>Client Details</p>
<form *ngIf="apiLoadFinish" [formGroup]="_clientQuesFrom" (submit)="onSubmit()" novalidate>
<div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="client_details" fxFill>
<div *ngFor="let sup of _clientQuesFrom.controls.client_details['controls']; let i=index">
<div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Client Name" formControlName="client_name" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>---
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="supplier_info_form_remark"></textarea>
</mat-form-field>
</div>
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Person Name" formControlName="contact_person" required>
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>---
</mat-form-field>
</div>
<div>
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Mobile Number" formControlName="mobile_number" (keypress)="keyPress($event)" minlength=10 maxlength=10 required>
<!-- <mat-error *ngIf="sup.controls['mobile_number'].hasError('requried') && sup.controls['mobile_number'].touched" class="mat-text-warn">Mobile Number Requried</mat-error> --
<mat-error *ngIf="sup.controls['mobile_number'].hasError('minlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
<mat-error *ngIf="sup.controls['mobile_number'].hasError('maxlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field>
<mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode" required>
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment" type="number" min="0">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 2 || sup.get('payment_mode').value == 3">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Credit Period" formControlName="credit_period">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--
</mat-form-field>
</div>
<div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
<div>
<mat-form-field>
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase" required>
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('frequency_of_purchase').value == 8">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--
</mat-form-field>
</div>
<div fxFlex="20">
<span *ngIf="_clientQuesFrom.controls.client_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="text-align:right;">
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Client Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</form>
</mat-card>-->
</mat-dialog-actions>
</form>
</div>

View File

@ -30,120 +30,440 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
})
export class ClientInfoComponent implements OnInit {
pageTitle: string ="Client Details";
pageTitle: string = "Client Details";
//@Input() pdid: number;
pdid : number;
pdid: string;
form_id: number;
loadDataStatus: boolean=true;
public _clientQuesFrom: FormGroup;
public _supplierQuesFrom: FormGroup;
public submitted = false;
public m_paymentModeType= [];
// public m_paymentModeType= [
// {
// 'id': "1",
// 'name': 'Immediate Or Advanced Payment'
// },
// {
// 'id': "2",
// 'name': 'Credit'
// },
// {
// 'id': "3",
// 'name': 'Combination of Both'
// },
// ];
public m_freqOfPurchase= [];
// public m_freqOfPurchase= [
// {
// 'id': "1",
// 'name': 'Daily'
// },
// {
// 'id': "2",
// 'name': 'Weekly'
// },
// {
// 'id': "3",
// 'name': 'Monthly'
// },
// {
// 'id': "4",
// 'name': 'Every 3 months'
// },
// {
// 'id': "5",
// 'name': 'Half yearly'
// },
// {
// 'id': "6",
// 'name': 'Yearly'
// },
// {
// 'id': "7",
// 'name': 'As and when required'
// },
// {
// 'id': "8",
// 'name': 'Others'
// }
// ]
private notifier: NotifierService;
public m_paymentModeType = [];
private notifier: NotifierService;
public m_manufacturingProducts = [
{
id: 1,
name: 'Manufac prd 1'
}, {
id: 2,
name: 'Manufac prd 2'
}
];
public m_tradingProducts = [
{
id: 1,
name: 'trading prd 1'
}, {
id: 2,
name: 'trading prd 2'
}
];
public m_suplierProducts = [
{
id: 1,
name: 'service prd 1'
}, {
id: 2,
name: 'service prd 2'
}
];
constructor(
notifier: NotifierService,
private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 2;
this.notifier = notifier;
}
public viewerOptions: any = {
navbar: false,
toolbar: {
zoomIn: 4,
zoomOut: 4,
oneToOne: 4,
reset: 4,
prev: 4,
play: {
show: 4,
size: 'large',
},
next: 4,
rotateLeft: 4,
rotateRight: 4,
flipHorizontal: 4,
flipVertical: 4,
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 2;
this.notifier = notifier;
}
};
ngOnInit() {
this.getM_FreqOfPurchase();
this.getM_PaymentModeType();
this.getClientFormDetails();
}
// ==================
getM_FreqOfPurchase() {
this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
data => {
this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
public viewerOptions: any = {
navbar: false,
toolbar: {
zoomIn: 4,
zoomOut: 4,
oneToOne: 4,
reset: 4,
prev: 4,
play: {
show: 4,
size: 'large',
},
error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found.";
}
)
next: 4,
rotateLeft: 4,
rotateRight: 4,
flipHorizontal: 4,
flipVertical: 4,
}
};
noRecordsFound: Boolean = false;
ngOnInit() {
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
// if(data.dataStatus === undefined){
let datas = {
"profession_name": "Others",
"type_of_activity": [
{
"type_of_activity_id": 1,
"name": "Manufacturing Details"
},
{
"type_of_activity_id": 2,
"name": "Retail trading"
},
{
"type_of_activity_id": 3,
"name": "Wholesale trading"
},
{
"type_of_activity_id": 4,
"name": "Service Providers"
}
]
};
this.initFormLoadDetails(datas.type_of_activity);
// }else {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.noRecordsFound = false;
// }
}, err => {
this.notifier.notify('warning', 'No Category Records Found.!');
this.noRecordsFound = false;
})
// this.getM_FreqOfPurchase();
this.getM_PaymentModeType();
// this.getPdSupplierFormDetails();
}
getM_PaymentModeType() {
retaildTradingForm: Boolean = false;
initFormLoadDetails(record) {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe(
data => {
if (data.dataStatus) {
let dataForm = data.records;
if (dataForm !== undefined) {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
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)]),
});
// Load form details for manufacturing
let arr = record.filter(data => data.type_of_activity_id === 1);
if (arr.length > 0) {
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
return dataForm.main_raw_materials[key];
});
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.main_raw_materials_total_payments_percent_on_credit || null);
}
// Load form details for the wholeshale trading details
let arr1 = record.filter(data => data.type_of_activity_id === 3);
if (arr1.length > 0) {
let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
return dataForm.trading_products[key];
});
this.initTradingProductsDetails(api_trading_products);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
}
// Load form details for the service provider prduct details
let arr2 = record.filter(data => data.type_of_activity_id === 4);
if (arr2.length > 0) {
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
return dataForm.service_products[key];
});
this.initServiceProviderProductsDetails(api_service_provider_products);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.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);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
this.noRecordsFound = true;
} else {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
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);
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);
if (arr1.length > 0) {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
}
let arr2 = record.filter(data => data.type_of_activity_id === 4);
if (arr2.length > 0) {
let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
return dataForm.service_products[key];
});
this.initServiceProviderProductsDetails(api_service_provider_products);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.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);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
this.noRecordsFound = true;
}
} else {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
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: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id === 1);
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);
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);
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);
if (arr3.length > 0) {
this.retaildTradingForm = true;
}
this.noRecordsFound = true;
}
}, err => {
}
);
}
manufacturingForm: Boolean = false;
manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 1);
if (arr.length > 0) {
this.manufacturingForm = true;
return this._formBuilder.group({
main_raw_materials: this._formBuilder.array([]),
main_raw_materials_total_payments_percent_on_credit: []
})
// }
} else {
return;
}
}
tradingForm: Boolean = false;
tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 3);
if (arr.length > 0) {
this.tradingForm = true;
return this._formBuilder.group({
trading_products: this._formBuilder.array([]),
trading_products_total_payments_percent_on_credit: []
});
} else {
return;
}
}
serviceProviderForm: Boolean = false;
serviceProviderFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 4);
if (arr.length > 0) {
this.serviceProviderForm = true;
return this._formBuilder.group({
service_products: this._formBuilder.array([]),
service_products_total_payments_percent_on_credit: []
});
} else {
return;
}
}
initManufacturingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
if (datas === null) {
control.push(this.initManufacturingProducts(null));
} else {
for (let val of datas) {
control.push(this.initManufacturingProducts(val));
}
}
}
initManufacturingProducts(records) {
if (records === null) {
return this._formBuilder.group({
manufacturing_product_name: [''],
manufacturing_client_name: [''],
manufacturing_contact_person_name: [''],
manufacturing_contact_person_mobile_number: [''],
manufacturing_payment_type: [''],
manufacturing_credit_days: [''],
})
} else {
return this._formBuilder.group({
manufacturing_product_name: [records.manufacturing_raw_material_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_payment_type: [records.manufacturing_payment_type || null],
manufacturing_credit_days: [records.manufacturing_credit_days || null],
})
}
}
initTradingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
if (datas === null) {
control.push(this.initTradingProducts(null));
} else {
for (let val of datas) {
control.push(this.initTradingProducts(val));
}
}
}
initTradingProducts(records) {
if (records === null) {
return this._formBuilder.group({
trade_product_name: [''],
trade_client_name: [''],
trade_product_contact_person_name: [''],
trade_product_contact_person_mobile_number: [''],
trade_product_payment_type: [''],
trade_product_frequency_of_purchase: [''],
trade_product_credit_days: [''],
})
} 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_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],
})
}
}
initServiceProviderProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products'];
if (datas === null) {
control.push(this.initServiceProviderProducts(null));
} else {
for (let val of datas) {
control.push(this.initServiceProviderProducts(val));
}
}
}
initServiceProviderProducts(records) {
if (records === null) {
return this._formBuilder.group({
service_provider_product_name: [''],
service_provider_client_name: [''],
service_provider_product_contact_person_name: [''],
service_provider_product_contact_person_mobile_number: [''],
service_provider_product_payment_type: [''],
service_provider_product_frequency_of_purchase: [''],
service_provider_product_credit_days: [''],
})
} 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_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],
})
}
}
addMoreRawMaterials(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
// console.log(control);
control.push(this.initManufacturingProducts(null));
}
removeRawMaterials(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
control.removeAt(inx);
}
addMoretradeProduct(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
// console.log(control);
control.push(this.initTradingProducts(null));
}
removeTradingProduct(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
control.removeAt(inx);
}
addMoreServiceProduct(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products'];
// console.log(control);
control.push(this.initServiceProviderProducts(null));
}
removeServiceProduct(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products'];
control.removeAt(inx);
}
// ==================
//getM_FreqOfPurchase() {
// this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
// data => {
// this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
// },
// error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found.";
/// }
// )
// }
getM_PaymentModeType() {
this.pdTrigerService.getAllMasterDatas('PAYMENTMODE').subscribe(
data => {
this.m_paymentModeType = data.records.filter(data => data.isactive == 1);
@ -156,147 +476,35 @@ public viewerOptions: any = {
}
// ==================
apiLoadFinish: boolean = false;
getClientFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe(
data => {
if (data) {
if(data.dataStatus){
this.formLoadData(data.records)
} else {
this.formLoadData(null)
}
this.apiLoadFinish = true;
} else {
// this.noRecordFound = true;
}
}
);
}
formLoadData(val) {
if(val !== null) {
let value = val;
this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['2'],
client_details: this._formBuilder.array([
// this.initDetails(),
])
});
this.addClientDetailsWithData(value.client_details);
} else {
this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['2'],
client_details: this._formBuilder.array([
this.initDetails(),
])
});
}
}
// convenience getter for easy access to form fields
get f() { return this._clientQuesFrom.controls; }
// Dynamic Form field creation Functionality : START ===>
initDetails() {
return this._formBuilder.group({
client_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: ['', Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[''],
credit_period:[''],
frequency_of_purchase: ['', Validators.compose([Validators.required])],
freq_purchase_others_text_value: ['']
});
}
initDetailsWithdata(data) {
return this._formBuilder.group({
client_name: [data.client_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''],
credit_period:[data.credit_period || ''],
frequency_of_purchase: [data.frequency_of_purchase, Validators.compose([Validators.required])],
freq_purchase_others_text_value: [data.freq_purchase_others_text_value || '']
});
}
addClientDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function(key) {
return supp_data[key];
});
if (result.length > 0) {
for (let val of result) {
let vals = {
client_name: val.client_name,
contact_person: val.contact_person,
mobile_number: val.mobile_number,
payment_mode: val.payment_mode,
per_of_immediate_advance_payment: val.per_of_immediate_advance_payment,
credit_period: val.credit_period,
frequency_of_purchase: val.frequency_of_purchase,
freq_purchase_others_text_value: val.freq_purchase_others_text_value
};
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetailsWithdata(vals));
}
}
}
addSupplierDetails(e) {
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetails());
}
removeLanguage(i: number) {
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.removeAt(i);
}
public paymentModeTextBox: number;
selectedPM(e) {
this.paymentModeTextBox = e.value;
// this.f.supplier_details.controls.get('payment_mode_value');
}
public freqPurchaseTextBox: number;
selectedFreqPurchase(e){
this.freqPurchaseTextBox = e.value;
}
// ==================
/** To Save/Edited Popup Data */
onSubmit() {
this.submitted = true;
// stop here if form is invalid
if (this._clientQuesFrom.invalid) {
if (this._supplierQuesFrom.invalid) {
return;
} else {
var answerFormValues = this._clientQuesFrom.value;
var answerFormValues = this._supplierQuesFrom.value;
// To Remove The "Null" With Key also
//To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
console.log(JSON.stringify(answerFormValues));
// Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {
if (dataresult.status == 200) {
// console.log(dataresult);
this.notifier.notify('success', 'Record Saved Successfully.!');
this.notifier.notify('success', 'Record Saved Successfully.!');
// this.dialogRef.close();
// alert("sample alert for Saving");
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close();
});
@ -309,8 +517,9 @@ var result = Object.keys(supp_data).map(function(key) {
onReset() {
// this._addQuesFrom.reset();
}
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
/** On Key Press Event For Mobile Number */
keyPress(event: any) {
const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode);

View File

@ -1,229 +1,134 @@
<div style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
<form *ngIf="apiLoadFinish" [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">{{pageTitle}}</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<mat-dialog-content>
<mat-tab-group>
<mat-tab label="Questions">
<ng-template matTabContent>
<mat-card>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card>
<mat-card-content>
<mat-form-field fxFill>
<textarea matInput placeholder="What are the main raw materials?(MEG Only)" formControlName="main_raw_materials"></textarea>
<mat-error *ngIf="submitted && f.main_raw_materials.hasError('required')" class="mat-text-warn">You must Include Raw Material Details.</mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
</div>
<h2 mat-dialog-title class="paragraph_change">
<div fxFlex="70" align="left" style="padding: 10px !important;">{{pageTitle}}</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right"
mat-dialog-close><mat-icon>close</mat-icon></button>
</div>
</h2>
<div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
<form [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<mat-dialog-content>
<mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.manufacturing_details['controls']; let i=index" [formGroupName]="i">
<div formArrayName="main_raw_materials">
<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;">Raw Material #{{l+1}}</h6>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<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: 100%">
<input matInput placeholder="Supplier Name" formControlName="manufacturing_supplier_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="manufacturing_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select (selectionChange)="selectedPM($event)" 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: 100%" *ngIf="items.get('manufacturing_payment_type').value == 3">
<input matInput placeholder="Number of days of credit provided" formControlName="manufacturing_credit_days">
</mat-form-field>
</div>
<div align="end">
<span *ngIf="item.controls.main_raw_materials.controls.length > 1" (click)="removeRawMaterials(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</mat-card>
</div>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card>
<!-- <mat-card-title></mat-card-title> -->
<mat-card-content formArrayName="supplier_details" fxFill>
<div *ngFor="let sup of _supplierQuesFrom.controls.supplier_details['controls']; let i=index" [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div fxFlex="30">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Supplier Name" formControlName="supplier_name" required>
<!-- <mat-error *ngIf="sup.controls['supplier_name'].hasError('required') && sup.controls['supplier_name'].touched" class="mat-text-warn">Supplier Name Required.</mat-error> -->
</mat-form-field>
</div>
<div fxFlex="30">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Person Name" formControlName="contact_person" required>
<!-- <mat-error *ngIf="sup.controls['contact_person'].hasError('required') && sup.controls['contact_person'].touched" class="mat-text-warn">Contact Person Name Required.</mat-error> -->
</mat-form-field>
</div>
<div fxFlex="30">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Contact Mobile Number" formControlName="mobile_number" (keypress)="keyPress($event)" minlength=10 maxlength=10 required>
<!-- <mat-error *ngIf="sup.controls['mobile_number'].hasError('requried') && sup.controls['mobile_number'].touched" class="mat-text-warn">Mobile Number Requried</mat-error> -->
<mat-error *ngIf="sup.controls['mobile_number'].hasError('minlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Valid Mobile Number Requried</mat-error>
<mat-error *ngIf="sup.controls['mobile_number'].hasError('maxlength') && sup.controls['mobile_number'].touched" class="mat-text-warn">Vaild Mobile Number Requried</mat-error>
</mat-form-field>
</div>
</div>
<div fxLayout="row wrap" fxLayoutGap="14px" fxLayoutAlign="start none">
<div fxFlex="30">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedPM($event)" placeholder="Payment Mode" formControlName="payment_mode" required>
<mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 1 || sup.get('payment_mode').value == 3" fxFlex="30">
<mat-form-field class="ml-xs example-full-width" >
<input matInput placeholder="% of immediate / Advance Payment Purchase to Total Purchase?" formControlName="per_of_immediate_advance_payment" type="number" min="0">
</mat-form-field>
</div>
<div *ngIf="sup.get('payment_mode').value == 2 || sup.get('payment_mode').value == 3" fxFlex="30">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Credit Period" formControlName="credit_period">
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutGap="14px" style="text-align:center;">
<!-- <div fxFlex="30">
<mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedFreqPurchase($event)" placeholder="Frequency of Purchase" formControlName="frequency_of_purchase" required>
<mat-option *ngFor="let feq of m_freqOfPurchase" [value]="feq.frequency_id">{{ feq.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="sup.get('frequency_of_purchase').value == 8" fxFlex="30">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Others Details" formControlName="freq_purchase_others_text_value">
</mat-form-field>
</div>-->
<!-- <div fxFlex="30" style="text-align:center;"> -->
<span *ngIf="_supplierQuesFrom.controls.supplier_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
<!-- </div> -->
</div>
</div>
</mat-card-content>
<mat-card-actions align="end">
<!-- <span *ngIf="_supplierQuesFrom.controls.supplier_details.controls.length > 1" (click)="removeLanguage(i)">
</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"
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>
</mat-card>
<mat-card *ngIf="tradingForm">
<h5 style="margin: 12px;">Trading Product Details</h5>
<div formArrayName="trade_details">
<div *ngFor="let item of _supplierQuesFrom.controls.trade_details['controls']; let i=index" [formGroupName]="i">
<div formArrayName="trading_products">
<div *ngFor="let items of item.controls.trading_products['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<h6 style="margin: 12px;">Trading Product #{{l+1}}</h6>
<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: 100%">
<input matInput placeholder="Supplier Name" formControlName="trade_supplier_name">
</mat-form-field>
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Name" formControlName="trade_product_contact_person_name">
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
<input matInput placeholder="Contact Person Mobile Number" formControlName="trade_product_contact_person_mobile_number">
</mat-form-field>
<mat-form-field style="width: 100%">
<mat-select (selectionChange)="selectedPM($event)" 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: 100%" *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>
</div>
<div align="end">
<span *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" color="primary" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span> -->
</mat-card-actions>
</mat-card>
</div>
</span>
</div>
</mat-card>
</div>
<mat-dialog-actions>
<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)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button>
</div>
</mat-dialog-actions>
</mat-card>
</ng-template>
</mat-tab>
<mat-tab label="Docs">
<ng-template matTabContent>
<div ngxViewer>
<div fxLayout="row wrap" style="padding:20px;">
<div fxFlex="100">
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div>
</div>
</div>
</div>
<div fxFlex="20" class="m-gap p-gap">
<div class="p-list-main mb-2" style="width: 60%;height: auto;">
<div class="p-list">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div>
</div>
</div>
</div>
</div>
<div fxFlex="row">
<div fxFlex="100" class="m-gap p-gap">
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20">
<a href="http://www.google.com"><mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;">picture_as_pdf</mat-icon> <span class="d-block">version_111</span></a>
</div>
</div>
</div>
</div>
</div>
</div>
</ng-template>
</mat-tab>
</mat-tab-group>
</mat-dialog-content>
<mat-dialog-actions>
</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>
</div>
</mat-card>
<mat-card *ngIf="serviceProviderForm">
<h5 style="margin: 12px;">Service Provider Product Details</h5>
<div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div>
</mat-card>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
<!-- <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="personal_info_form_remark" required></textarea>
</mat-form-field> -->
</div>
<div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
<!--<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button>-->
</div>
</mat-dialog-actions>
</form>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="supplier_info_form_remark"></textarea>
</mat-form-field>
</div>
<div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
</form>
</div>
<notifier-container></notifier-container>

View File

@ -3,7 +3,7 @@ import {
Component,
OnInit,
Inject,
Output,Input
Output, Input
} from '@angular/core';
import {
@ -32,68 +32,312 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
export class SupplierInfoComponent implements OnInit {
pageTitle: string ="Supplier Details";
pageTitle: string = "Supplier Details";
//@Input() pdid: number;
pdid : string;
form_id:number;
pdid: string;
form_id: number;
public _supplierQuesFrom: FormGroup;
public submitted = false;
public m_paymentModeType= [];
public m_paymentModeType = [];
private notifier: NotifierService;
constructor(
notifier: NotifierService,
private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 1;
this.notifier = notifier;
notifier: NotifierService,
private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 1;
this.notifier = notifier;
}
public viewerOptions: any = {
navbar: false,
toolbar: {
zoomIn: 4,
zoomOut: 4,
oneToOne: 4,
reset: 4,
prev: 4,
play: {
show: 4,
size: 'large',
},
next: 4,
rotateLeft: 4,
rotateRight: 4,
flipHorizontal: 4,
flipVertical: 4,
}
};
navbar: false,
toolbar: {
zoomIn: 4,
zoomOut: 4,
oneToOne: 4,
reset: 4,
prev: 4,
play: {
show: 4,
size: 'large',
},
next: 4,
rotateLeft: 4,
rotateRight: 4,
flipHorizontal: 4,
flipVertical: 4,
}
};
noRecordsFound: Boolean = false;
ngOnInit() {
// this.getM_FreqOfPurchase();
this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid).subscribe(data => {
// if(data.dataStatus === undefined){
let datas = {
"profession_name": "Others",
"type_of_activity": [
{
"type_of_activity_id": 1,
"name": "Manufacturing Details"
},
{
"type_of_activity_id": 2,
"name": "Retail trading"
},
{
"type_of_activity_id": 4,
"name": "Service Provider"
}
]
};
this.initFormLoadDetails(datas.type_of_activity);
// }else {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.noRecordsFound = false;
// }
}, err => {
this.notifier.notify('warning', 'No Category Records Found.!');
this.noRecordsFound = false;
})
// this.getM_FreqOfPurchase();
this.getM_PaymentModeType();
this.getPdSupplierFormDetails();
// this.getPdSupplierFormDetails();
}
// ==================
serviceProviderForm: Boolean = false;
initFormLoadDetails(record) {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
data => {
if(data.dataStatus){
let dataForm = data.records;
if(dataForm !== undefined) {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(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);
if(arr.length > 0) {
let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
return dataForm.main_raw_materials[key];
});
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.main_raw_materials_total_payments_percent_on_credit || null);
}
let arr1 = record.filter(data => data.type_of_activity_id === 2 || 3);
if(arr1.length > 0) {
let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
return dataForm.trading_products[key];
});
this.initTradingProductsDetails(api_trading_products);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
}
this.noRecordsFound = true;
} else {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(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);
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 === 2 || 3);
if(arr1.length > 0) {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);
}
this.noRecordsFound = true;
}
let arr2 = record.filter(data => data.type_of_activity_id === 4);
if(arr2.length > 0) {
this.serviceProviderForm = true;
}
} else {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
});
let arr = record.filter(data => data.type_of_activity_id === 1);
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 === 2 || 3);
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);
if(arr2.length > 0) {
this.serviceProviderForm = true;
}
this.noRecordsFound = true;
}
}, err => {
}
);
}
manufacturingForm: Boolean = false;
manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 1);
if (arr.length > 0) {
this.manufacturingForm = true;
return this._formBuilder.group({
main_raw_materials: this._formBuilder.array([]),
main_raw_materials_total_payments_percent_on_credit: []
})
// }
} else {
return;
}
}
tradingForm: Boolean = false;
tradingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id === 2 || 3);
if (arr.length > 0) {
this.tradingForm = true;
return this._formBuilder.group({
trading_products: this._formBuilder.array([]),
trading_products_total_payments_percent_on_credit: []
});
} else {
return;
}
}
initManufacturingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
if(datas === null){
control.push(this.initManufacturingProducts(null));
} else {
for (let val of datas) {
control.push(this.initManufacturingProducts(val));
}
}
}
initManufacturingProducts(records) {
if(records === null) {
return this._formBuilder.group({
manufacturing_raw_material_name: [''],
manufacturing_supplier_name: [''],
manufacturing_contact_person_name: [''],
manufacturing_contact_person_mobile_number: [''],
manufacturing_payment_type: [''],
manufacturing_credit_days: [''],
manufacturing_frequency_of_purchase: [''],
})
} else {
return this._formBuilder.group({
manufacturing_raw_material_name: [records.manufacturing_raw_material_name || null],
manufacturing_supplier_name: [records.manufacturing_supplier_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_payment_type: [records.manufacturing_payment_type || null],
manufacturing_credit_days: [records.manufacturing_credit_days || null],
manufacturing_frequency_of_purchase: [records.manufacturing_frequency_of_purchase || null],
})
}
}
initTradingProductsDetails(datas) {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
if(datas === null){
control.push(this.initTradingProducts(null));
} else {
for (let val of datas) {
control.push(this.initTradingProducts(val));
}
}
}
initTradingProducts(records) {
if(records === null) {
return this._formBuilder.group({
trade_product_name: [''],
trade_supplier_name: [''],
trade_product_contact_person_name: [''],
trade_product_contact_person_mobile_number: [''],
trade_product_payment_type: [''],
trade_product_frequency_of_purchase: [''],
trade_product_credit_days: [''],
})
} else {
return this._formBuilder.group({
trade_product_name: [records.trade_product_name],
trade_supplier_name: [records.trade_supplier_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_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],
})
}
}
addMoreRawMaterials(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
// console.log(control);
control.push(this.initManufacturingProducts(null));
}
removeRawMaterials(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials'];
control.removeAt(inx);
}
addMoretradeProduct(e): void {
// e.stropPropagation();
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
// console.log(control);
control.push(this.initTradingProducts(null));
}
removeTradingProduct(inx): void {
const control = <FormArray>this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products'];
control.removeAt(inx);
}
// ==================
//getM_FreqOfPurchase() {
// this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
// data => {
// this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
// },
// error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found.";
/// }
// )
// }
// this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
// data => {
// this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
// },
// error => {
// this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found.";
/// }
// )
// }
getM_PaymentModeType() {
getM_PaymentModeType() {
this.pdTrigerService.getAllMasterDatas('PAYMENTMODE').subscribe(
data => {
this.m_paymentModeType = data.records.filter(data => data.isactive == 1);
@ -106,122 +350,7 @@ export class SupplierInfoComponent implements OnInit {
}
// ==================
apiLoadFinish: boolean = false;
getPdSupplierFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
data => {
if (data) {
if(data.dataStatus){
this.formLoadData(data.records)
} else {
this.formLoadData(null)
}
this.apiLoadFinish = true;
} else {
// this.noRecordFound = true;
}
}
);
}
formLoadData(val) {
if(val !== null) {
let value = val;
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
main_raw_materials: [value.main_raw_materials, Validators.compose([Validators.required])],
supplier_details: this._formBuilder.array([
// this.initDetails(),
])
});
this.addSupplierDetailsWithData(value.supplier_details);
} else {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['1'],
main_raw_materials: [null, Validators.compose([Validators.required])],
supplier_details: this._formBuilder.array([
this.initDetails(),
])
});
}
}
// convenience getter for easy access to form fields
get f() { return this._supplierQuesFrom.controls; }
// Dynamic Form field creation Functionality : START ===>
initDetails() {
return this._formBuilder.group({
supplier_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: ['', Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[''],
credit_period:[''],
// frequency_of_purchase: ['', Validators.compose([Validators.required])],
// freq_purchase_others_text_value: ['']
});
}
initDetailsWithdata(data) {
return this._formBuilder.group({
supplier_name: [data.supplier_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required, Validators.minLength(10), Validators.maxLength(10)])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
per_of_immediate_advance_payment:[data.per_of_immediate_advance_payment || ''],
credit_period:[data.credit_period || ''],
//frequency_of_purchase: [data.frequency_of_purchase, Validators.compose([Validators.required])],
//freq_purchase_others_text_value: [data.freq_purchase_others_text_value || '']
});
}
addSupplierDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function(key) {
return supp_data[key];
});
if (result.length > 0) {
for (let val of result) {
let vals = {
supplier_name: val.supplier_name,
contact_person: val.contact_person,
mobile_number: val.mobile_number,
payment_mode: val.payment_mode,
per_of_immediate_advance_payment: val.per_of_immediate_advance_payment,
credit_period: val.credit_period
// frequency_of_purchase: val.frequency_of_purchase,
// freq_purchase_others_text_value: val.freq_purchase_others_text_value
};
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
control.push(this.initDetailsWithdata(vals));
}
}
}
addSupplierDetails(e) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
control.push(this.initDetails());
}
removeLanguage(i: number) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
control.removeAt(i);
}
public paymentModeTextBox: number;
selectedPM(e) {
this.paymentModeTextBox = e.value;
// this.f.supplier_details.controls.get('payment_mode_value');
}
public freqPurchaseTextBox: number;
selectedFreqPurchase(e){
this.freqPurchaseTextBox = e.value;
}
// ==================
/** To Save/Edited Popup Data */
onSubmit() {
@ -234,7 +363,7 @@ apiLoadFinish: boolean = false;
//To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
// alert(JSON.stringify(answerFormValues));
console.log(JSON.stringify(answerFormValues));
//Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => {
@ -253,8 +382,8 @@ apiLoadFinish: boolean = false;
// this.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close();
});
//After Saving the BRANCH data then popup close
// this.dialogRef.close();
// //After Saving the BRANCH data then popup close
// // this.dialogRef.close();
}
}

View File

@ -282,14 +282,14 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
// get Pd Final report Question Answer
getPdFinalReportDetails(pdId: number) {
getPdFinalReportDetails(pdId: number): Observable<any> {
return this._http.post<any>(this.apiUrl+"getFinalPDReportQuestions",{"pd_id":pdId})
.pipe(
catchError(this.handleError('operation', []))
)
}
getPDReportFinalDocument(pdId: any){
getPDReportFinalDocument(pdId: any): Observable<any>{
pdId.fk_createdby = this._aws.getlocale();
return this._http.post<any>(this.apiUrl+"generatePDReport",{"records": pdId})
.pipe(
@ -297,28 +297,28 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
)
}
getActualPDReportModelTemplate(pdId: any) {
getActualPDReportModelTemplate(pdId: any) : Observable<any>{
return this._http.post<any>(this.apiUrl+"getLatestPDReportBlob ",{"records":{"pd_id":pdId}})
.pipe(
catchError(this.handleError('operation', []))
)
}
updatePDReportDetails(records: any){
updatePDReportDetails(records: any): Observable<any>{
return this._http.post<any>(this.apiUrl+"saveNewVersionOfPDReport ",{"records": records})
.pipe(
catchError(this.handleError('operation', []))
)
}
getPdDocVersionList(pdId: number){
getPdDocVersionList(pdId: number): Observable<any>{
return this._http.post<any>(this.apiUrl+"getListOfPDReportVersions",{"records":{"pd_id":pdId}})
.pipe(
catchError(this.handleError('operation', []))
)
}
swapOlderPDReportToLatest(pdId: any){
swapOlderPDReportToLatest(pdId: any): Observable<any>{
pdId.fk_createdby = this._aws.getlocale();
alert(JSON.stringify(pdId));
return this._http.post<any>(this.apiUrl+"swapOlderPDReportToLatest",{"records": pdId})
@ -327,6 +327,12 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
)
}
getTypeofActivityForSuppliedInfoForm(pd_id: any): Observable<any>{
return this._http.post<any>(this.apiUrl+"getTypeOfActivetyFromBusinessForm", {"records": { "pd_id" : pd_id }})
.pipe(
catchError(this.handleError('operation', []))
)
}