supplier and client : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-07-11 20:14:07 +05:30
parent 01a9dbff57
commit 8cb9eaf845
5 changed files with 624 additions and 550 deletions

View File

@ -17,6 +17,18 @@
<mat-tab label="Questions"> <mat-tab label="Questions">
<ng-template matTabContent> <ng-template matTabContent>
<mat-card>
<mat-form-field style="width:60% !important;">
<mat-select placeholder="Is the Client Infomation Available" formControlName="client_info_available">
<mat-option>Select</mat-option>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
</mat-card>
<!-- <mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'"> -->
<div *ngIf="_supplierQuesFrom.controls.client_info_available.value == 'Yes'">
<mat-card *ngIf="manufacturingForm"> <mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5> <h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details"> <div formArrayName="manufacturing_details">
@ -428,6 +440,17 @@
</div> </div>
</div> </div>
</mat-card> </mat-card>
<mat-card *ngIf="_supplierQuesFrom.controls.client_info_available.value == 'Yes'">
<mat-form-field style="width:60% !important;">
<mat-select placeholder="Is the Billing Infomation Available" formControlName="bill_info">
<mat-option>Select</mat-option>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
</mat-card>
</div>
<!-- <mat-card *ngIf="retaildTradingForm"> <!-- <mat-card *ngIf="retaildTradingForm">
<h5 style="margin: 12px;padding:10px !important;">Retail Trading Product Details</h5> <h5 style="margin: 12px;padding:10px !important;">Retail Trading Product Details</h5>
<div style="text-align: center; margin: 12px;">Retail Trading Details Not applicable here !!</div> <div style="text-align: center; margin: 12px;">Retail Trading Details Not applicable here !!</div>
@ -494,7 +517,7 @@
<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="supplier_info_form_remark"></textarea> <textarea matInput placeholder="Remarks" formControlName="supplier_info_form_remark" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -207,6 +207,8 @@ export class ClientInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['2'], formid: ['2'],
company_id: [this.company_id], company_id: [this.company_id],
client_info_available: [dataForm.client_info_available == true ? 'Yes' : 'No' || null],
bill_info: [dataForm.bill_info == true ? 'Yes' : 'No' || null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
@ -279,6 +281,8 @@ export class ClientInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['2'], formid: ['2'],
company_id: [this.company_id], company_id: [this.company_id],
client_info_available: [dataForm.client_info_available == true ? 'Yes' : 'No' || null],
bill_info: [dataForm.bill_info == true ? 'Yes' : 'No' || null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
@ -316,6 +320,8 @@ export class ClientInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['2'], formid: ['2'],
company_id: [this.company_id], company_id: [this.company_id],
client_info_available: [null],
bill_info: [null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]), service_provider_details: this._formBuilder.array([this.serviceProviderFormCreation(record)]),
@ -350,7 +356,6 @@ export class ClientInfoComponent implements OnInit {
); );
} }
manufacturingForm: Boolean = false; manufacturingForm: Boolean = false;
manufacturingFormCreation(val) { manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 2); let arr = val.filter(data => data.type_of_activity_id == 2);
@ -366,6 +371,7 @@ export class ClientInfoComponent implements OnInit {
} }
} }
tradingForm: Boolean = false; tradingForm: Boolean = false;
tradingFormCreation(val) { tradingFormCreation(val) {
// let arr = val.filter(data => data.type_of_activity_id == 4); // let arr = val.filter(data => data.type_of_activity_id == 4);
@ -641,6 +647,10 @@ export class ClientInfoComponent implements OnInit {
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
this._supplierQuesFrom.value.client_info_available == 'No' ? this._supplierQuesFrom.controls['supplier_info_form_remark'].setValidators([Validators.required]) : this._supplierQuesFrom.controls['supplier_info_form_remark'].clearValidators();
this._supplierQuesFrom.controls['supplier_info_form_remark'].updateValueAndValidity();
// stop here if form is invalid // stop here if form is invalid
if (this._supplierQuesFrom.invalid) { if (this._supplierQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Check All Mandatory Fields.!'); this.notifier.notify('warning', 'Please Check All Mandatory Fields.!');
@ -648,6 +658,9 @@ export class ClientInfoComponent implements OnInit {
} else { } else {
var answerFormValues = this._supplierQuesFrom.value; var answerFormValues = this._supplierQuesFrom.value;
this._supplierQuesFrom.value.client_info_available == 'Yes' ? answerFormValues.client_info_available = true : answerFormValues.client_info_available = false ;
this._supplierQuesFrom.value.bill_info == 'Yes' ? answerFormValues.bill_info = true: answerFormValues.bill_info = false ;
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
Object.keys(answerFormValues).forEach((key) => { if (answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === '') { delete answerFormValues[key] }; }); Object.keys(answerFormValues).forEach((key) => { if (answerFormValues[key] === null || answerFormValues[key] === undefined || answerFormValues[key] === '') { delete answerFormValues[key] }; });
if (answerFormValues.manufacturing_details[0] == null) { if (answerFormValues.manufacturing_details[0] == null) {

View File

@ -16,6 +16,18 @@
<mat-tab-group> <mat-tab-group>
<mat-tab label="Questions"> <mat-tab label="Questions">
<ng-template matTabContent> <ng-template matTabContent>
<mat-card>
<mat-form-field style="width:60% !important;">
<mat-select placeholder="Is the Supplier Infomation Available" formControlName="supplier_info_available">
<mat-option>Select</mat-option>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
</mat-card>
<!-- <mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'"> -->
<div *ngIf="_supplierQuesFrom.controls.supplier_info_available.value == 'Yes'">
<mat-card *ngIf="manufacturingForm"> <mat-card *ngIf="manufacturingForm">
<h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5> <h5 style="margin: 12px;padding:10px !important;">Manufacturing Product Details</h5>
<div formArrayName="manufacturing_details"> <div formArrayName="manufacturing_details">
@ -513,6 +525,17 @@
</div> </div>
</div> </div>
</mat-card> </mat-card>
</div>
<mat-card *ngIf="_supplierQuesFrom.controls.supplier_info_available.value == 'Yes'">
<mat-form-field style="width:60% !important;">
<mat-select placeholder="Is the Billing Infomation Available" formControlName="bill_info">
<mat-option>Select</mat-option>
<mat-option value="Yes">Yes</mat-option>
<mat-option value="No">No</mat-option>
</mat-select>
</mat-form-field>
</mat-card>
<!-- <mat-card *ngIf="serviceProviderForm"> <!-- <mat-card *ngIf="serviceProviderForm">
<h5 style="margin: 12px;padding:10px !important;">Service Provider Product Details</h5> <h5 style="margin: 12px;padding:10px !important;">Service Provider Product Details</h5>
<div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div> <div style="text-align: center; margin: 12px;">Service Provider Details Not applicable here !!</div>
@ -582,7 +605,7 @@
<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="supplier_info_form_remark"></textarea> <textarea matInput placeholder="Remarks" formControlName="supplier_info_form_remark" required></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -176,9 +176,11 @@ export class SupplierInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['1'],
company_id: [this.company_id], company_id: [this.company_id],
supplier_info_available: [dataForm.supplier_info_available == true ? 'Yes' : 'No' || null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
bill_info: [dataForm.bill_info == true ? 'Yes' : 'No' || null],
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
@ -200,7 +202,6 @@ export class SupplierInfoComponent implements OnInit {
} }
let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4); let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4);
if (arr1.length > 0) { if (arr1.length > 0) {
if (dataForm.trade_details[0] !== null) { if (dataForm.trade_details[0] !== null) {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
@ -217,7 +218,6 @@ export class SupplierInfoComponent implements OnInit {
} }
let arr2 = record.filter(data => data.type_of_activity_id == 5); let arr2 = record.filter(data => data.type_of_activity_id == 5);
if (arr2.length > 0) { if (arr2.length > 0) {
if (dataForm.hasOwnProperty('servicing_details') && dataForm.servicing_details[0] !== null) { if (dataForm.hasOwnProperty('servicing_details') && dataForm.servicing_details[0] !== null) {
@ -231,6 +231,8 @@ export class SupplierInfoComponent implements OnInit {
} }
} }
this.noRecordsFound = true; this.noRecordsFound = true;
} else { } else {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
@ -238,9 +240,11 @@ export class SupplierInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['1'],
company_id: [this.company_id], company_id: [this.company_id],
supplier_info_available: [dataForm.supplier_info_available == true ? 'Yes' : 'No' || null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
bill_info: [dataForm.bill_info == true ? 'Yes' : 'No' || null],
supplier_info_form_remark: [dataForm.supplier_info_form_remark || null] supplier_info_form_remark: [dataForm.supplier_info_form_remark || null]
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
@ -268,9 +272,11 @@ export class SupplierInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['1'],
company_id: [this.company_id], company_id: [this.company_id],
supplier_info_available: [null],
manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]), manufacturing_details: this._formBuilder.array([this.manufacturingFormCreation(record)]),
trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]), servicing_details: this._formBuilder.array([this.servicingFormCreation(record)]),
bill_info: [null],
supplier_info_form_remark: [] supplier_info_form_remark: []
// wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]), // wholesale_trade_details: this._formBuilder.array([this.tradingFormCreation(record)]),
}); });
@ -299,6 +305,11 @@ export class SupplierInfoComponent implements OnInit {
} }
// data.controls.locality.value == 5
// ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required])
// : this.addressForm.controls['locality_mixuse'].clearValidators();
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
manufacturingForm: Boolean = false; manufacturingForm: Boolean = false;
manufacturingFormCreation(val) { manufacturingFormCreation(val) {
let arr = val.filter(data => data.type_of_activity_id == 2); let arr = val.filter(data => data.type_of_activity_id == 2);
@ -583,13 +594,17 @@ export class SupplierInfoComponent implements OnInit {
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
// stop here if form is invalid // stop here if form is invalid
this._supplierQuesFrom.value.supplier_info_available == 'No' ? this._supplierQuesFrom.controls['supplier_info_form_remark'].setValidators([Validators.required]) : this._supplierQuesFrom.controls['supplier_info_form_remark'].clearValidators();
this._supplierQuesFrom.controls['supplier_info_form_remark'].updateValueAndValidity();
if (this._supplierQuesFrom.invalid) { if (this._supplierQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Check All Mandatory Fields.!'); this.notifier.notify('warning', 'Please Check All Mandatory Fields.!');
return; return;
} else { } else {
var answerFormValues = this._supplierQuesFrom.value;
var answerFormValues = this._supplierQuesFrom.value;
this._supplierQuesFrom.value.supplier_info_available == 'Yes' ? answerFormValues.client_info_available = true : answerFormValues.client_info_available = false ;
this._supplierQuesFrom.value.bill_info == 'Yes' ? answerFormValues.bill_info = true: answerFormValues.bill_info = 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]);
//Add BRANCH data with help Service File //Add BRANCH data with help Service File