Moved to sqlalchemy 2.0
Added type checking as much as possible
Updated angular to 15
Moved from Angular flex layout to tailwind css

Started developing on vscode with devcontainers
This commit is contained in:
2023-02-20 18:49:17 +05:30
parent 792ccf923f
commit 5c7985e392
232 changed files with 2703 additions and 3018 deletions

View File

@ -1,83 +1,57 @@
<div fxLayout="row" fxFlex="50%" fxLayoutAlign="space-around center" class="example-card">
<mat-card fxFlex>
<mat-card-title-group>
<mat-card-title>Product</mat-card-title>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex="75">
<mat-label>Name</mat-label>
<input matInput #name placeholder="Name" formControlName="name" />
</mat-form-field>
<mat-form-field fxFlex="25">
<mat-label>Units</mat-label>
<input matInput placeholder="Units" formControlName="units" />
</mat-form-field>
</div>
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Price</mat-label>
<input matInput type="number" placeholder="Price" formControlName="price" />
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>Quantity</mat-label>
<input matInput type="number" placeholder="Quantity" formControlName="quantity" />
</mat-form-field>
</div>
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="hasHappyHour">Has Happy Hour?</mat-checkbox>
<mat-checkbox formControlName="isNotAvailable">Is Not Available?</mat-checkbox>
</div>
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Menu Category</mat-label>
<mat-select placeholder="Menu Category" formControlName="menuCategory">
<mat-option *ngFor="let mc of menuCategories" [value]="mc.id">
{{ mc.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>Sale Category</mat-label>
<mat-select placeholder="Sale Category" formControlName="saleCategory">
<mat-option *ngFor="let sc of saleCategories" [value]="sc.id">
{{ sc.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" (click)="save()">Save</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
</mat-card>
</div>
<mat-card class="flex-auto lg:max-w-[50%]">
<mat-card-header>
<mat-card-title>Product</mat-card-title>
</mat-card-header>
<mat-card-content>
<form [formGroup]="form" class="flex flex-col">
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto basis-3/4 mr-5">
<mat-label>Name</mat-label>
<input matInput #name formControlName="name" />
</mat-form-field>
<mat-form-field class="flex-auto basis-1/4">
<mat-label>Units</mat-label>
<input matInput formControlName="units" />
</mat-form-field>
</div>
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto mr-5">
<mat-label>Price</mat-label>
<input matInput type="number" formControlName="price" />
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Quantity</mat-label>
<input matInput type="number" formControlName="quantity" />
</mat-form-field>
</div>
<div class="flex flex-row justify-around content-start items-start">
<mat-checkbox formControlName="hasHappyHour">Has Happy Hour?</mat-checkbox>
<mat-checkbox formControlName="isNotAvailable">Is Not Available?</mat-checkbox>
</div>
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto mr-5">
<mat-label>Menu Category</mat-label>
<mat-select formControlName="menuCategory">
<mat-option *ngFor="let mc of menuCategories" [value]="mc.id">
{{ mc.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="flex-auto">
<mat-label>Sale Category</mat-label>
<mat-select formControlName="saleCategory">
<mat-option *ngFor="let sc of saleCategories" [value]="sc.id">
{{ sc.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" class="mr-5" (click)="save()">Save</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
</mat-card>

View File

@ -1,47 +1,34 @@
<mat-card>
<mat-card-title-group>
<mat-card-title>Products</mat-card-title>
<button
mat-button
(click)="updateSortOrder()"
[disabled]="(menuCategoryFilter | async) === '' || (searchFilter | async) !== ''"
>
Update Order
</button>
<!-- This should check filtered data and not data-->
<button mat-button mat-icon-button (click)="exportCsv()" [disabled]="!(data | async)?.length">
<mat-icon>save_alt</mat-icon>
</button>
<a mat-button [routerLink]="['/products', 'new']">
<mat-icon>add_box</mat-icon>
Add
</a>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
<mat-card-header>
<mat-card-title-group>
<mat-card-title>Products</mat-card-title>
<button
mat-button
(click)="updateSortOrder()"
[disabled]="(menuCategoryFilter | async) === '' || (searchFilter | async) !== ''"
>
<mat-form-field fxFlex>
<input
type="text"
matInput
placeholder="Filter"
formControlName="filter"
autocomplete="off"
/>
Update Order
</button>
<!-- This should check filtered data and not data-->
<button mat-icon-button (click)="exportCsv()" [disabled]="!(data | async)?.length">
<mat-icon>save_alt</mat-icon>
</button>
<a mat-button [routerLink]="['/products', 'new']">
<mat-icon>add_box</mat-icon>
Add
</a>
</mat-card-title-group>
</mat-card-header>
<mat-card-content>
<form [formGroup]="form" class="flex flex-col">
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto mr-5">
<mat-label>Filter</mat-label>
<input type="text" matInput formControlName="filter" autocomplete="off" />
</mat-form-field>
<mat-form-field fxFlex>
<mat-label>Product Type</mat-label>
<mat-select
placeholder="Menu Category"
formControlName="menuCategory"
(selectionChange)="filterOn($event.value)"
>
<mat-form-field class="flex-auto">
<mat-label>Menu Category</mat-label>
<mat-select formControlName="menuCategory" (selectionChange)="filterOn($event.value)">
<mat-option>-- All Products --</mat-option>
<mat-option *ngFor="let mc of menuCategories" [value]="mc.id">
{{ mc.name }}
@ -69,7 +56,7 @@
<!-- Price Column -->
<ng-container matColumnDef="price">
<mat-header-cell *matHeaderCellDef class="right">Price</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.price | currency: 'INR' }}</mat-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.price | currency : 'INR' }}</mat-cell>
</ng-container>
<!-- Menu Category Column -->
@ -109,7 +96,7 @@
<ng-container matColumnDef="quantity">
<mat-header-cell *matHeaderCellDef class="right">Quantity</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.quantity | number: '1.2-2'
row.quantity | number : '1.2-2'
}}</mat-cell>
</ng-container>

View File

@ -7,8 +7,8 @@ import { MenuCategoryListResolver } from '../menu-category/menu-category-list-re
import { SaleCategoryListResolver } from '../sale-category/sale-category-list-resolver.service';
import { ProductDetailComponent } from './product-detail/product-detail.component';
import { ProductListResolver } from './product-list-resolver.service';
import { ProductListComponent } from './product-list/product-list.component';
import { ProductListResolver } from './product-list-resolver.service';
import { ProductResolver } from './product-resolver.service';
const productsRoutes: Routes = [

View File

@ -2,7 +2,6 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
import { CdkTableModule } from '@angular/cdk/table';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
@ -23,7 +22,6 @@ import { ProductsRoutingModule } from './products-routing.module';
CommonModule,
CdkTableModule,
DragDropModule,
FlexLayoutModule,
MatTableModule,
MatCardModule,
MatProgressSpinnerModule,