feat: add new standalone components for system and organization management modules
This commit is contained in:
@@ -17,6 +17,7 @@ import { PopoverService } from '../../../configuration-wizard/popover/popover.se
|
||||
import { PopoverRef } from '../../../configuration-wizard/popover/popover-ref';
|
||||
import { ConfigurationWizardService } from '../../../configuration-wizard/configuration-wizard.service';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-code',
|
||||
@@ -33,6 +34,7 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
private router = inject(Router);
|
||||
private configurationWizardService = inject(ConfigurationWizardService);
|
||||
private popoverService = inject(PopoverService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Code form. */
|
||||
codeForm: UntypedFormGroup;
|
||||
@@ -67,6 +69,14 @@ export class CreateCodeComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.createCode(this.codeForm.value).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code creation has been submitted for approval.'
|
||||
});
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
return;
|
||||
}
|
||||
if (this.configurationWizardService.showSystemCodesForm) {
|
||||
this.configurationWizardService.showSystemCodesForm = false;
|
||||
this.configurationWizardService.showRolesandPermission = true;
|
||||
|
||||
@@ -14,6 +14,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Edit Code Component.
|
||||
@@ -31,6 +32,7 @@ export class EditCodeComponent implements OnInit {
|
||||
private systemService = inject(SystemService);
|
||||
private route = inject(ActivatedRoute);
|
||||
private router = inject(Router);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Code Form */
|
||||
codeForm: UntypedFormGroup;
|
||||
@@ -75,6 +77,20 @@ export class EditCodeComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
this.systemService.updateCode(this.codeForm.value, this.codeData.id).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code update has been submitted for approval.'
|
||||
});
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
this.codeData.id
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
mat-stroked-button
|
||||
color="warn"
|
||||
(click)="delete()"
|
||||
*mifosxHasPermission="'DELETE_CODEVALUE'"
|
||||
*mifosxHasPermission="'DELETE_CODE'"
|
||||
class="vc-header__btn-delete"
|
||||
>
|
||||
<fa-icon icon="trash" class="m-r-10"></fa-icon>
|
||||
|
||||
@@ -30,6 +30,7 @@ import { MatCard, MatCardContent } from '@angular/material/card';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* View Code Component.
|
||||
@@ -53,6 +54,7 @@ export class ViewCodeComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private dialog = inject(MatDialog);
|
||||
private translateService = inject(TranslateService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Code Data */
|
||||
codeData: any;
|
||||
@@ -152,6 +154,13 @@ export class ViewCodeComponent implements OnInit {
|
||||
deleteCodeValue(index: number) {
|
||||
const codeValueId = this.codeValuesData[index].id;
|
||||
this.systemService.deleteCodeValue(this.codeData.id, codeValueId).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code value deletion has been submitted for approval.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.codeValuesData.splice(index, 1);
|
||||
this.codeValues.removeAt(index);
|
||||
this.codeValueRowStatus.splice(index, 1);
|
||||
@@ -177,6 +186,13 @@ export class ViewCodeComponent implements OnInit {
|
||||
this.systemService
|
||||
.updateCodeValue(this.codeData.id, this.codeValuesData[index].id, updatedCodeValue)
|
||||
.subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code value update has been submitted for approval.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.codeValues.at(index).disable();
|
||||
this.codeValueRowStatus[index] = 'disabled';
|
||||
this.codeValues.at(index).markAsPristine();
|
||||
@@ -192,7 +208,13 @@ export class ViewCodeComponent implements OnInit {
|
||||
});
|
||||
deleteCodeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.systemService.deleteCode(this.codeData.id).subscribe(() => {
|
||||
this.systemService.deleteCode(this.codeData.id).subscribe((deleteResponse: any) => {
|
||||
if (deleteResponse?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code deletion has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['/system/codes']);
|
||||
});
|
||||
}
|
||||
@@ -221,6 +243,13 @@ export class ViewCodeComponent implements OnInit {
|
||||
const newCodeValue: { name: string; description: string; position: string; isActive: boolean } =
|
||||
this.codeValues.at(index).value;
|
||||
this.systemService.createCodeValue(this.codeData.id, newCodeValue).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Code value creation has been submitted for approval.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.codeValues.at(index).disable();
|
||||
this.codeValueRowStatus[index] = 'disabled';
|
||||
this.codeValuesData.push({
|
||||
|
||||
Reference in New Issue
Block a user