feat(closing-entries): edit and delete closure

Add edit closure component and ability to delete an accounting closure
to backdate a transaction.
This commit is contained in:
Abhay Chawla
2018-08-04 23:03:39 +05:30
parent fcb8dce131
commit 6c80e86c0c
10 changed files with 182 additions and 6 deletions
@@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
import { AccountingService } from '../../accounting.service';
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
@Component({
selector: 'mifosx-view-closure',
@@ -14,7 +16,9 @@ export class ViewClosureComponent implements OnInit {
accountingClosure: any;
constructor(private accountingService: AccountingService,
private route: ActivatedRoute) { }
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog) { }
ngOnInit() {
this.accountingClosureId = Number(this.route.snapshot.paramMap.get('id'));
@@ -28,4 +32,18 @@ export class ViewClosureComponent implements OnInit {
});
}
deleteAccountingClosure() {
const deleteAccountingClosureDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `accounting closure ${this.accountingClosureId}` }
});
deleteAccountingClosureDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountingService.deleteAccountingClosure(this.accountingClosureId)
.subscribe(() => {
this.router.navigate(['/accounting/closing-entries']);
});
}
});
}
}