Skip to content

Commit f2db73e

Browse files
committed
Merge branch 'stable' of github.com:microting/eform-angular-timeplanning-plugin into stable
2 parents 33781a8 + 02a4b17 commit f2db73e

1 file changed

Lines changed: 68 additions & 68 deletions

File tree

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

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {Component, EventEmitter, Inject, OnInit, TemplateRef, ViewChild} from '@angular/core';
22
import {
3-
MAT_DIALOG_DATA,
4-
MatDialogActions,
5-
MatDialogClose,
6-
MatDialogContent,
7-
MatDialogTitle
3+
MAT_DIALOG_DATA,
4+
MatDialogActions,
5+
MatDialogClose,
6+
MatDialogContent,
7+
MatDialogTitle
88
} from '@angular/material/dialog';
99
import {MatButton, MatIconButton} from '@angular/material/button';
1010
import {TranslatePipe, TranslateService} from '@ngx-translate/core';
@@ -13,9 +13,9 @@ import {MatCheckbox} from '@angular/material/checkbox';
1313
import {FormsModule} from '@angular/forms';
1414
import {TimePlanningMessagesEnum} from '../../../../enums';
1515
import {
16-
AssignedSiteModel,
17-
PlanningPrDayModel,
18-
PlanningPrDayUpdateModel
16+
AssignedSiteModel,
17+
PlanningPrDayModel,
18+
PlanningPrDayUpdateModel
1919
} from '../../../../models';
2020
import {MtxGrid, MtxGridColumn} from '@ng-matero/extensions/grid';
2121
import {TimePlanningPnPlanningsService} from '../../../../services';
@@ -25,28 +25,28 @@ import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker';
2525
import {MatIcon} from '@angular/material/icon';
2626

2727
@Component({
28-
selector: 'app-workday-entity-dialog',
29-
templateUrl: './workday-entity-dialog.component.html',
30-
imports: [
31-
MatButton,
32-
MatDialogActions,
33-
MatDialogClose,
34-
TranslatePipe,
35-
MatDialogTitle,
36-
MatDialogContent,
37-
MatCheckbox,
38-
FormsModule,
39-
NgForOf,
40-
NgIf,
41-
MtxGrid,
42-
MatFormField,
43-
MatInput,
44-
MatLabel,
45-
NgxMaterialTimepickerModule,
46-
MatIconButton,
47-
MatIcon
48-
],
49-
styleUrls: ['./workday-entity-dialog.component.scss']
28+
selector: 'app-workday-entity-dialog',
29+
templateUrl: './workday-entity-dialog.component.html',
30+
imports: [
31+
MatButton,
32+
MatDialogActions,
33+
MatDialogClose,
34+
TranslatePipe,
35+
MatDialogTitle,
36+
MatDialogContent,
37+
MatCheckbox,
38+
FormsModule,
39+
NgForOf,
40+
NgIf,
41+
MtxGrid,
42+
MatFormField,
43+
MatInput,
44+
MatLabel,
45+
NgxMaterialTimepickerModule,
46+
MatIconButton,
47+
MatIcon
48+
],
49+
styleUrls: ['./workday-entity-dialog.component.scss']
5050
})
5151
export class WorkdayEntityDialogComponent implements OnInit {
5252
TimePlanningMessagesEnum = TimePlanningMessagesEnum;
@@ -261,17 +261,17 @@ export class WorkdayEntityDialogComponent implements OnInit {
261261
);
262262
}
263263

264-
getMaxDifference(start: string, end: string): string {
265-
const startTime = this.convertTimeToMinutes(start);
266-
const endTime = this.convertTimeToMinutes(end);
267-
const diff = endTime - startTime;
268-
if (diff < 0) {
269-
return '00:00';
264+
getMaxDifference(start: string, end: string): string {
265+
const startTime = this.convertTimeToMinutes(start);
266+
const endTime = this.convertTimeToMinutes(end);
267+
const diff = endTime - startTime;
268+
if (diff < 0) {
269+
return '00:00';
270+
}
271+
const hours = Math.floor(diff / 60);
272+
const minutes = diff % 60;
273+
return `${hours}:${minutes}`;
270274
}
271-
const hours = Math.floor(diff / 60);
272-
const minutes = diff % 60;
273-
return `${hours}:${minutes}`;
274-
}
275275

276276
convertTimeToDateTimeOfToday(hourMinutes: string): string {
277277
const today = new Date();
@@ -280,37 +280,37 @@ export class WorkdayEntityDialogComponent implements OnInit {
280280
return today.toISOString();
281281
}
282282

283-
convertTimeToMinutes(timeStamp: string, isFiveNumberIntervals: boolean = false): number {
284-
if (timeStamp === '' || timeStamp === null) {
285-
return null;
286-
}
287-
const parts = timeStamp.split(':');
288-
const hours = parseInt(parts[0], 10);
289-
const minutes = parseInt(parts[1], 10);
290-
if (isFiveNumberIntervals) {
291-
const result = ((hours * 60 + minutes) / 5);
292-
if (result !== 0) {
293-
return result + 1
294-
}
295-
return 0;
283+
convertTimeToMinutes(timeStamp: string, isFiveNumberIntervals: boolean = false): number {
284+
if (timeStamp === '' || timeStamp === null) {
285+
return null;
286+
}
287+
const parts = timeStamp.split(':');
288+
const hours = parseInt(parts[0], 10);
289+
const minutes = parseInt(parts[1], 10);
290+
if (isFiveNumberIntervals) {
291+
const result = ((hours * 60 + minutes) / 5);
292+
if (result !== 0) {
293+
return result + 1
294+
}
295+
return 0;
296+
}
297+
return hours * 60 + minutes;
296298
}
297-
return hours * 60 + minutes;
298-
}
299299

300-
convertHoursToTime(hours: number): string {
301-
const isNegative = hours < 0;
302-
if (hours < 0) {
303-
hours = Math.abs(hours);
304-
}
305-
const totalMinutes = Math.floor(hours * 60)
306-
const hrs = Math.floor(totalMinutes / 60);
307-
let mins = totalMinutes % 60;
308-
if (isNegative) {
309-
// return '${padZero(hrs)}:${padZero(60 - mins)}';
310-
return `-${hrs}:${this.padZero(mins)}`;
300+
convertHoursToTime(hours: number): string {
301+
const isNegative = hours < 0;
302+
if (hours < 0) {
303+
hours = Math.abs(hours);
304+
}
305+
const totalMinutes = Math.floor(hours * 60)
306+
const hrs = Math.floor(totalMinutes / 60);
307+
let mins = totalMinutes % 60;
308+
if (isNegative) {
309+
// return '${padZero(hrs)}:${padZero(60 - mins)}';
310+
return `-${hrs}:${this.padZero(mins)}`;
311+
}
312+
return `${this.padZero(hrs)}:${this.padZero(mins)}`;
311313
}
312-
return `${this.padZero(hrs)}:${this.padZero(mins)}`;
313-
}
314314

315315
onCancel() {
316316
}

0 commit comments

Comments
 (0)