fixed recurring transaction editing

This commit is contained in:
piratefinn 2018-03-20 17:41:03 +00:00
parent 463bbe98a9
commit 40eef44666
2 changed files with 3 additions and 7 deletions

View file

@ -104,7 +104,7 @@
<label class="col-md-3 form-control-label" for="text-input">Budget Type</label> <label class="col-md-3 form-control-label" for="text-input">Budget Type</label>
<div class="col-md-9"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
<select type="text" class="form-control" [compareWith]="byId" [(ngModel)]="clickedRecur.category"> <select type="text" class="form-control" [(ngModel)]="clickedRecur.category">
<option value="0">Uncategorised</option> <option value="0">Uncategorised</option>
<option *ngFor="let category of categoryIdList" [ngValue]="category"> <option *ngFor="let category of categoryIdList" [ngValue]="category">
{{ categoryList[category] }} {{ categoryList[category] }}

View file

@ -58,10 +58,6 @@ export class TransactionLogComponent implements OnInit {
this.loadTransactions(1); this.loadTransactions(1);
} }
byId(c1: ItemModel, c2: ItemModel) {
return c1 && c2 ? c1.id === c2.id : c1 === c2;
}
loadTransactions(logPage: number) { loadTransactions(logPage: number) {
this.api.transList(logPage).subscribe( this.api.transList(logPage).subscribe(
result => { result => {
@ -104,7 +100,7 @@ export class TransactionLogComponent implements OnInit {
let updatedTimeSubmit = moment(this.updatedTime, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ'); let updatedTimeSubmit = moment(this.updatedTime, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
this.clickedRecur.display_time = moment(this.updatedTime).format('llll'); this.clickedRecur.display_time = moment(this.updatedTime).format('llll');
let myParams = { let myParams = {
category: 111, category: (this.clickedRecur.category == 0 ? undefined : this.clickedRecur.category),
essential: this.clickedRecur.essential, essential: this.clickedRecur.essential,
id: this.clickedRecur.id, id: this.clickedRecur.id,
apply_time: updatedTimeSubmit, apply_time: updatedTimeSubmit,
@ -118,7 +114,7 @@ export class TransactionLogComponent implements OnInit {
result => { result => {
if ( result.success === true ) { if ( result.success === true ) {
this.transactionFormStatus = 'success'; this.transactionFormStatus = 'success';
this.resetForm(); this.transactionFormStatusSuccess = 'Edit Succeeded.';
} else { } else {
this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message); this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
this.transactionFormStatus = 'send_failed'; this.transactionFormStatus = 'send_failed';