feat: add new standalone components for system and organization management modules

This commit is contained in:
2026-09-28 12:55:42 +05:30
parent f451672ce7
commit 4ca08f6ee9
32 changed files with 347 additions and 32 deletions
@@ -12,6 +12,7 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators, ReactiveFormsModule }
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { AlertService } from 'app/core/alert/alert.service';
/** Custom Services */
import { SystemService } from '../../../system.service';
@@ -37,6 +38,7 @@ export class EditConfigurationComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private dateUtils = inject(Dates);
private alertService = inject(AlertService);
/** Minimum transaction date allowed. */
minDate = new Date(2000, 0, 1);
@@ -122,7 +124,15 @@ export class EditConfigurationComponent implements OnInit {
delete payload.dateValue;
}
this.systemService.updateConfiguration(this.configuration.id, payload).subscribe(() => {
this.systemService.updateConfiguration(this.configuration.id, payload).subscribe((response: any) => {
if (response?.rollbackTransaction) {
this.alertService.alert({
type: 'Success',
message: 'Configuration update has been submitted for approval.'
});
this.router.navigate(['../../'], { relativeTo: this.route });
return;
}
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
@@ -145,15 +145,25 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
* Enables/Disables respective configuration
*/
toggleStatus(configuration: any) {
this.systemService
.updateConfiguration(configuration.id, { enabled: configuration.enabled })
.subscribe((response: any) => {
configuration.enabled = response.changes.enabled;
if (configuration.name === SettingsService.businessDateConfigName) {
const msg = configuration.enabled ? 'enabled' : 'disabled';
this.alertService.alert({ type: SettingsService.businessDateType + ' Set Config', message: msg });
}
});
const desiredEnabled = configuration.enabled;
this.systemService.updateConfiguration(configuration.id, { enabled: desiredEnabled }).subscribe((response: any) => {
if (response?.rollbackTransaction) {
// Parked for checker approval - the configuration has not actually changed yet, so the
// toggle (already flipped optimistically by ngModel on click) must be reverted, and
// response.changes must not be read since a parked response never contains it.
configuration.enabled = !desiredEnabled;
this.alertService.alert({
type: 'Success',
message: 'Configuration update has been submitted for approval.'
});
return;
}
configuration.enabled = response.changes.enabled;
if (configuration.name === SettingsService.businessDateConfigName) {
const msg = configuration.enabled ? 'enabled' : 'disabled';
this.alertService.alert({ type: SettingsService.businessDateType + ' Set Config', message: msg });
}
});
}
/**