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>
<h2 mat-dialog-title class="paragraph_change"> <div fxFlex="30" align="end" style="padding: 10px !important;">
<div fxFlex="70" align="left" style="padding: 10px !important;">{{pageTitle}}</div> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right"
<div fxFlex="30" align="end" style="padding: 10px !important;"> mat-dialog-close><mat-icon>close</mat-icon></button>
<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> <div *ngIf="noRecordsFound" style="max-width: 100vw !important;width: 100% !important;height: 95% !important;">
</h2> <form [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate>
<mat-dialog-content>
<mat-dialog-content> <mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;">Manufacturing Product Details</h5>
<mat-tab-group> <div formArrayName="manufacturing_details">
<div *ngFor="let item of _supplierQuesFrom.controls.manufacturing_details['controls']; let i=index" [formGroupName]="i">
<mat-tab label="Questions"> <div formArrayName="main_raw_materials">
<ng-template matTabContent> <div *ngFor="let items of item.controls.main_raw_materials['controls']; let l=index" [formGroupName]="l">
<mat-card style="margin: 12px;">
<div fxLayout="row wrap"> <h6 style="margin: 12px;">Raw Material #{{l+1}}</h6>
<div fxFlex="100"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-card> <mat-form-field style="width: 100%">
<mat-card> <mat-select placeholder="Manufacturing Product Name" formControlName="manufacturing_product_name">
<!-- <mat-card-title></mat-card-title> --> <mat-option *ngFor="let pm of m_manufacturingProducts" [value]="pm.id">{{ pm.name }}</mat-option>
<mat-card-content formArrayName="client_details" fxFill> </mat-select>
<div *ngFor="let sup of _clientQuesFrom.controls.client_details['controls']; let i=index" [formGroupName]="i"> </mat-form-field>
<!-- <div [formGroupName]="i"> --> <!--<mat-form-field style="width: 100%">
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <input matInput placeholder="Raw Material Name" formControlName="manufacturing_raw_material_name">
<div> </mat-form-field>-->
<mat-form-field class="ml-xs example-full-width"> <mat-form-field style="width: 100%">
<input matInput placeholder="Client Name" formControlName="client_name" required> <input matInput placeholder="Client Name" formControlName="manufacturing_client_name">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> </mat-form-field>
</mat-form-field> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="Contact Person Name" formControlName="manufacturing_contact_person_name">
<div> </mat-form-field>
<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>
</div> </div>
</mat-dialog-actions> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
</mat-card> <mat-form-field style="width: 100%">
</div> <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> </div>
</ng-template> </div>
</mat-tab> <div>
<mat-form-field style="width: 100%">
<mat-tab label="Docs"> <input matInput placeholder="% of total manufacturing raw materials credit values" formControlName="main_raw_materials_total_payments_percent_on_credit"
<ng-template matTabContent> type="number">
<div fxLayout="row wrap" style="padding:20px;"> </mat-form-field>
<div fxFlex="100"> <div fxFlex="100" align="end">
<div fxFlex="20" class="m-gap p-gap"> <button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Supplier Details" matTooltipPosition="above"
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> class="mr-1 mb-1 hover-icon" (click)="addMoreRawMaterials($event); false"><mat-icon>add</mat-icon></button>
<div class="p-list"> </div>
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div> </div>
</div> </div>
</div> </div>
</div> </mat-card>
<div fxFlex="20" class="m-gap p-gap"> <mat-card *ngIf="tradingForm">
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> <h5 style="margin: 12px;">Trading Product Details</h5>
<div class="p-list"> <div formArrayName="trade_details">
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div> <div *ngFor="let item of _supplierQuesFrom.controls.trade_details['controls']; let i=index" [formGroupName]="i">
</div> <div formArrayName="trading_products">
</div> <div *ngFor="let items of item.controls.trading_products['controls']; let l=index" [formGroupName]="l">
</div> <mat-card style="margin: 12px;">
<div fxFlex="20" class="m-gap p-gap"> <h6 style="margin: 12px;">Trading Product #{{l+1}}</h6>
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div class="p-list"> <mat-form-field style="width: 100%">
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div> <mat-select placeholder="Trading Product Name" formControlName="trade_product_name">
</div> <mat-option *ngFor="let pm of m_tradingProducts" [value]="pm.id">{{ pm.name }}</mat-option>
</div> </mat-select>
</div> </mat-form-field>
<div fxFlex="20" class="m-gap p-gap"> <!--<mat-form-field style="width: 100%">
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> <input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
<div class="p-list"> </mat-form-field>-->
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=2" alt="Image 2"></div> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="Client Name" formControlName="trade_client_name">
</div> </mat-form-field>
</div> <mat-form-field style="width: 100%">
<div fxFlex="20" class="m-gap p-gap"> <input matInput placeholder="Contact Person Name" formControlName="trade_product_contact_person_name">
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> </mat-form-field>
<div class="p-list"> </div>
<div class="top"><img src="https://picsum.photos/2000/1500/?random=3" alt="Image 3"></div> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
</div> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="Contact Person Mobile Number" formControlName="trade_product_contact_person_mobile_number">
</div> </mat-form-field>
<div fxFlex="20" class="m-gap p-gap"> <mat-form-field style="width: 100%">
<div class="p-list-main mb-2" style="width: 60%;height: auto;"> <mat-select placeholder="Payment Type" formControlName="trade_product_payment_type">
<div class="p-list"> <mat-option *ngFor="let pm of m_paymentModeType" [value]="pm.id">{{ pm.name }}</mat-option>
<div class="top"> <img src="https://picsum.photos/2000/1500/?random=1" alt="Image 1"></div> </mat-select>
</div> </mat-form-field>
</div> <mat-form-field style="width: 100%" *ngIf="items.get('trade_product_payment_type').value == 3">
</div> <input matInput placeholder="Number of days of credit provided" formControlName="trade_product_credit_days">
</div> </mat-form-field>
<div fxFlex="row"> </div>
<div fxFlex="100" class="m-gap p-gap"> <div align="end">
<div fxLayout="row" fxLayoutWrap="wrap"> <span *ngIf="item.controls.trading_products.controls.length > 1" (click)="removeTradingProduct(l)">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> <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>
<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> </span>
</div> </div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> </mat-card>
<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 class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> <div>
<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> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="% of total trading product credit values" formControlName="trading_products_total_payments_percent_on_credit"
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> type="number">
<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> </mat-form-field>
</div> <div fxFlex="100" align="end">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> <button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Supplier Details" matTooltipPosition="above"
<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> class="mr-1 mb-1 hover-icon" (click)="addMoretradeProduct($event); false"><mat-icon>add</mat-icon></button>
</div> </div>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> </div>
<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> </mat-card>
<div fxLayout="row" fxLayoutWrap="wrap"> <!--===========================: service provider details : START-->
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25"> <mat-card *ngIf="serviceProviderForm">
<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> <h5 style="margin: 12px;">Service Provider Product Details</h5>
</div> <div formArrayName="service_provider_details">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25"> <div *ngFor="let item of _supplierQuesFrom.controls.service_provider_details['controls']; let i=index" [formGroupName]="i">
<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 formArrayName="service_products">
</div> <div *ngFor="let items of item.controls.service_products['controls']; let l=index" [formGroupName]="l">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25"> <mat-card style="margin: 12px;">
<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> <h6 style="margin: 12px;">Service Provider Product #{{l+1}}</h6>
</div> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="25" fxFlex.lg="25" fxFlex.xl="25"> <mat-form-field style="width: 100%">
<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> <mat-select placeholder="Service Provider Product Name" formControlName="service_provider_product_name">
</div> <mat-option *ngFor="let pm of m_suplierProducts" [value]="pm.id">{{ pm.name }}</mat-option>
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> </mat-select>
<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> </mat-form-field>
</div> <!--<mat-form-field style="width: 100%">
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" fxFlex.lg="20" fxFlex.xl="20"> <input matInput placeholder="Trade Product Name" formControlName="trade_product_name">
<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> </mat-form-field>-->
</div> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="Client Name" formControlName="service_provider_client_name">
</div> </mat-form-field>
</div> <mat-form-field style="width: 100%">
</div> <input matInput placeholder="Contact Person Name" formControlName="service_provider_product_contact_person_name">
</mat-form-field>
</ng-template> </div>
</mat-tab> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width: 100%">
</mat-tab-group> <input matInput placeholder="Contact Person Mobile Number" formControlName="service_provider_product_contact_person_mobile_number">
</mat-form-field>
</mat-dialog-content> <mat-form-field style="width: 100%">
<mat-select placeholder="Payment Type" formControlName="service_provider_product_payment_type">
<mat-dialog-actions> <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"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<!-- <mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="personal_info_form_remark" required></textarea> <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="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> </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>
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxFlex="40" align="end">
<div> <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>
<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>
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none"> </mat-dialog-actions>
<div> </form>
<mat-form-field> </div>
<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>-->

View File

@ -30,120 +30,440 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
}) })
export class ClientInfoComponent implements OnInit { export class ClientInfoComponent implements OnInit {
pageTitle: string ="Client Details"; pageTitle: string = "Client Details";
//@Input() pdid: number; //@Input() pdid: number;
pdid : number; pdid: string;
form_id: number; form_id: number;
loadDataStatus: boolean=true; public _supplierQuesFrom: FormGroup;
public _clientQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public m_paymentModeType= []; public m_paymentModeType = [];
// public m_paymentModeType= [ private notifier: NotifierService;
// {
// 'id': "1",
// 'name': 'Immediate Or Advanced Payment' public m_manufacturingProducts = [
// }, {
// { id: 1,
// 'id': "2", name: 'Manufac prd 1'
// 'name': 'Credit' }, {
// }, id: 2,
// { name: 'Manufac prd 2'
// 'id': "3", }
// 'name': 'Combination of Both' ];
// }, public m_tradingProducts = [
// ]; {
public m_freqOfPurchase= []; id: 1,
// public m_freqOfPurchase= [ name: 'trading prd 1'
// { }, {
// 'id': "1", id: 2,
// 'name': 'Daily' name: 'trading prd 2'
// }, }
// { ];
// 'id': "2", public m_suplierProducts = [
// 'name': 'Weekly' {
// }, id: 1,
// { name: 'service prd 1'
// 'id': "3", }, {
// 'name': 'Monthly' id: 2,
// }, name: 'service prd 2'
// { }
// '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;
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService, private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 2; this.form_id = 2;
this.notifier = notifier; 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,
} }
}; public viewerOptions: any = {
ngOnInit() { navbar: false,
this.getM_FreqOfPurchase(); toolbar: {
this.getM_PaymentModeType(); zoomIn: 4,
this.getClientFormDetails(); zoomOut: 4,
} oneToOne: 4,
reset: 4,
prev: 4,
// ================== play: {
show: 4,
getM_FreqOfPurchase() { size: 'large',
this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
data => {
this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
}, },
error => { next: 4,
// this.notifier.notify('warning', 'No Category Records Found.!'); rotateLeft: 4,
// this.m_assets_type = "No Category Records Found."; 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( this.pdTrigerService.getAllMasterDatas('PAYMENTMODE').subscribe(
data => { data => {
this.m_paymentModeType = data.records.filter(data => data.isactive == 1); 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 */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
// stop here if form is invalid // stop here if form is invalid
if (this._clientQuesFrom.invalid) { if (this._supplierQuesFrom.invalid) {
return; return;
} else { } 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]); Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
console.log(JSON.stringify(answerFormValues));
// Add BRANCH data with help Service File // Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => { dataresult => {
if (dataresult.status == 200) { if (dataresult.status == 200) {
// console.log(dataresult); // console.log(dataresult);
this.notifier.notify('success', 'Record Saved Successfully.!'); this.notifier.notify('success', 'Record Saved Successfully.!');
// this.dialogRef.close(); // this.dialogRef.close();
// alert("sample alert for Saving"); // alert("sample alert for Saving");
} }
else { 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 !"; // this.errorMessage = "Some Thing Wents Wrong Try Again !";
} }
}, error => { }, 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.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close(); // this.dialogRef.close();
}); });
@ -309,8 +517,9 @@ var result = Object.keys(supp_data).map(function(key) {
onReset() { onReset() {
// this._addQuesFrom.reset(); // 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]/; const pattern = /[0-9]/;
let inputChar = String.fromCharCode(event.charCode); let inputChar = String.fromCharCode(event.charCode);

View File

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

View File

@ -3,7 +3,7 @@ import {
Component, Component,
OnInit, OnInit,
Inject, Inject,
Output,Input Output, Input
} from '@angular/core'; } from '@angular/core';
import { import {
@ -32,68 +32,312 @@ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
export class SupplierInfoComponent implements OnInit { export class SupplierInfoComponent implements OnInit {
pageTitle: string ="Supplier Details"; pageTitle: string = "Supplier Details";
//@Input() pdid: number; //@Input() pdid: number;
pdid : string; pdid: string;
form_id:number; form_id: number;
public _supplierQuesFrom: FormGroup; public _supplierQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public m_paymentModeType= []; public m_paymentModeType = [];
private notifier: NotifierService; private notifier: NotifierService;
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private pdTrigerService: PdTrigerService, private pdTrigerService: PdTrigerService,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) { @Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
this.pdid = this.pd_all_details.pdmaster_details.pd_id; this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 1; this.form_id = 1;
this.notifier = notifier; this.notifier = notifier;
} }
public viewerOptions: any = { public viewerOptions: any = {
navbar: false, navbar: false,
toolbar: { toolbar: {
zoomIn: 4, zoomIn: 4,
zoomOut: 4, zoomOut: 4,
oneToOne: 4, oneToOne: 4,
reset: 4, reset: 4,
prev: 4, prev: 4,
play: { play: {
show: 4, show: 4,
size: 'large', size: 'large',
}, },
next: 4, next: 4,
rotateLeft: 4, rotateLeft: 4,
rotateRight: 4, rotateRight: 4,
flipHorizontal: 4, flipHorizontal: 4,
flipVertical: 4, flipVertical: 4,
} }
}; };
noRecordsFound: Boolean = false;
ngOnInit() { 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.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() { //getM_FreqOfPurchase() {
// this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe( // this.pdTrigerService.getAllMasterDatas('FREQUENCY').subscribe(
// data => { // data => {
// this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1); // this.m_freqOfPurchase = data.records.filter(data => data.isactive == 1);
// }, // },
// error => { // error => {
// this.notifier.notify('warning', 'No Category Records Found.!'); // this.notifier.notify('warning', 'No Category Records Found.!');
// this.m_assets_type = "No Category Records Found."; // this.m_assets_type = "No Category Records Found.";
/// } /// }
// ) // )
// } // }
getM_PaymentModeType() { getM_PaymentModeType() {
this.pdTrigerService.getAllMasterDatas('PAYMENTMODE').subscribe( this.pdTrigerService.getAllMasterDatas('PAYMENTMODE').subscribe(
data => { data => {
this.m_paymentModeType = data.records.filter(data => data.isactive == 1); 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 */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
@ -234,7 +363,7 @@ apiLoadFinish: boolean = false;
//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]); 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 //Add BRANCH data with help Service File
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
dataresult => { dataresult => {
@ -253,8 +382,8 @@ apiLoadFinish: boolean = false;
// this.errorMessage = "Something Wents Wrong Try Again !"; // this.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close(); // this.dialogRef.close();
}); });
//After Saving the BRANCH data then popup close // //After Saving the BRANCH data then popup close
// this.dialogRef.close(); // // this.dialogRef.close();
} }
} }

View File

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