diff --git a/src/app/loan-edit/people-reward/people-reward.component.ts b/src/app/loan-edit/people-reward/people-reward.component.ts index cef1b24..0ebe571 100644 --- a/src/app/loan-edit/people-reward/people-reward.component.ts +++ b/src/app/loan-edit/people-reward/people-reward.component.ts @@ -144,7 +144,6 @@ export class PeopleRewardComponent implements OnInit { // update Loan this.Loan.updateReward(resp.Amount, resp.Description, resp.Id, resp.LoanId, resp.PayOutId, resp.To, resp.From, resp.Ts); } - // console.log(resp); } ); diff --git a/src/app/models/broker.model.ts b/src/app/models/broker.model.ts index c702a83..94d62f7 100644 --- a/src/app/models/broker.model.ts +++ b/src/app/models/broker.model.ts @@ -1,34 +1,43 @@ import {PeopleModel} from './people.model'; import {UserExtraModel} from './user-extra.model'; -export class BrokerModel{ - constructor( - public Id: string, - public First: string, - public Last: string, - public Middle: string, - public Title: string, - public Display: string, - public Nick: string, - public Login: string, - public Enabled: boolean, - public BSB: string, - public ACC: string, - public License: string, - public Organization: string - ){} +export class BrokerModel extends PeopleModel { + public Login: string; + public BSB: string; + public ACC: string; + public License: string; + public Organization: string; + constructor( payload: Partial) { + super(payload); + this.Login = payload.Login || ''; + this.BSB = payload.BSB || ''; + this.ACC = payload.ACC || ''; + this.License = payload.License || ''; + this.Organization = payload.Organization || ''; + } public static EmptyNew(): BrokerModel { - return new BrokerModel('', '', '', '', '', '', '', - '', false, '', '', '', ''); + return new BrokerModel({}); } public static getFromUserAndExtra(u: PeopleModel, ex: UserExtraModel): BrokerModel { - return new BrokerModel( - u.Id, u.First, u.Last, u.Middle, u.Title, u.Display, u.Nick, ex.Login, u.Enabled, ex.BSB, ex.ACC, ex.License, ex.Organization - ); + const ret = new BrokerModel({}); + ret.Id = u.Id; + ret.First = u.First; + ret.Last = u.Last; + ret.Middle = u.Middle; + ret.Title = u.Title; + ret.Display = u.Display; + ret.Nick = u.Nick; + ret.Login = ex.Login; + ret.Enabled = u.Enabled; + ret.BSB = ex.BSB; + ret.ACC = ex.ACC; + ret.License = ex.License; + ret.Organization = ex.Organization; + return ret; } public toPeopleModel(): PeopleModel{ diff --git a/src/app/models/loan.model.ts b/src/app/models/loan.model.ts index 1ac77fe..2da0f55 100644 --- a/src/app/models/loan.model.ts +++ b/src/app/models/loan.model.ts @@ -193,10 +193,7 @@ export class LoanModel { private setBroker(v: any[]): void{ this.Broker = []; v.forEach((b => { - this.Broker.push(new BrokerModel( - b.Id, b.First, b.Last, b.Middle, b.Title, b.Display, b.Nick, b.Login, b.Enabled, b.BSB, b.ACC, b.License, b.Organization - ) - ); + this.Broker.push(new BrokerModel(b) ); })); }