This commit is contained in:
saravanakumarkandasami 2018-11-16 18:42:41 +05:30
commit 89e49a8d81
7 changed files with 72 additions and 46 deletions

View File

@ -193,13 +193,34 @@
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5"> <!--<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<div fxFlex="33"> <div fxFlex="33">
<mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Year and Month of Purchase" formControlName="year_of_purchase"> <div>
</mat-form-field> <label>Year and Month of Purchase?</label>
</div> <br>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="purchase_year">
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div>
</div> </div>
</div>-->
</div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 5">
<label>Year and Month of Purchase?</label>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field>
<input matInput type="number" placeholder="Year" formControlName="purchase_year">
</mat-form-field>
<mat-form-field>
<input matInput type="number" placeholder="Month" formControlName="purchase_month">
</mat-form-field>
</div>
</div> </div>
<div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5"> <div *ngIf="sup.get('assets_mode').value == 1 || sup.get('assets_mode').value == 2 || sup.get('assets_mode').value == 3 || sup.get('assets_mode').value == 4 || sup.get('assets_mode').value == 5">
@ -260,7 +281,7 @@
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above" <button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Asset Details" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button> 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" (click)="onReset(); false"><mat-icon>settings_backup_restore</mat-icon></button>--> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="onReset(); false"><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> <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
</div> </div>
</form> </form>

View File

@ -299,7 +299,8 @@ public m_investmentType = [];
details: this._formBuilder.array([]), details: this._formBuilder.array([]),
approximate_market_value: ['', Validators.compose([Validators.required])], approximate_market_value: ['', Validators.compose([Validators.required])],
name_of_the_owner: ['', Validators.compose([Validators.required])], name_of_the_owner: ['', Validators.compose([Validators.required])],
year_of_purchase: ['', Validators.compose([Validators.required])], purchase_year: ['', Validators.compose([Validators.required])],
purchase_month: ['', Validators.compose([Validators.required])],
emi: [''], emi: [''],
emi_paid: [''], emi_paid: [''],
elapsed_tenure: [''], elapsed_tenure: [''],
@ -467,7 +468,8 @@ public m_investmentType = [];
details: this._formBuilder.array([]), details: this._formBuilder.array([]),
approximate_market_value: [data.approximate_market_value, Validators.compose([Validators.required])], approximate_market_value: [data.approximate_market_value, Validators.compose([Validators.required])],
name_of_the_owner: [data.name_of_the_owner, Validators.compose([Validators.required])], name_of_the_owner: [data.name_of_the_owner, Validators.compose([Validators.required])],
year_of_purchase: [data.year_of_purchase, Validators.compose([Validators.required])], purchase_year: [data.purchase_year, Validators.compose([Validators.required])],
purchase_month: [data.purchase_month, Validators.compose([Validators.required])],
emi: [data.emi || 0], emi: [data.emi || 0],
emi_paid: [data.emi_paid || ''], emi_paid: [data.emi_paid || ''],
elapsed_tenure: [data.elapsed_tenure || ''], elapsed_tenure: [data.elapsed_tenure || ''],
@ -485,7 +487,8 @@ public m_investmentType = [];
assets_mode: val.assets_mode, assets_mode: val.assets_mode,
approximate_market_value: val.approximate_market_value, approximate_market_value: val.approximate_market_value,
name_of_the_owner: val.name_of_the_owner, name_of_the_owner: val.name_of_the_owner,
year_of_purchase: val.year_of_purchase, purchase_year: val.purchase_year,
purchase_month: val.purchase_month,
emi: val.emi, emi: val.emi,
emi_paid: val.emi_paid, emi_paid: val.emi_paid,
elapsed_tenure: val.elapsed_tenure, elapsed_tenure: val.elapsed_tenure,

View File

@ -70,7 +70,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select multiple placeholder="Other family members invovled" <mat-select multiple placeholder="Other family members invovled"
formControlName="other_main_person"formControlName="family_members_involved" (selectionChange)="relationChanged($event)"> formControlName="family_members_involved" (selectionChange)="relationChanged($event)">
<mat-option value="{{member.relationship_id}}" *ngFor="let member of relationData">{{member.name}}</mat-option> <mat-option value="{{member.relationship_id}}" *ngFor="let member of relationData">{{member.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>

View File

@ -75,13 +75,19 @@ export class BusinessInfoComponent implements OnInit {
return data.records.family_members_involved[key]; return data.records.family_members_involved[key];
}); });
let enduse: any = []; let enduse: any = [];
let existRelative: any =[];
selectedMembers.forEach(val => { selectedMembers.forEach(val => {
enduse.push(val.member); enduse.push(val.member);
existRelative.push(val);
}); });
this.relativeNames = existRelative;
if (DesgnArray.length == 0) { if (DesgnArray.length == 0) {
Desgn.push(this.createDesignation()); Desgn.push(this.createDesignation());
} else { } else {
DesgnArray.forEach(datas => {
Desgn.push(this.createDesignation()); Desgn.push(this.createDesignation());
});
} }
if (PartnrArray.length == 0) { if (PartnrArray.length == 0) {
Partnr.push(this.createPartners()); Partnr.push(this.createPartners());
@ -90,7 +96,7 @@ export class BusinessInfoComponent implements OnInit {
Partnr.push(this.createPartners()); Partnr.push(this.createPartners());
}); });
} }
if (data.other_documents == 'yes') { if (data.records.other_documents == 'yes') {
DocArray = Object.keys(data.records.documents).map(function (key) { DocArray = Object.keys(data.records.documents).map(function (key) {
return data.records.documents[key]; return data.records.documents[key];
}); });
@ -114,7 +120,6 @@ export class BusinessInfoComponent implements OnInit {
businessVal.designation = DesgnArray; businessVal.designation = DesgnArray;
businessVal.partners = PartnrArray; businessVal.partners = PartnrArray;
businessVal.documents = DocArray; businessVal.documents = DocArray;
console.log('businessVal', businessVal);
this.businessForm.setValue(businessVal); this.businessForm.setValue(businessVal);
} else { } else {

View File

@ -1,14 +1,14 @@
<!--<pre> {{ m_group | json}}</pre>--> <!--<pre> {{ m_group | json}}</pre>-->
<mat-card style="padding: 12px;"> <mat-card style="padding: 12px;">
<form *ngIf="apiLoadFinish" [formGroup]="_supplierQuesFrom" (submit)="onSubmit()" novalidate> <form *ngIf="apiLoadFinish" [formGroup]="_clientQuesFrom" (submit)="onSubmit()" novalidate>
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="supplier_details" fxFill> <div formArrayName="client_details" fxFill>
<div *ngFor="let sup of _supplierQuesFrom.controls.supplier_details['controls']; let i=index"> <div *ngFor="let sup of _clientQuesFrom.controls.client_details['controls']; let i=index">
<div [formGroupName]="i"> <div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
<div> <div>
<mat-form-field class="ml-xs example-full-width"> <mat-form-field class="ml-xs example-full-width">
<input matInput placeholder="Supplier Name" formControlName="supplier_name"> <input matInput placeholder="Client Name" formControlName="client_name">
<!--<mat-error *ngIf="submitted && f.supplier_name.hasError('required')" class="mat-text-warn">You must Include Supplier Name.</mat-error>--> <!--<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>
@ -62,7 +62,7 @@
</div> </div>
<div fxFlex="20"> <div fxFlex="20">
<span *ngIf="_supplierQuesFrom.controls.supplier_details.controls.length > 1" (click)="removeLanguage(i)"> <span *ngIf="_clientQuesFrom.controls.client_details.controls.length > 1" (click)="removeLanguage(i)">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button> <button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span> </span>
</div> </div>

View File

@ -31,7 +31,7 @@ export class ClientInfoComponent implements OnInit {
@Input() pdid: number; @Input() pdid: number;
public _supplierQuesFrom: FormGroup; public _clientQuesFrom: FormGroup;
public submitted = false; public submitted = false;
public m_paymentModeType= [ public m_paymentModeType= [
{ {
@ -88,12 +88,11 @@ export class ClientInfoComponent implements OnInit {
private pdTrigerService: PdTrigerService) { } private pdTrigerService: PdTrigerService) { }
ngOnInit() { ngOnInit() {
this.getClientFormDetails();
this.getPdSupplierFormDetails();
} }
apiLoadFinish: boolean = false; apiLoadFinish: boolean = false;
getPdSupplierFormDetails() { getClientFormDetails() {
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe( this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe(
data => { data => {
if (data) { if (data) {
if(data.dataStatus){ if(data.dataStatus){
@ -112,21 +111,19 @@ apiLoadFinish: boolean = false;
formLoadData(val) { formLoadData(val) {
if(val !== null) { if(val !== null) {
let value = val; let value = val;
this._supplierQuesFrom = this._formBuilder.group({ this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['2'],
main_raw_materials: [value.main_raw_materials, Validators.compose([Validators.required])], client_details: this._formBuilder.array([
supplier_details: this._formBuilder.array([
// this.initDetails(), // this.initDetails(),
]) ])
}); });
this.addSupplierDetailsWithData(value.supplier_details); this.addClientDetailsWithData(value.client_details);
} else { } else {
this._supplierQuesFrom = this._formBuilder.group({ this._clientQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['1'], formid: ['2'],
main_raw_materials: [null, Validators.compose([Validators.required])], client_details: this._formBuilder.array([
supplier_details: this._formBuilder.array([
this.initDetails(), this.initDetails(),
]) ])
}); });
@ -134,12 +131,12 @@ apiLoadFinish: boolean = false;
} }
// convenience getter for easy access to form fields // convenience getter for easy access to form fields
get f() { return this._supplierQuesFrom.controls; } get f() { return this._clientQuesFrom.controls; }
// Dynamic Form field creation Functionality : START ===> // Dynamic Form field creation Functionality : START ===>
initDetails() { initDetails() {
return this._formBuilder.group({ return this._formBuilder.group({
supplier_name: ['', Validators.compose([Validators.required])], client_name: ['', Validators.compose([Validators.required])],
contact_person: ['', Validators.compose([Validators.required])], contact_person: ['', Validators.compose([Validators.required])],
mobile_number: ['', Validators.compose([Validators.required])], mobile_number: ['', Validators.compose([Validators.required])],
payment_mode: ['', Validators.compose([Validators.required])], payment_mode: ['', Validators.compose([Validators.required])],
@ -152,7 +149,7 @@ apiLoadFinish: boolean = false;
initDetailsWithdata(data) { initDetailsWithdata(data) {
return this._formBuilder.group({ return this._formBuilder.group({
supplier_name: [data.supplier_name, Validators.compose([Validators.required])], client_name: [data.client_name, Validators.compose([Validators.required])],
contact_person: [data.contact_person, Validators.compose([Validators.required])], contact_person: [data.contact_person, Validators.compose([Validators.required])],
mobile_number: [data.mobile_number, Validators.compose([Validators.required])], mobile_number: [data.mobile_number, Validators.compose([Validators.required])],
payment_mode: [data.payment_mode, Validators.compose([Validators.required])], payment_mode: [data.payment_mode, Validators.compose([Validators.required])],
@ -163,7 +160,7 @@ apiLoadFinish: boolean = false;
}); });
} }
addSupplierDetailsWithData(supp_data) { addClientDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function(key) { var result = Object.keys(supp_data).map(function(key) {
return supp_data[key]; return supp_data[key];
@ -171,7 +168,7 @@ var result = Object.keys(supp_data).map(function(key) {
if (result.length > 0) { if (result.length > 0) {
for (let val of result) { for (let val of result) {
let vals = { let vals = {
supplier_name: val.supplier_name, client_name: val.client_name,
contact_person: val.contact_person, contact_person: val.contact_person,
mobile_number: val.mobile_number, mobile_number: val.mobile_number,
payment_mode: val.payment_mode, payment_mode: val.payment_mode,
@ -180,18 +177,18 @@ var result = Object.keys(supp_data).map(function(key) {
frequency_of_purchase: val.frequency_of_purchase, frequency_of_purchase: val.frequency_of_purchase,
freq_purchase_others_text_value: val.freq_purchase_others_text_value freq_purchase_others_text_value: val.freq_purchase_others_text_value
}; };
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details']; const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetailsWithdata(vals)); control.push(this.initDetailsWithdata(vals));
} }
} }
} }
addSupplierDetails(e) { addSupplierDetails(e) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details']; const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.push(this.initDetails()); control.push(this.initDetails());
} }
removeLanguage(i: number) { removeLanguage(i: number) {
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details']; const control = <FormArray>this._clientQuesFrom.controls['client_details'];
control.removeAt(i); control.removeAt(i);
} }
@ -209,14 +206,14 @@ var result = Object.keys(supp_data).map(function(key) {
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;
// stop here if form is invalid // stop here if form is invalid
if (this._supplierQuesFrom.invalid) { if (this._clientQuesFrom.invalid) {
return; return;
} else { } else {
var answerFormValues = this._supplierQuesFrom.value; var answerFormValues = this._clientQuesFrom.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]);
alert(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 => {

View File

@ -13,10 +13,10 @@
<input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year"> <input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)"> <input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)" type="number">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)"> <input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)" type="number">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Margin" formControlName="financial_margin"> <input matInput placeholder="Margin" formControlName="financial_margin">
@ -52,10 +52,10 @@
<input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year"> <input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)"> <input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)" type="number">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Net Profit / Loss" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)"> <input matInput placeholder="Net Profit / Loss" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)" type="number">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput disabled placeholder="Margin" formControlName="estimate_margin"> <input matInput disabled placeholder="Margin" formControlName="estimate_margin">