+
-
-
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
index 81c00de7e..204344fbb 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/assets-info/assets-info.component.ts
@@ -151,9 +151,13 @@ export class AssetsInfoComponent implements OnInit {
}
]
+ private notifier: NotifierService;
constructor(
+ notifier: NotifierService,
private _formBuilder: FormBuilder,
- private pdTrigerService: PdTrigerService) { }
+ private pdTrigerService: PdTrigerService) {
+ this.notifier = notifier;
+ }
ngOnInit() {
@@ -165,52 +169,9 @@ export class AssetsInfoComponent implements OnInit {
data => {
if (data) {
if (data.dataStatus) {
- this.formLoadData(data.records1)
+ this.formLoadData(data.records);
} 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.formLoadData(null);
}
this.apiLoadFinish = true;
} else {
@@ -240,6 +201,7 @@ export class AssetsInfoComponent implements OnInit {
])
});
}
+ this.loadDetails = true;
}
// convenience getter for easy access to form fields
@@ -257,11 +219,11 @@ export class AssetsInfoComponent implements OnInit {
approximate_market_value: ['', Validators.compose([Validators.required])],
name_of_the_owner: ['', Validators.compose([Validators.required])],
year_of_purchase: ['', Validators.compose([Validators.required])],
- emi: [''] ,
+ emi: [''],
emi_paid: [''],
- elapsed_tenure:[''],
+ elapsed_tenure: [''],
balance_tenure: ['']
- });
+ });
}
@@ -425,13 +387,13 @@ export class AssetsInfoComponent implements OnInit {
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: [data.emi || 0],
emi_paid: [data.emi_paid || ''],
- elapsed_tenure:[data.elapsed_tenure || ''],
- balance_tenure: [data.balance_tenure || '']
- });
+ elapsed_tenure: [data.elapsed_tenure || ''],
+ balance_tenure: [data.balance_tenure || '']
+ });
}
-loadDetails: boolean;
+ loadDetails: boolean;
addAssetsDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function (key) {
return supp_data[key];
@@ -439,17 +401,21 @@ loadDetails: boolean;
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
+ 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,
+ emi: val.emi,
+ emi_paid: val.emi_paid,
+ elapsed_tenure: val.elapsed_tenure,
+ balance_tenure: val.balance_tenure
};
const control =
this._assetsQuesFrom.controls['assets_details'];
control.push(this.initDetailsWithdata(vals));
- this.setAssetsDetailsWithData(vals.assets_mode, val.details , control.length - 1)
+ this.setAssetsDetailsWithData(vals.assets_mode, val.details, control.length - 1)
}
}
-this.loadDetails = true;
+ this.loadDetails = true;
}
setAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
@@ -457,7 +423,8 @@ this.loadDetails = true;
// var data = Object.keys(datas).map(function (key) {
// return datas[key];
// });
- let data= datas[0];
+ // alert(JSON.stringify(datas));
+ let data = datas;
const arr = (this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
arr.controls.splice(0);
switch (assets_details_mode) {
@@ -533,29 +500,35 @@ this.loadDetails = true;
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));
+ answerFormValues.assets_details.map(val => {
+ if (val.emi == '0') {
+ val.emi_paid = '';
+ val.elapsed_tenure = '';
+ val.balance_tenure = '';
+ }
+ });
+
// 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.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.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.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// this.errorMessage = "Something Wents Wrong Try Again !";
// this.dialogRef.close();
});
@@ -566,9 +539,10 @@ this.loadDetails = true;
/** To Reset Popup Data */
onReset() {
- // this._addQuesFrom.reset();
+ const arr = this._assetsQuesFrom.controls.assets_details;
+ arr.controls.splice(0);
+ this.getPdSupplierFormDetails();
}
-
// {
// 'main_raw_materials': 'sdkjfal',
// 'supplier_details' ; [
@@ -579,5 +553,4 @@ this.loadDetails = true;
// }
// ]
// }
-
}
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
index 7788df8b8..3f9b53c34 100644
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html
@@ -390,7 +390,11 @@
-
+
+
+
+
diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
index 7013bf116..dec74ad4f 100644
--- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
+++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts
@@ -203,7 +203,7 @@ getPDFormDetailsWithID(pdID, formID ):Observable