Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Component, DoCheck, Inject, OnInit} from '@angular/core';
import {Component, DoCheck, OnInit,
inject
} from '@angular/core';
import {
MAT_DIALOG_DATA
} from '@angular/material/dialog';
Expand All @@ -24,22 +26,19 @@ import {
standalone: false
})
export class AssignedSiteDialogComponent implements DoCheck, OnInit {
private fb = inject(FormBuilder);
public data = inject<AssignedSiteModel>(MAT_DIALOG_DATA);
private timePlanningPnSettingsService = inject(TimePlanningPnSettingsService);
private store = inject(Store);

assignedSiteForm!: FormGroup;

public selectCurrentUserIsAdmin$ = this.store.select(selectCurrentUserIsAdmin);
public selectCurrentUserIsFirstUser$ = this.store.select(selectCurrentUserIsFirstUser);
private previousData: AssignedSiteModel;
private globalAutoBreakSettings: GlobalAutoBreakSettingsModel;

constructor(
private fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public data: AssignedSiteModel,
private timePlanningPnSettingsService: TimePlanningPnSettingsService,
private store: Store
) {
this.previousData = {...data};
// this.calculateHours();
}


ngDoCheck(): void {
if (this.hasDataChanged()) {
Expand All @@ -49,6 +48,8 @@ export class AssignedSiteDialogComponent implements DoCheck, OnInit {
}

ngOnInit(): void {
this.previousData = {...this.data};
// this.calculateHours();
this.timePlanningPnSettingsService.getGlobalAutoBreakCalculationSettings().subscribe(result => {
if (result && result.success) {
this.globalAutoBreakSettings = result.model;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Component, Inject, Input, OnDestroy, OnInit} from '@angular/core';
import {Component, OnDestroy, OnInit,
inject
} from '@angular/core';
import {EMPTY, Subscription} from 'rxjs';
import {MatDatepickerInputEvent} from '@angular/material/datepicker';
import {SiteDto} from 'src/app/common/models';
Expand All @@ -21,18 +23,17 @@ import {MAT_DIALOG_DATA} from '@angular/material/dialog';
standalone: false,
})
export class DownloadExcelDialogComponent implements OnInit, OnDestroy {
public availableSites = inject<SiteDto[]>(MAT_DIALOG_DATA);
private toastrService = inject(ToastrService);
private workingHoursService = inject(TimePlanningPnWorkingHoursService);

siteId: number;

dateFrom: Date = null;
dateTo: Date = null;
downloadReportSub$: Subscription;

constructor(
@Inject(MAT_DIALOG_DATA) public availableSites: SiteDto[] = [],
private toastrService: ToastrService,
private workingHoursService: TimePlanningPnWorkingHoursService,
) {
}


ngOnInit(): void {
// this.getAvailableSites();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Component, Inject, OnInit, TemplateRef, ViewChild} from '@angular/core';
import {Component, OnInit, TemplateRef, ViewChild,
inject
} from '@angular/core';
import {MAT_DIALOG_DATA} from '@angular/material/dialog';
import {TranslateService} from '@ngx-translate/core';
import {DatePipe} from '@angular/common';
Expand Down Expand Up @@ -26,6 +28,15 @@ import {
standalone: false
})
export class WorkdayEntityDialogComponent implements OnInit {
private fb = inject(FormBuilder);
private planningsService = inject(TimePlanningPnPlanningsService);
public data = inject<{
planningPrDayModels: PlanningPrDayModel,
assignedSiteModel: AssignedSiteModel
}>(MAT_DIALOG_DATA);
protected datePipe = inject(DatePipe);
private translateService = inject(TranslateService);

TimePlanningMessagesEnum = TimePlanningMessagesEnum;
enumKeys: string[] = [];
tableHeaders: MtxGridColumn[] = [];
Expand Down Expand Up @@ -54,17 +65,7 @@ export class WorkdayEntityDialogComponent implements OnInit {
private readonly timeRegex = /^([01]\d|2[0-3]):([0-5]\d)$/;
inputErrorMessages: Record<string, Record<string, string>> = {};

constructor(
private fb: FormBuilder,
private planningsService: TimePlanningPnPlanningsService,
@Inject(MAT_DIALOG_DATA) public data: {
planningPrDayModels: PlanningPrDayModel,
assignedSiteModel: AssignedSiteModel
},
protected datePipe: DatePipe,
private translateService: TranslateService,
) {
}


ngOnInit(): void {
// Enum-opsætning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit,
inject
} from '@angular/core';
import { AutoUnsubscribe } from 'ngx-auto-unsubscribe';
import {Subscription, take} from 'rxjs';
import { SiteDto } from 'src/app/common/models';
Expand All @@ -23,6 +25,11 @@ import {MatDatepickerInputEvent} from '@angular/material/datepicker';
standalone: false
})
export class TimePlanningsContainerComponent implements OnInit, OnDestroy {
private store = inject(Store);
private planningsService = inject(TimePlanningPnPlanningsService);
private settingsService = inject(TimePlanningPnSettingsService);
private dialog = inject(MatDialog);

timePlanningsRequest: TimePlanningsRequestModel;
availableSites: SiteDto[] = [];
showResignedSites: boolean = false;
Expand All @@ -38,12 +45,7 @@ export class TimePlanningsContainerComponent implements OnInit, OnDestroy {
public selectCurrentUserLocale$ = this.store.select(selectCurrentUserLocale);
locale: string;

constructor(
private store: Store,
private planningsService: TimePlanningPnPlanningsService,
private settingsService: TimePlanningPnSettingsService,
private dialog: MatDialog,
) {}


ngOnInit(): void {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, Output,
SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation,
inject
} from '@angular/core';
import {AssignedSiteModel, TimePlanningModel} from '../../../models';
import {MtxGridColumn} from '@ng-matero/extensions/grid';
Expand All @@ -23,6 +24,14 @@ import {selectAuthIsAdmin, selectCurrentUserIsFirstUser} from "src/app/state";

})
export class TimePlanningsTableComponent implements OnInit, OnChanges {
private store = inject(Store);
private planningsService = inject(TimePlanningPnPlanningsService);
private timePlanningPnSettingsService = inject(TimePlanningPnSettingsService);
private dialog = inject(MatDialog);
private translateService = inject(TranslateService);
protected datePipe = inject(DatePipe);
private cdr = inject(ChangeDetectorRef);

@Input() timePlannings: TimePlanningModel[] = [];
@Input() dateFrom!: Date;
@Input() dateTo!: Date;
Expand All @@ -38,16 +47,7 @@ export class TimePlanningsTableComponent implements OnInit, OnChanges {
protected selectAuthIsAdmin$ = this.store.select(selectAuthIsAdmin);
public selectCurrentUserIsFirstUser$ = this.store.select(selectCurrentUserIsFirstUser);

constructor(
private store: Store,
private planningsService: TimePlanningPnPlanningsService,
private timePlanningPnSettingsService: TimePlanningPnSettingsService,
private dialog: MatDialog,
private translateService: TranslateService,
protected datePipe: DatePipe,
private cdr: ChangeDetectorRef
) {
}


ngOnInit(): void {
this.enumKeys = Object.keys(TimePlanningMessagesEnum).filter(key => isNaN(Number(key)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Component, OnDestroy, OnInit,
inject
} from '@angular/core';
import {Subscription} from 'rxjs';
import {TimePlanningPnSettingsService} from '../../../services';
import {TimePlanningSettingsModel} from '../../../models';
Expand All @@ -12,18 +14,18 @@ import {Store} from '@ngrx/store';
standalone: false
})
export class TimePlanningSettingsComponent implements OnInit, OnDestroy {
private timePlanningPnSettingsService = inject(TimePlanningPnSettingsService);
private store = inject(Store);

getSettings$: Subscription;
settingsModel: TimePlanningSettingsModel = new TimePlanningSettingsModel();
previousData: TimePlanningSettingsModel = new TimePlanningSettingsModel();
public selectCurrentUserIsFirstUser$ = this.store.select(selectCurrentUserIsFirstUser);

constructor(
private timePlanningPnSettingsService: TimePlanningPnSettingsService,
private store: Store
) {
this.previousData = {...this.settingsModel};
}


ngOnInit() {
this.previousData = {...this.settingsModel};
this.getSettings();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {AfterContentInit, Component, OnInit} from '@angular/core';
import {AfterContentInit, Component, OnInit,
inject
} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
import {translates} from './../i18n/translates';
import {Store} from '@ngrx/store';
Expand All @@ -12,13 +14,15 @@ import {take} from 'rxjs';
standalone: false
})
export class TimePlanningPnLayoutComponent implements AfterContentInit, OnInit {
private translateService = inject(TranslateService);
private store = inject(Store);

private pluginName = 'time-planning';

constructor(
private translateService: TranslateService,
store: Store
) {
store.select(selectPluginsVisitedPlugins)


ngOnInit() {
this.store.select(selectPluginsVisitedPlugins)
.pipe(take(1))
.subscribe(x => {
// check current plugin in activated plugin
Expand All @@ -28,14 +32,11 @@ export class TimePlanningPnLayoutComponent implements AfterContentInit, OnInit {
this.translateService.setTranslation(locale, translates[locale], true);
});
// add plugin to visited plugins
store.dispatch(addPluginToVisited(this.pluginName));
this.store.dispatch(addPluginToVisited(this.pluginName));
}
});
}

ngOnInit() {
}

ngAfterContentInit() {
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Component,
Inject,
OnDestroy,
OnInit,
inject
} from '@angular/core';
import {AutoUnsubscribe} from 'ngx-auto-unsubscribe';
import {TimeFlexesModel} from '../../../../../models';
Expand All @@ -12,21 +12,21 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
@Component({
selector: 'app-time-flexes-comment-office-all-update-modal',
templateUrl: './time-flexes-comment-office-all-update-modal.component.html',
styleUrls: ['./time-flexes-comment-office-all-update-modal.component.scss'],
styleUrls: ['./time-flexes-comment-office-all-update-modal.component.scss',
],
standalone: false
})
export class TimeFlexesCommentOfficeAllUpdateModalComponent
implements OnInit, OnDestroy {
public dialogRef = inject(MatDialogRef<TimeFlexesCommentOfficeAllUpdateModalComponent>);
private injectedTimeFlexes = inject<TimeFlexesModel>(MAT_DIALOG_DATA);

timeFlexes: TimeFlexesModel = new TimeFlexesModel();

constructor(
public dialogRef: MatDialogRef<TimeFlexesCommentOfficeAllUpdateModalComponent>,
@Inject(MAT_DIALOG_DATA) timeFlexes: TimeFlexesModel,
) {
this.timeFlexes = {...timeFlexes};
}


ngOnInit() {
this.timeFlexes = {...this.injectedTimeFlexes};
}

onUpdateFlexPlanning() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Component,
Inject,
OnDestroy,
OnInit,
inject
} from '@angular/core';
import {AutoUnsubscribe} from 'ngx-auto-unsubscribe';
import {TimeFlexesModel} from '../../../../../models';
Expand All @@ -16,16 +16,15 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
standalone: false
})
export class TimeFlexesCommentOfficeUpdateModalComponent implements OnInit, OnDestroy {
public dialogRef = inject(MatDialogRef<TimeFlexesCommentOfficeUpdateModalComponent>);
private injectedTimeFlexes = inject<TimeFlexesModel>(MAT_DIALOG_DATA);

timeFlexes: TimeFlexesModel = new TimeFlexesModel();

constructor(
public dialogRef: MatDialogRef<TimeFlexesCommentOfficeUpdateModalComponent>,
@Inject(MAT_DIALOG_DATA) timeFlexes: TimeFlexesModel,
) {
this.timeFlexes = {...timeFlexes};
}


ngOnInit() {
this.timeFlexes = {...this.injectedTimeFlexes};
}

onUpdateFlexPlanning() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit,
inject
} from '@angular/core';
import { AutoUnsubscribe } from 'ngx-auto-unsubscribe';
import { Subscription } from 'rxjs';
import { SiteDto } from 'src/app/common/models';
Expand All @@ -17,6 +19,8 @@ import { TimePlanningPnFlexesService } from '../../../../services';
standalone: false
})
export class TimeFlexesContainerComponent implements OnInit, OnDestroy {
private planningsService = inject(TimePlanningPnFlexesService);

timePlanningsRequest: TimePlanningsRequestModel;
availableSites: SiteDto[] = [];
timePlannings: TimeFlexesModel[] = [];
Expand All @@ -25,7 +29,7 @@ export class TimeFlexesContainerComponent implements OnInit, OnDestroy {
getTimePlannings$: Subscription;
updateTimePlanning$: Subscription;

constructor(private planningsService: TimePlanningPnFlexesService) {}


ngOnInit(): void {
this.getPlannings();
Expand Down
Loading
Loading