diff --git a/src/app/auth/role-guard.service.ts b/src/app/auth/role-guard.service.ts index be16047..8111b99 100644 --- a/src/app/auth/role-guard.service.ts +++ b/src/app/auth/role-guard.service.ts @@ -30,6 +30,7 @@ export class RoleGuardService{ new RegExp("/karbantartas/naptar/[\\d]+", "i"), ], 'projektvezeto': [ + new RegExp("/hiba/rogzites", "i"), new RegExp("/hiba/lista", "i"), new RegExp("/hiba/feladat-lista", "i"), new RegExp("/hiba/visszaigazolas/[\\d]+", "i"), @@ -125,6 +126,11 @@ export class RoleGuardService{ return true; } break; + case 'setFaultType': + if (roles.indexOf('projektvezeto') != -1) { + return true; + } + break; case 'monthlyClose': if (roles.indexOf('projektvezeto') != -1) { return true; diff --git a/src/app/fault-manager/confirm-expensive-fault/confirm-expensive-fault.component.html b/src/app/fault-manager/confirm-expensive-fault/confirm-expensive-fault.component.html index 4f86674..2ff779d 100644 --- a/src/app/fault-manager/confirm-expensive-fault/confirm-expensive-fault.component.html +++ b/src/app/fault-manager/confirm-expensive-fault/confirm-expensive-fault.component.html @@ -5,7 +5,7 @@
Mentés
-

Nagyértékű munka jóváhagyása

+

Munka jóváhagyása

+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
- +
-
-
- - -
-
-
- - -
+ + + + + + + + + + +

Hiba adatai

@@ -46,11 +67,11 @@ Becsült alapanyagköltség {{numericMaterialCostEstimate|currencyFormat}} - - Részletes költségvetés - Letöltés - - + + + + + Hiba helye {{fault.facilityLocation.roomNumber}}-{{fault.facilityLocation.name}} diff --git a/src/app/fault-manager/confirm-fault/confirm-fault.component.html b/src/app/fault-manager/confirm-fault/confirm-fault.component.html index fb426d0..2144521 100644 --- a/src/app/fault-manager/confirm-fault/confirm-fault.component.html +++ b/src/app/fault-manager/confirm-fault/confirm-fault.component.html @@ -24,26 +24,35 @@ [(ngModel)]="fault.workCostEstimate"> -
-

Költség becslés pdf formátumban

- -
+ + + +

A pirossal jelölt mezők kitöltése kötelező.

- - + + + + + + + + + +

Hiba helye

+ + + + diff --git a/src/app/fault-manager/confirm-fault/confirm-fault.component.ts b/src/app/fault-manager/confirm-fault/confirm-fault.component.ts index e963a3e..7ee2f10 100644 --- a/src/app/fault-manager/confirm-fault/confirm-fault.component.ts +++ b/src/app/fault-manager/confirm-fault/confirm-fault.component.ts @@ -6,6 +6,7 @@ import { finalize } from 'rxjs/operators'; import { environment } from "../../../environments/environment"; import { FaultManagerService } from "../fault-manager.service"; import { Fault } from "../shared/fault"; +import { FaultType } from "../shared/fault-type"; @Component({ selector: 'app-confirm-fault', @@ -36,49 +37,54 @@ export class ConfirmFaultComponent implements OnInit { ngOnInit() { this.titleService.setTitle('Webnapló : Hiba visszaigazolása'); this.route.data.subscribe((data: { fault: Fault }) => this.fault = data.fault); - jQuery(this.pdfUpload.nativeElement).on('change', changeEvent => { - for (let i = 0; i < this.pdfUpload.nativeElement.files.length; i++) { - if (!/\.(pdf)$/i.test(this.pdfUpload.nativeElement.files[i].name)) { - this.pdfUpload.nativeElement.value = null; - break; - } - } - }); - jQuery(this.photoUpload.nativeElement).on('change', changeEvent => { - this.rawImageData = []; - for (let i = 0; i < this.photoUpload.nativeElement.files.length; i++) { - if (!/\.(jpe?g|png|gif)$/i.test(this.photoUpload.nativeElement.files[i].name)) { - continue; - } - let reader = new FileReader(); - reader.addEventListener("load", () => { - this.rawImageData.push(reader.result); - }); - reader.readAsDataURL(this.photoUpload.nativeElement.files[i]); - } - }); + // jQuery(this.pdfUpload.nativeElement).on('change', changeEvent => { + // for (let i = 0; i < this.pdfUpload.nativeElement.files.length; i++) { + // if (!/\.(pdf)$/i.test(this.pdfUpload.nativeElement.files[i].name)) { + // this.pdfUpload.nativeElement.value = null; + // break; + // } + // } + // }); + // jQuery(this.photoUpload.nativeElement).on('change', changeEvent => { + // this.rawImageData = []; + // for (let i = 0; i < this.photoUpload.nativeElement.files.length; i++) { + // if (!/\.(jpe?g|png|gif)$/i.test(this.photoUpload.nativeElement.files[i].name)) { + // continue; + // } + // let reader = new FileReader(); + // reader.addEventListener("load", () => { + // this.rawImageData.push(reader.result); + // }); + // reader.readAsDataURL(this.photoUpload.nativeElement.files[i]); + // } + // }); } public confirm() { this.submitInProgress = true; - // this.fault.costEstimate = this.costEstimate; - this.faultManager.confirmFault(this.fault).pipe( + this.faultManager.setHighExpenseFault(this.fault).pipe( finalize(() => this.submitInProgress = false)) .subscribe(() => this.router.navigate(['/hiba/feladat-lista'])); } - public setHighExpenseFault() { - this.submitInProgress = true; - // this.fault.costEstimate = this.costEstimate; - this.faultManager.setHighExpenseFault(this.fault).pipe( - finalize(() => this.submitInProgress = false)) - .subscribe(fault => { - this.faultManager.attachPdf(this.fault.id, this.pdfUpload.nativeElement.files).subscribe( - attRes => this.router.navigate(['/hiba/feladat-lista']), - attErr => console.log("File upload error: ", attErr) - ); - }); - } + // public confirm() { + // this.submitInProgress = true; + // this.faultManager.confirmFault(this.fault).pipe( + // finalize(() => this.submitInProgress = false)) + // .subscribe(() => this.router.navigate(['/hiba/feladat-lista'])); + // } + // + // public setHighExpenseFault() { + // this.submitInProgress = true; + // this.faultManager.setHighExpenseFault(this.fault).pipe( + // finalize(() => this.submitInProgress = false)) + // .subscribe(fault => { + // this.faultManager.attachPdf(this.fault.id, this.pdfUpload.nativeElement.files).subscribe( + // attRes => this.router.navigate(['/hiba/feladat-lista']), + // attErr => console.log("File upload error: ", attErr) + // ); + // }); + // } public attachImages() { this.submitInProgress = true; @@ -145,4 +151,8 @@ export class ConfirmFaultComponent implements OnInit { && !this.noWorkCostEstimate && !this.noMaterialCostEstimate); } + + get faultType(): string { + return FaultType[this.fault.faultType]; + } } diff --git a/src/app/fault-manager/fault-manager.service.ts b/src/app/fault-manager/fault-manager.service.ts index dfe1bf2..430aed8 100644 --- a/src/app/fault-manager/fault-manager.service.ts +++ b/src/app/fault-manager/fault-manager.service.ts @@ -194,6 +194,7 @@ export class FaultManagerService implements Resolve> { return { id: fault.id, workSheetNumber: fault.worksheetNumber, + faultType: fault.faultType, errorOrigin: fault.errorOrigin.id, errorCategory: fault.errorCategory.id, solutionTimeInterval: fault.solutionTimeInterval.id, diff --git a/src/app/fault-manager/list-faults/list-faults.component.html b/src/app/fault-manager/list-faults/list-faults.component.html index 2d72990..8fccb9f 100644 --- a/src/app/fault-manager/list-faults/list-faults.component.html +++ b/src/app/fault-manager/list-faults/list-faults.component.html @@ -7,8 +7,8 @@ heading="Visszaigazolásra váró hiba jelentések">
+ [faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró munka." + heading="Jóváhagyásra váró munkák">
+ [faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró munka." + heading="Jóváhagyásra váró munkák">
Hiba adatai
Hiba típus{{faultType}}
Hiba helye {{fault.facilityLocation.roomNumber}}-{{fault.facilityLocation.name}}
+ + + + diff --git a/src/app/fault-manager/readonly-display/readonly-display.component.ts b/src/app/fault-manager/readonly-display/readonly-display.component.ts index 213eb5c..a02ec57 100644 --- a/src/app/fault-manager/readonly-display/readonly-display.component.ts +++ b/src/app/fault-manager/readonly-display/readonly-display.component.ts @@ -8,6 +8,7 @@ import { environment } from "../../../environments/environment"; import { Fault } from "../shared/fault"; import { AuthService } from "../../auth/auth.service"; import { FaultManagerService } from "../fault-manager.service"; +import { FaultType } from "../shared/fault-type"; @Component({ selector: 'app-readonly-display', @@ -92,4 +93,8 @@ export class ReadonlyDisplayComponent implements OnInit { attErr => alert("Hiba történt a képfeltöltés közben.") ); } + + get faultType(): string { + return FaultType[this.fault.faultType]; + } } diff --git a/src/app/fault-manager/record-fault/record-fault.component.html b/src/app/fault-manager/record-fault/record-fault.component.html index 6d069da..e673db7 100644 --- a/src/app/fault-manager/record-fault/record-fault.component.html +++ b/src/app/fault-manager/record-fault/record-fault.component.html @@ -31,6 +31,28 @@

Hiba

+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
@@ -79,7 +101,7 @@
-
diff --git a/src/app/fault-manager/record-fault/record-fault.component.ts b/src/app/fault-manager/record-fault/record-fault.component.ts index 70e34ef..8e0794f 100644 --- a/src/app/fault-manager/record-fault/record-fault.component.ts +++ b/src/app/fault-manager/record-fault/record-fault.component.ts @@ -9,6 +9,7 @@ import { SolutionTimeInterval } from "../shared"; import { FaultManagerService } from "../fault-manager.service"; import { SimpleFault } from "../shared/simple-fault"; import { Title } from "@angular/platform-browser"; +import { RoleGuardService } from "../../auth/role-guard.service"; @Component({ selector: 'app-record-fault', @@ -23,6 +24,7 @@ export class RecordFaultComponent implements OnInit, AfterViewInit { public submitInProgress: boolean = false; + public faultType: string = 'uzemeltetesi'; public facilityLocationText: string = ''; public errorCategory: ErrorCategory; public errorOrigin: ErrorOrigin; @@ -39,7 +41,8 @@ export class RecordFaultComponent implements OnInit, AfterViewInit { constructor(private activatedRoute: ActivatedRoute, private router: Router, private faultService: FaultManagerService, - private titleService: Title) { + private titleService: Title, + private roleGuard: RoleGuardService) { } ngOnInit() { @@ -83,6 +86,7 @@ export class RecordFaultComponent implements OnInit, AfterViewInit { this.submitInProgress = true; let fault: SimpleFault = { // id: null, + faultType: this.faultType, facilityLocation: parseInt(this.facilityLocationIdElement.nativeElement.value), facilityLocationDescription: this.facilityLocationText, errorCategory: this.errorCategory.id, @@ -154,4 +158,8 @@ export class RecordFaultComponent implements OnInit, AfterViewInit { get noAttachments(): boolean { return this.rawImageData.length == 0; } + + public hasPermission(resourceName: string): boolean { + return this.roleGuard.userCanAccessResource(resourceName); + } } diff --git a/src/app/fault-manager/repair-complete/repair-complete.component.html b/src/app/fault-manager/repair-complete/repair-complete.component.html index 8e9fd74..963e555 100644 --- a/src/app/fault-manager/repair-complete/repair-complete.component.html +++ b/src/app/fault-manager/repair-complete/repair-complete.component.html @@ -57,6 +57,10 @@

Hiba adatai

Hiba típus{{faultType}}
Munkalap száma {{fault?.worksheetNumber}}
+ + + + diff --git a/src/app/fault-manager/repair-complete/repair-complete.component.ts b/src/app/fault-manager/repair-complete/repair-complete.component.ts index 1cf5f4e..9f84a70 100644 --- a/src/app/fault-manager/repair-complete/repair-complete.component.ts +++ b/src/app/fault-manager/repair-complete/repair-complete.component.ts @@ -6,6 +6,7 @@ import { Fault } from "../shared/fault"; import { FaultManagerService } from "../fault-manager.service"; import { Title } from "@angular/platform-browser"; import { ActivatedRoute, Router } from "@angular/router"; +import { FaultType } from "../shared/fault-type"; @Component({ selector: 'app-repair-complete', @@ -75,4 +76,8 @@ export class RepairCompleteComponent implements OnInit { ? this.fault.materialCostEstimate : 0; } + + get faultType(): string { + return FaultType[this.fault.faultType]; + } } diff --git a/src/app/fault-manager/repair-fault/repair-fault.component.html b/src/app/fault-manager/repair-fault/repair-fault.component.html index 08fe18d..f770383 100644 --- a/src/app/fault-manager/repair-fault/repair-fault.component.html +++ b/src/app/fault-manager/repair-fault/repair-fault.component.html @@ -128,6 +128,10 @@

Hiba adatai

Hiba típus{{faultType}}
Becsült munkaköltség {{fault.workCostEstimate|currencyFormat}}
+ + + + diff --git a/src/app/fault-manager/repair-fault/repair-fault.component.ts b/src/app/fault-manager/repair-fault/repair-fault.component.ts index 9100fd7..fab1d73 100644 --- a/src/app/fault-manager/repair-fault/repair-fault.component.ts +++ b/src/app/fault-manager/repair-fault/repair-fault.component.ts @@ -11,6 +11,7 @@ import { Fault } from "../shared/fault"; import { UsedMaterial } from "../shared/used-material"; import { User } from "../../user/shared/user"; import { Comment } from "../shared/comment"; +import { FaultType } from "../shared/fault-type"; @Component({ selector: 'app-repair-fault', @@ -185,4 +186,8 @@ export class RepairFaultComponent implements OnInit { ? this.fault.materialCostEstimate : 0; } + + get faultType(): string { + return FaultType[this.fault.faultType]; + } } diff --git a/src/app/fault-manager/shared/fault-type.ts b/src/app/fault-manager/shared/fault-type.ts new file mode 100644 index 0000000..18865e1 --- /dev/null +++ b/src/app/fault-manager/shared/fault-type.ts @@ -0,0 +1,5 @@ +export enum FaultType { + uzemeltetesi = 'Üzemeltetési', + garancialis = 'Garanciális', + arajanlat = 'Árajánlat', +} diff --git a/src/app/fault-manager/shared/fault.ts b/src/app/fault-manager/shared/fault.ts index 05d9983..51ee2c6 100644 --- a/src/app/fault-manager/shared/fault.ts +++ b/src/app/fault-manager/shared/fault.ts @@ -9,6 +9,7 @@ import { UsedMaterial } from "./used-material"; export class Fault { public id?: number; public worksheetNumber: string; + public faultType: string; public facilityLocation: FacilityLocation; public facilityLocationDescription: string; public errorCategory: ErrorCategory; diff --git a/src/app/fault-manager/shared/simple-fault.ts b/src/app/fault-manager/shared/simple-fault.ts index 7fe593c..4e3f25b 100644 --- a/src/app/fault-manager/shared/simple-fault.ts +++ b/src/app/fault-manager/shared/simple-fault.ts @@ -4,6 +4,7 @@ import {Comment} from "./comment"; export class SimpleFault { public id?: number; public workSheetNumber?: string; + public faultType: string; public facilityLocation: number; public facilityLocationDescription: string; public errorCategory: number;
Hiba típus{{faultType}}
Becsült munkaköltség {{fault.workCostEstimate|currencyFormat}}