diff --git a/src/app/loan-edit-people/loan-edit-people.component.html b/src/app/loan-edit-people/loan-edit-people.component.html index cd06682..04541f2 100644 --- a/src/app/loan-edit-people/loan-edit-people.component.html +++ b/src/app/loan-edit-people/loan-edit-people.component.html @@ -1,49 +1,55 @@ - Loan Id: {{Loan.Id}} + Loan Id: {{Loan.Id}}
-
Select Clients
- - - - {{ dataItem.First +' ' + dataItem.Last}} - - -
-
-
- -
-
-
- +
+
+
Select Clients
+ + + + {{ dataItem.First +' ' + dataItem.Last}} + + - -
Assign Brokers
- - - - {{ dataItem.First +' ' + dataItem.Last}} - - -
-
-
- +
+
+
+ +
+
+
+
+
+
Assign Brokers
+ + + + {{ dataItem.First +' ' + dataItem.Last}} + + +
+
+
+ +
+
+
+
Other Related
- +  Basic Information {{Loan.Lender}} +
- @@ -12,7 +12,6 @@ ID from SuperCredit (Auto generated when save, cannot be changed) Error: the ID is required -
@@ -28,7 +27,6 @@ required [valuePrimitive] = "true" [(ngModel)] = "Loan.Status" - [ngModelOptions]="{standalone: true}" > cannot be changed after settlement @@ -49,8 +47,9 @@ - + E.g. 333 Opera House, Sydney Road, NSW 2000 , cannot be changed after settlement Loan Target is required @@ -95,7 +94,7 @@
- +
diff --git a/src/app/loan-edit/basicinfo/basicinfo.component.ts b/src/app/loan-edit/basicinfo/basicinfo.component.ts index d504c3a..4682f5a 100644 --- a/src/app/loan-edit/basicinfo/basicinfo.component.ts +++ b/src/app/loan-edit/basicinfo/basicinfo.component.ts @@ -1,5 +1,5 @@ import {Component, Input, OnInit, Output, EventEmitter} from '@angular/core'; -import {FormControl, FormGroup, Validators} from '@angular/forms'; +import {FormControl, FormGroup, NgForm, Validators} from '@angular/forms'; import {LoanModel} from '../../models/loan.model'; import {LoanSingleService} from '../../service/loan.single.service'; import {HttpErrorResponse} from '@angular/common/http'; @@ -52,7 +52,14 @@ export class BasicinfoComponent implements OnInit { ngOnInit(): void { } - public next(): void { + public next(basicInfoForm: NgForm): void { + + if ( ! basicInfoForm.valid ) { + basicInfoForm.form.markAllAsTouched(); + this.errorOccurred.emit('Please check your input, there are some errors'); + return ; + } + this.service.updateBasicInfo(this.Loan).subscribe( resp => { if ( this.Loan.Id === '' ) { diff --git a/src/app/loan-edit/loan-edit.component.html b/src/app/loan-edit/loan-edit.component.html index 0a293fa..0b6dbb5 100644 --- a/src/app/loan-edit/loan-edit.component.html +++ b/src/app/loan-edit/loan-edit.component.html @@ -43,7 +43,7 @@ (errorOccurred)="showError($event)" > -
+
Delete this Loan Allow Delete
diff --git a/src/app/loan-edit/loan-edit.component.ts b/src/app/loan-edit/loan-edit.component.ts index cd647aa..c8c0f63 100644 --- a/src/app/loan-edit/loan-edit.component.ts +++ b/src/app/loan-edit/loan-edit.component.ts @@ -4,7 +4,7 @@ import {StepperComponent} from '@progress/kendo-angular-layout'; import {LoanSingleService} from '../service/loan.single.service'; import {LoanModel} from '../models/loan.model'; import {BasicinfoComponent} from './basicinfo/basicinfo.component'; -import {ActivatedRoute} from '@angular/router'; +import {ActivatedRoute, Router} from '@angular/router'; import {AuthService} from '../service/auth.service'; @@ -25,6 +25,7 @@ export class LoanEditComponent implements OnInit { public curStepSuccess = false; public showDelete = false; + public navigateTo = ''; public steps = [ { label: 'Basic Info', isValid: true , errMsg: 'There are some errors'}, @@ -36,7 +37,7 @@ export class LoanEditComponent implements OnInit { public dialogOpened = false; public errorMessage = ''; - constructor( private lss: LoanSingleService, private actRoute: ActivatedRoute, private auth: AuthService) { } + constructor( private lss: LoanSingleService, private actRoute: ActivatedRoute, private auth: AuthService, private router: Router) { } // public get currentStepError(): boolean{ // const ret = false; // TODO: set the value @@ -74,7 +75,16 @@ export class LoanEditComponent implements OnInit { } public del(): void { - console.log('delete loan', this.Loan.Id); + this.lss.deleteLoan(this.Loan.Id).subscribe( + resp => { + console.log(resp); + this.showError('Loan' + resp + 'has been deleted'); + this.navigateTo='./#list-all-loans'; + }, + err => { + this.showError('Error Occurred, cannot delete: ' + err.toString()); + } + ); } public loadLoanById(id: string): void { @@ -96,10 +106,14 @@ export class LoanEditComponent implements OnInit { public action(status): void { this.dialogOpened = false; + if ( this.navigateTo !== '' ) { + this.router.navigate([this.navigateTo]); + } } public showError(msg: string): void{ this.errorMessage = msg; this.dialogOpened = true; } + } diff --git a/src/app/loan-edit/people-reward/people-reward.component.html b/src/app/loan-edit/people-reward/people-reward.component.html index 3d9b36e..a521361 100644 --- a/src/app/loan-edit/people-reward/people-reward.component.html +++ b/src/app/loan-edit/people-reward/people-reward.component.html @@ -1,9 +1,11 @@
- -
SuperCredit Loan Id: {{Loan.Id}}
+ +  Reward from Loan +
+ +
- { + return this.http.delete(this.auth.getUrl('loan/' + id)); + } + }