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:
@@ -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']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user