- Edit Succeeded.
+ {{transactionFormStatusSuccess}}
{{transactionFormStatusError}}
diff --git a/src/app/dashboard/transaction-log.component.ts b/src/app/dashboard/transaction-log.component.ts
index e9e10ce..580a4a9 100644
--- a/src/app/dashboard/transaction-log.component.ts
+++ b/src/app/dashboard/transaction-log.component.ts
@@ -26,6 +26,7 @@ export class TransactionLogComponent implements OnInit {
categoryList: any;
categoryNameList: string[] = [];
transactionFormStatus: string;
+ transactionFormStatusSuccess: string;
transactionFormStatusError = 'Error received, please try again.';
public paginateConfig: PaginationInstance = {
@@ -137,7 +138,32 @@ export class TransactionLogComponent implements OnInit {
}
deleteRecurringTransaction() {
-
+ let myParams = {
+ id: this.clickedRecur.id,
+ };
+ this.api
+ .recurDelete(myParams)
+ .subscribe(
+ result => {
+ if ( result.success === true ) {
+ this.transactionFormStatus = 'success';
+ this.transactionFormStatusSuccess = 'Delete Succeeded.';
+ } else {
+ this.transactionFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
+ this.transactionFormStatus = 'send_failed';
+ }
+ },
+ error => {
+ console.log(error);
+ try {
+ console.log(error.error);
+ this.transactionFormStatusError = '"' + error.error.error + '" Error, ' + error.error.message;
+ } catch (e) {
+ this.transactionFormStatusError = 'There was a server error, please try again later.';
+ }
+ this.transactionFormStatus = 'send_failed';
+ }
+ );
}
}
diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts
index 519d272..a77a68c 100644
--- a/src/app/providers/api-service.ts
+++ b/src/app/providers/api-service.ts
@@ -158,7 +158,7 @@ export class ApiService {
);
}
- // Uploads a transaction
+ // Edits a recurring transaction
public recurUpdate(data) {
data.session_key = this.sessionKey;
@@ -168,6 +168,16 @@ export class ApiService {
);
}
+ // Edits a recurring transaction
+
+ public recurDelete(data) {
+ data.session_key = this.sessionKey;
+ return this.http.post
(
+ this.apiUrl + '/recurring-transactions/delete',
+ data
+ );
+ }
+
// gets payroll list for log
public payrollList(data) {