Skip to content

Commit 3bfcce3

Browse files
committed
Fixing the site settings dialog to not allow conflicting settings.
1 parent 6966902 commit 3bfcce3

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
dynamicHeight="false"
55
>
66
<mat-tab label="{{'General' | translate }}">
7-
<div class="d-flex flex-row">
7+
<div class="d-flex flex-row" *ngIf="selectCurrentUserIsAdmin$ | async">
88
<!-- data.useGoogleSheetAsDefault -->
99
<mat-checkbox class="p-1"
1010
[id]="'useGoogleSheetAsDefault'"
@@ -13,7 +13,7 @@
1313
{{ 'Use Google Sheet as default' | translate }}
1414
</mat-checkbox>
1515
</div>
16-
<div class="d-flex flex-row" *ngIf="!data.useGoogleSheetAsDefault">
16+
<div class="d-flex flex-row" *ngIf="!data.useGoogleSheetAsDefault && selectCurrentUserIsAdmin$ | async" >
1717
<!-- data.useOnlyPlanHours checkbox -->
1818
<mat-checkbox class="p-1"
1919
[id]="'useOnlyPlanHours'"
@@ -40,7 +40,7 @@
4040
<!-- {{ 'Use detailed pause editing' | translate }}-->
4141
<!-- </mat-checkbox>-->
4242
<!-- </div>-->
43-
<div class="d-flex flex-row" *ngIf="data.globalAutoBreakCalculationActive">
43+
<div class="d-flex flex-row" *ngIf="data.globalAutoBreakCalculationActive && selectCurrentUserIsAdmin$ | async">
4444
<!-- data.autoBreakCalculationActive -->
4545
<mat-checkbox class="p-1"
4646
[id]="'autoBreakCalculationActive'"
@@ -49,15 +49,6 @@
4949
{{ 'Auto break calculation' | translate }}
5050
</mat-checkbox>
5151
</div>
52-
<div class="d-flex flex-row">
53-
<!-- data.allowAcceptOfPlannedHours -->
54-
<mat-checkbox class="p-1"
55-
[id]="'allowAcceptOfPlannedHours'"
56-
[name]="'allowAcceptOfPlannedHours'"
57-
[(ngModel)]="data.allowAcceptOfPlannedHours">
58-
{{ 'Allow accept of planned hours' | translate }}
59-
</mat-checkbox>
60-
</div>
6152
<div class="d-flex flex-row">
6253
<!-- data.allowEditOfRegistrations -->
6354
<mat-checkbox class="p-1"
@@ -76,7 +67,7 @@
7667
{{ 'Allow personal time registration' | translate }}
7768
</mat-checkbox>
7869
</div>
79-
<div class="d-flex flex-row">
70+
<div class="d-flex flex-row" *ngIf="data.allowPersonalTimeRegistration && !data.allowAcceptOfPlannedHours">
8071
<!-- data.allowPersonalTimeRegistration -->
8172
<mat-checkbox class="p-1"
8273
[id]="'usePunchClock'"
@@ -85,8 +76,17 @@
8576
{{ 'Use punch clock' | translate }}
8677
</mat-checkbox>
8778
</div>
79+
<div class="d-flex flex-row" *ngIf="data.allowPersonalTimeRegistration && !data.usePunchClock && selectCurrentUserIsAdmin$ | async">
80+
<!-- data.allowAcceptOfPlannedHours -->
81+
<mat-checkbox class="p-1"
82+
[id]="'allowAcceptOfPlannedHours'"
83+
[name]="'allowAcceptOfPlannedHours'"
84+
[(ngModel)]="data.allowAcceptOfPlannedHours">
85+
{{ 'Allow accept of planned hours' | translate }}
86+
</mat-checkbox>
87+
</div>
8888
</mat-tab>
89-
<mat-tab label="{{'Plan hours' | translate }}" *ngIf="data.useOnlyPlanHours && !data.useGoogleSheetAsDefault">
89+
<mat-tab label="{{'Plan hours' | translate }}" *ngIf="data.useOnlyPlanHours && !data.useGoogleSheetAsDefault && selectCurrentUserIsAdmin$ | async">
9090
<div class="d-flex flex-row"
9191
*ngFor="let day of ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']">
9292
<mat-form-field class="p-1">
@@ -105,7 +105,7 @@
105105
</mat-form-field>
106106
</div>
107107
</mat-tab>
108-
<mat-tab label="{{ 'Auto break calculation settings' | translate }}" *ngIf="data.autoBreakCalculationActive">
108+
<mat-tab label="{{ 'Auto break calculation settings' | translate }}" *ngIf="data.autoBreakCalculationActive && selectCurrentUserIsAdmin$ | async">
109109
<ng-container *ngFor="let day of ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']">
110110
<div class="d-flex flex-row">
111111
<mat-form-field class="p-1">
@@ -175,7 +175,7 @@
175175
</div>
176176
</ng-container>
177177
</mat-tab>
178-
<mat-tab label="{{'1st shift' | translate }}" *ngIf="!data.useOnlyPlanHours && !data.useGoogleSheetAsDefault">
178+
<mat-tab label="{{'1st shift' | translate }}" *ngIf="!data.useOnlyPlanHours && !data.useGoogleSheetAsDefault && selectCurrentUserIsAdmin$ | async">
179179
<ng-container *ngIf="selectCurrentUserIsAdmin$ | async">
180180
<div class="d-flex flex-row"
181181
*ngFor="let day of ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']">
@@ -232,7 +232,7 @@
232232
</div>
233233
</ng-container>
234234
</mat-tab>
235-
<mat-tab label="{{'2nd shift' | translate }}" *ngIf="!data.useOnlyPlanHours && !data.useGoogleSheetAsDefault">
235+
<mat-tab label="{{'2nd shift' | translate }}" *ngIf="!data.useOnlyPlanHours && !data.useGoogleSheetAsDefault && selectCurrentUserIsAdmin$ | async">
236236
<ng-container *ngIf="selectCurrentUserIsAdmin$ | async">
237237
<div class="d-flex flex-row"
238238
*ngFor="let day of ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']">

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {FormsModule} from '@angular/forms';
1212
import {MatFormField, MatLabel} from '@angular/material/form-field';
1313
import {MatInput} from '@angular/material/input';
1414
import {TranslatePipe} from '@ngx-translate/core';
15-
import {selectCurrentUserIsAdmin} from 'src/app/state';
15+
import {selectAuthIsAdmin, selectCurrentUserIsAdmin} from 'src/app/state';
1616
import {Store} from '@ngrx/store';
1717
import {AsyncPipe, NgForOf, NgIf} from '@angular/common';
1818
import {MatTab, MatTabGroup} from '@angular/material/tabs';
@@ -50,14 +50,14 @@ import {MatIcon} from '@angular/material/icon';
5050
styleUrls: ['./assigned-site-dialog.component.scss']
5151
})
5252
export class AssignedSiteDialogComponent implements DoCheck, OnInit {
53-
public selectCurrentUserIsAdmin$ = this.authStore.select(selectCurrentUserIsAdmin);
53+
public selectCurrentUserIsAdmin$ = this.store.select(selectCurrentUserIsAdmin);
5454
private previousData: AssignedSiteModel;
5555
private globalAutoBreakSettings: GlobalAutoBreakSettingsModel;
5656

5757
constructor(
5858
@Inject(MAT_DIALOG_DATA) public data: AssignedSiteModel,
5959
private timePlanningPnSettingsService: TimePlanningPnSettingsService,
60-
private authStore: Store
60+
private store: Store
6161
) {
6262
this.previousData = {...data};
6363
this.calculateHours();

0 commit comments

Comments
 (0)