diff --git a/overlord/src/app/cash-flow/cash-flow.ts b/overlord/src/app/cash-flow/cash-flow.ts index 5c422a9d..50dfc44d 100644 --- a/overlord/src/app/cash-flow/cash-flow.ts +++ b/overlord/src/app/cash-flow/cash-flow.ts @@ -16,19 +16,19 @@ export class CashFlow { static Data(value): CashFlowItem[] { const d: CashFlowItem[] = []; - if (value.body.operating && value.body.operating.length) { + if (value.body.operating?.length) { d.push(new CashFlowItem('Cash flows from Operating activities')); d.push(...value.body.operating); } - if (value.body.investing && value.body.investing.length) { + if (value.body.investing?.length) { d.push(new CashFlowItem('Cash flows from Investing activities')); d.push(...value.body.investing); } - if (value.body.financing && value.body.financing.length) { + if (value.body.financing?.length) { d.push(new CashFlowItem('Cash flows from Financing activities')); d.push(...value.body.financing); } - if (value.body.details && value.body.details.length) { + if (value.body.details?.length) { d.push(...value.body.details); } return d; diff --git a/overlord/src/app/core/jwt.interceptor.ts b/overlord/src/app/core/jwt.interceptor.ts index 8deb5d65..9d853f91 100644 --- a/overlord/src/app/core/jwt.interceptor.ts +++ b/overlord/src/app/core/jwt.interceptor.ts @@ -12,7 +12,7 @@ export class JwtInterceptor implements HttpInterceptor { intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { // add authorization header with jwt token if available const currentUser = this.authService.user; - if (currentUser && currentUser.access_token) { + if (currentUser?.access_token) { request = request.clone({ setHeaders: { Authorization: `Bearer ${currentUser.access_token}` diff --git a/overlord/src/app/employee-benefits/employee-benefits.component.html b/overlord/src/app/employee-benefits/employee-benefits.component.html index 3d56ab5e..0fb8cafe 100644 --- a/overlord/src/app/employee-benefits/employee-benefits.component.html +++ b/overlord/src/app/employee-benefits/employee-benefits.component.html @@ -109,7 +109,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/employee-benefits/employee-benefits.component.ts b/overlord/src/app/employee-benefits/employee-benefits.component.ts index 11fbcac9..4dfe8db7 100644 --- a/overlord/src/app/employee-benefits/employee-benefits.component.ts +++ b/overlord/src/app/employee-benefits/employee-benefits.component.ts @@ -14,7 +14,6 @@ import {ToasterService} from '../core/toaster.service'; import {debounceTime, distinctUntilChanged, map, startWith, switchMap} from 'rxjs/operators'; import {Employee} from '../employee/employee'; import {EmployeeService} from '../employee/employee.service'; -import {Account} from '../core/account'; @Component({ selector: 'app-employee-benefits', @@ -171,10 +170,10 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/incentive/incentive.component.html b/overlord/src/app/incentive/incentive.component.html index b662ef49..fa980a8d 100644 --- a/overlord/src/app/incentive/incentive.component.html +++ b/overlord/src/app/incentive/incentive.component.html @@ -75,7 +75,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/incentive/incentive.component.ts b/overlord/src/app/incentive/incentive.component.ts index 0317c1e8..cb62abef 100644 --- a/overlord/src/app/incentive/incentive.component.ts +++ b/overlord/src/app/incentive/incentive.component.ts @@ -126,10 +126,10 @@ export class IncentiveComponent implements OnInit { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/issue/issue.component.ts b/overlord/src/app/issue/issue.component.ts index 79ec2ac5..ca8ce574 100644 --- a/overlord/src/app/issue/issue.component.ts +++ b/overlord/src/app/issue/issue.component.ts @@ -207,10 +207,10 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/issue/issue.module.ts b/overlord/src/app/issue/issue.module.ts index 106eea1f..10788535 100644 --- a/overlord/src/app/issue/issue.module.ts +++ b/overlord/src/app/issue/issue.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - IssueDialogComponent ] }) export class IssueModule { diff --git a/overlord/src/app/journal/journal.component.html b/overlord/src/app/journal/journal.component.html index 604c5084..ecd8f3b4 100644 --- a/overlord/src/app/journal/journal.component.html +++ b/overlord/src/app/journal/journal.component.html @@ -108,7 +108,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/journal/journal.component.ts b/overlord/src/app/journal/journal.component.ts index 9750ba81..1d8e40b1 100644 --- a/overlord/src/app/journal/journal.component.ts +++ b/overlord/src/app/journal/journal.component.ts @@ -71,7 +71,7 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy { return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => { - if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('Post Vouchers') !== -1) + if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) this.post(); return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); @@ -203,10 +203,10 @@ export class JournalComponent implements OnInit, AfterViewInit, OnDestroy { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/journal/journal.module.ts b/overlord/src/app/journal/journal.module.ts index b724bc66..23a77629 100644 --- a/overlord/src/app/journal/journal.module.ts +++ b/overlord/src/app/journal/journal.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - JournalDialogComponent ] }) export class JournalModule { diff --git a/overlord/src/app/payment/payment.component.html b/overlord/src/app/payment/payment.component.html index 47eea8ca..2455d01c 100644 --- a/overlord/src/app/payment/payment.component.html +++ b/overlord/src/app/payment/payment.component.html @@ -110,7 +110,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/payment/payment.component.ts b/overlord/src/app/payment/payment.component.ts index 6273fd8f..d5bd228f 100644 --- a/overlord/src/app/payment/payment.component.ts +++ b/overlord/src/app/payment/payment.component.ts @@ -75,7 +75,7 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy { return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => { - if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('Post Vouchers') !== -1) + if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) this.post(); return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); @@ -207,10 +207,10 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/payment/payment.module.ts b/overlord/src/app/payment/payment.module.ts index 5cae5e5d..9c2cd6b5 100644 --- a/overlord/src/app/payment/payment.module.ts +++ b/overlord/src/app/payment/payment.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - PaymentDialogComponent ] }) export class PaymentModule { diff --git a/overlord/src/app/purchase-return/purchase-return.component.html b/overlord/src/app/purchase-return/purchase-return.component.html index 58df7f40..c093a8c0 100644 --- a/overlord/src/app/purchase-return/purchase-return.component.html +++ b/overlord/src/app/purchase-return/purchase-return.component.html @@ -134,7 +134,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/purchase-return/purchase-return.component.ts b/overlord/src/app/purchase-return/purchase-return.component.ts index b9dedc92..e0eb99f3 100644 --- a/overlord/src/app/purchase-return/purchase-return.component.ts +++ b/overlord/src/app/purchase-return/purchase-return.component.ts @@ -75,7 +75,7 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => { - if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('Post Vouchers') !== -1) { + if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) { this.post(); } return false; // Prevent bubbling @@ -194,10 +194,10 @@ export class PurchaseReturnComponent implements OnInit, AfterViewInit, OnDestroy canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/purchase-return/purchase-return.module.ts b/overlord/src/app/purchase-return/purchase-return.module.ts index 6f8db99e..0b95aeff 100644 --- a/overlord/src/app/purchase-return/purchase-return.module.ts +++ b/overlord/src/app/purchase-return/purchase-return.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - PurchaseReturnDialogComponent ] }) export class PurchaseReturnModule { diff --git a/overlord/src/app/purchase/purchase.component.html b/overlord/src/app/purchase/purchase.component.html index 201c43dd..32da92a6 100644 --- a/overlord/src/app/purchase/purchase.component.html +++ b/overlord/src/app/purchase/purchase.component.html @@ -146,7 +146,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/purchase/purchase.component.ts b/overlord/src/app/purchase/purchase.component.ts index 018bc111..e2198866 100644 --- a/overlord/src/app/purchase/purchase.component.ts +++ b/overlord/src/app/purchase/purchase.component.ts @@ -76,7 +76,7 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy { return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => { - if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('Post Vouchers') !== -1) { + if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) { this.post(); } return false; // Prevent bubbling @@ -207,10 +207,10 @@ export class PurchaseComponent implements OnInit, AfterViewInit, OnDestroy { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/purchase/purchase.module.ts b/overlord/src/app/purchase/purchase.module.ts index 4c77ebfb..372c20c4 100644 --- a/overlord/src/app/purchase/purchase.module.ts +++ b/overlord/src/app/purchase/purchase.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - PurchaseDialogComponent ] }) export class PurchaseModule { diff --git a/overlord/src/app/receipt/receipt.component.html b/overlord/src/app/receipt/receipt.component.html index bd7ed44d..43a079dc 100644 --- a/overlord/src/app/receipt/receipt.component.html +++ b/overlord/src/app/receipt/receipt.component.html @@ -110,7 +110,7 @@ {{(voucher.id) ? 'Update' : 'Save'}} </button> <button mat-raised-button (click)="post()" *ngIf="voucher.id" - [disabled]="voucher.posted || auth.user.perms.indexOf('Post Vouchers') === -1"> + [disabled]="voucher.posted || auth.user.perms.indexOf('post-vouchers') === -1"> {{(voucher.posted) ? 'Posted' : 'Post'}} </button> <button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="voucher.id" [disabled]="!canSave()"> diff --git a/overlord/src/app/receipt/receipt.component.ts b/overlord/src/app/receipt/receipt.component.ts index 532ed675..481b1a3e 100644 --- a/overlord/src/app/receipt/receipt.component.ts +++ b/overlord/src/app/receipt/receipt.component.ts @@ -75,7 +75,7 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy { return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => { - if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('Post Vouchers') !== -1) + if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) this.post(); return false; // Prevent bubbling }, ['INPUT', 'SELECT', 'TEXTAREA'])); @@ -206,10 +206,10 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy { canSave() { if (!this.voucher.id) { return true; - } else if (this.voucher.posted && this.auth.user.perms.indexOf('Edit Posted Vouchers') !== -1) { + } else if (this.voucher.posted && this.auth.user.perms.indexOf('edit-posted-vouchers') !== -1) { return true; } else { - return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf('Edit Other User\'s Vouchers') !== -1; + return this.voucher.user.id === this.auth.user.id || this.auth.user.perms.indexOf("edit-other-user's-vouchers") !== -1; } } diff --git a/overlord/src/app/receipt/receipt.module.ts b/overlord/src/app/receipt/receipt.module.ts index a1cc6b3c..f865edf2 100644 --- a/overlord/src/app/receipt/receipt.module.ts +++ b/overlord/src/app/receipt/receipt.module.ts @@ -71,9 +71,6 @@ export const MY_FORMATS = { providers: [ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]}, {provide: MAT_DATE_FORMATS, useValue: MY_FORMATS}, - ], - entryComponents: [ - ReceiptDialogComponent ] }) export class ReceiptModule { diff --git a/overlord/src/app/shared/shared.module.ts b/overlord/src/app/shared/shared.module.ts index 2a6b0aa9..1db13b41 100644 --- a/overlord/src/app/shared/shared.module.ts +++ b/overlord/src/app/shared/shared.module.ts @@ -21,10 +21,6 @@ import {ImageDialogComponent} from './image-dialog/image-dialog.component'; ClearPipe, LocalTimePipe ], - entryComponents: [ - ConfirmDialogComponent, - ImageDialogComponent - ], exports: [ AccountingPipe, ClearPipe, diff --git a/overlord/src/app/unposted/unposted-routing.module.ts b/overlord/src/app/unposted/unposted-routing.module.ts index 9e2be5ef..66548f5e 100644 --- a/overlord/src/app/unposted/unposted-routing.module.ts +++ b/overlord/src/app/unposted/unposted-routing.module.ts @@ -11,7 +11,7 @@ const unpostedRoutes: Routes = [ component: UnpostedComponent, canActivate: [AuthGuard], data: { - permission: 'Post Vouchers' + permission: 'post-vouchers' }, resolve: { info: UnpostedResolver