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) => {});
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<br />
|
||||
|
||||
<div class="layout-row-wrap responsive-column">
|
||||
<p class="mat-title flex-20">{{ 'labels.inputs.Events' | translate }}<span style="color: red">*</span></p>
|
||||
<p class="mat-title flex-20">{{ 'labels.inputs.Events' | translate }}<span class="red">*</span></p>
|
||||
|
||||
<button mat-raised-button class="AddEventButton flex-20" type="button" color="primary" (click)="addEvent()">
|
||||
<fa-icon icon="plus" class="m-r-10"></fa-icon>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<br />
|
||||
|
||||
<div class="layout-row-wrap responsive-column">
|
||||
<p class="mat-title flex-20">{{ 'labels.inputs.Events' | translate }} <span style="color: red">*</span></p>
|
||||
<p class="mat-title flex-20">{{ 'labels.inputs.Events' | translate }} <span class="red">*</span></p>
|
||||
|
||||
<button mat-raised-button class="AddEventButton flex-20" type="button" color="primary" (click)="addEvent()">
|
||||
<fa-icon icon="plus" class="m-r-10"></fa-icon>
|
||||
|
||||
@@ -9,7 +9,12 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
import { JobStep } from './workflow-diagram/workflow-diagram.component';
|
||||
|
||||
export interface JobStep {
|
||||
stepName: string;
|
||||
stepDescription: string;
|
||||
order: number;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-workflow-jobs',
|
||||
@@ -21,7 +26,7 @@ export class WorkflowJobsComponent implements OnInit {
|
||||
|
||||
jobNameOptions: any = [];
|
||||
jobStepsData: any = [];
|
||||
jobAvailableStepsData: any = [];
|
||||
jobAvailableStepsData: JobStep[] = [];
|
||||
jobStepsDataBase: any = [];
|
||||
jobStepName: String = null;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-fill" ="48">
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Text' | translate }}</mat-label>
|
||||
<input matInput maxlength="255" required formControlName="text" />
|
||||
<mat-error *ngIf="question.controls.text.hasError('required')">
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-fill" ="48">
|
||||
<mat-form-field class="flex-48">
|
||||
<mat-label>{{ 'labels.inputs.Text' | translate }}</mat-label>
|
||||
<input matInput maxlength="255" required formControlName="text" />
|
||||
<mat-error *ngIf="question.get('text').hasError('required')">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators, FormArray } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as _ from 'lodash';
|
||||
@@ -45,12 +45,14 @@ export class ViewRoleComponent implements OnInit {
|
||||
backupform: UntypedFormGroup;
|
||||
/** Temporarily stores Permission data */
|
||||
tempPermissionUIData: {
|
||||
permissions: { code: string }[];
|
||||
}[];
|
||||
[key: string]: {
|
||||
permissions: { code: string; id: number; selected?: boolean }[];
|
||||
};
|
||||
} = {};
|
||||
/** Stores permissions */
|
||||
permissions: {
|
||||
permissions: { code: string; id: number }[];
|
||||
};
|
||||
} = { permissions: [] };
|
||||
|
||||
/**
|
||||
* Retrieves the roledetails data from `resolve`.
|
||||
@@ -121,11 +123,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Groups the permissions based on rules
|
||||
*/
|
||||
groupRules() {
|
||||
this.tempPermissionUIData = [
|
||||
{
|
||||
permissions: []
|
||||
}
|
||||
];
|
||||
this.tempPermissionUIData = {};
|
||||
for (const i in this.rolePermissionService.permissionUsageData) {
|
||||
if (this.rolePermissionService.permissionUsageData[i]) {
|
||||
if (this.rolePermissionService.permissionUsageData[i].grouping !== this.currentGrouping) {
|
||||
@@ -135,7 +133,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
}
|
||||
const temp = {
|
||||
code: this.rolePermissionService.permissionUsageData[i].code,
|
||||
id: i,
|
||||
id: +i,
|
||||
selected: this.rolePermissionService.permissionUsageData[i].selected
|
||||
};
|
||||
this.tempPermissionUIData[this.currentGrouping].permissions.push(temp);
|
||||
@@ -177,7 +175,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
name = name || '';
|
||||
// replace '_' with ' '
|
||||
name = name.replace(/_/g, ' ');
|
||||
// for reorts replace read with view
|
||||
// for reports replace read with view
|
||||
if (this.previousGrouping === 'report') {
|
||||
name = name.replace(/READ/g, 'View');
|
||||
}
|
||||
@@ -185,7 +183,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Backups the valued
|
||||
* Backups the values
|
||||
*/
|
||||
backupCheckValues() {
|
||||
this.backupform = _.cloneDeep(this.formGroup) as UntypedFormGroup;
|
||||
@@ -220,7 +218,7 @@ export class ViewRoleComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
const value = this.formGroup.get('roster').value;
|
||||
const data = {};
|
||||
const data: { [key: string]: boolean } = {};
|
||||
const permissionData = {
|
||||
permissions: {}
|
||||
};
|
||||
@@ -238,8 +236,9 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Selects all the permission of a particular role
|
||||
*/
|
||||
selectAll() {
|
||||
const roster = this.formGroup.get('roster') as FormArray;
|
||||
for (let i = 0; i < this.permissions.permissions.length; i++) {
|
||||
this.formGroup.controls.roster['controls'][this.permissions.permissions[i].id].patchValue({
|
||||
roster.at(this.permissions.permissions[i].id).patchValue({
|
||||
selected: true
|
||||
});
|
||||
}
|
||||
@@ -249,8 +248,9 @@ export class ViewRoleComponent implements OnInit {
|
||||
* Deselects all the permissions of a particular role
|
||||
*/
|
||||
deselectAll() {
|
||||
const roster = this.formGroup.get('roster') as FormArray;
|
||||
for (let i = 0; i < this.permissions.permissions.length; i++) {
|
||||
this.formGroup.controls.roster['controls'][this.permissions.permissions[i].id].patchValue({
|
||||
roster.at(this.permissions.permissions[i].id).patchValue({
|
||||
selected: false
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user