Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89241f38fc | ||
|
|
6348fb5dd0 | ||
|
|
9d07b8ad82 | ||
|
|
0ddd7c719d | ||
|
|
3ad9cc8b9e | ||
|
|
63a40f7077 |
@ -13,7 +13,7 @@ set('default_stage', 'production');
|
||||
|
||||
// Servers
|
||||
|
||||
host('lxuz.hu')
|
||||
host('bggeneral.hu')
|
||||
->stage('production')
|
||||
->user('benkeg_gulbaba_frontend_access')
|
||||
->forwardAgent()
|
||||
|
||||
5
package-lock.json
generated
5
package-lock.json
generated
@ -2785,6 +2785,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"date-fns": {
|
||||
"version": "2.0.0-alpha.25",
|
||||
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.0.0-alpha.25.tgz",
|
||||
"integrity": "sha512-iQzJkHF0L4wah9Ae9PkvwemwFz6qmRLuNZcghmvf2t+ptLs1qXzONLiGtjmPQzL6+JpC01JjlTopY2AEy4NFAg=="
|
||||
},
|
||||
"date-format": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz",
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
"@auth0/angular-jwt": "^2.0.0",
|
||||
"@types/jquery": "^3.3.22",
|
||||
"core-js": "^2.5.4",
|
||||
"date-fns": "^2.0.0-alpha.25",
|
||||
"jquery": "^3.3.1",
|
||||
"rxjs": "~6.3.3",
|
||||
"zone.js": "~0.8.26"
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
<div class="column">
|
||||
<h2 class="ui teal image header">
|
||||
<i class="circular inverted tiny olive wrench icon"></i>
|
||||
<div class="content">
|
||||
<span class="content">
|
||||
WN GÜLBABA Bejelentkezés
|
||||
</div>
|
||||
</span>
|
||||
</h2>
|
||||
<form (ngSubmit)="doSubmit()" class="ui large form" [class.error]="hasError" [class.loading]="isLoading">
|
||||
<div class="ui raised segment">
|
||||
<div class="field">
|
||||
<div class="ui left icon input">
|
||||
<i class="user icon"></i>
|
||||
<input type="text" #loginField name="login" placeholder="E-mail cím">
|
||||
<input type="text" #loginField name="login" placeholder="E-mail cím" autocomplete="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui left icon input">
|
||||
<i class="lock icon"></i>
|
||||
<input type="password" #passwordField name="password" placeholder="Jelszó">
|
||||
<input type="password" #passwordField name="password" placeholder="Jelszó" autocomplete="current-password">
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui fluid large teal submit button">Bejelentkezés</button>
|
||||
|
||||
@ -26,8 +26,11 @@ export class RoleGuardService{
|
||||
new RegExp("/hiba/megjelenites/[\\d]+", "i"),
|
||||
new RegExp("/beallitasok", "i"),
|
||||
new RegExp("/karbantartas/(idoszeru|teljes)-lista", "i"),
|
||||
new RegExp("/karbantartas/naptar", "i"),
|
||||
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"),
|
||||
@ -38,6 +41,8 @@ export class RoleGuardService{
|
||||
new RegExp("/riportok/szures", "i"),
|
||||
new RegExp("/riportok/havi-zaras", "i"),
|
||||
new RegExp("/karbantartas/(idoszeru|teljes)-lista", "i"),
|
||||
new RegExp("/karbantartas/naptar", "i"),
|
||||
new RegExp("/karbantartas/naptar/[\\d]+", "i"),
|
||||
new RegExp("/karbantartas/szerkesztes", "i"),
|
||||
],
|
||||
|
||||
@ -91,6 +96,9 @@ export class RoleGuardService{
|
||||
if (roles.indexOf('uzemeltetesi_vezeto') != -1) {
|
||||
return true;
|
||||
}
|
||||
if (roles.indexOf('projektvezeto') != -1) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'confirm':
|
||||
if (roles.indexOf('projektvezeto') != -1) {
|
||||
@ -121,6 +129,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;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="ui indeterminate text loader">Mentés</div>
|
||||
</div>
|
||||
<form class="ui form" #confirmForm>
|
||||
<h4 class="ui dividing header">Nagyértékű munka jóváhagyása</h4>
|
||||
<h4 class="ui dividing header">Munka jóváhagyása</h4>
|
||||
<div class="field">
|
||||
<label>Elutasítás indoklása</label>
|
||||
<textarea rows="3"
|
||||
@ -13,9 +13,30 @@
|
||||
name="rejectReason"
|
||||
[(ngModel)]="rejectReason"></textarea>
|
||||
</div>
|
||||
<div class="inline fields">
|
||||
<label>Hiba típusa</label>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="uzemeltetesi" value="uzemeltetesi" [(ngModel)]="fault.faultType">
|
||||
<label for="uzemeltetesi">Üzemeltetési</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="garancialis" value="garancialis" [(ngModel)]="fault.faultType">
|
||||
<label for="garancialis">Garanciális</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="arajanlat" value="arajanlat" [(ngModel)]="fault.faultType">
|
||||
<label for="arajanlat">Árajánlat</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="four inline fields">
|
||||
<div class="two wide field">
|
||||
<button class="ui fluid button" [class.negative]="canReject" [class.disabled]="!canReject" (click)="reject()">Elvetés</button>
|
||||
<button class="ui fluid button" [class.negative]="canReject" [class.disabled]="!canReject" (click)="reject()">Elutasítás</button>
|
||||
</div>
|
||||
<div class="three wide field">
|
||||
<button class="ui fluid button"
|
||||
@ -23,17 +44,17 @@
|
||||
[class.disabled]="submitInProgress"
|
||||
(click)="confirm()">Jóváhagyás</button>
|
||||
</div>
|
||||
<div class="five wide field">
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" id="mustLowerCost" name="mustLowerCost"
|
||||
[(ngModel)]="fault.mustLowerCost">
|
||||
<label for="mustLowerCost">Költség csökkentés szükséges</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="six wide field" [class.error]="noAllocatedExpense" *ngIf="fault.mustLowerCost">
|
||||
<label>Keret összeg:</label>
|
||||
<input type="number" name="allocatedExpense" [(ngModel)]="fault.allocatedExpense">
|
||||
</div>
|
||||
<!--<div class="five wide field">-->
|
||||
<!--<div class="ui checkbox">-->
|
||||
<!--<input type="checkbox" id="mustLowerCost" name="mustLowerCost"-->
|
||||
<!--[(ngModel)]="fault.mustLowerCost">-->
|
||||
<!--<label for="mustLowerCost">Költség csökkentés szükséges</label>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="six wide field" [class.error]="noAllocatedExpense" *ngIf="fault.mustLowerCost">-->
|
||||
<!--<label>Keret összeg:</label>-->
|
||||
<!--<input type="number" name="allocatedExpense" [(ngModel)]="fault.allocatedExpense">-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
|
||||
<h4 class="ui dividing header">Hiba adatai</h4>
|
||||
@ -46,11 +67,11 @@
|
||||
<td class="collapsing">Becsült alapanyagköltség</td>
|
||||
<td>{{numericMaterialCostEstimate|currencyFormat}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="collapsing">Részletes költségvetés</td>
|
||||
<td><a [href]="expensePdfDownloadUrl" target="_blank"><i class="file pdf outline icon"></i>Letöltés</a>
|
||||
</td>
|
||||
</tr>
|
||||
<!--<tr>-->
|
||||
<!--<td class="collapsing">Részletes költségvetés</td>-->
|
||||
<!--<td><a [href]="expensePdfDownloadUrl" target="_blank"><i class="file pdf outline icon"></i>Letöltés</a>-->
|
||||
<!--</td>-->
|
||||
<!--</tr>-->
|
||||
<tr>
|
||||
<td class="collapsing">Hiba helye</td>
|
||||
<td><b>{{fault.facilityLocation.roomNumber}}</b>-{{fault.facilityLocation.name}}</td>
|
||||
|
||||
@ -24,26 +24,35 @@
|
||||
[(ngModel)]="fault.workCostEstimate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field" [class.error]="hasNoPdfAttachment" [hidden]="!highExpense">
|
||||
<h4 class="ui dividing header">Költség becslés pdf formátumban</h4>
|
||||
<input #pdfUpload type="file" accept="application/pdf"/>
|
||||
</div>
|
||||
<!--<div class="field" [class.error]="hasNoPdfAttachment" [hidden]="!highExpense">-->
|
||||
<!--<h4 class="ui dividing header">Költség becslés pdf formátumban</h4>-->
|
||||
<!--<input #pdfUpload type="file" accept="application/pdf"/>-->
|
||||
<!--</div>-->
|
||||
<div class="ui error message" [class.visible]="hasErrors">
|
||||
<p>A pirossal jelölt mezők kitöltése kötelező.</p>
|
||||
</div>
|
||||
<button *ngIf="!highExpense" class="ui button"
|
||||
<button class="ui button"
|
||||
[class.positive]="canConfirm"
|
||||
[class.disabled]="!canConfirm" tabindex="0"
|
||||
(click)="confirm()">Visszaigazolás
|
||||
</button>
|
||||
<button *ngIf="highExpense" class="ui button"
|
||||
[class.orange]="canHighExpense"
|
||||
[class.disabled]="!canHighExpense" tabindex="0"
|
||||
(click)="setHighExpenseFault()">Nagyértékű munka továbbküldése jóváhagyásra
|
||||
</button>
|
||||
<!--<button *ngIf="!highExpense" class="ui button"-->
|
||||
<!--[class.positive]="canConfirm"-->
|
||||
<!--[class.disabled]="!canConfirm" tabindex="0"-->
|
||||
<!--(click)="confirm()">Visszaigazolás-->
|
||||
<!--</button>-->
|
||||
<!--<button *ngIf="highExpense" class="ui button"-->
|
||||
<!--[class.orange]="canHighExpense"-->
|
||||
<!--[class.disabled]="!canHighExpense" tabindex="0"-->
|
||||
<!--(click)="setHighExpenseFault()">Nagyértékű munka továbbküldése jóváhagyásra-->
|
||||
<!--</button>-->
|
||||
|
||||
<h4 class="ui dividing header">Hiba helye</h4>
|
||||
<table class="ui red definition table">
|
||||
<tr>
|
||||
<td class="collapsing">Hiba típus</td>
|
||||
<td>{{faultType}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="collapsing">Hiba helye</td>
|
||||
<td><b>{{fault.facilityLocation.roomNumber}}</b>-{{fault.facilityLocation.name}}</td>
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,6 +194,7 @@ export class FaultManagerService implements Resolve<false|Array<Fault>> {
|
||||
return {
|
||||
id: fault.id,
|
||||
workSheetNumber: fault.worksheetNumber,
|
||||
faultType: fault.faultType,
|
||||
errorOrigin: fault.errorOrigin.id,
|
||||
errorCategory: fault.errorCategory.id,
|
||||
solutionTimeInterval: fault.solutionTimeInterval.id,
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
heading="Visszaigazolásra váró hiba jelentések"></div>
|
||||
<div app-table-view class="ui segment" [editor]="hasPermission('confirmExtraCost')"
|
||||
(actionClicked)="actionClickHandler($event)" [actions]="actionButtons['exp']"
|
||||
[faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró nagyértékű munka."
|
||||
heading="Jóváhagyásra váró nagyértékű munkák"></div>
|
||||
[faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró munka."
|
||||
heading="Jóváhagyásra váró munkák"></div>
|
||||
<div app-table-view class="ui segment" showWorksheetNumber="true" [editor]="hasPermission('repair')"
|
||||
(actionClicked)="actionClickHandler($event)" [actions]="actionButtons['cnf']"
|
||||
[faults]="cnfFaults" noRecordMessage="Nincs javításra váró hiba."
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
heading="Visszaigazolásra váró hiba jelentések"></div>
|
||||
<div app-table-view class="ui segment" *ngIf="hasPermission('confirmExtraCost')"
|
||||
(actionClicked)="actionClickHandler($event)" [actions]="actionButtons['exp']"
|
||||
[faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró nagyértékű munka."
|
||||
heading="Jóváhagyásra váró nagyértékű munkák"></div>
|
||||
[faults]="expFaults" noRecordMessage="Nincs jóváhagyásra váró munka."
|
||||
heading="Jóváhagyásra váró munkák"></div>
|
||||
<div app-table-view class="ui segment" showWorksheetNumber="true" *ngIf="hasPermission('repair')"
|
||||
(actionClicked)="actionClickHandler($event)" [actions]="actionButtons['cnf']"
|
||||
[faults]="cnfFaults" noRecordMessage="Nincs javításra váró hiba."
|
||||
|
||||
@ -45,6 +45,10 @@
|
||||
|
||||
<h4 class="ui dividing header">Hiba adatai</h4>
|
||||
<table class="ui red definition table">
|
||||
<tr *ngIf="fault">
|
||||
<td class="collapsing">Hiba típus</td>
|
||||
<td>{{faultType}}</td>
|
||||
</tr>
|
||||
<tr *ngIf="fault?.worksheetNumber">
|
||||
<td class="collapsing">Munkalap száma</td>
|
||||
<td>{{fault?.worksheetNumber}}</td>
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,28 @@
|
||||
</div>
|
||||
|
||||
<h4 class="ui dividing header">Hiba</h4>
|
||||
<div class="inline fields" *ngIf="hasPermission('setFaultType')">
|
||||
<label>Hiba típusa</label>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="uzemeltetesi" value="uzemeltetesi" [(ngModel)]="faultType">
|
||||
<label for="uzemeltetesi">Üzemeltetési</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="garancialis" value="garancialis" [(ngModel)]="faultType">
|
||||
<label for="garancialis">Garanciális</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="ui radio checkbox">
|
||||
<input type="radio" name="faultType" id="arajanlat" value="arajanlat" [(ngModel)]="faultType">
|
||||
<label for="arajanlat">Árajánlat</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="two fields">
|
||||
<div class="field" [class.error]="noErrorCategory">
|
||||
<label>Hiba szakág</label>
|
||||
@ -79,7 +101,7 @@
|
||||
<div class="field" [class.error]="noAttachments">
|
||||
<input #photoUpload type="file" accept="image/*" multiple/>
|
||||
</div>
|
||||
<div #photoAttachments class="photoAttachments" class="ui bordered images segment"
|
||||
<div #photoAttachments class="ui bordered images segment photoAttachments"
|
||||
*ngIf="rawImageData?.length">
|
||||
<img class="ui image" *ngFor="let image of rawImageData; let idx = index" [src]="image" height="200"/>
|
||||
</div>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,10 @@
|
||||
|
||||
<h4 class="ui dividing header">Hiba adatai</h4>
|
||||
<table class="ui red definition table">
|
||||
<tr>
|
||||
<td class="collapsing">Hiba típus</td>
|
||||
<td>{{faultType}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="collapsing">Becsült munkaköltség</td>
|
||||
<td>{{fault.workCostEstimate|currencyFormat}}</td>
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +128,10 @@
|
||||
|
||||
<h4 class="ui dividing header">Hiba adatai</h4>
|
||||
<table class="ui red definition table">
|
||||
<tr>
|
||||
<td class="collapsing">Hiba típus</td>
|
||||
<td>{{faultType}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="collapsing">Becsült munkaköltség</td>
|
||||
<td>{{fault.workCostEstimate|currencyFormat}}</td>
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
5
src/app/fault-manager/shared/fault-type.ts
Normal file
5
src/app/fault-manager/shared/fault-type.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export enum FaultType {
|
||||
uzemeltetesi = 'Üzemeltetési',
|
||||
garancialis = 'Garanciális',
|
||||
arajanlat = 'Árajánlat',
|
||||
}
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
<div class="ui main container">
|
||||
<h1 class="ui dividing header">Éves karbantartási feladatok</h1>
|
||||
<div class="ui two item stackable tabs menu">
|
||||
<a class="item" [class.active]="year==2018" [routerLink]="['/karbantartas/teljes-lista/2018']">2018</a>
|
||||
<a class="item" [class.active]="year==2019" [routerLink]="['/karbantartas/teljes-lista/2019']">2019</a>
|
||||
<a class="item" [class.active]="year==2020" [routerLink]="['/karbantartas/teljes-lista/2020']">2020</a>
|
||||
</div>
|
||||
<div class="ui raised segments">
|
||||
<div class="ui segment" *ngFor="let group of maintenances">
|
||||
<table class="ui celled striped selectable table">
|
||||
@ -13,7 +18,7 @@
|
||||
<tbody>
|
||||
|
||||
<tr *ngFor="let device of group.devices">
|
||||
<td class="collapsing">{{device.name}}</td>
|
||||
<td class="collapsing-off">{{device.name}}</td>
|
||||
<td>{{device.workDescription}}</td>
|
||||
<td>
|
||||
<div class="date-card-holder">
|
||||
@ -24,7 +29,7 @@
|
||||
<i class="file pdf outline icon"></i>
|
||||
</a>
|
||||
<i *ngIf="!hasPdf(task)" class="icon {{taskIcon(task)}}"></i>
|
||||
<a *ngIf="canModify()" [routerLink]="['/karbantartas/szerkesztes', task.hash]"
|
||||
<a *ngIf="canModify()" [routerLink]="['/karbantartas/szerkesztes', year, task.hash]"
|
||||
title="Szerkesztés">{{task?.shouldStartAt}}</a>
|
||||
<ng-container *ngIf="!canModify()">{{task?.shouldStartAt}}</ng-container>
|
||||
</div>
|
||||
|
||||
@ -15,6 +15,7 @@ import { RoleGuardService } from "../../auth/role-guard.service";
|
||||
})
|
||||
export class ListAllMaintenancesComponent implements OnInit {
|
||||
|
||||
public year: number = 2020;
|
||||
private today: string = "";
|
||||
|
||||
constructor(private maintenanceManager: MaintenanceManagerService,
|
||||
@ -26,6 +27,11 @@ export class ListAllMaintenancesComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Webnapló : Éves karbantartási feladatok');
|
||||
this.route.params.subscribe((params: {
|
||||
year: number
|
||||
}) => {
|
||||
this.year = params.year ? params.year : new Date().getFullYear();
|
||||
});
|
||||
this.route.data.subscribe((data: {
|
||||
maintenances: Array<DeviceGroup>,
|
||||
}) => {
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
<div class="ui main container">
|
||||
<h1 class="ui dividing header">Karbantartási naptár</h1>
|
||||
<div class="ui two item stackable tabs menu">
|
||||
<a class="item" [class.active]="year==2018" [routerLink]="['/karbantartas/naptar/2018']">2018</a>
|
||||
<a class="item" [class.active]="year==2019" [routerLink]="['/karbantartas/naptar/2019']">2019</a>
|
||||
<a class="item" [class.active]="year==2020" [routerLink]="['/karbantartas/naptar/2020']">2020</a>
|
||||
</div>
|
||||
<div class="ui raised segments">
|
||||
<div class="ui segment" *ngFor="let data of maintenances">
|
||||
<app-calendar [year]="year" [month]="data[0].month" [data]="data"></app-calendar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MaintenanceCalendarComponent } from './maintenance-calendar.component';
|
||||
|
||||
describe('MaintenanceCalendarComponent', () => {
|
||||
let component: MaintenanceCalendarComponent;
|
||||
let fixture: ComponentFixture<MaintenanceCalendarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MaintenanceCalendarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MaintenanceCalendarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,43 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DeviceGroup } from "../shared/device-group";
|
||||
import { MaintenanceManagerService } from "../maintenance-manager.service";
|
||||
import { Title } from "@angular/platform-browser";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-maintenance-calendar',
|
||||
templateUrl: './maintenance-calendar.component.html',
|
||||
styleUrls: ['./maintenance-calendar.component.css']
|
||||
})
|
||||
export class MaintenanceCalendarComponent implements OnInit {
|
||||
|
||||
public year: number = 2018;
|
||||
|
||||
constructor(private maintenanceManager: MaintenanceManagerService,
|
||||
private titleService: Title,
|
||||
private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.titleService.setTitle('Webnapló : Éves karbantartási feladatok');
|
||||
this.route.params.subscribe((params: {
|
||||
year: number
|
||||
}) => {
|
||||
this.year = params.year ? params.year : new Date().getFullYear();
|
||||
});
|
||||
this.route.data.subscribe((data: {
|
||||
maintenances: Array<DeviceGroup>,
|
||||
}) => {
|
||||
this.maintenances = data.maintenances;
|
||||
});
|
||||
}
|
||||
|
||||
get maintenances(): Array<DeviceGroup> {
|
||||
return this.maintenanceManager.maintenances;
|
||||
}
|
||||
|
||||
set maintenances(maintenances: Array<DeviceGroup>) {
|
||||
this.maintenanceManager.maintenances = maintenances;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,21 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from "rxjs";
|
||||
import { HttpClient, HttpHeaders, HttpRequest } from "@angular/common/http";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
|
||||
import { environment } from "../../environments/environment";
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from "@angular/router";
|
||||
import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router";
|
||||
import { DeviceGroup } from "./shared/device-group";
|
||||
import { MaintenanceEntity } from "./shared/maintenance-entity";
|
||||
|
||||
@Injectable()
|
||||
export class MaintenanceManagerService {
|
||||
|
||||
private apiEndpoint = environment.apiUrl + '/api/maintenance';
|
||||
private apiEndpointUpcoming = environment.apiUrl + '/api/maintenance/upcoming';
|
||||
static apiEndpoint = environment.apiUrl + '/api/maintenance';
|
||||
static apiEndpointUpcoming = environment.apiUrl + '/api/maintenance/upcoming';
|
||||
static apiEndpointCalendar = environment.apiUrl + '/api/maintenance/calendar';
|
||||
|
||||
static endpointMap = {
|
||||
all: MaintenanceManagerService.apiEndpoint,
|
||||
upcoming: MaintenanceManagerService.apiEndpointUpcoming,
|
||||
calendar: MaintenanceManagerService.apiEndpointCalendar,
|
||||
};
|
||||
|
||||
private cachedMaintenances: Array<DeviceGroup> = [];
|
||||
|
||||
constructor(private httpClient: HttpClient) {
|
||||
}
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
/**
|
||||
* Resolver for the route
|
||||
@ -25,10 +32,9 @@ export class MaintenanceManagerService {
|
||||
* @returns {Promise<Array<Fault>>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<Array<DeviceGroup>> {
|
||||
let filter = route.data.filter ? route.data.filter : 'upcoming';
|
||||
let url = filter == 'upcoming'
|
||||
? this.apiEndpointUpcoming
|
||||
: this.apiEndpoint;
|
||||
let year = route.params.year ? route.params.year : new Date().getFullYear();
|
||||
let filter = route.data.filter ? route.data.filter : 'all';
|
||||
let url = `${MaintenanceManagerService.endpointMap[filter]}/${year}`;
|
||||
return this.list(url).toPromise();
|
||||
}
|
||||
|
||||
@ -42,11 +48,15 @@ export class MaintenanceManagerService {
|
||||
}
|
||||
|
||||
public get(hash: string): Observable<MaintenanceEntity> {
|
||||
return this.httpClient.get<MaintenanceEntity>(`${this.apiEndpoint}/${hash}`);
|
||||
return this.httpClient.get<MaintenanceEntity>(`${MaintenanceManagerService.apiEndpoint}/${hash}`);
|
||||
}
|
||||
|
||||
public getByIdAndYear(hash: string, year: number): Observable<MaintenanceEntity> {
|
||||
return this.httpClient.get<MaintenanceEntity>(`${MaintenanceManagerService.apiEndpoint}/${year}/${hash}`);
|
||||
}
|
||||
|
||||
public update(maintenance: MaintenanceEntity) {
|
||||
return this.httpClient.put<MaintenanceEntity>(`${this.apiEndpoint}/${maintenance.hash}`, maintenance);
|
||||
return this.httpClient.put<MaintenanceEntity>(`${MaintenanceManagerService.apiEndpoint}/${maintenance.hash}`, maintenance);
|
||||
}
|
||||
|
||||
get maintenances(): Array<DeviceGroup> {
|
||||
@ -59,10 +69,8 @@ export class MaintenanceManagerService {
|
||||
|
||||
public setWip(id: string, page: string) {
|
||||
if(confirm("Biztos benne?")) {
|
||||
let url = page == 'upcoming'
|
||||
? this.apiEndpointUpcoming
|
||||
: this.apiEndpoint;
|
||||
this.httpClient.post<any>(`${this.apiEndpoint}/${id}/wip`,{}).subscribe(()=>{
|
||||
let url = MaintenanceManagerService.endpointMap[page];
|
||||
this.httpClient.post<any>(`${MaintenanceManagerService.apiEndpoint}/${id}/wip`,{}).subscribe(()=>{
|
||||
this.list(url).subscribe(result => this.cachedMaintenances = result);
|
||||
});
|
||||
}
|
||||
@ -70,10 +78,8 @@ export class MaintenanceManagerService {
|
||||
|
||||
public setFin(id: string, page: string) {
|
||||
if(confirm("Biztos benne?")) {
|
||||
let url = page == 'upcoming'
|
||||
? this.apiEndpointUpcoming
|
||||
: this.apiEndpoint;
|
||||
this.httpClient.post<any>(`${this.apiEndpoint}/${id}/fin`, {}).subscribe(() => {
|
||||
let url = MaintenanceManagerService.endpointMap[page];
|
||||
this.httpClient.post<any>(`${MaintenanceManagerService.apiEndpoint}/${id}/fin`, {}).subscribe(() => {
|
||||
this.list(url).subscribe(result => this.cachedMaintenances = result);
|
||||
});
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ export class MaintenanceResolverService {
|
||||
* @returns {Promise<MaintenanceEntity>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<MaintenanceEntity> {
|
||||
return this.maintenanceManager.get(route.params.id).toPromise();
|
||||
// return this.maintenanceManager.get(route.params.id).toPromise();
|
||||
return this.maintenanceManager.getByIdAndYear(route.params.id, route.params.year).toPromise();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,9 +8,20 @@ import { ListAllMaintenancesComponent } from "./list-all-maintenances/list-all-m
|
||||
import { ListUpcomingMaintenancesComponent } from "./list-upcoming-maintenances/list-upcoming-maintenances.component";
|
||||
import { EditMaintenanceComponent } from "./edit-maintenance/edit-maintenance.component";
|
||||
import { MaintenanceResolverService } from "./maintenance-resolver.service";
|
||||
import { MaintenanceCalendarComponent } from "./maintenance-calendar/maintenance-calendar.component";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'karbantartas/teljes-lista/:year',
|
||||
component: ListAllMaintenancesComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
maintenances: MaintenanceManagerService,
|
||||
},
|
||||
data: {
|
||||
filter: 'all',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/teljes-lista',
|
||||
component: ListAllMaintenancesComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
@ -20,6 +31,16 @@ const routes: Routes = [
|
||||
data: {
|
||||
filter: 'all',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/idoszeru-lista/:year',
|
||||
component: ListUpcomingMaintenancesComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
maintenances: MaintenanceManagerService,
|
||||
},
|
||||
data: {
|
||||
filter: 'upcoming',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/idoszeru-lista',
|
||||
component: ListUpcomingMaintenancesComponent,
|
||||
@ -31,7 +52,27 @@ const routes: Routes = [
|
||||
filter: 'upcoming',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/szerkesztes/:id',
|
||||
path: 'karbantartas/naptar/:year',
|
||||
component: MaintenanceCalendarComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
maintenances: MaintenanceManagerService,
|
||||
},
|
||||
data: {
|
||||
filter: 'calendar',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/naptar',
|
||||
component: MaintenanceCalendarComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
maintenances: MaintenanceManagerService,
|
||||
},
|
||||
data: {
|
||||
filter: 'calendar',
|
||||
},
|
||||
}, {
|
||||
path: 'karbantartas/szerkesztes/:year/:id',
|
||||
component: EditMaintenanceComponent,
|
||||
canActivate: [AuthGuardService, RoleGuardService],
|
||||
resolve: {
|
||||
|
||||
@ -9,17 +9,31 @@ import { ListAllMaintenancesComponent } from './list-all-maintenances/list-all-m
|
||||
import { ListUpcomingMaintenancesComponent } from './list-upcoming-maintenances/list-upcoming-maintenances.component';
|
||||
import { EditMaintenanceComponent } from './edit-maintenance/edit-maintenance.component';
|
||||
import { MaintenanceResolverService } from './maintenance-resolver.service';
|
||||
import { SharedModule } from "../shared/shared.module";
|
||||
import { MaintenanceCalendarComponent } from './maintenance-calendar/maintenance-calendar.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MaintenanceRoutingModule
|
||||
SharedModule,
|
||||
MaintenanceRoutingModule,
|
||||
],
|
||||
declarations: [
|
||||
UpcomingMaintenancesComponent,
|
||||
ListAllMaintenancesComponent,
|
||||
ListUpcomingMaintenancesComponent,
|
||||
EditMaintenanceComponent,
|
||||
MaintenanceCalendarComponent,
|
||||
],
|
||||
providers: [
|
||||
MaintenanceManagerService,
|
||||
MaintenanceResolverService,
|
||||
],
|
||||
exports: [
|
||||
UpcomingMaintenancesComponent,
|
||||
],
|
||||
declarations: [UpcomingMaintenancesComponent, ListAllMaintenancesComponent, ListUpcomingMaintenancesComponent, EditMaintenanceComponent],
|
||||
providers: [MaintenanceManagerService, MaintenanceResolverService],
|
||||
exports: [UpcomingMaintenancesComponent],
|
||||
})
|
||||
export class MaintenanceModule {
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<td *ngIf="canModify()" class="collapsing icon">
|
||||
<a *ngIf="hasMaintenanceSheet(task)" title="PDF letöltés"
|
||||
[href]="maintenancePdfUrl(task)" target="_blank"><i class="file pdf outline icon"></i></a>
|
||||
<a [routerLink]="['/karbantartas/szerkesztes', task.hash]"
|
||||
<a [routerLink]="['/karbantartas/szerkesztes', year, task.hash]"
|
||||
title="Szerkesztés"><i class="fitted pencil icon"></i></a>
|
||||
</td>
|
||||
<td class="collapsing">{{device.name}}</td>
|
||||
|
||||
@ -17,12 +17,14 @@ export class UpcomingMaintenancesComponent implements OnInit {
|
||||
@Input() warnWhenPast: boolean = true;
|
||||
@Input() maintenances: Array<DeviceGroup> = [];
|
||||
private today: string = "";
|
||||
public year: number;
|
||||
|
||||
constructor(
|
||||
private roleGuard: RoleGuardService,
|
||||
private maintenanceManager: MaintenanceManagerService
|
||||
) {
|
||||
this.today = (new Date()).toISOString().substring(0, 10);
|
||||
this.year = new Date().getFullYear();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@ -24,8 +24,9 @@
|
||||
<div class="ui simple dropdown item">
|
||||
<i class="wrench icon"></i>Karbantartás <i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<a class="item" [routerLink]="['/karbantartas/idoszeru-lista']"><i class="list icon"></i>Időszerű lista</a>
|
||||
<a class="item" [routerLink]="['/karbantartas/idoszeru-lista']"><i class="clock icon"></i>Időszerű lista</a>
|
||||
<a class="item" [routerLink]="['/karbantartas/teljes-lista']"><i class="list icon"></i>Teljes lista</a>
|
||||
<a class="item" [routerLink]="['/karbantartas/naptar']"><i class="calendar icon"></i>Naptár</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
|
||||
28
src/app/shared/calendar/calendar.component.css
Normal file
28
src/app/shared/calendar/calendar.component.css
Normal file
@ -0,0 +1,28 @@
|
||||
.y-calendar {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto auto auto auto auto;
|
||||
}
|
||||
|
||||
.y-calendar .y-item {
|
||||
display: block;
|
||||
width: calc(100% - 4px);
|
||||
height: calc(100% - 4px);
|
||||
margin: 2px;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.y-calendar .affix-day {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.y-calendar .suffix-day {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.y-calendar .day {
|
||||
background-color: #ffcc80;
|
||||
}
|
||||
|
||||
.y-calendar .weekend {
|
||||
background-color: #d5d5d5;
|
||||
}
|
||||
11
src/app/shared/calendar/calendar.component.html
Normal file
11
src/app/shared/calendar/calendar.component.html
Normal file
@ -0,0 +1,11 @@
|
||||
<h1 class="ui dividing header">{{formattedMonthHeader}}</h1>
|
||||
<div class="y-calendar">
|
||||
<div *ngFor="let a of loopable(affixDayCount)" class="y-item affix-day" [attr.data-value]="a"></div>
|
||||
<div *ngFor="let d of loopable(daysInMonth)" class="y-item day" [class.weekend]="isWeekend(d)" [attr.data-value]="d">
|
||||
<div>{{d}}</div>
|
||||
<div *ngFor="let task of dailyData(d)">
|
||||
{{task.device.work}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngFor="let s of loopable(suffixDayCount)" class="y-item suffix-day" [attr.data-value]="s"></div>
|
||||
</div>
|
||||
25
src/app/shared/calendar/calendar.component.spec.ts
Normal file
25
src/app/shared/calendar/calendar.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CalendarComponent } from './calendar.component';
|
||||
|
||||
describe('CalendarComponent', () => {
|
||||
let component: CalendarComponent;
|
||||
let fixture: ComponentFixture<CalendarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CalendarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CalendarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
68
src/app/shared/calendar/calendar.component.ts
Normal file
68
src/app/shared/calendar/calendar.component.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { format } from 'date-fns';
|
||||
import { hu } from "date-fns/locale";
|
||||
|
||||
@Component({
|
||||
selector: 'app-calendar',
|
||||
templateUrl: './calendar.component.html',
|
||||
styleUrls: ['./calendar.component.css']
|
||||
})
|
||||
export class CalendarComponent implements OnInit {
|
||||
|
||||
@Input('year')
|
||||
private year: number;
|
||||
|
||||
@Input('month')
|
||||
set month(month: number) {
|
||||
this.monthIdx = month - 1;
|
||||
}
|
||||
private monthIdx: number;
|
||||
|
||||
@Input('data')
|
||||
private data: any;
|
||||
|
||||
private firstDay: Date;
|
||||
private lastDay: Date;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
this.firstDay = new Date(this.year, this.monthIdx, 1);
|
||||
this.lastDay = new Date(this.year, this.monthIdx + 1, 0);
|
||||
}
|
||||
|
||||
public get affixDayCount(): number {
|
||||
return this.firstDay.getDay() === 0
|
||||
? 6
|
||||
: this.firstDay.getDay() - 1;
|
||||
}
|
||||
|
||||
public get suffixDayCount(): number {
|
||||
return this.lastDay.getDay() === 0
|
||||
? 0
|
||||
: 7 - this.lastDay.getDay();
|
||||
}
|
||||
|
||||
public get daysInMonth(): number {
|
||||
return this.lastDay.getDate();
|
||||
}
|
||||
|
||||
public loopable(number: number): Array<number> {
|
||||
return Array(number)
|
||||
.fill(null)
|
||||
.map((v,i) => i + 1);
|
||||
}
|
||||
|
||||
public get formattedMonthHeader(): string {
|
||||
return format(this.firstDay, "yyyy MMMM", {locale: hu});
|
||||
}
|
||||
|
||||
public isWeekend(day: number): boolean {
|
||||
return [0,6].includes(new Date(this.year, this.monthIdx, day).getDay());
|
||||
}
|
||||
|
||||
public dailyData(day: number) {
|
||||
const actualDay = new Date(this.year, this.monthIdx, day);
|
||||
return this.data.filter(item => item.start == format(actualDay, "yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ import { HTTP_INTERCEPTORS } from "@angular/common/http";
|
||||
import { SemanticDropdownComponent } from "./semantic-dropdown/semantic-dropdown.component";
|
||||
import { JsonRequestInterceptorService } from "./json-request-interceptor.service";
|
||||
import { CurrencyFormatPipe } from './pipe/currency-format.pipe';
|
||||
import { CalendarComponent } from './calendar/calendar.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -13,10 +14,12 @@ import { CurrencyFormatPipe } from './pipe/currency-format.pipe';
|
||||
declarations: [
|
||||
SemanticDropdownComponent,
|
||||
CurrencyFormatPipe,
|
||||
CalendarComponent,
|
||||
],
|
||||
exports: [
|
||||
SemanticDropdownComponent,
|
||||
CurrencyFormatPipe,
|
||||
CalendarComponent,
|
||||
],
|
||||
providers: [{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiUrl: 'https://api.gulbaba.lxuz.hu',
|
||||
apiUrl: 'https://api.gulbaba.bggeneral.hu',
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user