feat: add new standalone components for system and organization management modules
This commit is contained in:
@@ -42,6 +42,7 @@ import { AsyncPipe } from '@angular/common';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatGridList, MatGridTile } from '@angular/material/grid-list';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/**
|
||||
* Manage Currencies component.
|
||||
@@ -68,6 +69,7 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
private translateService = inject(TranslateService);
|
||||
private configurationWizardService = inject(ConfigurationWizardService);
|
||||
private popoverService = inject(PopoverService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
//** Defining PlaceHolders for the search bar */
|
||||
placeHolderLabel = '';
|
||||
@@ -164,8 +166,17 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
if (!selectedCurrencyCodes.includes(newCurrency.code)) {
|
||||
selectedCurrencyCodes.push(newCurrency.code);
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes).subscribe((response: any) => {
|
||||
this.selectedCurrencies.push(newCurrency);
|
||||
this.formRef.resetForm();
|
||||
if (response?.rollbackTransaction) {
|
||||
// Parked for checker approval - the currency has not actually been added yet, so the
|
||||
// local list must not be mutated as if it had.
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Currency configuration update has been submitted for approval.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.selectedCurrencies.push(newCurrency);
|
||||
if (this.configurationWizardService.showCurrencyForm) {
|
||||
this.configurationWizardService.showCurrencyForm = false;
|
||||
this.openDialog();
|
||||
@@ -187,9 +198,18 @@ export class ManageCurrenciesComponent implements OnInit, AfterViewInit, OnDestr
|
||||
});
|
||||
deleteCurrencyDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes).subscribe(() => {
|
||||
this.selectedCurrencies.splice(index, 1);
|
||||
this.organizationservice.updateCurrencies(selectedCurrencyCodes).subscribe((updateResponse: any) => {
|
||||
this.formRef.resetForm();
|
||||
if (updateResponse?.rollbackTransaction) {
|
||||
// Parked for checker approval - the currency has not actually been removed yet, so the
|
||||
// local list must not be mutated as if it had.
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Currency configuration update has been submitted for approval.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.selectedCurrencies.splice(index, 1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators, ReactiveFormsModule }
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-create-fund',
|
||||
@@ -25,6 +26,7 @@ export class CreateFundComponent implements OnInit {
|
||||
private formBuilder = inject(UntypedFormBuilder);
|
||||
private router = inject(Router);
|
||||
private route = inject(ActivatedRoute);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Charge form. */
|
||||
fundForm: UntypedFormGroup;
|
||||
@@ -49,6 +51,12 @@ export class CreateFundComponent implements OnInit {
|
||||
submit() {
|
||||
const payload = this.fundForm.getRawValue();
|
||||
this.organizationService.createFund(payload).subscribe((response: any) => {
|
||||
if (response?.rollbackTransaction) {
|
||||
this.alertService.alert({
|
||||
type: 'Success',
|
||||
message: 'Fund creation has been submitted for approval.'
|
||||
});
|
||||
}
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user