Skip to content

Commit 2961e83

Browse files
committed
Adding changes to only allow changing language on a device-user when everything is turned off.
1 parent 6d3be3f commit 2961e83

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-create-edit-modal/property-worker-create-edit-modal.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h3 mat-dialog-title>{{ (edit ? 'Edit employee' : 'New employee') | translate}}<
5353
[bindValue]="'languageCode'"
5454
[clearable]="false"
5555
[(ngModel)]="selectedDeviceUser.languageCode"
56-
[disabled]="selectedDeviceUser.isLocked"
56+
[disabled]="timeRegistrationEnabled || taskManagementEnabled || getAssignmentCount() > 0"
5757
[items]="activeLanguages">
5858
<ng-template ng-label-tmp let-item="item">
5959
{{item.name | translate}}

eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-create-edit-modal/property-worker-create-edit-modal.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy
2929
selectedDeviceUser: DeviceUserModel = new DeviceUserModel();
3030
selectedDeviceUserCopy: DeviceUserModel = new DeviceUserModel();
3131
assignments: PropertyAssignmentWorkerModel[] = [];
32+
assignmentsCopy: PropertyAssignmentWorkerModel[] = [];
33+
taskManagementEnabled: boolean = false;
34+
timeRegistrationEnabled: boolean = false;
3235
@Output() userUpdated: EventEmitter<void> = new EventEmitter<void>();
3336
tableHeaders: MtxGridColumn[] = [
3437
{
@@ -70,6 +73,9 @@ export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy
7073
this.availableProperties = [...model.availableProperties];
7174
this.selectedDeviceUser = {...model.deviceUser ?? new DeviceUserModel()};
7275
this.selectedDeviceUserCopy = {...model.deviceUser};
76+
this.assignmentsCopy = [...model.assignments];
77+
this.taskManagementEnabled = this.selectedDeviceUserCopy.taskManagementEnabled;
78+
this.timeRegistrationEnabled = this.selectedDeviceUserCopy.timeRegistrationEnabled
7379
}
7480

7581
get languages() {
@@ -199,6 +205,10 @@ export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy
199205
);
200206
}
201207

208+
getAssignmentCount(): number {
209+
return this.assignmentsCopy.filter((x) => x.isChecked).length;
210+
}
211+
202212
ngOnDestroy(): void {
203213
}
204214

0 commit comments

Comments
 (0)