Added: Alembic for migrations
Moving from Pyramid to FastAPI
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { map, switchMap, tap } from 'rxjs/operators';
|
||||
import { Observable, of as observableOf, throwError } from 'rxjs';
|
||||
import { BillService } from '../bill.service';
|
||||
@ -39,7 +39,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
printKotAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Print Kot')) {
|
||||
if (this.auth.user.perms.indexOf('print-kot') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
@ -69,7 +69,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
discountAllowed(): boolean {
|
||||
return this.auth.hasPermission('Discount');
|
||||
return this.auth.user.perms.indexOf('discount') === -1;
|
||||
}
|
||||
|
||||
showDiscount(): Observable<boolean | { id: string, name: string, discount: number }[]> {
|
||||
@ -120,13 +120,13 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
printBillAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Print Bill')) {
|
||||
if (this.auth.user.perms.indexOf('print-bill') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
return true;
|
||||
}
|
||||
if (this.bs.bill.voucherType !== PrintType.Kot && !this.auth.hasPermission('Edit Printed Bill')) {
|
||||
if (this.bs.bill.voucherType !== PrintType.Kot && this.auth.user.perms.indexOf('edit-printed-bill') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (this.bs.bill.isVoid) {
|
||||
@ -169,7 +169,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
receivePaymentAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Settle Bill')) {
|
||||
if (this.auth.user.perms.indexOf('settle-bill') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
@ -251,7 +251,8 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
moveTableAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Move Table') && !this.auth.hasPermission('Merge Tables')) {
|
||||
// TODO: Check if this condition should be "and" or "or"
|
||||
if (this.auth.user.perms.indexOf('move-table') === -1 && this.auth.user.perms.indexOf('merge-tables') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
@ -264,7 +265,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
if (!this.moveTableAllowed()) {
|
||||
return;
|
||||
}
|
||||
const canMergeTables = this.auth.hasPermission('Merge Tables');
|
||||
const canMergeTables = (this.auth.user.perms.indexOf('merge-tables') === -1);
|
||||
this.dialog.open(TablesDialogComponent, {
|
||||
// width: '750px',
|
||||
data: {
|
||||
@ -299,7 +300,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
voidBillAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Void Bill')) {
|
||||
if (this.auth.user.perms.indexOf('void-bill') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
@ -351,7 +352,7 @@ export class SalesHomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
splitBillAllowed(): boolean {
|
||||
if (!this.auth.hasPermission('Split Bill')) {
|
||||
if (this.auth.user.perms.indexOf('split-bill') === -1) {
|
||||
return false;
|
||||
}
|
||||
if (!this.bs.bill.id) {
|
||||
|
||||
Reference in New Issue
Block a user