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

@ -1,11 +1,11 @@
/** Common Imports */ /** Common Imports */
import { Component,OnInit,Inject,Output, Input } from '@angular/core'; import { Component, OnInit, Inject, Output, Input } from '@angular/core';
import { FormBuilder,FormGroup,Validators,FormArray } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormArray } from '@angular/forms';
import { NotifierService } from 'angular-notifier'; import { NotifierService } from 'angular-notifier';
import { MatDialog,MatDialogRef,MAT_DIALOG_DATA } from '@angular/material'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
@ -61,9 +61,9 @@ export class SupplierInfoComponent implements OnInit {
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
} }
pdf(fileURL){ pdf(fileURL) {
window.open(fileURL); window.open(fileURL);
} }
public viewerOptions: any = { public viewerOptions: any = {
navbar: false, navbar: false,
toolbar: { toolbar: {
@ -129,7 +129,7 @@ export class SupplierInfoComponent implements OnInit {
this.m_tradingProducts.push(val.prodcuts); this.m_tradingProducts.push(val.prodcuts);
} }
} }
if(val.type_of_activity_id == 5){ if (val.type_of_activity_id == 5) {
if (val.prodcuts) { if (val.prodcuts) {
this.m_serviceProvider.push(val.prodcuts); this.m_serviceProvider.push(val.prodcuts);
} }
@ -157,7 +157,7 @@ export class SupplierInfoComponent implements OnInit {
this.getMasterDetails('COMPANYRELATIONSHIPS', 1); this.getMasterDetails('COMPANYRELATIONSHIPS', 1);
this.getMasterDetails('TITLES', 2); this.getMasterDetails('TITLES', 2);
this.retriveFile(); this.retriveFile();
} }
initFormLoadDetails(record) { initFormLoadDetails(record) {
let params: any = {}; let params: any = {};
@ -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
@ -609,7 +624,7 @@ export class SupplierInfoComponent implements OnInit {
// this.errorMessage = "Some Thing Went Wrong Try Again !"; // this.errorMessage = "Some Thing Went Wrong Try Again !";
} }
}, error => { }, error => {
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!'); this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') + '\" Error Occur.!');
// this.errorMessage = "Something Went Wrong Try Again !"; // this.errorMessage = "Something Went Wrong Try Again !";
// this.dialogRef.close(); // this.dialogRef.close();
}); });
@ -625,18 +640,18 @@ export class SupplierInfoComponent implements OnInit {
selectedPersonDesignation(items, e, flag) { selectedPersonDesignation(items, e, flag) {
if (flag == 1) { if (flag == 1) {
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); } if (e == 1) { items.controls['other_person_designation'].setValidators([Validators.required]); }
else { items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');} else { items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue(''); }
items.controls['other_person_designation'].updateValueAndValidity(); items.controls['other_person_designation'].updateValueAndValidity();
} }
else if (flag == 2) { else if (flag == 2) {
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); } if (e == 1) { items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');} else { items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue(''); }
items.controls['other_person_designation'].updateValueAndValidity(); items.controls['other_person_designation'].updateValueAndValidity();
} }
else if (flag == 3) { else if (flag == 3) {
if(e == 1){ items.controls['other_person_designation'].setValidators([Validators.required]); } if (e == 1) { items.controls['other_person_designation'].setValidators([Validators.required]); }
else{ items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue('');} else { items.controls['other_person_designation'].clearValidators(); items.controls['other_person_designation'].setValue(''); }
items.controls['other_person_designation'].updateValueAndValidity(); items.controls['other_person_designation'].updateValueAndValidity();
} }
} }
@ -708,7 +723,7 @@ export class SupplierInfoComponent implements OnInit {
} }
else if (flag == 1) { else if (flag == 1) {
if (e == 3) { if (e == 3) {
items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]); items.controls['manufacturing_credit_days_from'].setValidators([Validators.required]);
items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]); items.controls['manufacturing_credit_days_to'].setValidators([Validators.required]);
} }
else { else {
@ -736,41 +751,41 @@ export class SupplierInfoComponent implements OnInit {
// let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id} // let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id}
pic.pdid = this.pdid; pic.pdid = this.pdid;
const imageRef = this.dialog.open(ImageCropComponent, { const imageRef = this.dialog.open(ImageCropComponent, {
data: pic, data: pic,
maxWidth: '100vw', maxWidth: '100vw',
maxHeight: '100vh', maxHeight: '100vh',
height: '100%', height: '100%',
width: '100%', width: '100%',
}); });
imageRef.afterClosed() imageRef.afterClosed()
.subscribe(dataresult => { .subscribe(dataresult => {
if(dataresult == 1){ if (dataresult == 1) {
this.documentsAndFilesList = []; this.documentsAndFilesList = [];
this.retriveFile(); this.retriveFile();
} }
}); });
} }
retriveFile(){ retriveFile() {
this.pdTrigerService.retriveFile(this.pdid,this.form_id,this.company_id).subscribe(data => { this.pdTrigerService.retriveFile(this.pdid, this.form_id, this.company_id).subscribe(data => {
if (data.status == 200) { if (data.status == 200) {
if (data.records.length > 0) { if (data.records.length > 0) {
data.records.forEach((val, index) => { data.records.forEach((val, index) => {
let splitted = val.pd_document_name.split("."); let splitted = val.pd_document_name.split(".");
let DocumentsAndFiles = { let DocumentsAndFiles = {
'document_id':val.pd_document_id, 'document_id': val.pd_document_id,
'document_name': val.pd_document_name, 'document_name': val.pd_document_name,
'document_title': val.pd_document_title, 'document_title': val.pd_document_title,
'document': val.doc_url, 'document': val.doc_url,
'document_type': splitted[1] == 'pdf' ? 'pdf' : 'image', 'document_type': splitted[1] == 'pdf' ? 'pdf' : 'image',
'is_show_report':val.is_show_report 'is_show_report': val.is_show_report
} }
this.documentsAndFilesList.push(DocumentsAndFiles); this.documentsAndFilesList.push(DocumentsAndFiles);
}); });
} }
} }
else { else {
this.documentsAndFilesList = []; this.documentsAndFilesList = [];
} }
}); });
} }
} }

View File

@ -30,13 +30,13 @@ export const environment = {
// } // }
firebase: { firebase: {
apiKey: "AIzaSyCk86rasBR2-sXlVu6ACUO406EM_1mcwgo", apiKey: "AIzaSyCk86rasBR2-sXlVu6ACUO406EM_1mcwgo",
authDomain: "pdgenie-prod.firebaseapp.com", authDomain: "pdgenie-prod.firebaseapp.com",
databaseURL: "https://pdgenie-prod.firebaseio.com%26quot%3B%2C/", databaseURL: "https://pdgenie-prod.firebaseio.com%26quot%3B%2C/",
projectId: "pdgenie-prod", projectId: "pdgenie-prod",
storageBucket: "", storageBucket: "",
messagingSenderId: "906855209078", messagingSenderId: "906855209078",
appId: "1:906855209078:web:c1583378f1fb2c71" appId: "1:906855209078:web:c1583378f1fb2c71"
} }
}; };