Moved to Angular 16
Moved to FastAPI 0.100.0
Moved to pydantic 2.0
This commit is contained in:
2023-07-22 09:19:48 +05:30
parent 8b2d15b9e1
commit 09b762d154
161 changed files with 693 additions and 753 deletions

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
import { Bill } from './bill';
@ -8,7 +8,7 @@ import { VoucherService } from './voucher.service';
@Injectable({
providedIn: 'root',
})
export class BillResolver implements Resolve<Bill> {
export class BillResolver {
constructor(private ser: VoucherService) {}
resolve(route: ActivatedRouteSnapshot): Observable<Bill> {

View File

@ -130,7 +130,7 @@
</ng-container>
<ng-container matColumnDef="gross-amount">
<mat-footer-cell *matFooterCellDef class="bold right-align">{{
bs.grossAmount | async | currency : 'INR'
bs.grossAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
@ -140,7 +140,7 @@
</ng-container>
<ng-container matColumnDef="hh-amount">
<mat-footer-cell *matFooterCellDef class="bold right-align">{{
bs.hhAmount | async | currency : 'INR'
bs.hhAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
@ -150,7 +150,7 @@
</ng-container>
<ng-container matColumnDef="discount-amount">
<mat-footer-cell *matFooterCellDef class="bold right-align">{{
bs.discountAmount | async | currency : 'INR'
bs.discountAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
@ -160,7 +160,7 @@
</ng-container>
<ng-container matColumnDef="tax-amount">
<mat-footer-cell *matFooterCellDef class="bold right-align">{{
bs.taxAmount | async | currency : 'INR'
bs.taxAmount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
@ -170,7 +170,7 @@
</ng-container>
<ng-container matColumnDef="amount-amount">
<mat-footer-cell *matFooterCellDef class="bold right-align">{{
bs.amount | async | currency : 'INR'
bs.amount | async | currency: 'INR'
}}</mat-footer-cell>
</ng-container>
</table>

View File

@ -1,11 +1,11 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable, of as observableOf } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class UpdateTableResolver implements Resolve<boolean> {
export class UpdateTableResolver {
constructor() {}
resolve(route: ActivatedRouteSnapshot): Observable<boolean> {

View File

@ -17,7 +17,10 @@ const serviceName = 'VoucherService';
@Injectable({ providedIn: 'root' })
export class VoucherService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
constructor(
private http: HttpClient,
private log: ErrorLoggerService,
) {}
get(id: string): Observable<Bill> {
return this.http

View File

@ -1,6 +1,5 @@
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { CanDeactivate } from '@angular/router';
import { Observable, of as observableOf } from 'rxjs';
import { map } from 'rxjs/operators';
@ -11,7 +10,7 @@ import { BillsComponent } from './bills/bills.component';
@Injectable({
providedIn: 'root',
})
export class CanDeactivateBillGuard implements CanDeactivate<BillsComponent> {
export class CanDeactivateBillGuard {
constructor(private dialog: MatDialog) {}
canDeactivate(component: BillsComponent): Observable<boolean> | boolean {
if (component.bs.canDeactivate()) {

View File

@ -14,7 +14,10 @@ const serviceName = 'CustomerService';
providedIn: 'root',
})
export class CustomerDiscountsService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
constructor(
private http: HttpClient,
private log: ErrorLoggerService,
) {}
list(id: string | undefined): Observable<DiscountItem[]> {
const getUrl: string = id === undefined ? `${url}` : `${url}/${id}`;

View File

@ -15,8 +15,8 @@
<mat-form-field class="flex-auto">
<input matInput type="number" formControlName="discount" autocomplete="off" />
<span matSuffix>%</span>
<mat-hint>Cust: {{ row.customer | percent : '1.2-2' }}</mat-hint>
<mat-hint align="end">Max: {{ row.limit | percent : '1.2-2' }}</mat-hint>
<mat-hint>Cust: {{ row.customer | percent: '1.2-2' }}</mat-hint>
<mat-hint align="end">Max: {{ row.limit | percent: '1.2-2' }}</mat-hint>
</mat-form-field>
</mat-cell>
</ng-container>

View File

@ -1,5 +1,4 @@
import { Injectable } from '@angular/core';
import { Resolve } from '@angular/router';
import { Observable } from 'rxjs';
import { MenuCategory } from '../../core/menu-category';
@ -8,7 +7,7 @@ import { MenuCategoryService } from '../../menu-category/menu-category.service';
@Injectable({
providedIn: 'root',
})
export class MenuCategoriesResolver implements Resolve<MenuCategory[]> {
export class MenuCategoriesResolver {
constructor(private ser: MenuCategoryService) {}
resolve(): Observable<MenuCategory[]> {

View File

@ -12,7 +12,10 @@ export class PaxComponent implements OnInit {
pax: FormControl<number>;
}>;
constructor(public dialogRef: MatDialogRef<PaxComponent>, @Inject(MAT_DIALOG_DATA) public data: number) {
constructor(
public dialogRef: MatDialogRef<PaxComponent>,
@Inject(MAT_DIALOG_DATA) public data: number,
) {
// Create form
this.form = new FormGroup({
pax: new FormControl<number>(0, { nonNullable: true }),

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router';
import { ActivatedRouteSnapshot, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { Product } from '../../core/product';
@ -8,8 +8,11 @@ import { ProductService } from '../../product/product.service';
@Injectable({
providedIn: 'root',
})
export class ProductsResolver implements Resolve<Product[]> {
constructor(private ser: ProductService, private router: Router) {}
export class ProductsResolver {
constructor(
private ser: ProductService,
private router: Router,
) {}
resolve(route: ActivatedRouteSnapshot): Observable<Product[]> {
const id = route.paramMap.get('id') as string;

View File

@ -19,7 +19,7 @@
[class.primary]="!item.hasHappyHour && !item.isNotAvailable"
>
<h3>{{ item.name }}</h3>
<span>{{ item.price | currency : 'INR' }}</span>
<span>{{ item.price | currency: 'INR' }}</span>
</mat-card>
</div>
</mat-card-content>

View File

@ -12,7 +12,10 @@ import { BillService } from '../bill.service';
export class ProductsComponent implements OnInit {
list: Product[] = [];
constructor(private route: ActivatedRoute, private bs: BillService) {}
constructor(
private route: ActivatedRoute,
private bs: BillService,
) {}
ngOnInit() {
this.route.data.subscribe((value) => {

View File

@ -12,14 +12,14 @@
<!-- Discount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency : 'INR'
amount | currency: 'INR'
}}</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field>
<input matInput type="number" formControlName="amount" autocomplete="off" />
</mat-form-field>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency : 'INR' }}</mat-footer-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>

View File

@ -64,7 +64,7 @@ export class ReceivePaymentComponent {
tap((x: SettleOption[]) => (this.displayReason = x.reduce((o, n) => o || n.hasReason, this.displayReason))),
tap((x: SettleOption[]) => (this.displayTable = x.length > 1)),
map((x: SettleOption[]) =>
x.map((y) => ({ ...y, amount: !this.displayTable ? this.amount : 0 } as ReceivePaymentItem)),
x.map((y) => ({ ...y, amount: !this.displayTable ? this.amount : 0 }) as ReceivePaymentItem),
),
)
.subscribe((x) => {

View File

@ -1,5 +1,4 @@
import { Injectable } from '@angular/core';
import { Resolve } from '@angular/router';
import { Observable } from 'rxjs';
import { Table } from '../../core/table';
@ -8,7 +7,7 @@ import { TableService } from '../../tables/table.service';
@Injectable({
providedIn: 'root',
})
export class RunningTablesResolver implements Resolve<Table[]> {
export class RunningTablesResolver {
constructor(private ser: TableService) {}
resolve(): Observable<Table[]> {

View File

@ -17,7 +17,7 @@
<span>{{ table.guest }}</span>
<span>{{ table.pax ?? '-' }} / {{ table.seats }} / {{ table.section?.name }}</span>
<span *ngIf="table.date">{{ table.date }}</span>
<span *ngIf="table.amount">{{ table.amount | currency : 'INR' }}</span>
<span *ngIf="table.amount">{{ table.amount | currency: 'INR' }}</span>
</mat-card>
<mat-card class="flex flex-col square-button mr-5, mb-5 strong-primary" matRipple (click)="openBill()">
<h3>Open Bill</h3>

View File

@ -14,7 +14,7 @@
<span>{{ table.guest }}</span>
<span>{{ table.pax ?? 0 }} / {{ table.seats }} Seats</span>
<span *ngIf="table.date">{{ table.date }}</span>
<span *ngIf="table.amount">{{ table.amount | currency : 'INR' }}</span>
<span *ngIf="table.amount">{{ table.amount | currency: 'INR' }}</span>
</mat-card>
</div>
</mat-dialog-content>