merge angular-17 into dev to upgrade from Angular v16 to v17
This commit is contained in:
+60
-36
@@ -8,31 +8,48 @@ import { PopoverService } from '../../configuration-wizard/popover/popover.servi
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
import { SystemService } from '../system.service';
|
||||
|
||||
interface Permission {
|
||||
code: string;
|
||||
id: number;
|
||||
selected: boolean;
|
||||
grouping?: string;
|
||||
}
|
||||
|
||||
interface PermissionGroup {
|
||||
permissions: Permission[];
|
||||
}
|
||||
|
||||
interface PermissionData {
|
||||
[key: string]: PermissionGroup;
|
||||
}
|
||||
|
||||
interface SubmitPermissionData {
|
||||
permissions: {
|
||||
[key: string]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-configure-maker-checker-tasks',
|
||||
templateUrl: './configure-maker-checker-tasks.component.html',
|
||||
styleUrls: ['./configure-maker-checker-tasks.component.scss']
|
||||
})
|
||||
export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewInit {
|
||||
permissionsData: any;
|
||||
permissionsData: Permission[] = [];
|
||||
groupings: string[] = [];
|
||||
currentGrouping = '';
|
||||
tempPermissionUIData: PermissionData = {};
|
||||
permissions: PermissionGroup = { permissions: [] };
|
||||
|
||||
formData = {};
|
||||
isDisabled = true;
|
||||
newEntry: any;
|
||||
selectedItem = '';
|
||||
previousGrouping = '';
|
||||
checkboxesChanged: Boolean = false;
|
||||
currentGrouping: string;
|
||||
formGroup: UntypedFormGroup;
|
||||
backupform: UntypedFormGroup;
|
||||
|
||||
permissions: {
|
||||
permissions: { code: string; id: number }[];
|
||||
};
|
||||
tempPermissionUIData: {
|
||||
permissions: { code: string }[];
|
||||
}[];
|
||||
|
||||
/* Reference of edit button */
|
||||
@ViewChild('buttonEdit') buttonEdit: ElementRef<any>;
|
||||
/* Template for popover on edit button */
|
||||
@@ -95,29 +112,33 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
});
|
||||
}
|
||||
|
||||
setMakerCheckerTask() {
|
||||
this.tempPermissionUIData = [
|
||||
{
|
||||
permissions: []
|
||||
}
|
||||
];
|
||||
for (const i in this.permissionsData) {
|
||||
if (this.permissionsData[i]) {
|
||||
if (this.permissionsData[i].grouping !== this.currentGrouping) {
|
||||
this.currentGrouping = this.permissionsData[i].grouping;
|
||||
this.groupings.push(this.currentGrouping);
|
||||
this.tempPermissionUIData[this.currentGrouping] = { permissions: [] };
|
||||
}
|
||||
const temp = { code: this.permissionsData[i].code, id: i, selected: this.permissionsData[i].selected };
|
||||
this.tempPermissionUIData[this.currentGrouping].permissions.push(temp);
|
||||
setMakerCheckerTask(): void {
|
||||
this.tempPermissionUIData = {};
|
||||
|
||||
for (const permission of this.permissionsData) {
|
||||
if (permission.grouping !== this.currentGrouping) {
|
||||
this.currentGrouping = permission.grouping || '';
|
||||
this.groupings.push(this.currentGrouping);
|
||||
this.tempPermissionUIData[this.currentGrouping] = { permissions: [] };
|
||||
}
|
||||
|
||||
const temp: Permission = {
|
||||
code: permission.code,
|
||||
id: permission.id,
|
||||
selected: permission.selected
|
||||
};
|
||||
|
||||
this.tempPermissionUIData[this.currentGrouping].permissions.push(temp);
|
||||
}
|
||||
}
|
||||
|
||||
showPermissions(grouping: string) {
|
||||
this.permissions = this.tempPermissionUIData[grouping];
|
||||
this.selectedItem = grouping;
|
||||
this.previousGrouping = grouping;
|
||||
showPermissions(grouping: string): void {
|
||||
const group = this.tempPermissionUIData[grouping];
|
||||
if (group) {
|
||||
this.permissions = group;
|
||||
this.selectedItem = grouping;
|
||||
this.previousGrouping = grouping;
|
||||
}
|
||||
}
|
||||
|
||||
permissionName = function (name: any) {
|
||||
@@ -175,17 +196,20 @@ export class ConfigureMakerCheckerTasksComponent implements OnInit, AfterViewIni
|
||||
this.formGroup.controls.roster.disable();
|
||||
}
|
||||
|
||||
submit() {
|
||||
const value = this.formGroup.get('roster').value;
|
||||
const data = {};
|
||||
const permissionData = {
|
||||
submit(): void {
|
||||
const value = this.formGroup.get('roster')?.value;
|
||||
const permissionData: SubmitPermissionData = {
|
||||
permissions: {}
|
||||
};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
data[value[i].code] = value[i].selected;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach((item) => {
|
||||
if (item.code && typeof item.selected === 'boolean') {
|
||||
permissionData.permissions[item.code] = item.selected;
|
||||
}
|
||||
});
|
||||
}
|
||||
permissionData.permissions = data;
|
||||
this.formGroup.controls.roster.disable();
|
||||
this.formGroup.get('roster')?.disable();
|
||||
this.checkboxesChanged = false;
|
||||
this.isDisabled = true;
|
||||
this.systemService.updateMakerCheckerPermission(permissionData).subscribe((response: any) => {});
|
||||
|
||||
Reference in New Issue
Block a user