Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
db1ff3b21b
@ -194,20 +194,20 @@
|
||||
</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>
|
||||
<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">
|
||||
<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">
|
||||
<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">
|
||||
<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>
|
||||
@ -228,7 +228,7 @@
|
||||
</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="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>
|
||||
|
||||
@ -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
|
||||
@ -425,7 +387,7 @@ 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 || '']
|
||||
@ -442,7 +404,11 @@ loadDetails: boolean;
|
||||
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
|
||||
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 = <FormArray>this._assetsQuesFrom.controls['assets_details'];
|
||||
control.push(this.initDetailsWithdata(vals));
|
||||
@ -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 = (<FormArray>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 = <FormArray>this._assetsQuesFrom.controls.assets_details;
|
||||
arr.controls.splice(0);
|
||||
this.getPdSupplierFormDetails();
|
||||
}
|
||||
|
||||
// {
|
||||
// 'main_raw_materials': 'sdkjfal',
|
||||
// 'supplier_details' ; [
|
||||
@ -579,5 +553,4 @@ this.loadDetails = true;
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -390,7 +390,11 @@
|
||||
<ng-container *ngSwitchCase="3">
|
||||
<app-personal-info [pdid]="startPD" [pd_all_details]="pdFullDetails"></app-personal-info>
|
||||
</ng-container>
|
||||
<!-- end personal type questions -->
|
||||
<ng-container *ngSwitchCase="4">
|
||||
<app-assets-info [pdid]="startPD"></app-assets-info>
|
||||
</ng-container>
|
||||
<!-- end personal type questions
|
||||
-->
|
||||
</ng-container>
|
||||
</div>
|
||||
<!-- end form based questions -->
|
||||
|
||||
@ -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",{"records1":saveData})
|
||||
return this._http.post<any>(this.apiUrl+"savePDFormDetails",{"records":saveData})
|
||||
.pipe(
|
||||
catchError(this.handleError('operation', []))
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user