diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-entity-list-modal/area-rule-entity-list-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-entity-list-modal/area-rule-entity-list-modal.component.ts index 30de81be3..f472e5f24 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-entity-list-modal/area-rule-entity-list-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-entity-list-modal/area-rule-entity-list-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit,} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import {EntityItemModel} from 'src/app/common/models'; import { EntityItemEditNameComponent } from 'src/app/common/modules/eform-shared/components'; import {EntitySelectService} from 'src/app/common/services'; @@ -16,21 +18,23 @@ import {Subscription} from 'rxjs'; standalone: false }) export class AreaRuleEntityListModalComponent implements OnInit, OnDestroy { + private entitySelectService = inject(EntitySelectService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + public dialogRef = inject(MatDialogRef); + private groupId = inject(MAT_DIALOG_DATA); + entityListChanged: EventEmitter> = new EventEmitter>(); entityList: Array = []; entityItemEditNameComponentAfterClosedSub$: Subscription; getEntitySelectableGroupSub$: Subscription; - constructor( - private entitySelectService: EntitySelectService, - public dialog: MatDialog, - private overlay: Overlay, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) groupId?: number - ) { - if (groupId) { - this.getEntitySelectableGroupSub$ = this.entitySelectService.getEntitySelectableGroup(groupId) + + + ngOnInit() { + if (this.groupId) { + this.getEntitySelectableGroupSub$ = this.entitySelectService.getEntitySelectableGroup(this.groupId) .subscribe(data => { if (data && data.success && data.model) { this.entityList = [...data.model.entityGroupItemLst]; @@ -43,9 +47,7 @@ export class AreaRuleEntityListModalComponent implements OnInit, OnDestroy { } }) } - } - - ngOnInit() {} +} hide() { this.dialogRef.close(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-plan-modal/area-rule-plan-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-plan-modal/area-rule-plan-modal.component.ts index 9f0bf203e..2ba117ad2 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-plan-modal/area-rule-plan-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/area-rule-plan-modal/area-rule-plan-modal.component.ts @@ -1,8 +1,8 @@ import { Component, EventEmitter, - Inject, OnInit, + inject } from '@angular/core'; import {format} from 'date-fns'; import { @@ -32,6 +32,15 @@ import {generateWeeksList} from '../../helpers'; standalone: false }) export class AreaRulePlanModalComponent implements OnInit { + private translate = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private model = inject<{ + areaRule: AreaRuleSimpleModel | AreaRuleNameAndTypeSpecificFields, + propertyId: number, + area: AreaModel, + areaRulePlan: AreaRulePlanningModel, + }>(MAT_DIALOG_DATA); + updateAreaRulePlan: EventEmitter = new EventEmitter(); selectedArea: AreaModel = new AreaModel(); selectedAreaRulePlanning: AreaRulePlanningModel = new AreaRulePlanningModel(); @@ -104,23 +113,14 @@ export class AreaRulePlanModalComponent implements OnInit { return this.selectedArea.availableWorkers.filter(x => assignedSites.some(y => y === x.siteId)); } - constructor( - private translate: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: { - areaRule: AreaRuleSimpleModel | AreaRuleNameAndTypeSpecificFields, - propertyId: number, - area: AreaModel, - areaRulePlan: AreaRulePlanningModel, - }, - ) { - this.setData(model.areaRule, model.propertyId, model.area, model.areaRulePlan); - } + ngOnInit() { + this.setData(this.model.areaRule, this.model.propertyId, this.model.area, this.model.areaRulePlan); + this.repeatTypeDay = R.map(x => { return {name: x === 1 ? this.translate.instant('Every') : x.toString(), id: x}; - }, R.range(1, 31)); // 1, 2, ..., 29, 30. + }, R.range(1, 31)); // 1, 2, ..., 29, 30. this.repeatTypeWeek = R.map(x => { return {name: x === 1 ? this.translate.instant('Every') : x.toString(), id: x}; }, R.range(1, 51)); // 1, 2, ..., 49, 50. diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/backend-configuration-case/backend-configuration-case-page/backend-configuration-case-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/backend-configuration-case/backend-configuration-case-page/backend-configuration-case-page.component.ts index 46b88f0e3..81e306223 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/backend-configuration-case/backend-configuration-case-page/backend-configuration-case-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/backend-configuration-case/backend-configuration-case-page/backend-configuration-case-page.component.ts @@ -4,6 +4,7 @@ import { QueryList, ViewChild, ViewChildren, + inject } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EFormService, CasesService} from 'src/app/common/services'; @@ -27,6 +28,13 @@ import {Store} from '@ngrx/store'; standalone: false }) export class BackendConfigurationCasePageComponent implements OnInit { + private activateRoute = inject(ActivatedRoute); + private casesService = inject(CasesService); + private store = inject(Store); + private eFormService = inject(EFormService); + private router = inject(Router); + private backendConfigurationPnCasesService = inject(BackendConfigurationPnCasesService); + @ViewChildren(CaseEditElementComponent) editElements: QueryList; @ViewChild('caseConfirmation', { static: false }) caseConfirmation; @@ -41,14 +49,9 @@ export class BackendConfigurationCasePageComponent implements OnInit { maxDate: Date; initialDate: Date; - constructor( - private activateRoute: ActivatedRoute, - private casesService: CasesService, - private store: Store, - private eFormService: EFormService, - private router: Router, - private backendConfigurationPnCasesService: BackendConfigurationPnCasesService - ) { + + + ngOnInit() { this.activateRoute.params.subscribe((params) => { this.id = +params['id']; this.planningId = +params['planningId']; @@ -57,9 +60,7 @@ export class BackendConfigurationCasePageComponent implements OnInit { this.activateRoute.queryParams.subscribe((queryParams) => { this.reverseRoute = queryParams['reverseRoute']; }) - } - ngOnInit() { this.loadTemplateInfo(); this.maxDate = new Date(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-container/properties-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-container/properties-container.component.ts index 6814af395..a49d99e32 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-container/properties-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-container/properties-container.component.ts @@ -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 {Subject, Subscription} from 'rxjs'; import {EntityItemModel, Paged} from 'src/app/common/models'; @@ -33,6 +35,14 @@ import {dialogConfigHelper} from 'src/app/common/helpers'; standalone: false }) export class PropertiesContainerComponent implements OnInit, OnDestroy { + private propertiesService = inject(BackendConfigurationPnPropertiesService); + public propertiesStateService = inject(PropertiesStateService); + public authStateService = inject(AuthStateService); + private entitySelectService = inject(EntitySelectService); + private translateService = inject(TranslateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + isFarms: boolean = false; tableHeaders: MtxGridColumn[] = [ { @@ -127,26 +137,18 @@ export class PropertiesContainerComponent implements OnInit, OnDestroy { updateEntitySelectableGroupSub$: Subscription; nameSearchSubjectSub$: Subscription; - constructor( - private propertiesService: BackendConfigurationPnPropertiesService, - public propertiesStateService: PropertiesStateService, - public authStateService: AuthStateService, - private entitySelectService: EntitySelectService, - private translateService: TranslateService, - private dialog: MatDialog, - private overlay: Overlay, - ) { - this.nameSearchSubjectSub$ = this.nameSearchSubject.pipe(debounceTime(500)).subscribe((val) => { - this.propertiesStateService.updateNameFilter(val.toString()); - this.getProperties(); - }); - } + // get backendConfigurationPnClaims() { // return BackendConfigurationPnClaims; // } ngOnInit() { + this.nameSearchSubjectSub$ = this.nameSearchSubject.pipe(debounceTime(500)).subscribe((val) => { + this.propertiesStateService.updateNameFilter(val.toString()); + this.getProperties(); + }); + this.getProperties(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-table/properties-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-table/properties-table.component.ts index 457bb3f56..b20fc16ce 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-table/properties-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/properties-page/properties-table/properties-table.component.ts @@ -1,4 +1,6 @@ -import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output,} from '@angular/core'; +import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, + inject +} from '@angular/core'; import {Paged, TableHeaderElementModel} from 'src/app/common/models'; import {PropertyModel} from '../../../../models/properties'; import {PropertiesStateService} from '../../store'; @@ -28,6 +30,13 @@ import { standalone: false }) export class PropertiesTableComponent implements OnInit { + private store = inject(Store); + public propertiesStateService = inject(PropertiesStateService); + private entitySelectService = inject(EntitySelectService); + public authStateService = inject(AuthStateService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + @Input() nameSearchSubject = new Subject(); @Input() propertiesModel: Paged = new Paged(); @@ -58,17 +67,12 @@ export class PropertiesTableComponent implements OnInit { return PropertyCompliancesColorBadgesEnum; } - constructor( - private store: Store, - public propertiesStateService: PropertiesStateService, - private entitySelectService: EntitySelectService, - public authStateService: AuthStateService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - ) { - iconRegistry.addSvgIconLiteral('file-word', sanitizer.bypassSecurityTrustHtml(WordIcon)); + + constructor() { + this.iconRegistry.addSvgIconLiteral('file-word', this.sanitizer.bypassSecurityTrustHtml(WordIcon)); } + ngOnInit(): void { this.tableHeaders = [ { header: 'ID', field: 'id', sortable: true }, diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-create-modal/property-create-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-create-modal/property-create-modal.component.ts index 45e231abd..dca896a24 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-create-modal/property-create-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-create-modal/property-create-modal.component.ts @@ -1,4 +1,6 @@ -import { Component, EventEmitter, OnDestroy, OnInit } from '@angular/core'; +import { Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { applicationLanguages, applicationLanguagesTranslated } from 'src/app/common/const'; import { PropertyCreateModel } from '../../../../models'; @@ -16,6 +18,11 @@ import { Subscription } from 'rxjs'; standalone: false }) export class PropertyCreateModalComponent implements OnInit, OnDestroy { + private fb = inject(FormBuilder); + public authStateService = inject(AuthStateService); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + public dialogRef = inject(MatDialogRef); + propertyCreate: EventEmitter = new EventEmitter(); newPropertyForm: FormGroup; newProperty: PropertyCreateModel = new PropertyCreateModel(); @@ -29,12 +36,12 @@ export class PropertyCreateModalComponent implements OnInit, OnDestroy { return applicationLanguages; } - constructor( - private fb: FormBuilder, - public authStateService: AuthStateService, - private propertiesService: BackendConfigurationPnPropertiesService, - public dialogRef: MatDialogRef - ) { + + + ngOnDestroy(): void { + } + + ngOnInit() { this.propertyIsFarm = false; // Initialize reactive form @@ -47,12 +54,7 @@ export class PropertyCreateModalComponent implements OnInit, OnDestroy { workorderEnable: [false], isFarm: [false] }); - } - ngOnDestroy(): void { - } - - ngOnInit() { } hide() { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-delete-modal/property-delete-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-delete-modal/property-delete-modal.component.ts index f11f58278..be98e5436 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-delete-modal/property-delete-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-delete-modal/property-delete-modal.component.ts @@ -1,8 +1,8 @@ import { Component, EventEmitter, - Inject, OnInit, + inject } from '@angular/core'; import { PropertyModel } from '../../../../models'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @@ -14,12 +14,12 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class PropertyDeleteModalComponent implements OnInit { + public dialogRef = inject(MatDialogRef); + public propertyModel = inject(MAT_DIALOG_DATA); + propertyDelete: EventEmitter = new EventEmitter(); - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public propertyModel: PropertyModel = new PropertyModel() - ) {} + ngOnInit() {} diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-docx-report-modal/property-docx-report-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-docx-report-modal/property-docx-report-modal.component.ts index c37ccba15..72f4eb4cd 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-docx-report-modal/property-docx-report-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-docx-report-modal/property-docx-report-modal.component.ts @@ -1,8 +1,8 @@ import { Component, - Inject, OnDestroy, OnInit, + inject } from '@angular/core'; import {PropertyAreaModel,} from '../../../../models'; import {BackendConfigurationPnPropertiesService, BackendConfigurationPnReportService} from '../../../../services'; @@ -22,6 +22,12 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class PropertyDocxReportModalComponent implements OnInit, OnDestroy { + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + private reportService = inject(BackendConfigurationPnReportService); + private toasterService = inject(ToastrService); + public dialogRef = inject(MatDialogRef); + public propertyId = inject(MAT_DIALOG_DATA); + selectedArea: PropertyAreaModel; selectedYear: number; areasList: PropertyAreaModel[] = []; @@ -30,23 +36,17 @@ export class PropertyDocxReportModalComponent implements OnInit, OnDestroy { downloadReportSub$: Subscription; getPropertyAreasSub$: Subscription; - constructor( - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - private reportService: BackendConfigurationPnReportService, - private toasterService: ToastrService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public propertyId: number - ) { + + + ngOnInit() { this.getPropertyAreasSub$ = this.backendConfigurationPnPropertiesService - .getPropertyAreas(propertyId) + .getPropertyAreas(this.propertyId) .subscribe((data) => { if (data && data.success && data.model) { this.areasList = data.model.filter(x => x.activated && x.name === '24. IE-indberetning'); } }); - } - ngOnInit() { const currentYear = new Date().getFullYear(); this.years = R.range(currentYear - 1, currentYear + 10); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-areas-modal/property-areas-edit-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-areas-modal/property-areas-edit-modal.component.ts index cfe0266cf..665745d95 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-areas-modal/property-areas-edit-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-areas-modal/property-areas-edit-modal.component.ts @@ -1,8 +1,8 @@ import { Component, EventEmitter, - Inject, OnInit, + inject } from '@angular/core'; import { PropertyAreaModel, @@ -24,6 +24,12 @@ import {Store} from '@ngrx/store'; standalone: false }) export class PropertyAreasEditModalComponent implements OnInit { + private store = inject(Store); + public authStateService = inject(AuthStateService); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private model = inject<{ selectedProperty: PropertyModel, propertyAreas: PropertyAreaModel[] }>(MAT_DIALOG_DATA); + updatePropertyAreas: EventEmitter = new EventEmitter(); selectedProperty: PropertyUpdateModel = new PropertyUpdateModel(); selectedPropertyAreas: PropertyAreaModel[] = []; @@ -49,21 +55,15 @@ export class PropertyAreasEditModalComponent implements OnInit { public isAuth$ = this.store.select(selectAuthIsAuth); private selectAuthIsAdmin$ = this.store.select(selectAuthIsAuth); - constructor( - private store: Store, - public authStateService: AuthStateService, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: { selectedProperty: PropertyModel, propertyAreas: PropertyAreaModel[] } - ) { - this.selectedProperty = {...model.selectedProperty, languagesIds: []}; + + + ngOnInit() { + this.selectedProperty = {...this.model.selectedProperty, languagesIds: []}; this.selectAuthIsAdmin$.subscribe((isAdmin) => { - this.selectedPropertyAreas = model.propertyAreas + this.selectedPropertyAreas = this.model.propertyAreas .filter(x => (!this.disabledAreas.includes(x.name) || isAdmin)); }); - } - ngOnInit() { } get getSelectedPropertyAreas() { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-modal/property-edit-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-modal/property-edit-modal.component.ts index 2a3eead61..9f7c6064c 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-modal/property-edit-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/properties/property-actions/property-edit-modal/property-edit-modal.component.ts @@ -1,9 +1,9 @@ import { Component, EventEmitter, - Inject, OnDestroy, OnInit, + inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { applicationLanguages } from 'src/app/common/const'; @@ -24,6 +24,13 @@ import { selectAuthIsAuth } from 'src/app/state/auth/auth.selector'; standalone: false, }) export class PropertyEditModalComponent implements OnInit, OnDestroy { + private fb = inject(FormBuilder); + private store = inject(Store); + public authStateService = inject(AuthStateService); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + public dialogRef = inject(MatDialogRef); + public model = inject(MAT_DIALOG_DATA); + propertyUpdate: EventEmitter = new EventEmitter(); editPropertyForm: FormGroup; propertyIsFarm = false; @@ -33,31 +40,24 @@ export class PropertyEditModalComponent implements OnInit, OnDestroy { getCompanyTypeSub$: Subscription; public selectAuthIsAdmin$ = this.store.select(selectAuthIsAuth); - constructor( - private fb: FormBuilder, - private store: Store, - public authStateService: AuthStateService, - private propertiesService: BackendConfigurationPnPropertiesService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public model: PropertyModel - ) { - this.selectedLanguages = model.languages.map((x) => ({ id: x.id, checked: true })); + + + ngOnInit() { + this.selectedLanguages = this.model.languages.map((x) => ({ id: x.id, checked: true })); this.editPropertyForm = this.fb.group({ - cvr: [model.cvr, Validators.required], - mainMailAddress: [model.mainMailAddress], - name: [model.name, Validators.required], - chr: [model.chr], - address: [model.address], - workorderEnable: [model.workorderEnable || false], - isFarm: [model.isFarm || false], - industryCode: [model.industryCode || ''] + cvr: [this.model.cvr, Validators.required], + mainMailAddress: [this.model.mainMailAddress], + name: [this.model.name, Validators.required], + chr: [this.model.chr], + address: [this.model.address], + workorderEnable: [this.model.workorderEnable || false], + isFarm: [this.model.isFarm || false], + industryCode: [this.model.industryCode || ''] }); - this.propertyIsFarm = model.isFarm || false; - } - - ngOnInit() {} + this.propertyIsFarm = this.model.isFarm || false; +} hide() { this.dialogRef.close(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/property-areas/property-areas.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/property-areas/property-areas.component.ts index cb8fcac92..ce82deb0e 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/property-areas/property-areas.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/property-areas/property-areas.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit,} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import { PropertyAreaModel, PropertyAreasUpdateModel, @@ -26,6 +28,16 @@ import {Store} from '@ngrx/store'; standalone: false }) export class PropertyAreasComponent implements OnInit, OnDestroy { + private store = inject(Store); + public route = inject(ActivatedRoute); + public router = inject(Router); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + private translateService = inject(TranslateService); + public authStateService = inject(AuthStateService); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + selectedProperty: PropertyModel = new PropertyModel(); selectedPropertyAreas: Array = new Array(); breadcrumbs = [ @@ -83,18 +95,7 @@ export class PropertyAreasComponent implements OnInit, OnDestroy { public isAuth$ = this.store.select(selectAuthIsAuth); public selectAuthIsAdmin$ = this.store.select(selectAuthIsAuth); - constructor( - private store: Store, - public route: ActivatedRoute, - public router: Router, - private dialog: MatDialog, - private overlay: Overlay, - private translateService: TranslateService, - public authStateService: AuthStateService, - private propertiesService: BackendConfigurationPnPropertiesService, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - ) { - } + ngOnInit() { this.routerSub$ = this.route.params.subscribe((params) => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/case-delete/case-delete.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/case-delete/case-delete.component.ts index 806561cbf..9817be7e3 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/case-delete/case-delete.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/case-delete/case-delete.component.ts @@ -1,7 +1,7 @@ import { Component, - Inject, OnInit, + inject } from '@angular/core'; import {BackendConfigurationPnReportService} from '../../../services'; import {ReportEformItemModel} from '../../../models'; @@ -14,12 +14,11 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class CaseDeleteComponent implements OnInit { - constructor( - private backendConfigurationPnReportService: BackendConfigurationPnReportService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public reportEformItemModel: ReportEformItemModel - ) { - } + private backendConfigurationPnReportService = inject(BackendConfigurationPnReportService); + public dialogRef = inject(MatDialogRef); + public reportEformItemModel = inject(MAT_DIALOG_DATA); + + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-container/report-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-container/report-container.component.ts index 2ddb34db0..f3478be81 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-container/report-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-container/report-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import {saveAs} from 'file-saver'; import {ToastrService} from 'ngx-toastr'; import { @@ -32,6 +34,17 @@ import {TranslateService} from "@ngx-translate/core"; standalone: false }) export class ReportContainerComponent implements OnInit, OnDestroy { + private translateService = inject(TranslateService); + private reportService = inject(BackendConfigurationPnReportService); + private toastrService = inject(ToastrService); + public gallery = inject(Gallery); + public lightbox = inject(Lightbox); + private imageService = inject(TemplateFilesService); + private viewportScroller = inject(ViewportScroller); + private store = inject(Store); + private reportStateService = inject(ReportStateService); + private router = inject(Router); + reportsModel: ReportEformPnModel[] = []; availableTags: SharedTagModel[] = []; currentUserFullName: string; @@ -47,29 +60,18 @@ export class ReportContainerComponent implements OnInit, OnDestroy { generateReportSub$: Subscription; downloadReportSub$: Subscription; - constructor( - private translateService: TranslateService, - private reportService: BackendConfigurationPnReportService, - private toastrService: ToastrService, - public gallery: Gallery, - public lightbox: Lightbox, - private imageService: TemplateFilesService, - private viewportScroller: ViewportScroller, - private store: Store, - private reportStateService: ReportStateService, - private router: Router, - ) { + + + ngOnInit() { this.selectReportsV1ScrollPosition$ .pipe(take(1)) .subscribe(scrollPosition => this.scrollPosition = scrollPosition); - } - ngOnInit() { let reportPnGenerateModel: ReportPnGenerateModel = { ...this.reportStateService.extractData(), type: '', version2: false - }; + }; if (reportPnGenerateModel.dateFrom !== null) { this.startWithParams = true; this.onGenerateReport(reportPnGenerateModel); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-header/report-header.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-header/report-header.component.ts index a428c6c5c..699379b80 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-header/report-header.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-header/report-header.component.ts @@ -5,6 +5,7 @@ import { OnInit, Output, OnDestroy, + inject } from '@angular/core'; import {FormControl, FormGroup, Validators} from '@angular/forms'; import {ReportPnGenerateModel} from '../../../models/report'; @@ -25,6 +26,10 @@ import {format, parse} from 'date-fns'; standalone: false }) export class ReportHeaderComponent implements OnInit, OnDestroy { + private reportStateService = inject(ReportStateService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + @Output() generateReport: EventEmitter = new EventEmitter(); @Output() @@ -37,17 +42,13 @@ export class ReportHeaderComponent implements OnInit, OnDestroy { valueChangesSub$: Subscription; - constructor( - private reportStateService: ReportStateService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - ) { - iconRegistry.addSvgIconLiteral('file-word', sanitizer.bypassSecurityTrustHtml(WordIcon)); - iconRegistry.addSvgIconLiteral('file-excel', sanitizer.bypassSecurityTrustHtml(ExcelIcon)); - iconRegistry.addSvgIconLiteral('file-pdf', sanitizer.bypassSecurityTrustHtml(PdfIcon)); - } + ngOnInit() { + this.iconRegistry.addSvgIconLiteral('file-word', this.sanitizer.bypassSecurityTrustHtml(WordIcon)); + this.iconRegistry.addSvgIconLiteral('file-excel', this.sanitizer.bypassSecurityTrustHtml(ExcelIcon)); + this.iconRegistry.addSvgIconLiteral('file-pdf', this.sanitizer.bypassSecurityTrustHtml(PdfIcon)); + const reportPnGenerateModel = this.reportStateService.extractData(); this.generateForm = new FormGroup( { @@ -59,7 +60,7 @@ export class ReportHeaderComponent implements OnInit, OnDestroy { dateTo: new FormControl( reportPnGenerateModel.dateTo && parse(reportPnGenerateModel.dateTo, PARSING_DATE_FORMAT, new Date()), [Validators.required]), - },), + },), }); this.valueChangesSub$ = this.generateForm.valueChanges.subscribe( (value) => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-table/report-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-table/report-table.component.ts index 1aad37fdd..e89d9b8e9 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-table/report-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/components/reports/report-table/report-table.component.ts @@ -8,6 +8,7 @@ import { OnInit, Output, SimpleChanges, + inject } from '@angular/core'; import {ReportEformItemModel} from '../../../models/report'; import {CaseDeleteComponent} from '../../../components'; @@ -31,6 +32,11 @@ import {Store} from '@ngrx/store'; standalone: false }) export class ReportTableComponent implements OnInit, OnChanges, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + @Input() items: ReportEformItemModel[] = []; @Input() reportIndex: number; @Input() itemHeaders: { key: string; value: string }[] = []; @@ -86,15 +92,12 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy { private selectAuthIsAdmin$ = this.store.select(selectAuthIsAuth); private selectCurrentUserFullName$ = this.store.select(selectCurrentUserFullName); - constructor( - private store: Store, - private translateService: TranslateService, - private dialog: MatDialog, - private overlay: Overlay, - ) { + + constructor() { this.selectAuthIsAdmin$.pipe(take(1)).subscribe((selectAuthIsAdmin) => this.isAdmin = selectAuthIsAdmin); } + ngOnChanges(changes: SimpleChanges): void { if (/*!changes.itemHeaders.isFirstChange() && */changes.itemHeaders) { const itemHeaders = this.itemHeaders.map((x, i): MtxGridColumn => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/layouts/backend-configuration-pn-layout.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/layouts/backend-configuration-pn-layout.component.ts index 23880ae7f..0c57399cd 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/layouts/backend-configuration-pn-layout.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/layouts/backend-configuration-pn-layout.component.ts @@ -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 {addPluginToVisited, selectPluginsVisitedPlugins} from 'src/app/state'; @@ -12,13 +14,15 @@ import {take} from 'rxjs'; standalone: false }) export class BackendConfigurationPnLayoutComponent implements AfterContentInit, OnInit { + private translateService = inject(TranslateService); + private store = inject(Store); + private pluginName = 'backend-configuration'; - 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 @@ -28,14 +32,11 @@ export class BackendConfigurationPnLayoutComponent implements AfterContentInit, 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() { } } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-create-modal/area-rule-create-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-create-modal/area-rule-create-modal.component.ts index d6de8f031..1966ef02c 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-create-modal/area-rule-create-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-create-modal/area-rule-create-modal.component.ts @@ -2,10 +2,10 @@ import { ChangeDetectorRef, Component, EventEmitter, - Inject, OnInit, TemplateRef, ViewChild, + inject } from '@angular/core'; import {debounceTime, switchMap} from 'rxjs/operators'; import {TemplateListModel, TemplateRequestModel} from 'src/app/common/models'; @@ -33,6 +33,13 @@ import {MtxGridColumn, MtxGridCellTemplate} from '@ng-matero/extensions/grid'; standalone: false }) export class AreaRuleCreateModalComponent implements OnInit { + private eFormService = inject(EFormService); + private cd = inject(ChangeDetectorRef); + private backendConfigurationPnAreasService = inject(BackendConfigurationPnAreasService); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private injectedData = inject<{selectedArea: AreaModel, areaRules: AreaRuleSimpleModel[]}>(MAT_DIALOG_DATA); + @ViewChild('checkboxTpl', { static: true }) checkboxTpl!: TemplateRef; @ViewChild('weekdaysTpl', { static: true }) weekdaysTpl!: TemplateRef; selectedArea: AreaModel = new AreaModel(); @@ -135,17 +142,11 @@ export class AreaRuleCreateModalComponent implements OnInit { dataForTable: Array>> = []; - constructor( - private eFormService: EFormService, - private cd: ChangeDetectorRef, - private backendConfigurationPnAreasService: BackendConfigurationPnAreasService, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: {selectedArea: AreaModel, areaRules: AreaRuleSimpleModel[]} - ) { + - this.selectedArea = model.selectedArea; - this.areaRules = model.areaRules; + ngOnInit() { + this.selectedArea = this.injectedData.selectedArea; + this.areaRules = this.injectedData.areaRules; this.typeahead .pipe( @@ -179,12 +180,10 @@ export class AreaRuleCreateModalComponent implements OnInit { }); this.areaRules.forEach(x => this.newAreaRulesForType8 = [...this.newAreaRulesForType8, x.translatedName]); } - } - ngOnInit() { this.hours.forEach((x, index) => { this.templates = {...this.templates, [`${index}.isActive`]: this.checkboxTpl}; - }); + }); this.templates = {...this.templates, weekdays: this.weekdaysTpl}; } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-delete-modal/area-rule-delete-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-delete-modal/area-rule-delete-modal.component.ts index 69c2a5d97..af658e48f 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-delete-modal/area-rule-delete-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-delete-modal/area-rule-delete-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {AreaRuleSimpleModel} from '../../../../models'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @@ -9,13 +11,12 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class AreaRuleDeleteModalComponent implements OnInit { + public dialogRef = inject(MatDialogRef); + public areaRule = inject(MAT_DIALOG_DATA); + deleteAreaRule: EventEmitter = new EventEmitter(); - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public areaRule: AreaRuleSimpleModel = new AreaRuleSimpleModel(), - ) { - } + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-edit-modal/area-rule-edit-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-edit-modal/area-rule-edit-modal.component.ts index f22ac9caa..da5d7ebfe 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-edit-modal/area-rule-edit-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rule-edit-modal/area-rule-edit-modal.component.ts @@ -2,10 +2,10 @@ import { ChangeDetectorRef, Component, EventEmitter, - Inject, OnInit, TemplateRef, ViewChild, + inject } from '@angular/core'; import { debounceTime, switchMap } from 'rxjs/operators'; import { TemplateListModel, TemplateRequestModel } from 'src/app/common/models'; @@ -28,6 +28,12 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class AreaRuleEditModalComponent implements OnInit { + private eFormService = inject(EFormService); + private cd = inject(ChangeDetectorRef); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private model = inject<{areaRule: AreaRuleModel, selectedArea: AreaModel, planningStatus: boolean}>(MAT_DIALOG_DATA); + @ViewChild('checkboxTpl', { static: true }) checkboxTpl!: TemplateRef; @ViewChild('weekdaysTpl', { static: true }) weekdaysTpl!: TemplateRef; selectedArea: AreaModel = new AreaModel(); @@ -122,22 +128,18 @@ export class AreaRuleEditModalComponent implements OnInit { dataForTable: Array>> = []; - constructor( - private eFormService: EFormService, - private cd: ChangeDetectorRef, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: {areaRule: AreaRuleModel, selectedArea: AreaModel, planningStatus: boolean} - ) { - this.planningStatus = model.planningStatus; + + + ngOnInit() { + this.planningStatus = this.model.planningStatus; //this.selectedAreaRule = R.clone(model.areaRule); this.selectedAreaRule = new AreaRuleUpdateModel(); - this.selectedAreaRule.id = model.areaRule.id; - this.selectedAreaRule.eformId = model.areaRule.eformId; - this.selectedAreaRule.eformName = model.areaRule.eformName; - this.selectedAreaRule.typeSpecificFields = R.clone(model.areaRule.typeSpecificFields); - this.selectedAreaRule.translatedNames = R.clone(model.areaRule.translatedNames); - this.selectedArea = model.selectedArea; + this.selectedAreaRule.id = this.model.areaRule.id; + this.selectedAreaRule.eformId = this.model.areaRule.eformId; + this.selectedAreaRule.eformName = this.model.areaRule.eformName; + this.selectedAreaRule.typeSpecificFields = R.clone(this.model.areaRule.typeSpecificFields); + this.selectedAreaRule.translatedNames = R.clone(this.model.areaRule.translatedNames); + this.selectedArea = this.model.selectedArea; this.typeahead .pipe( @@ -151,12 +153,10 @@ export class AreaRuleEditModalComponent implements OnInit { this.templatesModel = items.model; this.cd.markForCheck(); }); - } - ngOnInit() { this.hours.forEach((x, index) => { this.templates = {...this.templates, [`${index}.isActive`]: this.checkboxTpl}; - }); + }); this.templates = {...this.templates, weekdays: this.weekdaysTpl}; this.dataForTable = this.getDataForTable(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-container/area-rules-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-container/area-rules-container.component.ts index 9bfc0dd99..ee4348a7a 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-container/area-rules-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-container/area-rules-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit,} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {Subscription} from 'rxjs'; @@ -40,6 +42,16 @@ import { Sort } from '@angular/material/sort'; standalone: false }) export class AreaRulesContainerComponent implements OnInit, OnDestroy { + private areasService = inject(BackendConfigurationPnAreasService); + public authStateService = inject(AuthStateService); + private route = inject(ActivatedRoute); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + private translateService = inject(TranslateService); + private entitySelectService = inject(EntitySelectService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + private areaRulesStateService = inject(AreaRulesStateService); + areaRules: AreaRuleSimpleModel[] = []; selectedArea: AreaModel = new AreaModel(); chemicalsModel: Paged = new Paged(); @@ -75,19 +87,7 @@ export class AreaRulesContainerComponent implements OnInit, OnDestroy { onUpdateAreaRuleSub$: Subscription; propertyUpdateSub$: Subscription; - constructor( - private areasService: BackendConfigurationPnAreasService, - public authStateService: AuthStateService, - private route: ActivatedRoute, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - private translateService: TranslateService, - private entitySelectService: EntitySelectService, - // public chemicalsStateService: ChemicalsStateService, - private dialog: MatDialog, - private overlay: Overlay, - private areaRulesStateService: AreaRulesStateService, - ) { - } + ngOnInit() { this.routerSub$ = this.route.params.subscribe((params) => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-table/area-rules-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-table/area-rules-table.component.ts index 2b882301e..90b97dda0 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-table/area-rules-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/area-rules/components/area-rules-table/area-rules-table.component.ts @@ -6,6 +6,7 @@ import { OnChanges, OnInit, Output, SimpleChanges, + inject } from '@angular/core'; import {Paged,} from 'src/app/common/models'; import { @@ -39,6 +40,14 @@ import { standalone: false }) export class AreaRulesTableComponent implements OnChanges, OnInit { + private store = inject(Store); + private authStateService = inject(AuthStateService); + private templateFilesService = inject(TemplateFilesService); + private translateService = inject(TranslateService); + public areaRulesStateService = inject(AreaRulesStateService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + @Input() areaRules: AreaRuleSimpleModel[] = []; @Input() chemicalsModel: Paged = new Paged(); @Input() selectedArea: AreaModel = new AreaModel(); @@ -457,18 +466,12 @@ export class AreaRulesTableComponent implements OnChanges, OnInit { public selectAreaRulesPaginationSort$ = this.store.select(selectAreaRulesPaginationSort); public selectAreaRulesPaginationIsSortDsc$ = this.store.select(selectAreaRulesPaginationIsSortDsc); - constructor( - private store: Store, - private authStateService: AuthStateService, - private templateFilesService: TemplateFilesService, - private translateService: TranslateService, - public areaRulesStateService: AreaRulesStateService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - ) { - iconRegistry.addSvgIconLiteral('file-pdf', sanitizer.bypassSecurityTrustHtml(PdfIcon)); + + constructor() { + this.iconRegistry.addSvgIconLiteral('file-pdf', this.sanitizer.bypassSecurityTrustHtml(PdfIcon)); } + ngOnChanges(changes: SimpleChanges): void { if ( ( diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-case/compliance-case-page/compliance-case-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-case/compliance-case-page/compliance-case-page.component.ts index bfd091ce8..c23d67d7c 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-case/compliance-case-page/compliance-case-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-case/compliance-case-page/compliance-case-page.component.ts @@ -4,6 +4,7 @@ import { QueryList, ViewChild, ViewChildren, + inject } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EFormService} from 'src/app/common/services'; @@ -28,6 +29,11 @@ import {Store} from '@ngrx/store'; standalone: false }) export class ComplianceCasePageComponent implements OnInit { + private activateRoute = inject(ActivatedRoute); + private backendConfigurationPnCompliancesService = inject(BackendConfigurationPnCompliancesService); + private eFormService = inject(EFormService); + private router = inject(Router); + @ViewChildren(CaseEditElementComponent) editElements: QueryList; @ViewChild('caseConfirmation', {static: false}) caseConfirmation; @@ -45,12 +51,9 @@ export class ComplianceCasePageComponent implements OnInit { replyRequest: ReplyRequest = new ReplyRequest(); maxDate: Date; - constructor( - private activateRoute: ActivatedRoute, - private backendConfigurationPnCompliancesService: BackendConfigurationPnCompliancesService, - private eFormService: EFormService, - private router: Router, - ) { + + + ngOnInit() { this.activateRoute.params.subscribe((params) => { this.id = +params['sdkCaseId']; this.propertyId = +params['propertyId']; @@ -60,12 +63,10 @@ export class ComplianceCasePageComponent implements OnInit { this.complianceId = +params['complianceId']; this.workerId = +params['siteId']; }); - activateRoute.queryParams.subscribe((params) => { + this.activateRoute.queryParams.subscribe((params) => { this.reverseRoute = params['reverseRoute']; }); - } - ngOnInit() { this.loadTemplateInfo(); this.maxDate = new Date(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-delete/compliance-delete.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-delete/compliance-delete.component.ts index 930224c3e..9d6352097 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-delete/compliance-delete.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliance-delete/compliance-delete.component.ts @@ -1,4 +1,6 @@ -import {Component, Inject, OnInit} from '@angular/core'; +import {Component, OnInit, + inject +} from '@angular/core'; import {TranslateService} from '@ngx-translate/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {ComplianceModel} from 'src/app/plugins/modules/backend-configuration-pn/models'; @@ -11,12 +13,12 @@ import {BackendConfigurationPnCompliancesService} from 'src/app/plugins/modules/ standalone: false }) export class ComplianceDeleteComponent implements OnInit { - constructor( - private service: BackendConfigurationPnCompliancesService, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public complianceModel: ComplianceModel - ) { } + private service = inject(BackendConfigurationPnCompliancesService); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + public complianceModel = inject(MAT_DIALOG_DATA); + + ngOnInit() { } deleteCompliance() { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-container/compliances-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-container/compliances-container.component.ts index 45d3935f5..c3439be8d 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-container/compliances-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-container/compliances-container.component.ts @@ -1,4 +1,6 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { AutoUnsubscribe } from 'ngx-auto-unsubscribe'; import { Subscription } from 'rxjs'; @@ -18,6 +20,12 @@ import { CompliancesStateService } from '../store'; standalone: false }) export class CompliancesContainerComponent implements OnInit, OnDestroy { + public authStateService = inject(AuthStateService); + private route = inject(ActivatedRoute); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + private translateService = inject(TranslateService); + private compliancesStateService = inject(CompliancesStateService); + breadcrumbs = [ { name: '', @@ -35,13 +43,7 @@ export class CompliancesContainerComponent implements OnInit, OnDestroy { routerSub$: Subscription; getAllCompliancesSub$: Subscription; - constructor( - public authStateService: AuthStateService, - private route: ActivatedRoute, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - private translateService: TranslateService, - private compliancesStateService: CompliancesStateService - ) {} + ngOnInit() { this.routerSub$ = this.route.params.subscribe((params) => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-table/compliances-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-table/compliances-table.component.ts index aa1b0c8e9..700f65a9d 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-table/compliances-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/compliance/components/compliances-table/compliances-table.component.ts @@ -1,4 +1,6 @@ -import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output,} from '@angular/core'; +import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, + inject +} from '@angular/core'; import {ComplianceModel, ReportEformItemModel} from '../../../../models'; import {PropertyCompliancesColorBadgesEnum} from '../../../../enums'; import {CompliancesStateService} from '../store'; @@ -25,6 +27,15 @@ import {Store} from '@ngrx/store'; standalone: false }) export class CompliancesTableComponent implements OnInit { + private store = inject(Store); + public compliancesStateService = inject(CompliancesStateService); + public authStateService = inject(AuthStateService); + private translateService = inject(TranslateService); + private router = inject(Router); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + private route = inject(ActivatedRoute); + mergedTableHeaders: MtxGridColumn[] = []; @Output() complianceDeleted: EventEmitter = new EventEmitter(); @@ -132,17 +143,7 @@ export class CompliancesTableComponent implements OnInit { public isAuth$ = this.store.select(selectAuthIsAuth); private selectAuthIsAdmin$ = this.store.select(selectAuthIsAuth); - constructor( - private store: Store, - public compliancesStateService: CompliancesStateService, - public authStateService: AuthStateService, - private translateService: TranslateService, - private router: Router, - private dialog: MatDialog, - private overlay: Overlay, - private route: ActivatedRoute, - ) { - } + ngOnInit(): void { let isAdmin = false; diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-create/documents-document-create.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-create/documents-document-create.component.ts index de8d1c19c..80df17682 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-create/documents-document-create.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-create/documents-document-create.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, OnInit,} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {FormBuilder, FormGroup, FormArray, FormControl} from '@angular/forms'; import {applicationLanguages2, PARSING_DATE_FORMAT} from 'src/app/common/const'; import {CommonDictionaryModel,} from 'src/app/common/models'; @@ -28,6 +30,14 @@ import {Store} from '@ngrx/store'; standalone: false }) export class DocumentsDocumentCreateComponent implements OnInit { + private fb = inject(FormBuilder); + private authStore = inject(Store); + private templateFilesService = inject(TemplateFilesService); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + private backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + private localeService = inject(LocaleService); + public dialogRef = inject(MatDialogRef); + form: FormGroup; newDocumentModel: DocumentModel = new DocumentModel(); // selectedFolder: number; @@ -70,15 +80,8 @@ export class DocumentsDocumentCreateComponent implements OnInit { } } - constructor( - private fb: FormBuilder, - private authStore: Store, - private templateFilesService: TemplateFilesService, - private propertiesService: BackendConfigurationPnPropertiesService, - private backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - localeService: LocaleService, - public dialogRef: MatDialogRef, - ) { + + constructor() { this.selectCurrentUserLanguageId$.subscribe((languageId) => { this.selectedLanguage = languageId; }); @@ -88,6 +91,7 @@ export class DocumentsDocumentCreateComponent implements OnInit { } + ngOnInit(): void { this.getFolders(); this.initCreateForm(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-delete/documents-document-delete.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-delete/documents-document-delete.component.ts index b17eb8a6a..4a0fba872 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-delete/documents-document-delete.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-delete/documents-document-delete.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit, } from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {DocumentModel} from '../../../../../models'; import {BackendConfigurationPnDocumentsService} from '../../../../../services'; import {Subscription} from 'rxjs'; @@ -15,6 +17,13 @@ import {DomSanitizer} from '@angular/platform-browser'; standalone: false }) export class DocumentsDocumentDeleteComponent implements OnInit { + private templateFilesService = inject(TemplateFilesService); + private backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + public dialogRef = inject(MatDialogRef); + private documentModel = inject(MAT_DIALOG_DATA); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + documentDeleted: EventEmitter = new EventEmitter(); newDocumentModel: DocumentModel = new DocumentModel(); pdfSub$: Subscription; @@ -43,18 +52,13 @@ export class DocumentsDocumentDeleteComponent implements OnInit { } } - constructor( - private templateFilesService: TemplateFilesService, - private backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) documentModel: DocumentModel, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - ) { - iconRegistry.addSvgIconLiteral('file-pdf', sanitizer.bypassSecurityTrustHtml(PdfIcon)); - this.getDocument(documentModel.id); + + constructor() { + this.iconRegistry.addSvgIconLiteral('file-pdf', this.sanitizer.bypassSecurityTrustHtml(PdfIcon)); + this.getDocument(this.documentModel.id); } + ngOnInit(): void {} hide() { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-edit/documents-document-edit.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-edit/documents-document-edit.component.ts index ed2037831..e50b24573 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-edit/documents-document-edit.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-actions/document-edit/documents-document-edit.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import { DocumentModel, DocumentSimpleFolderModel @@ -27,6 +29,15 @@ import {selectCurrentUserLanguageId} from 'src/app/state/auth/auth.selector'; standalone: false }) export class DocumentsDocumentEditComponent implements OnInit { + private fb = inject(FormBuilder); + private authStore = inject(Store); + private templateFilesService = inject(TemplateFilesService); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + private backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + private localeService = inject(LocaleService); + public dialogRef = inject(MatDialogRef); + private injectedDocumentModel = inject(MAT_DIALOG_DATA); + form: FormGroup; documentModel: DocumentModel = new DocumentModel(); selectedFolder: number; @@ -71,17 +82,9 @@ export class DocumentsDocumentEditComponent implements OnInit { return {name: '', description: '', extensionFile: extension, languageId: languageId}; } - constructor( - private fb: FormBuilder, - private authStore: Store, - private templateFilesService: TemplateFilesService, - private propertiesService: BackendConfigurationPnPropertiesService, - private backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - localeService: LocaleService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) documentModel: DocumentModel, - ) { - this.getDocument(documentModel.id); + + constructor() { + this.getDocument(this.injectedDocumentModel.id); this.selectCurrentUserLanguageId$.subscribe((languageId) => { this.selectedLanguage = languageId; }); @@ -90,6 +93,7 @@ export class DocumentsDocumentEditComponent implements OnInit { // ).id; } + ngOnInit(): void { this.getFolders(); this.getPropertiesDictionary(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-container/documents-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-container/documents-container.component.ts index 616003047..de5c6d04b 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-container/documents-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-container/documents-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import { DocumentsDocumentCreateComponent, DocumentsDocumentDeleteComponent, @@ -41,6 +43,17 @@ import { standalone: false }) export class DocumentsContainerComponent implements OnInit, OnDestroy { + private store = inject(Store); + private propertyService = inject(BackendConfigurationPnPropertiesService); + public backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private translate = inject(TranslateService); + public documentsStateService = inject(DocumentsStateService); + public localeService = inject(LocaleService); + private route = inject(ActivatedRoute); + private statisticsStateService = inject(StatisticsStateService); + folders: DocumentSimpleFolderModel[]; documents: Paged = new Paged(); simpleDocuments: DocumentSimpleModel[]; @@ -73,17 +86,8 @@ export class DocumentsContainerComponent implements OnInit, OnDestroy { return ''; } - constructor( - private store: Store, - private propertyService: BackendConfigurationPnPropertiesService, - public backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - public dialog: MatDialog, - private overlay: Overlay, - private translate: TranslateService, - public documentsStateService: DocumentsStateService, - public localeService: LocaleService, - private route: ActivatedRoute, - private statisticsStateService: StatisticsStateService,) { + + constructor() { this.selectCurrentUserLanguageId$.subscribe((languageId) => { this.selectedLanguage = languageId; }); @@ -106,6 +110,7 @@ export class DocumentsContainerComponent implements OnInit, OnDestroy { }); } + ngOnInit(): void { this.getProperties(); this.getActiveSortDirectionSub$ = this.selectDocumentsPaginationIsSortDsc$ diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-filters/documents-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-filters/documents-filters.component.ts index c10b92bdd..47da4c797 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-filters/documents-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-filters/documents-filters.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {FormControl, FormGroup} from '@angular/forms'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; @@ -26,6 +27,8 @@ import { standalone: false }) export class DocumentsFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + @Output() updateTable: EventEmitter = new EventEmitter(); @Input() folders: DocumentSimpleFolderModel[]; @Input() documents: DocumentSimpleModel[]; @@ -40,10 +43,7 @@ export class DocumentsFiltersComponent implements OnInit, OnDestroy { expireChangesSub$: Subscription; selectDocumentsFilters$ = this.store.select(selectDocumentsFilters); - constructor( - private store: Store, - ) { - } + ngOnInit(): void { this.selectFiltersSub$ = this.selectDocumentsFilters$ diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-create/documents-folder-create.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-create/documents-folder-create.component.ts index 0240dd400..c73fb3a49 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-create/documents-folder-create.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-create/documents-folder-create.component.ts @@ -2,6 +2,7 @@ import { Component, EventEmitter, OnInit, + inject } from '@angular/core'; import {FolderCreateModel, FolderDto,} from 'src/app/common/models'; import {applicationLanguages2} from 'src/app/common/const'; @@ -21,6 +22,13 @@ import {Store} from '@ngrx/store'; standalone: false }) export class DocumentsFolderCreateComponent implements OnInit { + private authStore = inject(Store); + public backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + private toastrService = inject(ToastrService); + private translateService = inject(TranslateService); + private localeService = inject(LocaleService); + public dialogRef = inject(MatDialogRef); + folderCreate: EventEmitter = new EventEmitter(); name = ''; selectedParentFolder: FolderDto; @@ -33,23 +41,16 @@ export class DocumentsFolderCreateComponent implements OnInit { return applicationLanguages2; } - constructor( - private authStore: Store, - public backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - private toastrService: ToastrService, - private translateService: TranslateService, - localeService: LocaleService, - public dialogRef: MatDialogRef, - ) { + + + ngOnInit() { this.selectCurrentUserLanguageId$.subscribe((languageId) => { this.selectedLanguage = languageId; }); // this.selectedLanguage = applicationLanguages2.find( // (x) => x.locale === localeService.getCurrentUserLocale() // ).id; - } - ngOnInit() { this.initCreateForm(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-delete/documents-folder-delete.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-delete/documents-folder-delete.component.ts index 8918db85f..84e8cbdc0 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-delete/documents-folder-delete.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-delete/documents-folder-delete.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit,} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {AuthStateService} from 'src/app/common/store'; import {applicationLanguages} from 'src/app/common/const'; @@ -14,17 +16,16 @@ import {Store} from '@ngrx/store'; standalone: false }) export class DocumentsFolderDeleteComponent implements OnInit { + private authStore = inject(Store); + private backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + private authStateService = inject(AuthStateService); + public dialogRef = inject(MatDialogRef); + public folder = inject(MAT_DIALOG_DATA); + folderDelete: EventEmitter = new EventEmitter(); private selectCurrentUserLanguageId$ = this.authStore.select(selectCurrentUserLanguageId); - constructor( - private authStore: Store, - private backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - private authStateService: AuthStateService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public folder: DocumentFolderModel, - ) { - } + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-edit/documents-folder-edit.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-edit/documents-folder-edit.component.ts index 6ab192b40..08f8f154c 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-edit/documents-folder-edit.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folder-edit/documents-folder-edit.component.ts @@ -1,9 +1,9 @@ import { Component, EventEmitter, - Inject, OnDestroy, OnInit, + inject } from '@angular/core'; import { AutoUnsubscribe } from 'ngx-auto-unsubscribe'; import {FolderDto,} from 'src/app/common/models'; @@ -26,6 +26,14 @@ import {Store} from '@ngrx/store'; standalone: false }) export class DocumentsFolderEditComponent implements OnInit, OnDestroy { + private authStore = inject(Store); + public backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + private toastrService = inject(ToastrService); + private translateService = inject(TranslateService); + private localeService = inject(LocaleService); + public dialogRef = inject(MatDialogRef); + private selectedFolder = inject(MAT_DIALOG_DATA); + name = ''; selectedParentFolder: FolderDto; selectedLanguageId: number; @@ -39,16 +47,10 @@ export class DocumentsFolderEditComponent implements OnInit, OnDestroy { return applicationLanguages2; } - constructor( - private authStore: Store, - public backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - private toastrService: ToastrService, - private translateService: TranslateService, - localeService: LocaleService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) selectedFolder: DocumentFolderModel, - ) { - this.getFolder(selectedFolder.id); + + + ngOnInit() { + this.getFolder(this.selectedFolder.id); this.selectCurrentUserLanguageId$.subscribe((languageId) => { this.selectedLanguageId = languageId; @@ -56,9 +58,7 @@ export class DocumentsFolderEditComponent implements OnInit, OnDestroy { // this.selectedLanguage = applicationLanguages2.find( // (x) => x.locale === localeService.getCurrentUserLocale() // ).id; - } - ngOnInit() { } hide() { @@ -71,11 +71,11 @@ export class DocumentsFolderEditComponent implements OnInit, OnDestroy { this.folderUpdateModel = new DocumentFolderModel(); this.folderUpdateModel = { ...this.folderUpdateModel, - id: model.id, + id: this.selectedFolder.id, documentFolderTranslations: [], }; for (let i = 0; i < applicationLanguages2.length; i++) { - const translations = model.documentFolderTranslations.find( + const translations = this.selectedFolder.documentFolderTranslations.find( (x) => x.languageId === applicationLanguages2[i].id ); this.folderUpdateModel.documentFolderTranslations.push({ diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folders/documents-folders.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folders/documents-folders.component.ts index 2d00bede2..a4d2dd1fa 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folders/documents-folders.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-folders/documents-folders/documents-folders.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import { Paged, @@ -29,17 +30,17 @@ import {Store} from "@ngrx/store"; standalone: false }) export class DocumentsFoldersComponent implements OnInit, OnDestroy { + private store = inject(Store); + public dialogRef = inject(MatDialogRef); + public backendConfigurationPnDocumentsService = inject(BackendConfigurationPnDocumentsService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + folders: Paged = new Paged(); @Output() foldersChanged: EventEmitter = new EventEmitter(); folderCreateSub$: any; - constructor( - private store: Store, - public dialogRef: MatDialogRef, - public backendConfigurationPnDocumentsService: BackendConfigurationPnDocumentsService, - public dialog: MatDialog, - private overlay: Overlay,) { - } + ngOnDestroy(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.ts index ced90f966..c52f7a956 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/documents/components/documents-table/documents-table.component.ts @@ -4,6 +4,7 @@ import { Input, OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {DocumentModel, DocumentSimpleFolderModel, DocumentTranslationModel,} from '../../../../models'; import {MtxGridColumn} from '@ng-matero/extensions/grid'; @@ -30,6 +31,13 @@ import { standalone: false }) export class DocumentsTableComponent implements OnInit, OnDestroy { + private store = inject(Store); + private templateFilesService = inject(TemplateFilesService); + private translateService = inject(TranslateService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + public documentsStateService = inject(DocumentsStateService); + tableHeaders: MtxGridColumn[] = [ {field: 'id', header: this.translateService.stream('Id'), sortable: true, sortProp: {id: 'Id'}}, { @@ -82,18 +90,13 @@ export class DocumentsTableComponent implements OnInit, OnDestroy { public selectDocumentsPaginationSort$ = this.store.select(selectDocumentsPaginationSort); public selectDocumentsPaginationIsSortDsc$ = this.store.select(selectDocumentsPaginationIsSortDsc); - constructor( - private store: Store, - private templateFilesService: TemplateFilesService, - private translateService: TranslateService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - public documentsStateService: DocumentsStateService, - ) { - iconRegistry.addSvgIconLiteral('file-word', sanitizer.bypassSecurityTrustHtml(WordIcon)); - iconRegistry.addSvgIconLiteral('file-pdf', sanitizer.bypassSecurityTrustHtml(PdfIcon)); + + constructor() { + this.iconRegistry.addSvgIconLiteral('file-word', this.sanitizer.bypassSecurityTrustHtml(WordIcon)); + this.iconRegistry.addSvgIconLiteral('file-pdf', this.sanitizer.bypassSecurityTrustHtml(PdfIcon)); } + getLanguageById(languageId: number) { const index = applicationLanguages2.findIndex(x => x.id === languageId); if (index !== -1) { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/file-tags/file-tags.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/file-tags/file-tags.component.ts index 8a03be882..6898726cd 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/file-tags/file-tags.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/file-tags/file-tags.component.ts @@ -7,6 +7,7 @@ import { OnInit, Output, SimpleChanges, + inject } from '@angular/core'; import { SharedTagCreateComponent, @@ -31,6 +32,10 @@ import {dialogConfigHelper} from 'src/app/common/helpers'; standalone: false }) export class FileTagsComponent implements OnInit, OnDestroy, OnChanges { + private tagsService = inject(BackendConfigurationPnFileTagsService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + @Input() availableTags: SharedTagModel[] = []; @Output() tagsChanged: EventEmitter = new EventEmitter(); dialogRef: MatDialogRef; @@ -46,11 +51,7 @@ export class FileTagsComponent implements OnInit, OnDestroy, OnChanges { showMultipleTagTagSub$: Subscription; createdTagsSub$: Subscription; - constructor( - private tagsService: BackendConfigurationPnFileTagsService, - public dialog: MatDialog, - private overlay: Overlay, - ) {} + ngOnInit() {} diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/download-files-name-archive/download-files-name-archive.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/download-files-name-archive/download-files-name-archive.component.ts index ef64cc1e5..123bb2af7 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/download-files-name-archive/download-files-name-archive.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/download-files-name-archive/download-files-name-archive.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter} from '@angular/core'; +import {Component, EventEmitter, + inject +} from '@angular/core'; import {MatDialogRef} from '@angular/material/dialog'; @Component({ @@ -8,6 +10,8 @@ import {MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class DownloadFilesNameArchiveComponent { + public dialogRef = inject(MatDialogRef); + clickDownloadFiles: EventEmitter = new EventEmitter(); zipName: string = ''; @@ -15,8 +19,7 @@ export class DownloadFilesNameArchiveComponent { return !this.zipName; } - constructor(public dialogRef: MatDialogRef,) { - } + hide() { this.dialogRef.close(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-edit-file/file-create-edit-file.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-edit-file/file-create-edit-file.component.ts index cc2018678..e55587d5f 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-edit-file/file-create-edit-file.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-edit-file/file-create-edit-file.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges,} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, + inject +} from '@angular/core'; import {dialogConfigHelper} from 'src/app/common/helpers'; import {FilesCreateModel} from '../../../../../../models'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; @@ -19,6 +21,10 @@ import * as R from 'ramda'; standalone: false }) export class FileCreateEditFileComponent implements OnChanges, OnDestroy { + private dragulaService = inject(DragulaService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + @Output() saveFile: EventEmitter = new EventEmitter(); @Output() cancelSaveFile: EventEmitter = new EventEmitter(); @Input() file: FilesCreateModel; @@ -57,11 +63,8 @@ export class FileCreateEditFileComponent implements OnChanges, OnDestroy { //return []; } - constructor( - private dragulaService: DragulaService, - public dialog: MatDialog, - private overlay: Overlay, - ) { + + constructor() { this.dragulaService.createGroup(this.dragulaContainerName, { moves: (el, container, handle) => { return handle.classList.contains(this.dragulaHandle); @@ -73,6 +76,7 @@ export class FileCreateEditFileComponent implements OnChanges, OnDestroy { }); } + deletePage(indexPage: number) { this.fileAsPdfDocument.removePage(indexPage); this.fileAsPdfDocument.save().then(async x => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-zoom-page/file-create-zoom-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-zoom-page/file-create-zoom-page.component.ts index acca12e41..2f04c8bb8 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-zoom-page/file-create-zoom-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create-zoom-page/file-create-zoom-page.component.ts @@ -1,4 +1,6 @@ -import {Component, Inject} from '@angular/core'; +import {Component, + inject +} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @Component({ @@ -8,15 +10,17 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class FileCreateZoomPageComponent { + public dialogRef = inject(MatDialogRef); + private model = inject<{ page: number, src: Uint8Array }>(MAT_DIALOG_DATA); + page: number = 0; src: Uint8Array = new Uint8Array(); zoom: number = 1; - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: { page: number, src: Uint8Array }, - ) { - this.page = model.page; - this.src = model.src; + + constructor() { + this.page = this.model.page; + this.src = this.model.src; } + } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create.component.ts index 0217e5821..ff80fa58e 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-create/file-create.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit, ViewChild,} from '@angular/core'; +import {Component, OnDestroy, OnInit, ViewChild, + inject +} from '@angular/core'; import {FilesCreateModel} from '../../../../../models'; import {SharedTagModel} from 'src/app/common/models'; import { @@ -20,6 +22,12 @@ import {ActivatedRoute, Router} from '@angular/router'; standalone: false }) export class FileCreateComponent implements OnInit, OnDestroy { + private propertiesService = inject(BackendConfigurationPnPropertiesService); + private backendConfigurationPnFilesService = inject(BackendConfigurationPnFilesService); + private tagsService = inject(BackendConfigurationPnFileTagsService); + private router = inject(Router); + private route = inject(ActivatedRoute); + @ViewChild('tagsModal') tagsModal: FileTagsComponent; mimePdfType = 'application/pdf'; @@ -60,14 +68,7 @@ export class FileCreateComponent implements OnInit, OnDestroy { return false; } - constructor( - private propertiesService: BackendConfigurationPnPropertiesService, - private backendConfigurationPnFilesService: BackendConfigurationPnFilesService, - private tagsService: BackendConfigurationPnFileTagsService, - private router: Router, - private route: ActivatedRoute, - ) { - } + ngOnInit(): void { this.getProperties(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-name-edit/file-name-edit.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-name-edit/file-name-edit.component.ts index ad0f6bd9b..953c47b95 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-name-edit/file-name-edit.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-name-edit/file-name-edit.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import {FileModel} from '../../../../../models'; import {BackendConfigurationPnFilesService, BackendConfigurationPnPropertiesService} from '../../../../../services'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @@ -15,19 +17,20 @@ import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; standalone: false }) export class FileNameEditComponent implements OnInit, OnDestroy { + private backendConfigurationPnFilesService = inject(BackendConfigurationPnFilesService); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + public dialogRef = inject(MatDialogRef); + public fileModel = inject(MAT_DIALOG_DATA); + fileNameUpdated: EventEmitter = new EventEmitter(); public oldFileModel: FileModel; public availableProperties: CommonDictionaryModel[] = []; getAllPropertiesSub$: Subscription; - constructor( - private backendConfigurationPnFilesService: BackendConfigurationPnFilesService, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public fileModel: FileModel, - ) { - this.oldFileModel = {...fileModel}; + + constructor() { + this.oldFileModel = {...this.fileModel}; this.getAllPropertiesSub$ = this.backendConfigurationPnPropertiesService.getAllPropertiesDictionary() .subscribe((data) => { if (data && data.success && data.model) { @@ -36,6 +39,7 @@ export class FileNameEditComponent implements OnInit, OnDestroy { }); } + get disabledSaveBtn() { return R.equals( { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-tags-edit/file-tags-edit.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-tags-edit/file-tags-edit.component.ts index d2e1eec50..8f6f265e0 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-tags-edit/file-tags-edit.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-actions/file-tags-edit/file-tags-edit.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {FilesModel} from '../../../../../models'; import {BackendConfigurationPnFilesService} from '../../../../../services'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @@ -12,6 +14,10 @@ import * as R from 'ramda'; standalone: false }) export class FileTagsEditComponent implements OnInit { + private backendConfigurationPnFilesService = inject(BackendConfigurationPnFilesService); + public dialogRef = inject(MatDialogRef); + private model = inject<{ fileModel: FilesModel, availableTags: SharedTagModel[] }>(MAT_DIALOG_DATA); + fileTagsUpdated: EventEmitter = new EventEmitter(); oldFileModel: FilesModel; currentTagIds: number[] = []; @@ -21,16 +27,14 @@ export class FileTagsEditComponent implements OnInit { return R.equals(this.oldFileModel.tags.map(x => x.id), this.currentTagIds); } - constructor( - private backendConfigurationPnFilesService: BackendConfigurationPnFilesService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) model: { fileModel: FilesModel, availableTags: SharedTagModel[] } - ) { - this.oldFileModel = {...model.fileModel}; - this.currentTagIds = model.fileModel.tags.map(x => x.id); - this.availableTags = model.availableTags; + + constructor() { + this.oldFileModel = {...this.model.fileModel}; + this.currentTagIds = this.model.fileModel.tags.map(x => x.id); + this.availableTags = this.model.availableTags; } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-container/files-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-container/files-container.component.ts index b198d07dd..3ebf03126 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-container/files-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-container/files-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import {Component, OnDestroy, OnInit, ViewChild, + inject +} from '@angular/core'; import {DownloadFilesNameArchiveComponent, FileNameEditComponent, FileTagsComponent, FileTagsEditComponent} from '../'; import {FilesModel} from '../../../../models'; import { @@ -26,6 +28,14 @@ import {Store} from "@ngrx/store"; standalone: false }) export class FilesContainerComponent implements OnInit, OnDestroy { + private store = inject(Store); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + public filesStateService = inject(FilesStateService); + private tagsService = inject(BackendConfigurationPnFileTagsService); + private translateService = inject(TranslateService); + private filesService = inject(BackendConfigurationPnFilesService); + @ViewChild('tagsModal') tagsModal: FileTagsComponent; availableTags: SharedTagModel[] = []; files: Paged = new Paged(); @@ -39,16 +49,7 @@ export class FilesContainerComponent implements OnInit, OnDestroy { downloadFilesSub$: Subscription; clickDownloadFilesSub$: Subscription; - constructor( - private store: Store, - public dialog: MatDialog, - private overlay: Overlay, - public filesStateService: FilesStateService, - private tagsService: BackendConfigurationPnFileTagsService, - private translateService: TranslateService, - private filesService: BackendConfigurationPnFilesService, - ) { - } + ngOnInit(): void { this.getTags(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-filters/files-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-filters/files-filters.component.ts index be21fd95c..56b0bbd59 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-filters/files-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-filters/files-filters.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {FormControl, FormGroup} from '@angular/forms'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; @@ -28,6 +29,11 @@ import { standalone: false }) export class FilesFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translate = inject(TranslateService); + public filesStateService = inject(FilesStateService); + private propertyService = inject(BackendConfigurationPnPropertiesService); + @Output() updateTable: EventEmitter = new EventEmitter(); private _availableTags: SharedTagModel[] = []; filtersForm: FormGroup; @@ -75,15 +81,12 @@ export class FilesFiltersComponent implements OnInit, OnDestroy { } } - constructor( - private store: Store, - private translate: TranslateService, - public filesStateService: FilesStateService, - private propertyService: BackendConfigurationPnPropertiesService, - ) { + + constructor() { this.selectFiltersSub$ = this.selectFilesFilters$.subscribe((filters) => this.currentFilters = filters) } + ngOnInit(): void { this.getProperties(); this.selectFilesFilters$ diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-table/files-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-table/files-table.component.ts index ac120d43f..b572bc809 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-table/files-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/files/components/files-table/files-table.component.ts @@ -4,6 +4,7 @@ import { Input, OnInit, Output, + inject } from '@angular/core'; import {FilesModel} from '../../../../models'; import {MtxGridColumn} from '@ng-matero/extensions/grid'; @@ -26,6 +27,11 @@ import { standalone: false }) export class FilesTableComponent implements OnInit { + private store = inject(Store); + public filesStateService = inject(FilesStateService); + private translateService = inject(TranslateService); + private filesService = inject(BackendConfigurationPnFilesService); + _files: Paged = new Paged(); @Input() set files(files: Paged) { @@ -83,13 +89,7 @@ export class FilesTableComponent implements OnInit { public selectFilesPaginationIsSortDsc$ = this.store.select(selectFilesPaginationIsSortDsc); public selectFilesNameFilters$ = this.store.select(selectFilesNameFilters); - constructor( - private store: Store, - public filesStateService: FilesStateService, - private translateService: TranslateService, - private filesService: BackendConfigurationPnFilesService, - ) { - } + ngOnInit(): void { } diff --git a/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 b/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 index f015186d4..7e4b8e7ef 100644 --- a/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 +++ b/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 @@ -1,9 +1,9 @@ import { Component, EventEmitter, - Inject, OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {Subscription} from 'rxjs'; @@ -27,6 +27,18 @@ import validator from 'validator'; standalone: false }) export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy { + private fb = inject(FormBuilder); + public propertiesService = inject(BackendConfigurationPnPropertiesService); + public authStateService = inject(AuthStateService); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private appSettingsStateService = inject(AppSettingsStateService); + private model = inject<{ + deviceUser: DeviceUserModel, + assignments: PropertyAssignmentWorkerModel[], + availableProperties: CommonDictionaryModel[], + }>(MAT_DIALOG_DATA); + availableProperties: CommonDictionaryModel[] = []; edit: boolean = false; selectedDeviceUser: DeviceUserModel = new DeviceUserModel(); @@ -60,75 +72,7 @@ export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy activeLanguages: Array = []; form: FormGroup; - constructor( - private fb: FormBuilder, - public propertiesService: BackendConfigurationPnPropertiesService, - public authStateService: AuthStateService, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - private appSettingsStateService: AppSettingsStateService, - @Inject(MAT_DIALOG_DATA) model: - { - deviceUser: DeviceUserModel, - assignments: PropertyAssignmentWorkerModel[], - availableProperties: CommonDictionaryModel[], - }, - ) { - this.assignments = [...model.assignments]; - this.availableProperties = [...model.availableProperties]; - this.selectedDeviceUser = {...model.deviceUser ?? new DeviceUserModel()}; - this.selectedDeviceUserCopy = {...model.deviceUser}; - this.assignmentsCopy = [...model.assignments]; - this.taskManagementEnabled = this.selectedDeviceUserCopy.taskManagementEnabled; - this.timeRegistrationEnabled = this.selectedDeviceUserCopy.timeRegistrationEnabled; - - this.form = this.fb.group({ - userFirstName: [this.selectedDeviceUser.userFirstName || '', Validators.required], - userLastName: [this.selectedDeviceUser.userLastName || '', Validators.required], - workerEmail: [this.selectedDeviceUser.workerEmail || '', [ - Validators.required, - (control) => validator.isEmail(control.value) ? null : {invalidEmail: true} - ]], - phoneNumber: [this.selectedDeviceUser.phoneNumber || '', [ - (control) => { - const value = control.value; - if (!value) { - return null; - } - return validator.isMobilePhone(value) ? null : {invalidPhoneNumber: true}; - } - ]], - pinCode: [this.selectedDeviceUser.pinCode || ''], - employeeNo: [this.selectedDeviceUser.employeeNo || ''], - languageCode: [this.selectedDeviceUser.languageCode || ''], - timeRegistrationEnabled: [this.selectedDeviceUser.timeRegistrationEnabled || false], - taskManagementEnabled: [this.selectedDeviceUser.taskManagementEnabled || false], - resigned: [this.selectedDeviceUser.resigned || false], - resignedAtDate: [ - this.selectedDeviceUser.resigned ? new Date(this.selectedDeviceUser.resignedAtDate) : new Date(), - this.selectedDeviceUser.resigned ? Validators.required : null - ], - }); - - if (this.selectedDeviceUser.resigned) { - Object.keys(this.form.controls).forEach(key => { - if (key !== 'resigned' && key !== 'resignedAtDate') { - this.form.get(key)?.disable(); - } - }); - } - - this.form.valueChanges.subscribe(formValue => { - Object.assign(this.selectedDeviceUser, formValue); - }); - - this.updateDisabledFieldsBasedOnResigned(); - - this.form.get('resigned')?.valueChanges.subscribe(() => { - this.updateDisabledFieldsBasedOnResigned(); - }); - - } + private updateDisabledFieldsBasedOnResigned() { const isResigned = this.form.get('resigned')?.value; @@ -184,6 +128,60 @@ export class PropertyWorkerCreateEditModalComponent implements OnInit, OnDestroy } ngOnInit() { + this.assignments = [...this.model.assignments]; + this.availableProperties = [...this.model.availableProperties]; + this.selectedDeviceUser = {...this.model.deviceUser ?? new DeviceUserModel()}; + this.selectedDeviceUserCopy = {...this.model.deviceUser}; + this.assignmentsCopy = [...this.model.assignments]; + this.taskManagementEnabled = this.selectedDeviceUserCopy.taskManagementEnabled; + this.timeRegistrationEnabled = this.selectedDeviceUserCopy.timeRegistrationEnabled; + + this.form = this.fb.group({ + userFirstName: [this.selectedDeviceUser.userFirstName || '', Validators.required], + userLastName: [this.selectedDeviceUser.userLastName || '', Validators.required], + workerEmail: [this.selectedDeviceUser.workerEmail || '', [ + Validators.required, + (control) => validator.isEmail(control.value) ? null : {invalidEmail: true} + ]], + phoneNumber: [this.selectedDeviceUser.phoneNumber || '', [ + (control) => { + const value = control.value; + if (!value) { + return null; + } + return validator.isMobilePhone(value) ? null : {invalidPhoneNumber: true}; + } + ]], + pinCode: [this.selectedDeviceUser.pinCode || ''], + employeeNo: [this.selectedDeviceUser.employeeNo || ''], + languageCode: [this.selectedDeviceUser.languageCode || ''], + timeRegistrationEnabled: [this.selectedDeviceUser.timeRegistrationEnabled || false], + taskManagementEnabled: [this.selectedDeviceUser.taskManagementEnabled || false], + resigned: [this.selectedDeviceUser.resigned || false], + resignedAtDate: [ + this.selectedDeviceUser.resigned ? new Date(this.selectedDeviceUser.resignedAtDate) : new Date(), + this.selectedDeviceUser.resigned ? Validators.required : null + ], + }); + + if (this.selectedDeviceUser.resigned) { + Object.keys(this.form.controls).forEach(key => { + if (key !== 'resigned' && key !== 'resignedAtDate') { + this.form.get(key)?.disable(); + } + }); + } + + this.form.valueChanges.subscribe(formValue => { + Object.assign(this.selectedDeviceUser, formValue); + }); + + this.updateDisabledFieldsBasedOnResigned(); + + this.form.get('resigned')?.valueChanges.subscribe(() => { + this.updateDisabledFieldsBasedOnResigned(); + }); + this.getEnabledLanguages(); this.updateFormControlDisabledStates(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-delete-modal/property-worker-delete-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-delete-modal/property-worker-delete-modal.component.ts index 0594efffa..f791b270e 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-delete-modal/property-worker-delete-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-delete-modal/property-worker-delete-modal.component.ts @@ -1,6 +1,6 @@ import { Component, - Inject, + inject, OnInit, } from '@angular/core'; import {DeviceUserService} from 'src/app/common/services'; @@ -15,13 +15,10 @@ import {DeviceUserModel} from '../../../../models'; standalone: false }) export class PropertyWorkerDeleteModalComponent implements OnInit { - constructor( - private deviceUserService: DeviceUserService, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public selectedDeviceUser: DeviceUserModel = new DeviceUserModel() - ) { - } + private deviceUserService = inject(DeviceUserService); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + public dialogRef = inject(MatDialogRef); + public selectedDeviceUser = inject(MAT_DIALOG_DATA); ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-filters/property-worker-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-filters/property-worker-filters.component.ts index 00bce2bfe..f4d3f7c81 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-filters/property-worker-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-filters/property-worker-filters.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; +import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, + inject +} from '@angular/core'; import {CommonDictionaryModel} from 'src/app/common/models'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {FormControl, FormGroup} from '@angular/forms'; @@ -20,6 +22,9 @@ import { standalone: false }) export class PropertyWorkerFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + public propertyWorkersStateService = inject(PropertyWorkersStateService); + @Output() updateTable: EventEmitter = new EventEmitter(); @Input() properties: CommonDictionaryModel[] = []; //@Input() availableSites: Array; @@ -35,10 +40,8 @@ export class PropertyWorkerFiltersComponent implements OnInit, OnDestroy { valueChangesShowResignedSub$: Subscription; private selectPropertyWorkersFilters$ = this.store.select(selectPropertyWorkersFilters); - constructor( - private store: Store, - public propertyWorkersStateService: PropertyWorkersStateService, - ) { + + constructor() { this.filtersForm = new FormGroup({ propertyIds: new FormControl([]), showResigned: new FormControl(false), @@ -46,6 +49,7 @@ export class PropertyWorkerFiltersComponent implements OnInit, OnDestroy { }); } + ngOnInit(): void { this.getFiltersAsyncSub$ = this.selectPropertyWorkersFilters$ .pipe( diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-otp-modal/property-worker-otp-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-otp-modal/property-worker-otp-modal.component.ts index b35d31eaf..c85b1dffa 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-otp-modal/property-worker-otp-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-otp-modal/property-worker-otp-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, Inject, OnInit} from '@angular/core'; +import {Component, OnInit, + inject +} from '@angular/core'; import {UnitsService} from 'src/app/common/services'; import {DeviceUserModel} from '../../../../models'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @@ -10,11 +12,11 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class PropertyWorkerOtpModalComponent implements OnInit { - constructor( - private unitsService: UnitsService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public selectedSimpleSite: DeviceUserModel = new DeviceUserModel(), - ) {} + private unitsService = inject(UnitsService); + public dialogRef = inject(MatDialogRef); + public selectedSimpleSite = inject(MAT_DIALOG_DATA); + + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-table/property-worker-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-table/property-worker-table.component.ts index 831f8b4a3..cb6118a0a 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-table/property-worker-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-worker-table/property-worker-table.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {MtxGridColumn} from '@ng-matero/extensions/grid'; import {DeviceUserModel, PropertyAssignWorkersModel} from '../../../../models'; @@ -39,6 +41,13 @@ import {AuthStateService} from 'src/app/common/store'; standalone: false }) export class PropertyWorkerTableComponent implements OnInit, OnDestroy, OnChanges { + private store = inject(Store); + private translateService = inject(TranslateService); + private authStateService = inject(AuthStateService); + public propertyWorkersStateService = inject(PropertyWorkersStateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + //@Input() propertyWorkers: any[] = []; @Input() sitesDto: any[] = []; @Output() updateTable: EventEmitter = new EventEmitter(); @@ -62,23 +71,7 @@ export class PropertyWorkerTableComponent implements OnInit, OnDestroy, OnChange return TaskWizardStatusesEnum; } - constructor( - private store: Store, - private translateService: TranslateService, - private authStateService: AuthStateService, - public propertyWorkersStateService: PropertyWorkersStateService, - private dialog: MatDialog, - private overlay: Overlay,) { - this.searchSubject.pipe(debounceTime(500)).subscribe((val) => { - this.propertyWorkersStateService.updateNameFilter(val); - }); - this.selectCurrentUserClaimsDeviceUsersDelete$.subscribe((data) => { - this.deviceUsersDelete = data; - }); - this.selectCurrentUserClaimsDeviceUsersUpdate$.subscribe((data) => { - this.deviceUsersUpdate = data; - }); - } + ngOnChanges(changes: SimpleChanges): void { if (changes['showResigned']) { @@ -329,6 +322,16 @@ export class PropertyWorkerTableComponent implements OnInit, OnDestroy, OnChange ngOnInit() { + this.searchSubject.pipe(debounceTime(500)).subscribe((val) => { + this.propertyWorkersStateService.updateNameFilter(val); + }); + this.selectCurrentUserClaimsDeviceUsersDelete$.subscribe((data) => { + this.deviceUsersDelete = data; + }); + this.selectCurrentUserClaimsDeviceUsersUpdate$.subscribe((data) => { + this.deviceUsersUpdate = data; + }); + this.buildTableHeaders(); //this.getDeviceUsersFiltered(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-workers-page/property-workers-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-workers-page/property-workers-page.component.ts index 02b5a890e..2ebc8f6cd 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-workers-page/property-workers-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/property-workers/components/property-workers-page/property-workers-page.component.ts @@ -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 { @@ -34,6 +36,12 @@ import { standalone: false }) export class PropertyWorkersPageComponent implements OnInit, OnDestroy { + private store = inject(Store); + private propertiesService = inject(BackendConfigurationPnPropertiesService); + public propertyWorkersStateService = inject(PropertyWorkersStateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + sitesDto: Array; availableProperties: CommonDictionaryModel[]; workersAssignments: PropertyAssignWorkersModel[]; @@ -48,14 +56,7 @@ export class PropertyWorkersPageComponent implements OnInit, OnDestroy { public selectCurrentUserClaimsDeviceUsersCreate$ = this.store.select(selectCurrentUserClaimsDeviceUsersCreate); private selectPropertyWorkersFilters$ = this.store.select(selectPropertyWorkersFilters); - constructor( - private store: Store, - private propertiesService: BackendConfigurationPnPropertiesService, - public propertyWorkersStateService: PropertyWorkersStateService, - private dialog: MatDialog, - private overlay: Overlay, - ) { - } + ngOnInit() { let propertyIds: number[] = []; diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/case-delete/case-delete.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/case-delete/case-delete.component.ts index 07b542a72..e6e944a17 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/case-delete/case-delete.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/case-delete/case-delete.component.ts @@ -1,7 +1,7 @@ import { Component, - Inject, OnInit, + inject } from '@angular/core'; import {BackendConfigurationPnReportService} from '../../../../services'; import {ReportEformItemModel} from '../../../../models'; @@ -14,12 +14,11 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class CaseDeleteComponent implements OnInit { - constructor( - private backendConfigurationPnReportService: BackendConfigurationPnReportService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public reportEformItemModel: ReportEformItemModel - ) { - } + private backendConfigurationPnReportService = inject(BackendConfigurationPnReportService); + public dialogRef = inject(MatDialogRef); + public reportEformItemModel = inject(MAT_DIALOG_DATA); + + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-container/report-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-container/report-container.component.ts index 83c465ff6..cc4abe6c0 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-container/report-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-container/report-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import {saveAs} from 'file-saver'; import {ToastrService} from 'ngx-toastr'; import { @@ -31,6 +33,18 @@ import {TranslateService} from '@ngx-translate/core'; standalone: false }) export class ReportContainerComponent implements OnInit, OnDestroy { + private translateService = inject(TranslateService); + private store = inject(Store); + private reportService = inject(BackendConfigurationPnReportService); + private toastrService = inject(ToastrService); + private router = inject(Router); + public authStateService = inject(AuthStateService); + public gallery = inject(Gallery); + public lightbox = inject(Lightbox); + private imageService = inject(TemplateFilesService); + private viewportScroller = inject(ViewportScroller); + private reportStateService = inject(ReportStateService); + reportsModel: NewReportEformPnModel[] = []; availableTags: SharedTagModel[] = []; currentUserFullName: string; @@ -45,30 +59,18 @@ export class ReportContainerComponent implements OnInit, OnDestroy { downloadReportSub$: Subscription; imageSub$: Subscription[] = []; - constructor( - private translateService: TranslateService, - private store: Store, - private reportService: BackendConfigurationPnReportService, - private toastrService: ToastrService, - private router: Router, - public authStateService: AuthStateService, - public gallery: Gallery, - public lightbox: Lightbox, - private imageService: TemplateFilesService, - private viewportScroller: ViewportScroller, - private reportStateService: ReportStateService, - ) { + + + ngOnInit() { this.selectReportsV2ScrollPosition$ .pipe(take(1)) .subscribe(scrollPosition => this.scrollPosition = scrollPosition); - } - ngOnInit() { let reportPnGenerateModel: ReportPnGenerateModel = { ...this.reportStateService.extractData(), type: '', version2: true - }; + }; if (reportPnGenerateModel.dateFrom !== null) { this.startWithParams = true; this.onGenerateReport(reportPnGenerateModel); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-header/report-header.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-header/report-header.component.ts index 2a3114658..63256b864 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-header/report-header.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-header/report-header.component.ts @@ -5,6 +5,7 @@ import { OnInit, Output, OnDestroy, + inject } from '@angular/core'; import {FormControl, FormGroup, Validators} from '@angular/forms'; import {ReportPnGenerateModel} from '../../../../models'; @@ -26,6 +27,10 @@ import {format, parse} from 'date-fns'; }) // REPORTS V2 export class ReportHeaderComponent implements OnInit, OnDestroy { + private reportStateService = inject(ReportStateService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + @Output() generateReport: EventEmitter = new EventEmitter(); @Output() @@ -34,17 +39,13 @@ export class ReportHeaderComponent implements OnInit, OnDestroy { generateForm: FormGroup; valueChangesSub$: Subscription; - constructor( - private reportStateService: ReportStateService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - ) { - iconRegistry.addSvgIconLiteral('file-word', sanitizer.bypassSecurityTrustHtml(WordIcon)); - iconRegistry.addSvgIconLiteral('file-excel', sanitizer.bypassSecurityTrustHtml(ExcelIcon)); - iconRegistry.addSvgIconLiteral('file-pdf', sanitizer.bypassSecurityTrustHtml(PdfIcon)); - } + ngOnInit() { + this.iconRegistry.addSvgIconLiteral('file-word', this.sanitizer.bypassSecurityTrustHtml(WordIcon)); + this.iconRegistry.addSvgIconLiteral('file-excel', this.sanitizer.bypassSecurityTrustHtml(ExcelIcon)); + this.iconRegistry.addSvgIconLiteral('file-pdf', this.sanitizer.bypassSecurityTrustHtml(PdfIcon)); + const reportPnGenerateModel = this.reportStateService.extractData(); this.generateForm = new FormGroup( { @@ -56,7 +57,7 @@ export class ReportHeaderComponent implements OnInit, OnDestroy { dateTo: new FormControl( reportPnGenerateModel.dateTo && parse(reportPnGenerateModel.dateTo, PARSING_DATE_FORMAT, new Date()), [Validators.required]), - },), + },), }); this.valueChangesSub$ = this.generateForm.valueChanges.subscribe( (value) => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-table/report-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-table/report-table.component.ts index 075874edf..373c2e499 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-table/report-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/reports/components/report-table/report-table.component.ts @@ -8,6 +8,7 @@ import { OnInit, Output, SimpleChanges, + inject } from '@angular/core'; import {ReportEformItemModel} from '../../../../models'; import {CaseDeleteComponent} from '../'; @@ -31,6 +32,11 @@ import {Store} from '@ngrx/store'; standalone: false }) export class ReportTableComponent implements OnInit, OnChanges, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + @Input() items: ReportEformItemModel[] = []; @Input() reportIndex: number; @Input() itemHeaders: { key: string; value: string }[] = []; @@ -84,13 +90,7 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy { private selectAuthIsAdmin$ = this.store.select(selectAuthIsAdmin); private selectCurrentUserFullName$ = this.store.select(selectCurrentUserFullName); - constructor( - private store: Store, - private translateService: TranslateService, - private dialog: MatDialog, - private overlay: Overlay, - ) { - } + ngOnChanges(changes: SimpleChanges): void { if (/*!changes.itemHeaders.isFirstChange() && */changes.itemHeaders) { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-priorities/ad-hoc-task-priorities.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-priorities/ad-hoc-task-priorities.component.ts index 43f541cc4..232e539d0 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-priorities/ad-hoc-task-priorities.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-priorities/ad-hoc-task-priorities.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, + inject +} from '@angular/core'; import {AdHocTaskPrioritiesModel,} from '../../../../models'; import {TranslateService} from '@ngx-translate/core'; import {AuthStateService} from 'src/app/common/store'; @@ -16,6 +18,10 @@ import {Store} from '@ngrx/store'; standalone: false }) export class AdHocTaskPrioritiesComponent implements OnChanges, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private authStateService = inject(AuthStateService); + @Input() adHocTaskPrioritiesModel: AdHocTaskPrioritiesModel; @Input() selectedPropertyName: string = ''; @Input() view: number[] = []; @@ -116,16 +122,14 @@ export class AdHocTaskPrioritiesComponent implements OnChanges, OnDestroy { private selectIsDarkMode$ = this.store.select(selectIsDarkMode); private selectCurrentUserLocale$ = this.store.select(selectCurrentUserLocale); - constructor( - private store: Store, - private translateService: TranslateService, - private authStateService: AuthStateService - ) { + + constructor() { this.isDarkThemeAsyncSub$ = this.selectIsDarkMode$.subscribe((isDarkMode) => { this.isDarkTheme = isDarkMode; }); } + changeData(labelsTranslated: string[], adHocTaskPrioritiesModel: AdHocTaskPrioritiesModel) { this.chartData = [ { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-workers/ad-hoc-task-workers.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-workers/ad-hoc-task-workers.component.ts index ea576249f..7a12ba425 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-workers/ad-hoc-task-workers.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/ad-hoc-task-workers/ad-hoc-task-workers.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, + inject +} from '@angular/core'; import {AdHocTaskWorkers,} from '../../../../models'; import {AuthStateService} from 'src/app/common/store'; import {format} from 'date-fns'; @@ -15,6 +17,9 @@ import {Store} from '@ngrx/store'; standalone: false }) export class AdHocTaskWorkersComponent implements OnChanges, OnDestroy { + private store = inject(Store); + private authStateService = inject(AuthStateService); + @Input() adHocTaskWorkers: AdHocTaskWorkers; @Input() selectedPropertyName: string = ''; @Input() view: number[] = []; @@ -77,15 +82,14 @@ export class AdHocTaskWorkersComponent implements OnChanges, OnDestroy { private selectIsDarkMode$ = this.store.select(selectIsDarkMode); - constructor( - private store: Store, - private authStateService: AuthStateService - ) { + + constructor() { this.isDarkThemeAsyncSub$ = this.selectIsDarkMode$.subscribe((isDarkMode) => { this.isDarkTheme = isDarkMode; }); } + ngOnChanges(changes: SimpleChanges): void { if (changes.adHocTaskWorkers && !changes.adHocTaskWorkers.isFirstChange() && diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/document-updated-days/document-updated-days.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/document-updated-days/document-updated-days.component.ts index f22ea309e..b7f3f8a50 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/document-updated-days/document-updated-days.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/document-updated-days/document-updated-days.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, + inject +} from '@angular/core'; import {DocumentUpdatedDaysModel,} from '../../../../models'; import {TranslateService} from '@ngx-translate/core'; import {AuthStateService} from 'src/app/common/store'; @@ -17,6 +19,10 @@ import {Store} from '@ngrx/store'; standalone: false }) export class DocumentUpdatedDaysComponent implements OnChanges, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private authStateService = inject(AuthStateService); + @Input() documentUpdatedDaysModel: DocumentUpdatedDaysModel; @Input() selectedPropertyName: string = ''; @Input() view: number[] = []; @@ -109,16 +115,14 @@ export class DocumentUpdatedDaysComponent implements OnChanges, OnDestroy { private selectIsDarkMode$ = this.store.select(selectIsDarkMode); private selectCurrentUserLocale$ = this.store.select(selectCurrentUserLocale); - constructor( - private store: Store, - private translateService: TranslateService, - private authStateService: AuthStateService - ) { + + constructor() { this.isDarkThemeAsyncSub$ = this.selectIsDarkMode$.subscribe((isDarkMode) => { this.isDarkTheme = isDarkMode; }); } + ngOnChanges(changes: SimpleChanges): void { if (changes.documentUpdatedDaysModel && !changes.documentUpdatedDaysModel.isFirstChange() && diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-days/planned-task-days.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-days/planned-task-days.component.ts index eaf0cceac..931e218ff 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-days/planned-task-days.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-days/planned-task-days.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, + inject +} from '@angular/core'; import {PlannedTaskDaysModel,} from '../../../../models'; import {TranslateService} from '@ngx-translate/core'; import {AuthStateService} from 'src/app/common/store'; @@ -16,6 +18,10 @@ import {selectCurrentUserLocale, selectIsDarkMode} from 'src/app/state'; standalone: false }) export class PlannedTaskDaysComponent implements OnChanges, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private authStateService = inject(AuthStateService); + @Input() plannedTaskDaysModel: PlannedTaskDaysModel; @Input() selectedPropertyName: string = ''; @Input() view: number[] = []; @@ -124,16 +130,14 @@ export class PlannedTaskDaysComponent implements OnChanges, OnDestroy { private selectIsDarkMode$ = this.store.select(selectIsDarkMode); private selectCurrentUserLocale$ = this.store.select(selectCurrentUserLocale); - constructor( - private store: Store, - private translateService: TranslateService, - private authStateService: AuthStateService - ) { + + constructor() { this.isDarkThemeAsyncSub$ = this.selectIsDarkMode$.subscribe((isDarkMode) => { this.isDarkTheme = isDarkMode; }); } + changeData(labelsTranslated: string[], plannedTaskDaysModel: PlannedTaskDaysModel) { this.chartData = [ { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-workers/planned-task-workers.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-workers/planned-task-workers.component.ts index 084ebd21f..2428530da 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-workers/planned-task-workers.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/planned-task-workers/planned-task-workers.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges} from '@angular/core'; +import {Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, + inject +} from '@angular/core'; import {PlannedTaskWorkers,} from '../../../../models'; import {AuthStateService} from 'src/app/common/store'; import {format} from 'date-fns'; @@ -15,6 +17,9 @@ import {selectIsDarkMode} from 'src/app/state'; standalone: false }) export class PlannedTaskWorkersComponent implements OnChanges, OnDestroy { + private store = inject(Store); + private authStateService = inject(AuthStateService); + @Input() plannedTaskWorkers: PlannedTaskWorkers; @Input() selectedPropertyName: string = ''; @Input() view: number[] = []; @@ -77,15 +82,14 @@ export class PlannedTaskWorkersComponent implements OnChanges, OnDestroy { private selectIsDarkMode$ = this.store.select(selectIsDarkMode); - constructor( - private store: Store, - private authStateService: AuthStateService - ) { + + constructor() { this.isDarkThemeAsyncSub$ = this.selectIsDarkMode$.subscribe((isDarkMode) => { this.isDarkTheme = isDarkMode; }); } + ngOnChanges(changes: SimpleChanges): void { if (changes.plannedTaskWorkers && !changes.plannedTaskWorkers.isFirstChange() && diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.ts index 301461334..d021ee9ba 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/statistics/components/statistics-container/statistics-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit} from '@angular/core'; +import {Component, OnDestroy, OnInit, + inject +} from '@angular/core'; import { AdHocTaskPrioritiesModel, AdHocTaskWorkers, @@ -31,6 +33,12 @@ import { standalone: false }) export class StatisticsContainerComponent implements OnInit, OnDestroy { + private store = inject(Store); + public statisticsStateService = inject(StatisticsStateService); + private backendConfigurationPnPropertiesService = inject(BackendConfigurationPnPropertiesService); + private router = inject(Router); + private taskTrackerStateService = inject(TaskTrackerStateService); + plannedTaskDays: PlannedTaskDaysModel; adHocTaskPrioritiesModel: AdHocTaskPrioritiesModel; adHocTaskWorkers: AdHocTaskWorkers; @@ -80,13 +88,8 @@ export class StatisticsContainerComponent implements OnInit, OnDestroy { public selectSideMenuOpened$ = this.store.select(selectSideMenuOpened); public selectStatisticsPropertyId$ = this.store.select(selectStatisticsPropertyId); - constructor( - private store: Store, - public statisticsStateService: StatisticsStateService, - private backendConfigurationPnPropertiesService: BackendConfigurationPnPropertiesService, - private router: Router, - private taskTrackerStateService: TaskTrackerStateService, - ) { + + constructor() { this.getPropertyIdAsyncSub$ = this.selectStatisticsPropertyId$ .subscribe(propertyId => this.selectedPropertyId = propertyId); this.selectSideMenuOpened$.subscribe((sideMenuOpened) => { @@ -94,6 +97,7 @@ export class StatisticsContainerComponent implements OnInit, OnDestroy { }); } + ngOnInit(): void { this.getAllStatistics(); this.getProperties(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-create-show-modal/task-management-create-show-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-create-show-modal/task-management-create-show-modal.component.ts index 2d3d0f71a..8817881a1 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-create-show-modal/task-management-create-show-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-create-show-modal/task-management-create-show-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit, Output,} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, Output, + inject +} from '@angular/core'; import { CommonDictionaryModel } from 'src/app/common/models'; import { BackendConfigurationPnPropertiesService, @@ -28,6 +30,17 @@ import {Lightbox} from 'ng-gallery/lightbox'; }) export class TaskManagementCreateShowModalComponent implements OnInit, OnDestroy { + private propertyService = inject(BackendConfigurationPnPropertiesService); + private sitesService = inject(SitesService); + private imageService = inject(TemplateFilesService); + public gallery = inject(Gallery); + public lightbox = inject(Lightbox); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private taskManagementService = inject(BackendConfigurationPnTaskManagementService); + public dialogRef = inject(MatDialogRef); + private workOrderCase = inject(MAT_DIALOG_DATA); + @Output() taskCreated: EventEmitter = new EventEmitter(); propertyAreas: string[] = []; properties: CommonDictionaryModel[] = []; @@ -46,18 +59,8 @@ export class TaskManagementCreateShowModalComponent getPropertiesAssignmentsSub$: Subscription; currentWorkOrderCase: WorkOrderCaseForReadModel; - constructor( - private propertyService: BackendConfigurationPnPropertiesService, - private sitesService: SitesService, - private imageService: TemplateFilesService, - public gallery: Gallery, - public lightbox: Lightbox, - public dialog: MatDialog, - private overlay: Overlay, - private taskManagementService: BackendConfigurationPnTaskManagementService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) workOrderCase?: WorkOrderCaseForReadModel, - ) { + + constructor() { this.workOrderCaseForm = new FormGroup({ propertyId: new FormControl({ value: null, @@ -85,26 +88,26 @@ export class TaskManagementCreateShowModalComponent }, Validators.required), }); this.getProperties(); - if (workOrderCase) { - this.currentWorkOrderCase = workOrderCase; - this.getPropertyAreas(workOrderCase.propertyId); - this.getSites(workOrderCase.propertyId); + if (this.workOrderCase) { + this.currentWorkOrderCase = this.workOrderCase; + this.getPropertyAreas(this.workOrderCase.propertyId); + this.getSites(this.workOrderCase.propertyId); this.workOrderCaseForm.patchValue( { - propertyId: workOrderCase.propertyId, - areaName: workOrderCase.areaName, + propertyId: this.workOrderCase.propertyId, + areaName: this.workOrderCase.areaName, // assignedTo: workOrderCase.assignedSiteId, - descriptionTask: workOrderCase.description.replace(//gi, '\n'), - priority: workOrderCase.priority, - caseStatusEnum: workOrderCase.caseStatusEnum, + descriptionTask: this.workOrderCase.description.replace(//gi, '\n'), + priority: this.workOrderCase.priority, + caseStatusEnum: this.workOrderCase.caseStatusEnum, }, { emitEvent: false } ); // this.workOrderCaseForm.disable({ emitEvent: false }); this.workOrderCaseForm.controls['propertyId'].disable({ emitEvent: false }); this.workOrderCaseForm.controls['areaName'].disable({ emitEvent: false }); - this.description = workOrderCase.description; - workOrderCase.pictureNames.forEach((fileName) => { + this.description = this.workOrderCase.description; + this.workOrderCase.pictureNames.forEach((fileName) => { this.imageSubs$.push( this.imageService.getImage(fileName).subscribe((blob) => { const imageUrl = URL.createObjectURL(blob); @@ -145,6 +148,7 @@ export class TaskManagementCreateShowModalComponent } } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-delete-modal/task-management-delete-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-delete-modal/task-management-delete-modal.component.ts index c7de5a3e4..a1c10b7f5 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-delete-modal/task-management-delete-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-actions/task-management-delete-modal/task-management-delete-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit, Output,} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, Output, + inject +} from '@angular/core'; import { WorkOrderCaseModel, } from '../../../../../models'; @@ -13,13 +15,12 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class TaskManagementDeleteModalComponent implements OnInit, OnDestroy { + public dialogRef = inject(MatDialogRef); + public workOrderCase = inject(MAT_DIALOG_DATA); + @Output() workOrderCaseDelete: EventEmitter = new EventEmitter(); - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public workOrderCase: WorkOrderCaseModel = new WorkOrderCaseModel(), - ) { - } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-container/task-management-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-container/task-management-container.component.ts index a3444b0f1..eb696d523 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-container/task-management-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-container/task-management-container.component.ts @@ -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 {AdHocTaskPrioritiesModel, AdHocTaskWorkers, PropertyModel, WorkOrderCaseModel} from '../../../../models'; import {TaskManagementStateService} from '../store'; @@ -43,6 +45,19 @@ import { standalone: false }) export class TaskManagementContainerComponent implements OnInit, OnDestroy { + private store = inject(Store); + private loaderService = inject(LoaderService); + public taskManagementStateService = inject(TaskManagementStateService); + public taskManagementService = inject(BackendConfigurationPnTaskManagementService); + private toasterService = inject(ToastrService); + private propertyService = inject(BackendConfigurationPnPropertiesService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private statisticsStateService = inject(StatisticsStateService); + private route = inject(ActivatedRoute); + workOrderCases: WorkOrderCaseModel[] = []; properties: CommonDictionaryModel[] = []; adHocTaskPrioritiesModel: AdHocTaskPrioritiesModel; @@ -80,22 +95,11 @@ export class TaskManagementContainerComponent implements OnInit, OnDestroy { private selectTaskManagementFilters$ = this.store.select(selectTaskManagementFilters); private selectStatisticsPropertyId$ = this.store.select(selectStatisticsPropertyId); - constructor( - private store: Store, - private loaderService: LoaderService, - public taskManagementStateService: TaskManagementStateService, - public taskManagementService: BackendConfigurationPnTaskManagementService, - private toasterService: ToastrService, - private propertyService: BackendConfigurationPnPropertiesService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - public dialog: MatDialog, - private overlay: Overlay, - private statisticsStateService: StatisticsStateService, - private route: ActivatedRoute, - ) { - iconRegistry.addSvgIconLiteral('file-word', sanitizer.bypassSecurityTrustHtml(WordIcon)); - iconRegistry.addSvgIconLiteral('file-excel', sanitizer.bypassSecurityTrustHtml(ExcelIcon)); + + + ngOnInit() { + this.iconRegistry.addSvgIconLiteral('file-word', this.sanitizer.bypassSecurityTrustHtml(WordIcon)); + this.iconRegistry.addSvgIconLiteral('file-excel', this.sanitizer.bypassSecurityTrustHtml(ExcelIcon)); this.route.queryParams.subscribe(x => { if (x && x.diagramForShow) { this.diagramForShow = x.diagramForShow; @@ -135,9 +139,7 @@ export class TaskManagementContainerComponent implements OnInit, OnDestroy { // } this.updateTable(); }); - } - ngOnInit() { this.loaderService.setLoading(false); this.getProperties(); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-filters/task-management-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-filters/task-management-filters.component.ts index 5ae762459..04806e83d 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-filters/task-management-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-filters/task-management-filters.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {FormControl, FormGroup} from '@angular/forms'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; @@ -36,6 +37,16 @@ import {TaskManagementStateService} from '../store'; standalone: false }) export class TaskManagementFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translate = inject(TranslateService); + private propertyService = inject(BackendConfigurationPnPropertiesService); + private sitesService = inject(SitesService); + public dialog = inject(MatDialog); + private entitySelectService = inject(EntitySelectService); + private overlay = inject(Overlay); + private taskManagementService = inject(BackendConfigurationPnTaskManagementService); + private taskManagementStateService = inject(TaskManagementStateService); + @Output() updateTable: EventEmitter = new EventEmitter(); @Output() @@ -72,18 +83,7 @@ export class TaskManagementFiltersComponent implements OnInit, OnDestroy { priorityValueChangesSub$: Subscription; public selectTaskManagementFilters$ = this.store.select(selectTaskManagementFilters); - constructor( - private store: Store, - private translate: TranslateService, - private propertyService: BackendConfigurationPnPropertiesService, - private sitesService: SitesService, - public dialog: MatDialog, - private entitySelectService: EntitySelectService, - private overlay: Overlay, - private taskManagementService: BackendConfigurationPnTaskManagementService, - private taskManagementStateService: TaskManagementStateService, - ) { - } + ngOnInit(): void { this.getProperties(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-table/task-management-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-table/task-management-table.component.ts index e74f39df2..98ae282ca 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-table/task-management-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-management/components/task-management-table/task-management-table.component.ts @@ -4,6 +4,7 @@ import { Input, OnInit, Output, + inject } from '@angular/core'; import {WorkOrderCaseModel} from '../../../../models'; import { @@ -28,6 +29,10 @@ import { standalone: false }) export class TaskManagementTableComponent implements OnInit { + private store = inject(Store); + public taskManagementStateService = inject(TaskManagementStateService); + private translateService = inject(TranslateService); + tableHeaders: MtxGridColumn[] = [ {header: this.translateService.stream('Id'), field: 'id', sortProp: {id: 'Id'}, sortable: true, class: 'id'}, { @@ -91,12 +96,7 @@ export class TaskManagementTableComponent implements OnInit { public selectTaskManagementPaginationSort$ = this.store.select(selectTaskManagementPaginationSort); public selectTaskManagementPaginationIsSortDsc$ = this.store.select(selectTaskManagementPaginationIsSortDsc); - constructor( - private store: Store, - public taskManagementStateService: TaskManagementStateService, - private translateService: TranslateService, - ) { - } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-create-show-modal/task-tracker-create-show-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-create-show-modal/task-tracker-create-show-modal.component.ts index 5f518f78c..dab3bcd62 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-create-show-modal/task-tracker-create-show-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-create-show-modal/task-tracker-create-show-modal.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit, Output,} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, Output, + inject +} from '@angular/core'; import { CommonDictionaryModel } from 'src/app/common/models'; import { BackendConfigurationPnPropertiesService, @@ -28,6 +30,17 @@ import {Lightbox} from 'ng-gallery/lightbox'; }) export class TaskTrackerCreateShowModalComponent implements OnInit, OnDestroy { + private propertyService = inject(BackendConfigurationPnPropertiesService); + private sitesService = inject(SitesService); + private imageService = inject(TemplateFilesService); + public gallery = inject(Gallery); + public lightbox = inject(Lightbox); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private taskManagementService = inject(BackendConfigurationPnTaskManagementService); + public dialogRef = inject(MatDialogRef); + private workOrderCase = inject(MAT_DIALOG_DATA); + @Output() taskCreated: EventEmitter = new EventEmitter(); propertyAreas: string[] = []; properties: CommonDictionaryModel[] = []; @@ -46,18 +59,8 @@ export class TaskTrackerCreateShowModalComponent getPropertiesAssignmentsSub$: Subscription; currentWorkOrderCase: WorkOrderCaseForReadModel; - constructor( - private propertyService: BackendConfigurationPnPropertiesService, - private sitesService: SitesService, - private imageService: TemplateFilesService, - public gallery: Gallery, - public lightbox: Lightbox, - public dialog: MatDialog, - private overlay: Overlay, - private taskManagementService: BackendConfigurationPnTaskManagementService, - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) workOrderCase?: WorkOrderCaseForReadModel, - ) { + + constructor() { this.workOrderCaseForm = new FormGroup({ propertyId: new FormControl({ value: null, @@ -85,26 +88,26 @@ export class TaskTrackerCreateShowModalComponent }, Validators.required), }); this.getProperties(); - if (workOrderCase) { - this.currentWorkOrderCase = workOrderCase; - this.getPropertyAreas(workOrderCase.propertyId); - this.getSites(workOrderCase.propertyId); + if (this.workOrderCase) { + this.currentWorkOrderCase = this.workOrderCase; + this.getPropertyAreas(this.workOrderCase.propertyId); + this.getSites(this.workOrderCase.propertyId); this.workOrderCaseForm.patchValue( { - propertyId: workOrderCase.propertyId, - areaName: workOrderCase.areaName, + propertyId: this.workOrderCase.propertyId, + areaName: this.workOrderCase.areaName, // assignedTo: workOrderCase.assignedSiteId, - descriptionTask: workOrderCase.description, - priority: workOrderCase.priority, - caseStatusEnum: workOrderCase.caseStatusEnum, + descriptionTask: this.workOrderCase.description, + priority: this.workOrderCase.priority, + caseStatusEnum: this.workOrderCase.caseStatusEnum, }, { emitEvent: false } ); // this.workOrderCaseForm.disable({ emitEvent: false }); this.workOrderCaseForm.controls['propertyId'].disable({ emitEvent: false }); this.workOrderCaseForm.controls['areaName'].disable({ emitEvent: false }); - this.description = workOrderCase.description; - workOrderCase.pictureNames.forEach((fileName) => { + this.description = this.workOrderCase.description; + this.workOrderCase.pictureNames.forEach((fileName) => { this.imageSubs$.push( this.imageService.getImage(fileName).subscribe((blob) => { const imageUrl = URL.createObjectURL(blob); @@ -145,6 +148,7 @@ export class TaskTrackerCreateShowModalComponent } } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-select-worker-modal/task-tracker-select-worker-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-select-worker-modal/task-tracker-select-worker-modal.component.ts index 96dafc95a..b62694e13 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-select-worker-modal/task-tracker-select-worker-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-select-worker-modal/task-tracker-select-worker-modal.component.ts @@ -1,5 +1,7 @@ import {CommonDictionaryModel, WorkerModel} from 'src/app/common/models'; -import {Component, EventEmitter, Inject, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, ViewChild, + inject +} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {TaskWizardCreateModel} from 'src/app/plugins/modules/backend-configuration-pn/models'; import * as R from 'ramda'; @@ -12,6 +14,9 @@ import {TaskWizardStatusesEnum} from 'src/app/plugins/modules/backend-configurat standalone: false }) export class TaskTrackerSelectWorkerModalComponent implements OnInit, OnDestroy { + public dialogRef = inject(MatDialogRef); + private injectedWorkers = inject(MAT_DIALOG_DATA); + sites: CommonDictionaryModel[] = []; workerName: string; workerSelected: EventEmitter = new EventEmitter(); @@ -33,9 +38,7 @@ export class TaskTrackerSelectWorkerModalComponent implements OnInit, OnDestroy }; selectedSite: any; - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) workers: WorkerModel[]) {} + ngOnDestroy(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-shown-columns/task-tracker-shown-columns.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-shown-columns/task-tracker-shown-columns.component.ts index f69913a77..0cd73217b 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-shown-columns/task-tracker-shown-columns.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-actions/task-tracker-shown-columns/task-tracker-shown-columns.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnDestroy, OnInit} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {TranslateService} from '@ngx-translate/core'; @@ -14,27 +16,29 @@ import {FormControl, FormGroup} from '@angular/forms'; standalone: false }) export class TaskTrackerShownColumnsComponent implements OnInit, OnDestroy { + private data = inject(MAT_DIALOG_DATA); + private translate = inject(TranslateService); + private _formBuilder = inject(FormBuilder); + private dialogRef = inject(MatDialogRef); + public columnsChanged = new EventEmitter(); columns: FormGroup; - constructor( - @Inject(MAT_DIALOG_DATA) data: Columns, - private translate: TranslateService, - private _formBuilder: FormBuilder, - private dialogRef: MatDialogRef - ) { + + constructor() { this.columns = new FormGroup({ - property: new FormControl(data['property']), - task: new FormControl(data['task']), - tags: new FormControl(data['tags']), - workers: new FormControl(data['workers']), - start: new FormControl(data['start']), - repeat: new FormControl(data['repeat']), - deadline: new FormControl(data['deadline']), - calendar: new FormControl(data['calendar']), + property: new FormControl(this.data['property']), + task: new FormControl(this.data['task']), + tags: new FormControl(this.data['tags']), + workers: new FormControl(this.data['workers']), + start: new FormControl(this.data['start']), + repeat: new FormControl(this.data['repeat']), + deadline: new FormControl(this.data['deadline']), + calendar: new FormControl(this.data['calendar']), }); } + save() { this.columnsChanged.emit(this.columns.value); } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-container/task-tracker-container.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-container/task-tracker-container.component.ts index 7d0dbc45a..07268b8bf 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-container/task-tracker-container.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-container/task-tracker-container.component.ts @@ -1,4 +1,6 @@ -import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import {Component, OnDestroy, OnInit, ViewChild, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import { TaskModel, @@ -60,6 +62,24 @@ import { standalone: false }) export class TaskTrackerContainerComponent implements OnInit, OnDestroy { + private store = inject(Store); + private loaderService = inject(LoaderService); + public taskTrackerStateService = inject(TaskTrackerStateService); + public taskTrackerService = inject(BackendConfigurationPnTaskTrackerService); + private toasterService = inject(ToastrService); + private propertyService = inject(BackendConfigurationPnPropertiesService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private areasService = inject(BackendConfigurationPnAreasService); + private iconRegistry = inject(MatIconRegistry); + private sanitizer = inject(DomSanitizer); + private backendConfigurationPnTaskWizardService = inject(BackendConfigurationPnTaskWizardService); + private appSettingsStateService = inject(AppSettingsStateService); + private itemsPlanningPnTagsService = inject(ItemsPlanningPnTagsService); + public statisticsStateService = inject(StatisticsStateService); + private route = inject(ActivatedRoute); + private router = inject(Router); + @ViewChild('planningTagsModal') planningTagsModal: PlanningTagsComponent; tasks: TaskModel[] = []; columns: Columns = { @@ -116,26 +136,10 @@ export class TaskTrackerContainerComponent implements OnInit, OnDestroy { private selectTaskTrackerFilters$ = this.store.select(selectTaskTrackerFilters); private selectStatisticsPropertyId$ = this.store.select(selectStatisticsPropertyId); - constructor( - private store: Store, - private loaderService: LoaderService, - public taskTrackerStateService: TaskTrackerStateService, - public taskTrackerService: BackendConfigurationPnTaskTrackerService, - private toasterService: ToastrService, - private propertyService: BackendConfigurationPnPropertiesService, - public dialog: MatDialog, - private overlay: Overlay, - private areasService: BackendConfigurationPnAreasService, - iconRegistry: MatIconRegistry, - sanitizer: DomSanitizer, - private backendConfigurationPnTaskWizardService: BackendConfigurationPnTaskWizardService, - private appSettingsStateService: AppSettingsStateService, - private itemsPlanningPnTagsService: ItemsPlanningPnTagsService, - public statisticsStateService: StatisticsStateService, - private route: ActivatedRoute, - private router: Router, - ) { - iconRegistry.addSvgIconLiteral('file-excel', sanitizer.bypassSecurityTrustHtml(ExcelIcon)); + + + ngOnInit() { + this.iconRegistry.addSvgIconLiteral('file-excel', this.sanitizer.bypassSecurityTrustHtml(ExcelIcon)); this.route.queryParams.subscribe(x => { if (x && x.showDiagram) { this.showDiagram = x.showDiagram; @@ -162,9 +166,7 @@ export class TaskTrackerContainerComponent implements OnInit, OnDestroy { this.getPlannedTaskDays(); } }); - } - ngOnInit() { this.updateTable(); this.getColumns(); this.getProperties(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-filters/task-tracker-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-filters/task-tracker-filters.component.ts index 728004e7f..e6158a510 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-filters/task-tracker-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-filters/task-tracker-filters.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {TaskTrackerStateService} from '../store'; import {FormControl, FormGroup} from '@angular/forms'; @@ -28,6 +29,11 @@ import { standalone: false }) export class TaskTrackerFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translate = inject(TranslateService); + private taskTrackerStateService = inject(TaskTrackerStateService); + private propertyService = inject(BackendConfigurationPnPropertiesService); + @Output() updateTable: EventEmitter = new EventEmitter(); @Input() properties: CommonDictionaryModel[] = []; @Input() tags: CommonDictionaryModel[] = []; @@ -45,13 +51,7 @@ export class TaskTrackerFiltersComponent implements OnInit, OnDestroy { getSitesSub$: Subscription; private selectTaskTrackerFilters$ = this.store.select(selectTaskTrackerFilters); - constructor( - private store: Store, - private translate: TranslateService, - private taskTrackerStateService: TaskTrackerStateService, - private propertyService: BackendConfigurationPnPropertiesService, - ) { - } + ngOnInit(): void { this.subToFormChanges(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-table/task-tracker-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-table/task-tracker-table.component.ts index 3dd01e98f..4812b085e 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-table/task-tracker-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-tracker/components/task-tracker-table/task-tracker-table.component.ts @@ -4,6 +4,7 @@ import { Input, OnChanges, OnInit, Output, SimpleChanges, + inject } from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import { @@ -36,6 +37,14 @@ import {Overlay} from '@angular/cdk/overlay'; standalone: false }) export class TaskTrackerTableComponent implements OnInit, OnChanges { + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + private store = inject(Store); + private translateService = inject(TranslateService); + private taskTrackerStateService = inject(TaskTrackerStateService); + private route = inject(ActivatedRoute); + private router = inject(Router); + @Input() columnsFromDb: Columns; @Input() tasks: TaskModel[] = []; @Output() updateTable: EventEmitter = new EventEmitter(); @@ -93,16 +102,7 @@ export class TaskTrackerTableComponent implements OnInit, OnChanges { private selectCurrentUserFullName$ = this.store.select(selectCurrentUserFullName); private currentUserFullName: string; - constructor( - private dialog: MatDialog, - private overlay: Overlay, - private store: Store, - private translateService: TranslateService, - private taskTrackerStateService: TaskTrackerStateService, - private route: ActivatedRoute, - private router: Router, - ) { - } + ngOnInit(): void { // this.taskTrackerStateService.getFiltersAsync().subscribe(filters => { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-create-modal/task-wizard-create-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-create-modal/task-wizard-create-modal.component.ts index d95d9ff3c..ec87a2ccb 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-create-modal/task-wizard-create-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-create-modal/task-wizard-create-modal.component.ts @@ -1,4 +1,6 @@ -import {ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit,} from '@angular/core'; +import {ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import { CommonDictionaryModel, @@ -39,6 +41,16 @@ import {Store} from '@ngrx/store'; standalone: false }) export class TaskWizardCreateModalComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private eFormService = inject(EFormService); + private cd = inject(ChangeDetectorRef); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private authStateService = inject(AuthStateService); + private fb = inject(FormBuilder); + planningTagsModal: PlanningTagsComponent createTask: EventEmitter = new EventEmitter(); changeProperty: EventEmitter = new EventEmitter(); @@ -88,17 +100,8 @@ export class TaskWizardCreateModalComponent implements OnInit, OnDestroy { return TaskWizardStatusesEnum; } - constructor( - private store: Store, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - private eFormService: EFormService, - private cd: ChangeDetectorRef, - public dialog: MatDialog, - private overlay: Overlay, - private authStateService: AuthStateService, - private fb: FormBuilder, - ) { + + constructor() { this.typeahead .pipe( debounceTime(200), @@ -113,6 +116,7 @@ export class TaskWizardCreateModalComponent implements OnInit, OnDestroy { }); } + repeatEveryOptions: { id: number, name: string }[] = []; ngOnInit(): void { diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-folders-modal/task-wizard-folders-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-folders-modal/task-wizard-folders-modal.component.ts index 4b7f71305..95a8f4dab 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-folders-modal/task-wizard-folders-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-folders-modal/task-wizard-folders-modal.component.ts @@ -3,6 +3,7 @@ import { EventEmitter, OnDestroy, OnInit, + inject } from '@angular/core'; import {FolderDto} from 'src/app/common/models'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; @@ -16,12 +17,13 @@ import {MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class TaskWizardFoldersModalComponent implements OnInit, OnDestroy { + public dialogRef = inject(MatDialogRef); + folderSelected: EventEmitter = new EventEmitter(); eFormSdkFolderId: number; folders: FolderDto[] = []; - constructor(public dialogRef: MatDialogRef) { - } + ngOnInit() { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-multiple-deactivate/task-wizard-multiple-deactivate.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-multiple-deactivate/task-wizard-multiple-deactivate.component.ts index e8253ced2..3348d96e7 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-multiple-deactivate/task-wizard-multiple-deactivate.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-multiple-deactivate/task-wizard-multiple-deactivate.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, Inject, OnInit,} from '@angular/core'; +import {Component, EventEmitter, OnInit, + inject +} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; @Component({ @@ -8,11 +10,11 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; standalone: false }) export class TaskWizardMultipleDeactivateComponent implements OnInit { + public dialogRef = inject(MatDialogRef); + public selectedTaskCount = inject(MAT_DIALOG_DATA); + deactivateMultipleTasks: EventEmitter = new EventEmitter(); - constructor( - public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public selectedTaskCount: number, - ) {} + ngOnInit() {} diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-update-modal/task-wizard-update-modal.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-update-modal/task-wizard-update-modal.component.ts index 0820da685..0a92f1ebe 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-update-modal/task-wizard-update-modal.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-actions/task-wizard-update-modal/task-wizard-update-modal.component.ts @@ -1,4 +1,6 @@ -import {ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit,} from '@angular/core'; +import {ChangeDetectorRef, Component, EventEmitter, OnDestroy, OnInit, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import { CommonDictionaryModel, @@ -38,6 +40,15 @@ import {Store} from '@ngrx/store'; standalone: false }) export class TaskWizardUpdateModalComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + public dialogRef = inject(MatDialogRef); + private eFormService = inject(EFormService); + private cd = inject(ChangeDetectorRef); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private fb = inject(FormBuilder); + planningTagsModal: PlanningTagsComponent; updateTask: EventEmitter = new EventEmitter(); typeahead = new EventEmitter(); @@ -91,16 +102,8 @@ export class TaskWizardUpdateModalComponent implements OnInit, OnDestroy { return R.equals(this.taskForm.value, this.copyModel); } - constructor( - private store: Store, - private translateService: TranslateService, - public dialogRef: MatDialogRef, - private eFormService: EFormService, - private cd: ChangeDetectorRef, - public dialog: MatDialog, - private overlay: Overlay, - private fb: FormBuilder - ) { + + constructor() { this.typeahead .pipe( debounceTime(200), @@ -115,6 +118,7 @@ export class TaskWizardUpdateModalComponent implements OnInit, OnDestroy { }); } + ngOnInit(): void { // this.initForm(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-filters/task-wizard-filters.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-filters/task-wizard-filters.component.ts index 1ae2ea83a..d752018ca 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-filters/task-wizard-filters.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-filters/task-wizard-filters.component.ts @@ -4,6 +4,7 @@ import { OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {CommonDictionaryModel, FolderDto} from 'src/app/common/models'; @@ -28,6 +29,11 @@ import {ActivatedRoute} from '@angular/router'; standalone: false }) export class TaskWizardFiltersComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private route = inject(ActivatedRoute); + private taskWizardStateService = inject(TaskWizardStateService); + @Output() updateTable: EventEmitter = new EventEmitter(); @Input() properties: CommonDictionaryModel[] = []; @Input() folders: FolderDto[] = []; @@ -54,12 +60,8 @@ export class TaskWizardFiltersComponent implements OnInit, OnDestroy { private selectTaskWizardFilters$ = this.store.select(selectTaskWizardFilters); currentFilters: TaskWizardFiltrationModel; - constructor( - private store: Store, - private translateService: TranslateService, - private route: ActivatedRoute, - private taskWizardStateService: TaskWizardStateService, - ) { + + constructor() { this.selectTaskWizardFilters$.subscribe(x => this.currentFilters = x); this.route.queryParams.subscribe(x => { if (x && x.showDiagram) { @@ -68,6 +70,7 @@ export class TaskWizardFiltersComponent implements OnInit, OnDestroy { }); } + ngOnInit(): void { this.filtersForm = new FormGroup({ propertyIds: new FormControl(this.currentFilters.propertyIds), diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-page/task-wizard-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-page/task-wizard-page.component.ts index f6bbbb2f2..85f932904 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-page/task-wizard-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-page/task-wizard-page.component.ts @@ -1,4 +1,6 @@ -import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild,} from '@angular/core'; +import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {BackendConfigurationPnPropertiesService, BackendConfigurationPnTaskWizardService} from '../../../../services'; import {filter, tap} from 'rxjs/operators'; @@ -38,6 +40,19 @@ import { standalone: false }) export class TaskWizardPageComponent implements OnInit, OnDestroy, AfterViewInit { + private store = inject(Store); + private propertyService = inject(BackendConfigurationPnPropertiesService); + private itemsPlanningPnTagsService = inject(ItemsPlanningPnTagsService); + private taskWizardStateService = inject(TaskWizardStateService); + private translateService = inject(TranslateService); + public dialog = inject(MatDialog); + private overlay = inject(Overlay); + private backendConfigurationPnTaskWizardService = inject(BackendConfigurationPnTaskWizardService); + private appSettingsStateService = inject(AppSettingsStateService); + public authStateService = inject(AuthStateService); + private route = inject(ActivatedRoute); + private statisticsStateService = inject(StatisticsStateService); + @ViewChild('planningTagsModal') planningTagsModal: PlanningTagsComponent; properties: CommonDictionaryModel[] = []; folders: FolderDto[] = []; @@ -88,20 +103,8 @@ export class TaskWizardPageComponent implements OnInit, OnDestroy, AfterViewInit private selectTaskWizardPropertyIds$ = this.store.select(selectTaskWizardPropertyIds); private selectTaskWizardFilters$ = this.store.select(selectTaskWizardFilters); - constructor( - private store: Store, - private propertyService: BackendConfigurationPnPropertiesService, - private itemsPlanningPnTagsService: ItemsPlanningPnTagsService, - private taskWizardStateService: TaskWizardStateService, - private translateService: TranslateService, - public dialog: MatDialog, - private overlay: Overlay, - private backendConfigurationPnTaskWizardService: BackendConfigurationPnTaskWizardService, - private appSettingsStateService: AppSettingsStateService, - public authStateService: AuthStateService, - private route: ActivatedRoute, - private statisticsStateService: StatisticsStateService, - ) { + + constructor() { this.route.queryParams.subscribe(x => { if (x && x.showDiagram) { this.showDiagram = x.showDiagram; @@ -112,6 +115,7 @@ export class TaskWizardPageComponent implements OnInit, OnDestroy, AfterViewInit }); } + ngOnInit(): void { let propertyIds: number[] = []; this.getProperties(); diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-table/task-wizard-table.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-table/task-wizard-table.component.ts index abf15cb66..838606803 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-table/task-wizard-table.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-wizard/components/task-wizard-table/task-wizard-table.component.ts @@ -2,6 +2,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, + inject } from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import {MtxGridColumn} from '@ng-matero/extensions/grid'; @@ -29,6 +30,11 @@ import {PlanningModel} from "src/app/plugins/modules/items-planning-pn/models"; standalone: false }) export class TaskWizardTableComponent implements OnInit, OnDestroy { + private store = inject(Store); + private translateService = inject(TranslateService); + private authStateService = inject(AuthStateService); + public taskWizardStateService = inject(TaskWizardStateService); + @Input() tasks: TaskWizardModel[] = []; @Output() updateTable: EventEmitter = new EventEmitter(); @Output() deleteTask: EventEmitter = new EventEmitter(); @@ -96,13 +102,7 @@ export class TaskWizardTableComponent implements OnInit, OnDestroy { return RepeatTypeEnum; } - constructor( - private store: Store, - private translateService: TranslateService, - private authStateService: AuthStateService, - public taskWizardStateService: TaskWizardStateService, - ) { - } + ngOnInit(): void { } diff --git a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-worker-assignments/components/task-worker-assignments-page/task-worker-assignments-page.component.ts b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-worker-assignments/components/task-worker-assignments-page/task-worker-assignments-page.component.ts index 4b6b038bd..b6987c807 100644 --- a/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-worker-assignments/components/task-worker-assignments-page/task-worker-assignments-page.component.ts +++ b/eform-client/src/app/plugins/modules/backend-configuration-pn/modules/task-worker-assignments/components/task-worker-assignments-page/task-worker-assignments-page.component.ts @@ -1,4 +1,6 @@ -import {Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild} from '@angular/core'; +import {Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild, + inject +} from '@angular/core'; import {AutoUnsubscribe} from 'ngx-auto-unsubscribe'; import { CommonDictionaryModel, LanguagesModel, @@ -42,6 +44,20 @@ import {AppSettingsStateService} from 'src/app/modules/application-settings/comp standalone: false }) export class TaskWorkerAssignmentsPageComponent implements OnInit, OnDestroy { + private store = inject(Store); + public taskWorkerAssignmentsStateService = inject(TaskWorkerAssignmentsStateService); + private activatedRoute = inject(ActivatedRoute); + private sitesService = inject(SitesService); + private backendConfigurationPnAreasService = inject(BackendConfigurationPnAreasService); + private areasService = inject(BackendConfigurationPnAreasService); + private translateService = inject(TranslateService); + private dialog = inject(MatDialog); + private overlay = inject(Overlay); + private propertyService = inject(BackendConfigurationPnPropertiesService); + private backendConfigurationPnTaskWizardService = inject(BackendConfigurationPnTaskWizardService); + private itemsPlanningPnTagsService = inject(ItemsPlanningPnTagsService); + private appSettingsStateService = inject(AppSettingsStateService); + @ViewChild('planningTagsModal') planningTagsModal: PlanningTagsComponent; tableHeaders: MtxGridColumn[] = [ { @@ -109,22 +125,7 @@ export class TaskWorkerAssignmentsPageComponent implements OnInit, OnDestroy { public selectTaskWorkerAssignmentPaginationSort$ = this.store.select(selectTaskWorkerAssignmentPaginationSort); public selectTaskWorkerAssignmentPaginationIsSortDsc$ = this.store.select(selectTaskWorkerAssignmentPaginationIsSortDsc); - constructor( - private store: Store, - public taskWorkerAssignmentsStateService: TaskWorkerAssignmentsStateService, - private activatedRoute: ActivatedRoute, - private sitesService: SitesService, - private backendConfigurationPnAreasService: BackendConfigurationPnAreasService, - private areasService: BackendConfigurationPnAreasService, - private translateService: TranslateService, - private dialog: MatDialog, - private overlay: Overlay, - private propertyService: BackendConfigurationPnPropertiesService, - private backendConfigurationPnTaskWizardService: BackendConfigurationPnTaskWizardService, - private itemsPlanningPnTagsService: ItemsPlanningPnTagsService, - private appSettingsStateService: AppSettingsStateService, - ) { - } + ngOnInit() { this.activatedRoute.params.subscribe((params) => {