assets info pd Form added : kdk
This commit is contained in:
parent
22dbdf39af
commit
f8d080927a
@ -0,0 +1,235 @@
|
||||
<!--<pre> {{ m_group | json}}</pre>-->
|
||||
<mat-card style="padding: 12px;">
|
||||
<form *ngIf="apiLoadFinish && loadDetails" [formGroup]="_assetsQuesFrom" (submit)="onSubmit()" novalidate>
|
||||
<div fxLayout="row" fxLayoutAlign="start none">
|
||||
<div formArrayName="assets_details" fxFill>
|
||||
<div *ngFor="let sup of _assetsQuesFrom.controls.assets_details['controls']; let i=index">
|
||||
<mat-card>
|
||||
<div [formGroupName]="i">
|
||||
<div fxLayout="row wrap" fxLayoutGap="12px" fxLayoutAlign="start none">
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<mat-select (selectionChange)="selectedAssetsType($event, i)" placeholder="Select Assets Type" formControlName="assets_mode">
|
||||
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id">{{ asset.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<!--Desction Dynamic details: START-->
|
||||
<div formArrayName="details" class="example-full-width">
|
||||
<!--Property-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 1 ">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Select Property" formControlName="property_type">
|
||||
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Four Wheeler-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 2">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Two Wheeler-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 3">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Manufacturer, Model" formControlName="manufacturer_model">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--jwell details-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 4">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Description" formControlName="jwell_description">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Consumer Durable-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 5">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Description" formControlName="consumer_durable_description">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Insurance-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 6">
|
||||
<div fxFill>
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="33">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Type" formControlName="insurance_type">
|
||||
<mat-option *ngFor="let ins_type of m_insuranceType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Premium Paid" formControlName="premium_paid">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Frequency" formControlName="frequency_mode">
|
||||
<mat-option *ngFor="let freqn of m_freqOfPurchase" [value]="freqn.id">{{ freqn.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Sum Assured" formControlName="sum_assured">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Members Covered" formControlName="members_coverd">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Investments-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 7">
|
||||
<div>
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="33">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Type" formControlName="investments_type">
|
||||
<mat-option *ngFor="let ins_type of m_investmentType" [value]="ins_type.id">{{ ins_type.name }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Amount of Investment" formControlName="amount_of_invest">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Bank Name" formControlName="bank_name">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--other assets-->
|
||||
<div *ngIf="sup.get('assets_mode').value == 8">
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div *ngFor="let detail of sup['controls'].details['controls']; let s = index">
|
||||
<div [formGroupName]="s">
|
||||
<div>
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Desction Dynamic details : END -->
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Approximate Market Value" formControlName="approximate_market_value">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Name of the Owner" formControlName="name_of_the_owner">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Year of Purchase and Approximate month" formControlName="year_of_purchase">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="33">
|
||||
<mat-checkbox formControlName="emi" [ngModel]="sup.get('emi').value === 1 ? true : false"
|
||||
(ngModelChange)="sup.get('emi').value = $event ? 1 : 0">EMI</mat-checkbox>
|
||||
</div>
|
||||
<div *ngIf="sup.get('emi').value === 1" fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="EMI Paid" formControlName="emi_paid">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="sup.get('emi').value === 1" fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Elapsed Tenure" formControlName="elapsed_tenure">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="sup.get('emi').value === 1" fxFlex="33">
|
||||
<mat-form-field class="ml-xs example-full-width">
|
||||
<input matInput placeholder="Balance Tenure" formControlName="balance_tenure">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row" fxLayoutGap="12px" fxLayoutAlign="start none">
|
||||
<div fxFlex="20">
|
||||
<span *ngIf="_assetsQuesFrom.controls.assets_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>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
<button mat-raised-button mat-icon-button mat-button color="primary" matTooltip="Add More Answer" matTooltipPosition="above"
|
||||
class="mr-1 mb-1 hover-icon" (click)="addSupplierDetails($event); false"><mat-icon>add</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="text-align:right;">
|
||||
<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>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AssetsInfoComponent } from './assets-info.component';
|
||||
|
||||
describe('AssetsInfoComponent', () => {
|
||||
let component: AssetsInfoComponent;
|
||||
let fixture: ComponentFixture<AssetsInfoComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AssetsInfoComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AssetsInfoComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,583 @@
|
||||
/** Common Imports */
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
Inject,
|
||||
Input
|
||||
} from '@angular/core';
|
||||
|
||||
import {
|
||||
FormBuilder,
|
||||
FormGroup,
|
||||
Validators,
|
||||
FormArray,
|
||||
} from '@angular/forms';
|
||||
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
import {
|
||||
MatDialog,
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA
|
||||
} from '@angular/material';
|
||||
/** Service */
|
||||
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
|
||||
@Component({
|
||||
selector: 'app-assets-info',
|
||||
templateUrl: './assets-info.component.html',
|
||||
styleUrls: ['./assets-info.component.scss']
|
||||
})
|
||||
export class AssetsInfoComponent implements OnInit {
|
||||
|
||||
@Input() pdid: number;
|
||||
|
||||
public _assetsQuesFrom: FormGroup;
|
||||
public submitted = false;
|
||||
|
||||
public m_assets_type = [
|
||||
{
|
||||
'id': "1",
|
||||
'name': "Property"
|
||||
},
|
||||
{
|
||||
'id': "2",
|
||||
'name': "Four Wheeler"
|
||||
},
|
||||
{
|
||||
'id': "3",
|
||||
'name': "Two Wheeler"
|
||||
},
|
||||
{
|
||||
'id': "4",
|
||||
'name': "Jewellery"
|
||||
},
|
||||
{
|
||||
'id': "5",
|
||||
'name': "Consumer Durable"
|
||||
},
|
||||
{
|
||||
'id': "6",
|
||||
'name': "Insurance"
|
||||
},
|
||||
{
|
||||
'id': "7",
|
||||
'name': "Investments"
|
||||
},
|
||||
{
|
||||
'id': "8",
|
||||
'name': "Others"
|
||||
}
|
||||
]
|
||||
|
||||
public m_propertyType = [
|
||||
{
|
||||
'id': "1",
|
||||
'name': 'Residential'
|
||||
},
|
||||
{
|
||||
'id': "2",
|
||||
'name': 'Commercial'
|
||||
},
|
||||
{
|
||||
'id': "3",
|
||||
'name': 'Industrial'
|
||||
},
|
||||
{
|
||||
'id': "4",
|
||||
'name': 'Land'
|
||||
}
|
||||
];
|
||||
|
||||
public m_insuranceType = [{
|
||||
'id': "1",
|
||||
'name': 'Life'
|
||||
}, {
|
||||
'id': "2",
|
||||
'name': 'Health'
|
||||
}]
|
||||
|
||||
public m_investmentType = [{
|
||||
'id': "1",
|
||||
'name': 'FD'
|
||||
}, {
|
||||
'id': "2",
|
||||
'name': 'RD'
|
||||
}, {
|
||||
'id': "3",
|
||||
'name': 'Mutual Funds'
|
||||
}, {
|
||||
'id': "4",
|
||||
'name': 'PPF'
|
||||
}, {
|
||||
'id': "5",
|
||||
'name': 'Shares'
|
||||
}, {
|
||||
'id': "6",
|
||||
'name': 'Others'
|
||||
}]
|
||||
|
||||
public m_freqOfPurchase = [
|
||||
{
|
||||
'id': "1",
|
||||
'name': 'Daily'
|
||||
},
|
||||
{
|
||||
'id': "2",
|
||||
'name': 'Weekly'
|
||||
},
|
||||
{
|
||||
'id': "3",
|
||||
'name': 'Monthly'
|
||||
},
|
||||
{
|
||||
'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'
|
||||
}
|
||||
]
|
||||
|
||||
constructor(
|
||||
private _formBuilder: FormBuilder,
|
||||
private pdTrigerService: PdTrigerService) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.getPdSupplierFormDetails();
|
||||
}
|
||||
apiLoadFinish: boolean = false;
|
||||
getPdSupplierFormDetails() {
|
||||
this.pdTrigerService.getPDFormDetailsWithID(this.pdid, '4').subscribe(
|
||||
data => {
|
||||
if (data) {
|
||||
if (data.dataStatus) {
|
||||
this.formLoadData(data.records1)
|
||||
} else {
|
||||
let data =
|
||||
{
|
||||
"records1":{
|
||||
"pdid":"60",
|
||||
"formid":"4",
|
||||
"assets_details":[
|
||||
{
|
||||
"assets_mode":"1",
|
||||
"details":[
|
||||
{
|
||||
"property_type":"1"
|
||||
}
|
||||
],
|
||||
"approximate_market_value":"12000",
|
||||
"name_of_the_owner":"xyz",
|
||||
"year_of_purchase":"2010",
|
||||
"emi":0,
|
||||
"emi_paid":"",
|
||||
"elapsed_tenure":"",
|
||||
"balance_tenure":""
|
||||
},
|
||||
{
|
||||
"assets_mode":"7",
|
||||
"details":[
|
||||
{
|
||||
"investments_type":"1",
|
||||
"amount_of_invest":"200000",
|
||||
"bank_name":"mmm bank"
|
||||
}
|
||||
],
|
||||
"approximate_market_value":"123333",
|
||||
"name_of_the_owner":"msnc",
|
||||
"year_of_purchase":"2013",
|
||||
"emi":1,
|
||||
"emi_paid":"fasdf",
|
||||
"elapsed_tenure":"sdfasd",
|
||||
"balance_tenure":"sdfasdf"
|
||||
}
|
||||
],
|
||||
"fk_createdby":"1"
|
||||
}
|
||||
}
|
||||
this.formLoadData(data.records1)
|
||||
// this.formLoadData(null);
|
||||
}
|
||||
this.apiLoadFinish = true;
|
||||
} else {
|
||||
// this.noRecordFound = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
formLoadData(val) {
|
||||
if (val !== null) {
|
||||
let value = val;
|
||||
this._assetsQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['4'],
|
||||
assets_details: this._formBuilder.array([
|
||||
// this.initDetails(),
|
||||
])
|
||||
});
|
||||
this.addAssetsDetailsWithData(value.assets_details);
|
||||
} else {
|
||||
this._assetsQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['4'],
|
||||
assets_details: this._formBuilder.array([
|
||||
this.initDetails(),
|
||||
])
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// convenience getter for easy access to form fields
|
||||
get f() { return this._assetsQuesFrom.controls; }
|
||||
|
||||
get f_assets_details() {
|
||||
return <FormArray>this._assetsQuesFrom.get('assets_details');
|
||||
}
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initDetails() {
|
||||
return this._formBuilder.group({
|
||||
assets_mode: ['', Validators.compose([Validators.required])],
|
||||
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])],
|
||||
emi: [''] ,
|
||||
emi_paid: [''],
|
||||
elapsed_tenure:[''],
|
||||
balance_tenure: ['']
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
show: boolean;
|
||||
selectedAssetsType(e: any, i: any): void {
|
||||
let val = i;
|
||||
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
arr.controls.splice(0);
|
||||
switch (e.value) {
|
||||
case '1': {
|
||||
let val = i;
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadProperty());
|
||||
break;
|
||||
}
|
||||
case '2': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.load_Two_Four_Weeler());
|
||||
break;
|
||||
}
|
||||
case '3': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.load_Two_Four_Weeler());
|
||||
break;
|
||||
}
|
||||
case '4': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadJwellDescription());
|
||||
break;
|
||||
}
|
||||
case '5': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadConsumerDurableDescription());
|
||||
break;
|
||||
}
|
||||
case '6': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadInsuranceDescription());
|
||||
break;
|
||||
}
|
||||
case '7': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadInvestDescription());
|
||||
break;
|
||||
}
|
||||
case '8': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.otherAssetsDescription());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loadProperty() {
|
||||
return this._formBuilder.group({
|
||||
property_type: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadJwellDescription() {
|
||||
return this._formBuilder.group({
|
||||
jwell_description: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadConsumerDurableDescription() {
|
||||
return this._formBuilder.group({
|
||||
consumer_durable_description: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
otherAssetsDescription() {
|
||||
return this._formBuilder.group({
|
||||
any_other_assets: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadInsuranceDescription() {
|
||||
return this._formBuilder.group({
|
||||
insurance_type: ['', Validators.compose([Validators.required])],
|
||||
premium_paid: ['', Validators.compose([Validators.required])],
|
||||
frequency_mode: ['', Validators.compose([Validators.required])],
|
||||
sum_assured: ['', Validators.compose([Validators.required])],
|
||||
members_coverd: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadInvestDescription() {
|
||||
return this._formBuilder.group({
|
||||
investments_type: ['', Validators.compose([Validators.required])],
|
||||
amount_of_invest: ['', Validators.compose([Validators.required])],
|
||||
bank_name: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
load_Two_Four_Weeler() {
|
||||
return this._formBuilder.group({
|
||||
manufacturer_model: ['', Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
loadPropertyWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
property_type: [data.property_type, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadJwellDescriptionWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
jwell_description: [data.jwell_description, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadConsumerDurableDescriptionWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
consumer_durable_description: [data.consumer_durable_description, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
otherAssetsDescriptionWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
any_other_assets: [data.any_other_assets, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadInsuranceDescriptionWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
insurance_type: [data.insurance_type, Validators.compose([Validators.required])],
|
||||
premium_paid: [data.premium_paid, Validators.compose([Validators.required])],
|
||||
frequency_mode: [data.frequency_mode, Validators.compose([Validators.required])],
|
||||
sum_assured: [data.sum_assured, Validators.compose([Validators.required])],
|
||||
members_coverd: [data.members_coverd, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
loadInvestDescriptionWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
investments_type: [data.investments_type, Validators.compose([Validators.required])],
|
||||
amount_of_invest: [data.amount_of_invest, Validators.compose([Validators.required])],
|
||||
bank_name: [data.bank_name, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
load_Two_Four_WeelerWithData(data) {
|
||||
return this._formBuilder.group({
|
||||
manufacturer_model: [data.manufacturer_model, Validators.compose([Validators.required])]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
initDetailsWithdata(data) {
|
||||
return this._formBuilder.group({
|
||||
assets_mode: [data.assets_mode, Validators.compose([Validators.required])],
|
||||
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])],
|
||||
emi: [data.year_of_purchase],
|
||||
emi_paid: [data.emi_paid || ''],
|
||||
elapsed_tenure:[data.elapsed_tenure || ''],
|
||||
balance_tenure: [data.balance_tenure || '']
|
||||
});
|
||||
}
|
||||
loadDetails: boolean;
|
||||
addAssetsDetailsWithData(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 = {
|
||||
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
|
||||
};
|
||||
const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
|
||||
control.push(this.initDetailsWithdata(vals));
|
||||
this.setAssetsDetailsWithData(vals.assets_mode, val.details , control.length - 1)
|
||||
}
|
||||
}
|
||||
this.loadDetails = true;
|
||||
}
|
||||
|
||||
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
|
||||
let val = i;
|
||||
// var data = Object.keys(datas).map(function (key) {
|
||||
// return datas[key];
|
||||
// });
|
||||
let data= datas[0];
|
||||
const arr = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
arr.controls.splice(0);
|
||||
switch (assets_details_mode) {
|
||||
case '1': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadPropertyWithData(data));
|
||||
break;
|
||||
}
|
||||
case '2': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.load_Two_Four_WeelerWithData(data));
|
||||
break;
|
||||
}
|
||||
case '3': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.load_Two_Four_WeelerWithData(data));
|
||||
break;
|
||||
}
|
||||
case '4': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadJwellDescriptionWithData(data));
|
||||
break;
|
||||
}
|
||||
case '5': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadConsumerDurableDescriptionWithData(data));
|
||||
break;
|
||||
}
|
||||
case '6': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadInsuranceDescriptionWithData(data));
|
||||
break;
|
||||
}
|
||||
case '7': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.loadInvestDescriptionWithData(data));
|
||||
break;
|
||||
}
|
||||
case '8': {
|
||||
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
|
||||
control.push(this.otherAssetsDescriptionWithData(data));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addSupplierDetails(e) {
|
||||
const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
|
||||
control.push(this.initDetails());
|
||||
}
|
||||
removeLanguage(i: number) {
|
||||
const control = <FormArray>this._assetsQuesFrom.controls['assets_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 */
|
||||
onSubmit() {
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
if (this._assetsQuesFrom.invalid) {
|
||||
alert()
|
||||
return;
|
||||
} else {
|
||||
var answerFormValues = this._assetsQuesFrom.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 => {
|
||||
if (dataresult.status == 200) {
|
||||
// console.log(dataresult);
|
||||
// this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||
// this.dialogRef.close();
|
||||
// alert("sample alert for Saving");
|
||||
}
|
||||
else {
|
||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
||||
}
|
||||
}, error => {
|
||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
// this.errorMessage = "Something Wents Wrong Try Again !";
|
||||
// this.dialogRef.close();
|
||||
});
|
||||
//After Saving the BRANCH data then popup close
|
||||
// this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** To Reset Popup Data */
|
||||
onReset() {
|
||||
// this._addQuesFrom.reset();
|
||||
}
|
||||
|
||||
// {
|
||||
// 'main_raw_materials': 'sdkjfal',
|
||||
// 'supplier_details' ; [
|
||||
// {
|
||||
// 'supplier_name':'ldskjfalks',
|
||||
// 'payment_mode': '1',
|
||||
// 'payment_mode_value':''
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
}
|
||||
@ -164,10 +164,9 @@ apiLoadFinish: boolean = false;
|
||||
}
|
||||
|
||||
addSupplierDetailsWithData(supp_data) {
|
||||
|
||||
var result = Object.keys(supp_data).map(function(key) {
|
||||
var result = Object.keys(supp_data).map(function(key) {
|
||||
return supp_data[key];
|
||||
});
|
||||
});
|
||||
if (result.length > 0) {
|
||||
for (let val of result) {
|
||||
let vals = {
|
||||
|
||||
@ -45,7 +45,10 @@ categoryFormButtons : any=[
|
||||
"form_id":3,
|
||||
"form_name":"Personal Details",
|
||||
},
|
||||
|
||||
{
|
||||
"form_id":4,
|
||||
"form_name":"Asset Details",
|
||||
},
|
||||
];
|
||||
|
||||
formsCategoryEnable:boolean=false;
|
||||
|
||||
@ -45,6 +45,7 @@ import { QcCompletedPdComponent } from './list-pd/qc-completed-pd/qc-completed-p
|
||||
import { ClientInfoComponent } from './list-pd/start-pd/forms/client-info/client-info.component';
|
||||
import { SupplierInfoComponent } from './list-pd/start-pd/forms/supplier-info/supplier-info.component';
|
||||
import { PersonalInfoComponent } from './list-pd/start-pd/forms/personal-info/personal-info.component';
|
||||
import { AssetsInfoComponent } from './list-pd/start-pd/forms/assets-info/assets-info.component';
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
*/
|
||||
@ -115,7 +116,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
||||
AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),OwlDateTimeModule,
|
||||
OwlNativeDateTimeModule,
|
||||
],
|
||||
declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent],
|
||||
declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent],
|
||||
exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
|
||||
providers: [PdTrigerService, GetGeometricLocationService],
|
||||
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent]
|
||||
|
||||
@ -203,7 +203,7 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
|
||||
// saveData[0].fk_updatedby = this._aws.getlocale();
|
||||
// saveData[0].updatedon = currentdate;
|
||||
|
||||
return this._http.post<any>(this.apiUrl+"savePDFormDetails",{"records":saveData})
|
||||
return this._http.post<any>(this.apiUrl+"savePDFormDetails",{"records1":saveData})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
@ -216,7 +216,7 @@ getPDFormDetailsWithID(pdID, formID ):Observable<any> {
|
||||
// saveData[0].fk_updatedby = this._aws.getlocale();
|
||||
// saveData[0].updatedon = currentdate;
|
||||
|
||||
return this._http.post<any>(this.apiUrl+"savePDQuestions",{"records":saveData})
|
||||
return this._http.post<any>(this.apiUrl+"savePDQuestions",{"records1":saveData})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user