Files
cbsnexora/src/app/system/account-number-preferences/view-account-number-preference/view-account-number-preference.component.ts
T
Ralph HopmanandAdam Saghy 9034ce2847 build: Replace Codelyzer and TSLint with Angular ESLint
Migrate from the deprecated TSLint to Angluar ESLint. Also fix current
linting issues in the code, in particular:

- Use strict equals operators (=== and !==)
- Remove empty lifecycle methods (mostly ngOnInit)
- Output bindings including aliases should not be named as standard dom
  events (submit)
- Async pipe results should not be negated
2024-11-08 09:37:08 +01:00

62 lines
2.2 KiB
TypeScript

/** Angular Imports */
import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */
import { SystemService } from '../../system.service';
/** Custom Components */
import { TranslateService } from '@ngx-translate/core';
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
/**
* View Account Number Preference Component.
*/
@Component({
selector: 'mifosx-view-account-number-preference',
templateUrl: './view-account-number-preference.component.html',
styleUrls: ['./view-account-number-preference.component.scss']
})
export class ViewAccountNumberPreferenceComponent {
/** Account Number Preference Data */
accountNumberPreferenceData: any;
/**
* Retrieves the account number preference data from `resolve`.
* @param {SystemService} systemService Accounting Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference.
* @param {TranslateService} translateService Translate Service.
*/
constructor(private route: ActivatedRoute,
private systemService: SystemService,
private router: Router,
private dialog: MatDialog,
private translateService: TranslateService) {
this.route.data.subscribe((data: { accountNumberPreference: any }) => {
this.accountNumberPreferenceData = data.accountNumberPreference;
});
}
/**
* Deletes the account number preference and redirects to account number preferences.
*/
delete() {
const deleteAccountNumberPreferenceDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: this.translateService.instant('labels.heading.Account Number Preferences') + ' ' + this.accountNumberPreferenceData.id}
});
deleteAccountNumberPreferenceDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.systemService.deleteAccountNumberPreference(this.accountNumberPreferenceData.id)
.subscribe(() => {
this.router.navigate(['/system/account-number-preferences']);
});
}
});
}
}