Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
89e49a8d81
@ -193,13 +193,34 @@
|
||||
</mat-form-field>
|
||||
</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">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Year and Month of Purchase" formControlName="year_of_purchase">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label>Year and Month of Purchase?</label>
|
||||
<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 *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 *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"
|
||||
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>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -299,7 +299,8 @@ public m_investmentType = [];
|
||||
details: this._formBuilder.array([]),
|
||||
approximate_market_value: ['', 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_paid: [''],
|
||||
elapsed_tenure: [''],
|
||||
@ -467,7 +468,8 @@ public m_investmentType = [];
|
||||
details: this._formBuilder.array([]),
|
||||
approximate_market_value: [data.approximate_market_value, 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_paid: [data.emi_paid || ''],
|
||||
elapsed_tenure: [data.elapsed_tenure || ''],
|
||||
@ -485,7 +487,8 @@ public m_investmentType = [];
|
||||
assets_mode: val.assets_mode,
|
||||
approximate_market_value: val.approximate_market_value,
|
||||
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_paid: val.emi_paid,
|
||||
elapsed_tenure: val.elapsed_tenure,
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<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-select>
|
||||
</mat-form-field>
|
||||
|
||||
@ -75,13 +75,19 @@ export class BusinessInfoComponent implements OnInit {
|
||||
return data.records.family_members_involved[key];
|
||||
});
|
||||
let enduse: any = [];
|
||||
let existRelative: any =[];
|
||||
selectedMembers.forEach(val => {
|
||||
enduse.push(val.member);
|
||||
existRelative.push(val);
|
||||
});
|
||||
this.relativeNames = existRelative;
|
||||
if (DesgnArray.length == 0) {
|
||||
Desgn.push(this.createDesignation());
|
||||
} else {
|
||||
DesgnArray.forEach(datas => {
|
||||
Desgn.push(this.createDesignation());
|
||||
});
|
||||
|
||||
}
|
||||
if (PartnrArray.length == 0) {
|
||||
Partnr.push(this.createPartners());
|
||||
@ -90,7 +96,7 @@ export class BusinessInfoComponent implements OnInit {
|
||||
Partnr.push(this.createPartners());
|
||||
});
|
||||
}
|
||||
if (data.other_documents == 'yes') {
|
||||
if (data.records.other_documents == 'yes') {
|
||||
DocArray = Object.keys(data.records.documents).map(function (key) {
|
||||
return data.records.documents[key];
|
||||
});
|
||||
@ -114,7 +120,6 @@ export class BusinessInfoComponent implements OnInit {
|
||||
businessVal.designation = DesgnArray;
|
||||
businessVal.partners = PartnrArray;
|
||||
businessVal.documents = DocArray;
|
||||
console.log('businessVal', businessVal);
|
||||
|
||||
this.businessForm.setValue(businessVal);
|
||||
} else {
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
<!--<pre> {{ m_group | json}}</pre>-->
|
||||
<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 formArrayName="supplier_details" fxFill>
|
||||
<div *ngFor="let sup of _supplierQuesFrom.controls.supplier_details['controls']; let i=index">
|
||||
<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="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-form-field>
|
||||
</div>
|
||||
@ -62,7 +62,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -31,7 +31,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
|
||||
@Input() pdid: number;
|
||||
|
||||
public _supplierQuesFrom: FormGroup;
|
||||
public _clientQuesFrom: FormGroup;
|
||||
public submitted = false;
|
||||
public m_paymentModeType= [
|
||||
{
|
||||
@ -88,12 +88,11 @@ export class ClientInfoComponent implements OnInit {
|
||||
private pdTrigerService: PdTrigerService) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getPdSupplierFormDetails();
|
||||
this.getClientFormDetails();
|
||||
}
|
||||
apiLoadFinish: boolean = false;
|
||||
getPdSupplierFormDetails() {
|
||||
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '1').subscribe(
|
||||
getClientFormDetails() {
|
||||
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '2').subscribe(
|
||||
data => {
|
||||
if (data) {
|
||||
if(data.dataStatus){
|
||||
@ -112,21 +111,19 @@ apiLoadFinish: boolean = false;
|
||||
formLoadData(val) {
|
||||
if(val !== null) {
|
||||
let value = val;
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
this._clientQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['1'],
|
||||
main_raw_materials: [value.main_raw_materials, Validators.compose([Validators.required])],
|
||||
supplier_details: this._formBuilder.array([
|
||||
formid: ['2'],
|
||||
client_details: this._formBuilder.array([
|
||||
// this.initDetails(),
|
||||
])
|
||||
});
|
||||
this.addSupplierDetailsWithData(value.supplier_details);
|
||||
this.addClientDetailsWithData(value.client_details);
|
||||
} else {
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
this._clientQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['1'],
|
||||
main_raw_materials: [null, Validators.compose([Validators.required])],
|
||||
supplier_details: this._formBuilder.array([
|
||||
formid: ['2'],
|
||||
client_details: this._formBuilder.array([
|
||||
this.initDetails(),
|
||||
])
|
||||
});
|
||||
@ -134,12 +131,12 @@ apiLoadFinish: boolean = false;
|
||||
}
|
||||
|
||||
// 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 ===>
|
||||
initDetails() {
|
||||
return this._formBuilder.group({
|
||||
supplier_name: ['', Validators.compose([Validators.required])],
|
||||
client_name: ['', Validators.compose([Validators.required])],
|
||||
contact_person: ['', Validators.compose([Validators.required])],
|
||||
mobile_number: ['', Validators.compose([Validators.required])],
|
||||
payment_mode: ['', Validators.compose([Validators.required])],
|
||||
@ -152,7 +149,7 @@ apiLoadFinish: boolean = false;
|
||||
|
||||
initDetailsWithdata(data) {
|
||||
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])],
|
||||
mobile_number: [data.mobile_number, 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) {
|
||||
return supp_data[key];
|
||||
@ -171,7 +168,7 @@ var result = Object.keys(supp_data).map(function(key) {
|
||||
if (result.length > 0) {
|
||||
for (let val of result) {
|
||||
let vals = {
|
||||
supplier_name: val.supplier_name,
|
||||
client_name: val.client_name,
|
||||
contact_person: val.contact_person,
|
||||
mobile_number: val.mobile_number,
|
||||
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,
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addSupplierDetails(e) {
|
||||
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
|
||||
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
|
||||
control.push(this.initDetails());
|
||||
}
|
||||
removeLanguage(i: number) {
|
||||
const control = <FormArray>this._supplierQuesFrom.controls['supplier_details'];
|
||||
const control = <FormArray>this._clientQuesFrom.controls['client_details'];
|
||||
control.removeAt(i);
|
||||
}
|
||||
|
||||
@ -209,14 +206,14 @@ var result = Object.keys(supp_data).map(function(key) {
|
||||
onSubmit() {
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
if (this._supplierQuesFrom.invalid) {
|
||||
if (this._clientQuesFrom.invalid) {
|
||||
return;
|
||||
} else {
|
||||
var answerFormValues = this._supplierQuesFrom.value;
|
||||
var answerFormValues = this._clientQuesFrom.value;
|
||||
|
||||
// To Remove The "Null" With Key also
|
||||
Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]);
|
||||
alert(JSON.stringify(answerFormValues));
|
||||
|
||||
// Add BRANCH data with help Service File
|
||||
this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe(
|
||||
dataresult => {
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
<input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year">
|
||||
</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>
|
||||
<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>
|
||||
<input matInput placeholder="Margin" formControlName="financial_margin">
|
||||
@ -52,10 +52,10 @@
|
||||
<input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year">
|
||||
</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>
|
||||
<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>
|
||||
<input matInput disabled placeholder="Margin" formControlName="estimate_margin">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user