Fixed permission names in front end as they have to be kebab cased
This commit is contained in:
parent
1a553146e2
commit
a5fcb2026c
overlord/src/app
cash-flow
core
employee-benefits
incentive
issue
journal
payment
purchase-return
purchase
receipt
shared
unposted
@ -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;
|
||||
|
@ -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}`
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()">
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -21,10 +21,6 @@ import {ImageDialogComponent} from './image-dialog/image-dialog.component';
|
||||
ClearPipe,
|
||||
LocalTimePipe
|
||||
],
|
||||
entryComponents: [
|
||||
ConfirmDialogComponent,
|
||||
ImageDialogComponent
|
||||
],
|
||||
exports: [
|
||||
AccountingPipe,
|
||||
ClearPipe,
|
||||
|
@ -11,7 +11,7 @@ const unpostedRoutes: Routes = [
|
||||
component: UnpostedComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Post Vouchers'
|
||||
permission: 'post-vouchers'
|
||||
},
|
||||
resolve: {
|
||||
info: UnpostedResolver
|
||||
|
Loading…
x
Reference in New Issue
Block a user