Fixed permission names in front end as they have to be kebab cased

This commit is contained in:
2020-05-30 10:29:23 +05:30
parent 1a553146e2
commit a5fcb2026c
25 changed files with 34 additions and 57 deletions

View File

@ -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()">

View File

@ -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;
}
}

View File

@ -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 {