Chore: Moved from css to sass, god knows what to do now.

Chore: Prettier line length changed to 120 from 100
Fix: Hard coded the face as the primary color to make the buttons stand out
This commit is contained in:
tanshu committed 2023-03-13 23:52:44 +05:30
1 parent b021861ba3
commit efa2af396d
123 files changed
+313 -836

No files matched your search

+2 -1
View File
@@ -13,7 +13,8 @@
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@angular-eslint/recommended--extra"
"plugin:@angular-eslint/recommended--extra",
"prettier"
],
"plugins": [
"import",
+1 -1
View File
@@ -4,5 +4,5 @@ module.exports = {
semi: true,
singleQuote: true,
bracketSpacing: true,
printWidth: 100
printWidth: 120
};
+5 -2
View File
@@ -7,6 +7,7 @@
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"style": "sass",
"strict": true
}
},
@@ -24,13 +25,14 @@
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "sass",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
"src/styles.sass"
],
"scripts": []
},
@@ -97,13 +99,14 @@
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "sass",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
"src/styles.sass"
],
"scripts": []
}
+1
View File
@@ -44,6 +44,7 @@
"@typescript-eslint/parser": "^5.52.0",
"autoprefixer": "^10.4.13",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
+15 -37
View File
@@ -8,20 +8,16 @@ import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: 'beer-sale-report',
loadChildren: () =>
import('./beer-sale-report/beer-sale-report.module').then((mod) => mod.BeerSaleReportModule),
loadChildren: () => import('./beer-sale-report/beer-sale-report.module').then((mod) => mod.BeerSaleReportModule),
},
{
path: 'bill-settlement-report',
loadChildren: () =>
import('./bill-settlement-report/bill-settlement-report.module').then(
(mod) => mod.BillSettlementReportModule,
),
import('./bill-settlement-report/bill-settlement-report.module').then((mod) => mod.BillSettlementReportModule),
},
{
path: 'cashier-report',
loadChildren: () =>
import('./cashier-report/cashier-report.module').then((mod) => mod.CashierReportModule),
loadChildren: () => import('./cashier-report/cashier-report.module').then((mod) => mod.CashierReportModule),
},
{
path: 'customers',
@@ -33,8 +29,7 @@ const routes: Routes = [
},
{
path: 'discount-report',
loadChildren: () =>
import('./discount-report/discount-report.module').then((mod) => mod.DiscountReportModule),
loadChildren: () => import('./discount-report/discount-report.module').then((mod) => mod.DiscountReportModule),
},
{
path: 'guest-book',
@@ -42,8 +37,7 @@ const routes: Routes = [
},
{
path: 'header-footer',
loadChildren: () =>
import('./header-footer/header-footer.module').then((mod) => mod.HeaderFooterModule),
loadChildren: () => import('./header-footer/header-footer.module').then((mod) => mod.HeaderFooterModule),
},
{
path: 'modifiers',
@@ -52,9 +46,7 @@ const routes: Routes = [
{
path: 'modifier-categories',
loadChildren: () =>
import('./modifier-categories/modifier-categories.module').then(
(mod) => mod.ModifierCategoriesModule,
),
import('./modifier-categories/modifier-categories.module').then((mod) => mod.ModifierCategoriesModule),
},
{
path: 'regimes',
@@ -71,21 +63,16 @@ const routes: Routes = [
{
path: 'product-sale-report',
loadChildren: () =>
import('./product-sale-report/product-sale-report.module').then(
(mod) => mod.ProductSaleReportModule,
),
import('./product-sale-report/product-sale-report.module').then((mod) => mod.ProductSaleReportModule),
},
{
path: 'product-updates-report',
loadChildren: () =>
import('./product-updates-report/product-updates-report.module').then(
(mod) => mod.ProductUpdatesReportModule,
),
import('./product-updates-report/product-updates-report.module').then((mod) => mod.ProductUpdatesReportModule),
},
{
path: 'menu-categories',
loadChildren: () =>
import('./menu-category/menu-categories.module').then((mod) => mod.MenuCategoriesModule),
loadChildren: () => import('./menu-category/menu-categories.module').then((mod) => mod.MenuCategoriesModule),
},
{
path: 'roles',
@@ -97,13 +84,11 @@ const routes: Routes = [
},
{
path: 'sale-report',
loadChildren: () =>
import('./sale-report/sale-report.module').then((mod) => mod.SaleReportModule),
loadChildren: () => import('./sale-report/sale-report.module').then((mod) => mod.SaleReportModule),
},
{
path: 'sale-categories',
loadChildren: () =>
import('./sale-category/sale-categories.module').then((mod) => mod.SaleCategoriesModule),
loadChildren: () => import('./sale-category/sale-categories.module').then((mod) => mod.SaleCategoriesModule),
},
{
path: 'sections',
@@ -111,8 +96,7 @@ const routes: Routes = [
},
{
path: 'section-printers',
loadChildren: () =>
import('./section-printers/section-printers.module').then((mod) => mod.SectionPrintersModule),
loadChildren: () => import('./section-printers/section-printers.module').then((mod) => mod.SectionPrintersModule),
},
{
path: 'settings',
@@ -120,8 +104,7 @@ const routes: Routes = [
},
{
path: 'settle-options',
loadChildren: () =>
import('./settle-option/settle-options.module').then((mod) => mod.SettleOptionsModule),
loadChildren: () => import('./settle-option/settle-options.module').then((mod) => mod.SettleOptionsModule),
},
{
path: 'tables',
@@ -137,17 +120,12 @@ const routes: Routes = [
},
{
path: 'temporal-products',
loadChildren: () =>
import('./temporal-product/temporal-products.module').then(
(mod) => mod.TemporalProductsModule,
),
loadChildren: () => import('./temporal-product/temporal-products.module').then((mod) => mod.TemporalProductsModule),
},
{
path: 'update-product-prices',
loadChildren: () =>
import('./update-product-prices/update-product-prices.module').then(
(mod) => mod.UpdateProductPricesModule,
),
import('./update-product-prices/update-product-prices.module').then((mod) => mod.UpdateProductPricesModule),
},
{
path: 'users',
+1 -5
View File
@@ -7,11 +7,7 @@ import { AuthService } from './auth.service';
@Injectable({ providedIn: 'root' })
export class AuthGuard implements CanActivate {
constructor(
private router: Router,
private authService: AuthService,
private toaster: ToasterService,
) {}
constructor(private router: Router, private authService: AuthService, private toaster: ToasterService) {}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const { user } = this.authService;
@@ -13,15 +13,8 @@
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto">
<mat-label>Password</mat-label>
<input
matInput
formControlName="password"
[type]="hide ? 'password' : 'text'"
(keyup.enter)="login()"
/>
<mat-icon matSuffix (click)="hide = !hide">{{
hide ? 'visibility' : 'visibility_off'
}}</mat-icon>
<input matInput formControlName="password" [type]="hide ? 'password' : 'text'" (keyup.enter)="login()" />
<mat-icon matSuffix (click)="hide = !hide">{{ hide ? 'visibility' : 'visibility_off' }}</mat-icon>
</mat-form-field>
</div>
<mat-divider></mat-divider>
@@ -34,16 +34,12 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
<div class="flex flex-row justify-around content-start items-start sm:max-lg:flex-col">
<mat-checkbox class="flex-auto mr-5" formControlName="regular">Regular</mat-checkbox>
<mat-checkbox class="flex-auto mr-5" formControlName="happy">Happy Hour</mat-checkbox>
<mat-checkbox class="flex-auto mr-5" formControlName="staff"
>Staff Consumption</mat-checkbox
>
<mat-checkbox class="flex-auto mr-5" formControlName="staff">Staff Consumption</mat-checkbox>
<mat-checkbox class="flex-auto mr-5" formControlName="nc">No Charge</mat-checkbox>
</div>
</form>
@@ -7,12 +7,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -9,10 +9,7 @@ describe('BillSettlementReportResolver', () => {
});
});
it('should be created', inject(
[BillSettlementReportResolver],
(service: BillSettlementReportResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([BillSettlementReportResolver], (service: BillSettlementReportResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -34,9 +34,7 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -15,9 +15,7 @@ import { BillSettlementReportDataSource } from './bill-settlement-report-datasou
})
export class BillSettlementReportComponent implements OnInit {
info: BillSettlementReport = new BillSettlementReport();
dataSource: BillSettlementReportDataSource = new BillSettlementReportDataSource(
this.info.amounts,
);
dataSource: BillSettlementReportDataSource = new BillSettlementReportDataSource(this.info.amounts);
form: FormGroup<{
startDate: FormControl<Date>;
@@ -6,12 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -9,10 +9,7 @@ describe('BillSettlementReportService', () => {
});
});
it('should be created', inject(
[BillSettlementReportService],
(service: BillSettlementReportService) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([BillSettlementReportService], (service: BillSettlementReportService) => {
expect(service).toBeTruthy();
}));
});
@@ -26,8 +26,6 @@ export class BillSettlementReportService {
}
return this.http
.get<BillSettlementReport>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'get')),
) as Observable<BillSettlementReport>;
.pipe(catchError(this.log.handleError(serviceName, 'get'))) as Observable<BillSettlementReport>;
}
}
@@ -49,9 +49,7 @@
</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -73,16 +73,14 @@ export class CashierReportComponent implements OnInit {
}
print() {
this.ser
.print(this.info.cashier.id as string, this.info.startDate, this.info.finishDate)
.subscribe(
() => {
this.toaster.show('', 'Successfully Printed');
},
(error) => {
this.toaster.show('Error', error);
},
);
this.ser.print(this.info.cashier.id as string, this.info.startDate, this.info.finishDate).subscribe(
() => {
this.toaster.show('', 'Successfully Printed');
},
(error) => {
this.toaster.show('Error', error);
},
);
}
getInfo(): CashierReport {
@@ -7,12 +7,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -17,11 +17,7 @@ const serviceName = 'CashierReportService';
export class CashierReportService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
list(
id: string | null,
startDate: string | null,
finishDate: string | null,
): Observable<CashierReport> {
list(id: string | null, startDate: string | null, finishDate: string | null): Observable<CashierReport> {
const listUrl = id === null ? url : `${url}/${id}`;
const options = { params: new HttpParams() };
if (startDate !== null) {
+1 -8
View File
@@ -11,14 +11,7 @@ import { ErrorInterceptor } from './http-auth-interceptor';
import { JwtInterceptor } from './jwt.interceptor';
@NgModule({
imports: [
CommonModule,
MatButtonModule,
MatIconModule,
MatMenuModule,
MatToolbarModule,
RouterModule,
],
imports: [CommonModule, MatButtonModule, MatIconModule, MatMenuModule, MatToolbarModule, RouterModule],
declarations: [],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
+1 -3
View File
@@ -60,8 +60,6 @@ export class CustomerService {
const options = { params: new HttpParams().set('q', query) };
return this.http
.get<Customer[]>(`${url}/query`, options)
.pipe(catchError(this.log.handleError(serviceName, 'autocomplete'))) as Observable<
Customer[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'autocomplete'))) as Observable<Customer[]>;
}
}
@@ -27,9 +27,7 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
<mat-card-subtitle>
Created on <strong>{{ item.creationDate | localTime }}</strong>
@@ -38,9 +38,7 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -6,12 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -8,22 +8,13 @@
<mat-form-field class="flex-auto">
<mat-label>Name</mat-label>
<input matInput #name formControlName="name" />
<mat-error *ngIf="form.controls['name'].hasError('required')">
Name is <strong>required</strong>
</mat-error>
<mat-error *ngIf="form.controls['name'].hasError('required')"> Name is <strong>required</strong> </mat-error>
</mat-form-field>
</div>
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto">
<mat-label>Phone</mat-label>
<input
matInput
#phone
type="text"
formControlName="phone"
[matAutocomplete]="auto"
autocomplete="off"
/>
<input matInput #phone type="text" formControlName="phone" [matAutocomplete]="auto" autocomplete="off" />
</mat-form-field>
<mat-autocomplete
#auto="matAutocomplete"
@@ -51,9 +51,7 @@ export class GuestBookDetailComponent implements OnInit, AfterViewInit {
map((x) => (x !== null && (x as string).length >= 1 ? x : null)),
debounceTime(150),
distinctUntilChanged(),
switchMap((x) =>
x === null ? observableOf([]) : this.customerService.autocomplete(x as string),
),
switchMap((x) => (x === null ? observableOf([]) : this.customerService.autocomplete(x as string))),
);
}
@@ -13,13 +13,7 @@
<div class="flex flex-row justify-around content-start items-start">
<mat-form-field class="flex-auto">
<mat-label>Date</mat-label>
<input
matInput
[matDatepicker]="date"
(focus)="date.open()"
formControlName="date"
autocomplete="off"
/>
<input matInput [matDatepicker]="date" (focus)="date.open()" formControlName="date" autocomplete="off" />
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
<mat-datepicker #date></mat-datepicker>
</mat-form-field>
@@ -60,12 +54,7 @@
<ng-container matColumnDef="action">
<mat-header-cell *matHeaderCellDef class="center">Action</mat-header-cell>
<mat-cell *matCellDef="let row" class="center">
<button
mat-icon-button
[routerLink]="['/sales']"
[queryParams]="{ guest: row.id }"
*ngIf="!row.tableId"
>
<button mat-icon-button [routerLink]="['/sales']" [queryParams]="{ guest: row.id }" *ngIf="!row.tableId">
<mat-icon>chair</mat-icon>
</button>
<button
@@ -44,13 +44,11 @@ export class GuestBookListComponent implements OnInit {
}
listenToDateChange(): void {
this.form.controls.date.valueChanges
.pipe(map((x) => moment(x).format('DD-MMM-YYYY')))
.subscribe((x) =>
this.ser.list(x).subscribe((list: GuestBookList) => {
this.data.next(list.list);
}),
);
this.form.controls.date.valueChanges.pipe(map((x) => moment(x).format('DD-MMM-YYYY'))).subscribe((x) =>
this.ser.list(x).subscribe((list: GuestBookList) => {
this.data.next(list.list);
}),
);
}
ngOnInit() {
@@ -4,12 +4,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
MatNativeDateModule,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
DateAdapter,
} from '@angular/material/core';
import { MatNativeDateModule, MAT_DATE_FORMATS, MAT_DATE_LOCALE, DateAdapter } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
@@ -20,9 +20,9 @@ export class HeaderFooterService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
list(): Observable<HeaderFooter[]> {
return this.http
.get<HeaderFooter[]>(url)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<HeaderFooter[]>;
return this.http.get<HeaderFooter[]>(url).pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<
HeaderFooter[]
>;
}
save(item: HeaderFooter): Observable<HeaderFooter[]> {
@@ -16,22 +16,8 @@
</form>
</mat-card-content>
<mat-card-actions>
<button
mat-raised-button
[disabled]="item.isFixture"
color="primary"
class="mr-5"
(click)="save()"
>
Save
</button>
<button
mat-raised-button
[disabled]="item.isFixture"
color="warn"
(click)="confirmDelete()"
*ngIf="!!item.id"
>
<button mat-raised-button [disabled]="item.isFixture" color="primary" class="mr-5" (click)="save()">Save</button>
<button mat-raised-button [disabled]="item.isFixture" color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
@@ -9,10 +9,7 @@ describe('MenuCategoryListResolver', () => {
});
});
it('should be created', inject(
[MenuCategoryListResolver],
(service: MenuCategoryListResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([MenuCategoryListResolver], (service: MenuCategoryListResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -39,11 +39,7 @@
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row
*matRowDef="let row; columns: displayedColumns"
cdkDrag
[cdkDragData]="row"
></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns" cdkDrag [cdkDragData]="row"></mat-row>
</mat-table>
</mat-card-content>
</mat-card>
@@ -22,9 +22,7 @@ export class MenuCategoryService {
const getUrl: string = id === null ? url : `${url}/${id}`;
return this.http
.get<MenuCategory>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<MenuCategory>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<MenuCategory>;
}
list(shouldHaveActiveProducts: boolean | undefined): Observable<MenuCategory[]> {
@@ -52,9 +50,7 @@ export class MenuCategoryService {
updateSortOrder(list: MenuCategory[]): Observable<boolean> {
return this.http
.post<MenuCategory[]>(`${url}/list`, list, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'updateSortOrder')),
) as Observable<boolean>;
.pipe(catchError(this.log.handleError(serviceName, 'updateSortOrder'))) as Observable<boolean>;
}
saveOrUpdate(menuCategory: MenuCategory): Observable<MenuCategory> {
@@ -166,22 +166,18 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
isMenuCategoryPartiallySelected(node: NodeItem) {
const total = (this.productsOfMenuCategory.get(node.id) as Product[]).length;
const ticked = (this.productsOfMenuCategory.get(node.id) as Product[]).reduce(
(acc, current) => {
if (current.enabled) {
// eslint-disable-next-line no-param-reassign
acc += 1;
}
return acc;
},
0,
);
const ticked = (this.productsOfMenuCategory.get(node.id) as Product[]).reduce((acc, current) => {
if (current.enabled) {
// eslint-disable-next-line no-param-reassign
acc += 1;
}
return acc;
}, 0);
return ticked > 0 && ticked < total;
}
toggleProductSelection(node: NodeItem) {
(this.products.get(node.id) as Product).enabled = !(this.products.get(node.id) as Product)
.enabled;
(this.products.get(node.id) as Product).enabled = !(this.products.get(node.id) as Product).enabled;
}
toggleMenuCategorySelection(node: NodeItem) {
@@ -9,10 +9,7 @@ describe('ModifierCategoryListResolver', () => {
});
});
it('should be created', inject(
[ModifierCategoryListResolver],
(service: ModifierCategoryListResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ModifierCategoryListResolver], (service: ModifierCategoryListResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -9,10 +9,7 @@ describe('ModifierCategoryResolver', () => {
});
});
it('should be created', inject(
[ModifierCategoryResolver],
(service: ModifierCategoryResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ModifierCategoryResolver], (service: ModifierCategoryResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -22,25 +22,19 @@ export class ModifierCategoryService {
const getUrl: string = id === null ? url : `${url}/${id}`;
return this.http
.get<ModifierCategory>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<ModifierCategory>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<ModifierCategory>;
}
list(): Observable<ModifierCategory[]> {
return this.http
.get<ModifierCategory[]>(`${url}/list`)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<
ModifierCategory[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<ModifierCategory[]>;
}
listForProduct(id: string): Observable<ModifierCategory[]> {
return this.http
.get<ModifierCategory[]>(`${url}/for-product/${id}`)
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))) as Observable<
ModifierCategory[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfProduct'))) as Observable<ModifierCategory[]>;
}
save(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
@@ -52,9 +46,7 @@ export class ModifierCategoryService {
update(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
return this.http
.put<ModifierCategory>(`${url}/${modifierCategory.id}`, modifierCategory, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'update')),
) as Observable<ModifierCategory>;
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<ModifierCategory>;
}
saveOrUpdate(modifierCategory: ModifierCategory): Observable<ModifierCategory> {
@@ -67,8 +59,6 @@ export class ModifierCategoryService {
delete(id: string): Observable<ModifierCategory> {
return this.http
.delete<ModifierCategory>(`${url}/${id}`, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'delete')),
) as Observable<ModifierCategory>;
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<ModifierCategory>;
}
}
@@ -36,8 +36,6 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
@@ -10,10 +10,7 @@ export class ModifierListDataSource extends DataSource<Modifier> {
public viewData: Modifier[];
private filterValue: string;
constructor(
private readonly filter: Observable<string>,
private readonly dataObs: Observable<Modifier[]>,
) {
constructor(private readonly filter: Observable<string>, private readonly dataObs: Observable<Modifier[]>) {
super();
this.data = [];
this.viewData = [];
@@ -45,8 +42,6 @@ export class ModifierListDataSource extends DataSource<Modifier> {
private getFilteredData(data: Modifier[]): Modifier[] {
const filter = this.filterValue === undefined ? '' : this.filterValue;
return data.filter(
(x) => (x.modifierCategory as ModifierCategory).id === filter || filter === '',
);
return data.filter((x) => (x.modifierCategory as ModifierCategory).id === filter || filter === '');
}
}
@@ -16,11 +16,7 @@
<mat-icon>account_box</mat-icon>
Login
</button>
<button
mat-button
[routerLink]="['/', 'logout']"
*ngIf="(auth.currentUser | async)?.name as name"
>
<button mat-button [routerLink]="['/', 'logout']" *ngIf="(auth.currentUser | async)?.name as name">
<mat-icon>account_box</mat-icon>
Logout {{ name }}
</button>
@@ -24,8 +24,6 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
@@ -9,10 +9,7 @@ describe('ProductSaleReportResolver', () => {
});
});
it('should be created', inject(
[ProductSaleReportResolver],
(service: ProductSaleReportResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ProductSaleReportResolver], (service: ProductSaleReportResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -38,9 +38,7 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -59,17 +57,13 @@
<!-- Sale Column -->
<ng-container matColumnDef="sale">
<mat-header-cell *matHeaderCellDef class="right">Sale</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.regularBill | number : '1.2-2'
}}</mat-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.regularBill | number : '1.2-2' }}</mat-cell>
</ng-container>
<!-- No Charge Column -->
<ng-container matColumnDef="noCharge">
<mat-header-cell *matHeaderCellDef class="right">No Charge</mat-header-cell>
<mat-cell *matCellDef="let row" class="right">{{
row.noCharge | number : '1.2-2'
}}</mat-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.noCharge | number : '1.2-2' }}</mat-cell>
</ng-container>
<!-- Staff Column -->
@@ -6,12 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -9,10 +9,7 @@ describe('ProductSaleReportService', () => {
});
});
it('should be created', inject(
[ProductSaleReportService],
(service: ProductSaleReportService) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ProductSaleReportService], (service: ProductSaleReportService) => {
expect(service).toBeTruthy();
}));
});
@@ -9,10 +9,7 @@ describe('ProductUpdatesReportResolver', () => {
});
});
it('should be created', inject(
[ProductUpdatesReportResolver],
(service: ProductUpdatesReportResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ProductUpdatesReportResolver], (service: ProductUpdatesReportResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -34,9 +34,7 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -6,12 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -9,10 +9,7 @@ describe('ProductUpdatesReportService', () => {
});
});
it('should be created', inject(
[ProductUpdatesReportService],
(service: ProductUpdatesReportService) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([ProductUpdatesReportService], (service: ProductUpdatesReportService) => {
expect(service).toBeTruthy();
}));
});
@@ -26,8 +26,6 @@ export class ProductUpdatesReportService {
}
return this.http
.get<ProductUpdatesReport>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'get')),
) as Observable<ProductUpdatesReport>;
.pipe(catchError(this.log.handleError(serviceName, 'get'))) as Observable<ProductUpdatesReport>;
}
}
@@ -50,8 +50,6 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
@@ -95,17 +95,11 @@
<!-- Quantity Column -->
<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'
}}</mat-cell>
<mat-cell *matCellDef="let row" class="right">{{ row.quantity | number : '1.2-2' }}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row
*matRowDef="let row; columns: displayedColumns"
cdkDrag
[cdkDragData]="row"
></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns" cdkDrag [cdkDragData]="row"></mat-row>
</mat-table>
</mat-card-content>
</mat-card>
@@ -23,11 +23,7 @@ export class ProductListComponent implements OnInit {
searchFilter: Observable<string> = new Observable();
menuCategoryFilter: BehaviorSubject<string> = new BehaviorSubject('');
data: BehaviorSubject<Product[]> = new BehaviorSubject<Product[]>([]);
dataSource: ProductListDataSource = new ProductListDataSource(
this.searchFilter,
this.menuCategoryFilter,
this.data,
);
dataSource: ProductListDataSource = new ProductListDataSource(this.searchFilter, this.menuCategoryFilter, this.data);
form: FormGroup<{
menuCategory: FormControl<string | null>;
@@ -37,14 +33,7 @@ export class ProductListComponent implements OnInit {
list: Product[] = [];
menuCategories: MenuCategory[] = [];
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns: string[] = [
'name',
'price',
'menuCategory',
'saleCategory',
'info',
'quantity',
];
displayedColumns: string[] = ['name', 'price', 'menuCategory', 'saleCategory', 'info', 'quantity'];
constructor(
private route: ActivatedRoute,
@@ -59,10 +48,7 @@ export class ProductListComponent implements OnInit {
this.data.subscribe((data: Product[]) => {
this.list = data;
});
this.searchFilter = this.form.controls.filter.valueChanges.pipe(
debounceTime(150),
distinctUntilChanged(),
);
this.searchFilter = this.form.controls.filter.valueChanges.pipe(debounceTime(150), distinctUntilChanged());
}
filterOn(val: string) {
@@ -70,11 +56,7 @@ export class ProductListComponent implements OnInit {
}
ngOnInit() {
this.dataSource = new ProductListDataSource(
this.searchFilter,
this.menuCategoryFilter,
this.data,
);
this.dataSource = new ProductListDataSource(this.searchFilter, this.menuCategoryFilter, this.data);
this.route.data.subscribe((value) => {
const data = value as { list: Product[]; menuCategories: MenuCategory[] };
this.loadData(data.list, data.menuCategories);
+3 -9
View File
@@ -34,18 +34,14 @@ export class ProductService {
const options = { params: new HttpParams().set('sc', id) };
return this.http
.get<Product[]>(`${url}/query`, options)
.pipe(catchError(this.log.handleError(serviceName, 'listOfSaleCategory'))) as Observable<
Product[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'listOfSaleCategory'))) as Observable<Product[]>;
}
listIsActiveOfCategory(id: string): Observable<Product[]> {
const options = { params: new HttpParams().set('mc', id) };
return this.http
.get<Product[]>(`${url}/query`, options)
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfCategory'))) as Observable<
Product[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'listIsActiveOfCategory'))) as Observable<Product[]>;
}
save(product: Product): Observable<void> {
@@ -63,9 +59,7 @@ export class ProductService {
updateSortOrder(list: Product[]): Observable<Product[]> {
return this.http
.post<Product[]>(`${url}/list`, list, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'updateSortOrder'))) as Observable<
Product[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'updateSortOrder'))) as Observable<Product[]>;
}
saveOrUpdate(product: Product): Observable<void> {
@@ -25,22 +25,8 @@
</form>
</mat-card-content>
<mat-card-actions>
<button
mat-raised-button
[disabled]="item.isFixture"
color="primary"
class="mr-5"
(click)="save()"
>
Save
</button>
<button
mat-raised-button
[disabled]="item.isFixture"
color="warn"
(click)="confirmDelete()"
*ngIf="!!item.id"
>
<button mat-raised-button [disabled]="item.isFixture" color="primary" class="mr-5" (click)="save()">Save</button>
<button mat-raised-button [disabled]="item.isFixture" color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
Delete
</button>
</mat-card-actions>
@@ -31,9 +31,7 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
<mat-card class="flex-auto lg:max-w-[50%]">
@@ -9,10 +9,7 @@ describe('SaleCategoryListResolver', () => {
});
});
it('should be created', inject(
[SaleCategoryListResolver],
(service: SaleCategoryListResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([SaleCategoryListResolver], (service: SaleCategoryListResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -27,9 +27,7 @@
<!-- Tax Column -->
<ng-container matColumnDef="tax">
<mat-header-cell *matHeaderCellDef>Tax</mat-header-cell>
<mat-cell *matCellDef="let row"
>{{ row.tax.rate | percent : '1.2-2' }} {{ row.tax.name }}</mat-cell
>
<mat-cell *matCellDef="let row">{{ row.tax.rate | percent : '1.2-2' }} {{ row.tax.name }}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
@@ -22,9 +22,7 @@ export class SaleCategoryService {
const getUrl: string = id === null ? url : `${url}/${id}`;
return this.http
.get<SaleCategory>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<SaleCategory>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<SaleCategory>;
}
list(): Observable<SaleCategory[]> {
@@ -38,9 +38,7 @@
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
<mat-datepicker #finishDate></mat-datepicker>
</mat-form-field>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">
Show
</button>
<button mat-raised-button class="flex-auto basis-1/5" color="primary" (click)="show()">Show</button>
</div>
</form>
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
@@ -6,12 +6,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
@@ -8,3 +8,11 @@
.selected {
background-color: green;
}
.item-name {
text-align: center;
padding: 0.5rem;
}
.face {
background-color: #3f51b5;
color: #ffffff;
}
@@ -6,6 +6,7 @@
matRipple
(click)="select('REGULAR_BILL')"
[class.selected]="selected === 'REGULAR_BILL'"
[class.face]="selected !== 'REGULAR_BILL'"
>
<h3 class="item-name">Regular</h3>
</mat-card>
@@ -14,6 +15,7 @@
matRipple
(click)="select('STAFF')"
[class.selected]="selected === 'STAFF'"
[class.face]="selected !== 'STAFF'"
>
<h3 class="item-name">Staff</h3>
</mat-card>
@@ -22,6 +24,7 @@
matRipple
(click)="select('NO_CHARGE')"
[class.selected]="selected === 'NO_CHARGE'"
[class.face]="selected !== 'NO_CHARGE'"
>
<h3 class="item-name">No Charge</h3>
</mat-card>
+11 -38
View File
@@ -80,10 +80,7 @@ export class BillService {
productId: i.product.id,
isHappyHour: i.isHappyHour,
isPrinted: !!k.id,
info: `${i.product.name} @ ${i.price} - ${this.math.halfRoundEven(
i.discount * 100,
2,
)}%`,
info: `${i.product.name} @ ${i.price} - ${this.math.halfRoundEven(i.discount * 100, 2)}%`,
quantity: i.quantity,
modifiers: i.modifiers,
}),
@@ -104,8 +101,7 @@ export class BillService {
return this.bill.kots.reduce(
(t, k) =>
k.inventories.reduce(
(a, c) =>
c.product.id === productId && c.isHappyHour === happyHour ? a + c.quantity : a,
(a, c) => (c.product.id === productId && c.isHappyHour === happyHour ? a + c.quantity : a),
0,
) + t,
0,
@@ -114,9 +110,7 @@ export class BillService {
addProduct(product: Product, quantity: number, discount: number): void {
const newKot = this.bill.kots.find((k) => k.id === undefined) as Kot;
const old = newKot.inventories.find(
(x) => x.product.id === product.id && x.isHappyHour === product.hasHappyHour,
);
const old = newKot.inventories.find((x) => x.product.id === product.id && x.isHappyHour === product.hasHappyHour);
if (quantity < 0) {
const minimum = this.minimum(product.id as string, product.hasHappyHour) + quantity;
if (minimum + quantity < 0) {
@@ -190,10 +184,7 @@ export class BillService {
const old = newKot.inventories.find(
(x) => x.product.id === item.productId && x.isHappyHour === item.isHappyHour,
) as Inventory;
if (
item.quantity > 1 ||
(canEdit && this.minimum(item.productId as string, item.isHappyHour) >= 1)
) {
if (item.quantity > 1 || (canEdit && this.minimum(item.productId as string, item.isHappyHour) >= 1)) {
old.quantity -= 1;
} else if (item.quantity === 0) {
newKot.inventories.splice(newKot.inventories.indexOf(old), 1);
@@ -220,13 +211,9 @@ export class BillService {
discount(discounts: { id: string; name: string; discount: number }[]): void {
for (const kot of this.bill.kots) {
const noDiscount = kot.inventories
.filter((x) => x.isHappyHour)
.map((x) => x.product.id as string);
const noDiscount = kot.inventories.filter((x) => x.isHappyHour).map((x) => x.product.id as string);
for (const inventory of kot.inventories) {
const e = discounts.find(
(d) => d.id === (inventory.product.saleCategory as SaleCategory).id,
);
const e = discounts.find((d) => d.id === (inventory.product.saleCategory as SaleCategory).id);
if (e === undefined || noDiscount.indexOf(inventory.product.id as string) !== -1) {
continue;
}
@@ -265,12 +252,7 @@ export class BillService {
}
receivePayment(value: { choices: ReceivePaymentItem[]; reason: string }): Observable<boolean> {
return this.ser.receivePayment(
this.bill.id as string,
value.choices,
value.reason,
this.updateTable,
);
return this.ser.receivePayment(this.bill.id as string, value.choices, value.reason, this.updateTable);
}
moveTable(table: Table): Observable<boolean> {
@@ -296,17 +278,13 @@ export class BillService {
updateAmounts() {
this.grossAmount.next(
this.math.halfRoundEven(
this.bill.kots.reduce(
(t, k) => k.inventories.reduce((a, c) => a + c.price * c.quantity, 0) + t,
0,
),
this.bill.kots.reduce((t, k) => k.inventories.reduce((a, c) => a + c.price * c.quantity, 0) + t, 0),
),
);
this.hhAmount.next(
this.math.halfRoundEven(
this.bill.kots.reduce(
(t, k) =>
k.inventories.reduce((a, c) => a + (c.isHappyHour ? c.price : 0) * c.quantity, 0) + t,
(t, k) => k.inventories.reduce((a, c) => a + (c.isHappyHour ? c.price : 0) * c.quantity, 0) + t,
0,
),
),
@@ -314,11 +292,7 @@ export class BillService {
this.discountAmount.next(
this.math.halfRoundEven(
this.bill.kots.reduce(
(t, k) =>
k.inventories.reduce(
(a, c) => a + (c.isHappyHour ? 0 : c.price) * c.quantity * c.discount,
0,
) + t,
(t, k) => k.inventories.reduce((a, c) => a + (c.isHappyHour ? 0 : c.price) * c.quantity * c.discount, 0) + t,
0,
),
),
@@ -328,8 +302,7 @@ export class BillService {
this.bill.kots.reduce(
(t, k) =>
k.inventories.reduce(
(a, c) =>
a + (c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * c.taxRate,
(a, c) => a + (c.isHappyHour ? 0 : c.price) * c.quantity * (1 - c.discount) * c.taxRate,
0,
) + t,
0,
+13 -59
View File
@@ -3,17 +3,9 @@
<mat-card-title>Bill</mat-card-title>
</mat-card-header>
<mat-card-content>
<table
mat-table
#table
[dataSource]="dataSource"
aria-label="Elements"
class="mat-elevation-z8"
>
<table mat-table #table [dataSource]="dataSource" aria-label="Elements" class="mat-elevation-z8">
<ng-container matColumnDef="bill-no-title">
<mat-header-cell *matHeaderCellDef class="deep-purple-200 bold"
>Bill / KOT number</mat-header-cell
>
<mat-header-cell *matHeaderCellDef class="deep-purple-200 bold">Bill / KOT number</mat-header-cell>
</ng-container>
<ng-container matColumnDef="bill-no-details">
<mat-header-cell *matHeaderCellDef class="deep-purple-200 bold right-align"
@@ -28,18 +20,12 @@
<ng-container matColumnDef="time-details">
<mat-header-cell *matHeaderCellDef class="deep-purple-100 bold right-align"
><span [matTooltip]="bs.bill.dateTip">{{ bs.bill.date }}</span
>&nbsp;/&nbsp;<span [matTooltip]="bs.bill.creationDateTip">{{
bs.bill.creationDate
}}</span
>&nbsp;/&nbsp;<span [matTooltip]="bs.bill.lastEditDateTip">{{
bs.bill.lastEditDate
}}</span></mat-header-cell
>&nbsp;/&nbsp;<span [matTooltip]="bs.bill.creationDateTip">{{ bs.bill.creationDate }}</span
>&nbsp;/&nbsp;<span [matTooltip]="bs.bill.lastEditDateTip">{{ bs.bill.lastEditDate }}</span></mat-header-cell
>
</ng-container>
<ng-container matColumnDef="table-title">
<mat-header-cell *matHeaderCellDef class="deep-purple-50 bold"
>Table / Pax / Customer</mat-header-cell
>
<mat-header-cell *matHeaderCellDef class="deep-purple-50 bold">Table / Pax / Customer</mat-header-cell>
</ng-container>
<ng-container matColumnDef="table-details">
<mat-header-cell *matHeaderCellDef class="deep-purple-50 bold right-align"
@@ -73,7 +59,7 @@
</ng-container>
<!-- Info Column -->
<ng-container matColumnDef="info">
<mat-cell *matCellDef="let row" [class.blue800]="row.isNewKot">
<mat-cell *matCellDef="let row">
<span>
{{ row.info }}
</span>
@@ -86,52 +72,22 @@
<ng-container matColumnDef="quantity">
<mat-header-cell *matHeaderCellDef>Quantity</mat-header-cell>
<mat-cell *matCellDef="let row" class="right-align">
<button
mat-icon-button
(click)="subtractOne(row)"
[disabled]="row.isPrinted"
*ngIf="!row.isKot"
>
<button mat-icon-button (click)="subtractOne(row)" [disabled]="row.isPrinted" *ngIf="!row.isKot">
<mat-icon class="del">indeterminate_check_box</mat-icon>
</button>
<button
mat-icon-button
(click)="quantity(row)"
[disabled]="rowQuantityDisabled(row)"
*ngIf="!row.isKot"
>
<button mat-icon-button (click)="quantity(row)" [disabled]="rowQuantityDisabled(row)" *ngIf="!row.isKot">
{{ row.quantity }}
</button>
<button
mat-icon-button
(click)="addOne(row)"
[disabled]="row.isPrinted"
*ngIf="!row.isKot"
>
<button mat-icon-button (click)="addOne(row)" [disabled]="row.isPrinted" *ngIf="!row.isKot">
<mat-icon class="del">control_point</mat-icon>
</button>
<button
mat-icon-button
(click)="removeItem(row)"
[disabled]="row.isPrinted"
*ngIf="!row.isKot"
>
<button mat-icon-button (click)="removeItem(row)" [disabled]="row.isPrinted" *ngIf="!row.isKot">
<mat-icon class="del">cancel</mat-icon>
</button>
<button
mat-icon-button
(click)="modifier(row)"
[disabled]="row.isPrinted"
*ngIf="!row.isKot"
>
<button mat-icon-button (click)="modifier(row)" [disabled]="row.isPrinted" *ngIf="!row.isKot">
<mat-icon class="del">assignment</mat-icon>
</button>
<button
mat-icon-button
(click)="moveKot(row)"
[disabled]="row.isKot && !row.kotId"
*ngIf="row.isKot"
>
<button mat-icon-button (click)="moveKot(row)" [disabled]="row.isKot && !row.kotId" *ngIf="row.isKot">
<mat-icon class="del">open_in_new</mat-icon>
</button>
</mat-cell>
@@ -145,9 +101,7 @@
}}</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="hh-title">
<mat-footer-cell *matFooterCellDef class="grey300 bold"
>Happy Hour Discount</mat-footer-cell
>
<mat-footer-cell *matFooterCellDef class="grey300 bold">Happy Hour Discount</mat-footer-cell>
</ng-container>
<ng-container matColumnDef="hh-amount">
<mat-footer-cell *matFooterCellDef class="grey300 bold right-align">{{
@@ -76,7 +76,8 @@ export class BillsComponent implements OnInit {
chooseCustomer() {
const dialogRef = this.dialog.open(ChooseCustomerComponent, {
// width: '750px',
maxWidth: '100%',
width: '50%',
data: this.bs.bill.customer?.id,
});
+5 -20
View File
@@ -25,11 +25,7 @@ export class VoucherService {
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<Bill>;
}
getFromTable(
tableId: string,
voucherId: string | null,
guestId: string | null,
): Observable<Bill> {
getFromTable(tableId: string, voucherId: string | null, guestId: string | null): Observable<Bill> {
let params = new HttpParams();
if (voucherId !== null) {
params = params.set('v', voucherId);
@@ -53,17 +49,10 @@ export class VoucherService {
getFromBill(billId: string): Observable<Bill> {
return this.http
.get<Bill>(`${url}/from-bill/${billId}`)
.pipe(
catchError(this.log.handleError(serviceName, `getFromBill billId=${billId}`)),
) as Observable<Bill>;
.pipe(catchError(this.log.handleError(serviceName, `getFromBill billId=${billId}`))) as Observable<Bill>;
}
save(
voucher: Bill,
voucherType: VoucherType,
guestBookId: string | null,
updateTable: boolean,
): Observable<boolean> {
save(voucher: Bill, voucherType: VoucherType, guestBookId: string | null, updateTable: boolean): Observable<boolean> {
const options = {
params: new HttpParams().set('p', voucherType.toString()).set('u', updateTable.toString()),
};
@@ -169,9 +158,7 @@ export class VoucherService {
kotId,
tableId: table.id,
})
.pipe(
catchError(this.log.handleError(serviceName, 'moveKotToNewTable')),
) as Observable<boolean>;
.pipe(catchError(this.log.handleError(serviceName, 'moveKotToNewTable'))) as Observable<boolean>;
}
mergeKotWithOldBill(id: string, kotId: string, table: Table): Observable<boolean> {
@@ -182,9 +169,7 @@ export class VoucherService {
tableId: table.id,
newVoucherId: table.voucherId,
})
.pipe(
catchError(this.log.handleError(serviceName, 'mergeKotWithOldBill')),
) as Observable<boolean>;
.pipe(catchError(this.log.handleError(serviceName, 'mergeKotWithOldBill'))) as Observable<boolean>;
}
splitBill(id: string, inventoriesToMove: string[], table: Table, updateTable: boolean) {
@@ -55,7 +55,7 @@
</div>
</form>
</mat-dialog-content>
<mat-dialog-actions>
<mat-dialog-actions align="end">
<button mat-button [mat-dialog-close]="false">Cancel</button>
<button mat-raised-button color="primary" (click)="save()">Select</button>
</mat-dialog-actions>
@@ -9,10 +9,7 @@ describe('CustomerDiscountsService', () => {
});
});
it('should be created', inject(
[CustomerDiscountsService],
(service: CustomerDiscountsService) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([CustomerDiscountsService], (service: CustomerDiscountsService) => {
expect(service).toBeTruthy();
}));
});
@@ -20,9 +20,7 @@ export class CustomerDiscountsService {
const getUrl: string = id === undefined ? `${url}` : `${url}/${id}`;
return this.http
.get<DiscountItem[]>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<
DiscountItem[]
>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<DiscountItem[]>;
}
listForDiscount(): Observable<{ name: string; discount: number; discountLimit: number }[]> {
@@ -10,15 +10,8 @@
<!-- Discount Column -->
<ng-container matColumnDef="discount">
<mat-header-cell *matHeaderCellDef class="center" class="flex-auto"
>Discount</mat-header-cell
>
<mat-cell
*matCellDef="let row; let i = index"
class="center"
[formGroupName]="i"
class="flex-auto"
>
<mat-header-cell *matHeaderCellDef class="center" class="flex-auto">Discount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field class="flex-auto">
<input matInput type="number" formControlName="discount" autocomplete="off" />
<span matSuffix>%</span>
@@ -22,3 +22,8 @@
.disabled {
background-color: #dddddd;
}
.face {
background-color: #3f51b5;
color: #ffffff;
}
@@ -1,6 +1,6 @@
<div class="flex flex-row flex-wrap -mr-5 -mb-5">
<mat-card
class="flex flex-col square-button mr-5, mb-5"
class="face flex flex-col square-button mr-5, mb-5"
matRipple
[routerLink]="['menu-categories']"
queryParamsHandling="preserve"
@@ -12,6 +12,7 @@
matRipple
(click)="discount()"
[class.disabled]="!discountAllowed()"
[class.face]="discountAllowed()"
>
<h3 class="item-name">Discount</h3>
</mat-card>
@@ -20,6 +21,7 @@
matRipple
(click)="printKot()"
[class.disabled]="!printKotAllowed()"
[class.face]="printKotAllowed()"
>
<h3 class="item-name">Print KOT</h3>
</mat-card>
@@ -28,14 +30,11 @@
matRipple
(click)="printBill()"
[class.disabled]="!printBillAllowed()"
[class.face]="printBillAllowed()"
>
<h3 class="item-name">Print Bill</h3>
</mat-card>
<mat-card
class="flex flex-col square-button mr-5, mb-5 warn"
matRipple
[routerLink]="['/', 'sales', 'tables']"
>
<mat-card class="flex flex-col square-button mr-5, mb-5 warn" matRipple [routerLink]="['/', 'sales', 'tables']">
<h3 class="item-name">Back to Tables</h3>
</mat-card>
<mat-card
@@ -43,6 +42,7 @@
matRipple
(click)="receivePayment()"
[class.disabled]="!receivePaymentAllowed()"
[class.face]="receivePaymentAllowed()"
>
<h3 class="item-name">Receive Payment</h3>
</mat-card>
@@ -51,6 +51,7 @@
matRipple
(click)="moveTable()"
[class.disabled]="!moveTableAllowed()"
[class.face]="moveTableAllowed()"
>
<h3 class="item-name">Move Table</h3>
</mat-card>
@@ -59,6 +60,7 @@
matRipple
(click)="voidBill()"
[class.disabled]="!voidBillAllowed()"
[class.face]="voidBillAllowed()"
>
<h3 class="item-name">Void Bill</h3>
</mat-card>
@@ -67,6 +69,7 @@
matRipple
(click)="splitBill()"
[class.disabled]="!splitBillAllowed()"
[class.face]="splitBillAllowed()"
>
<h3 class="item-name">Split Bill</h3>
</mat-card>
@@ -88,13 +88,11 @@ export class SalesHomeComponent {
}
discount(): void {
this.showDiscount().subscribe(
(result: boolean | { id: string; name: string; discount: number }[]) => {
if (result) {
this.bs.discount(result as { id: string; name: string; discount: number }[]);
}
},
);
this.showDiscount().subscribe((result: boolean | { id: string; name: string; discount: number }[]) => {
if (result) {
this.bs.discount(result as { id: string; name: string; discount: number }[]);
}
});
}
billTypeDialog() {
@@ -335,9 +333,7 @@ export class SalesHomeComponent {
return true;
}
showBillSplitChoices(): Observable<
{ id: string; name: string; selected: boolean }[] | undefined | false
> {
showBillSplitChoices(): Observable<{ id: string; name: string; selected: boolean }[] | undefined | false> {
return this.dialog
.open(SplitBillComponent, {
data: this.saleCategoryService
@@ -362,9 +358,7 @@ export class SalesHomeComponent {
if (!this.splitBillAllowed()) {
return;
}
const obs = this.bs.selection.isEmpty()
? this.splitBillWithChoice()
: this.splitBillWithSelection();
const obs = this.bs.selection.isEmpty() ? this.splitBillWithChoice() : this.splitBillWithSelection();
let inventories: string[];
obs
.pipe(
@@ -404,11 +398,7 @@ export class SalesHomeComponent {
throw new Error('Cancelled');
}
}),
map((x) =>
(x as { id: string; name: string; selected: boolean }[])
.filter((y) => y.selected)
.map((y) => y.id),
),
map((x) => (x as { id: string; name: string; selected: boolean }[]).filter((y) => y.selected).map((y) => y.id)),
tap((x: string[]) => {
const sel = this.bs.getInventories(x);
if (sel.keep.length === 0 || sel.move.length === 0) {
@@ -18,3 +18,8 @@
.warn {
background-color: red;
}
.face {
background-color: #3f51b5;
color: #ffffff;
}
@@ -10,7 +10,7 @@
<h3 class="item-name">Back</h3>
</mat-card>
<mat-card
class="flex flex-col square-button mr-5, mb-5"
class="face flex flex-col square-button mr-5, mb-5"
matRipple
*ngFor="let item of list"
[routerLink]="['../products', item.id]"
@@ -5,9 +5,7 @@
<span>{{ item.name }}</span>
<mat-chip-listbox matBadge="0" matBadgeOverlap="false">
<mat-chip-option *ngIf="!item.maximum">{{ item.minimum }} - ∞</mat-chip-option>
<mat-chip-option *ngIf="!!item.maximum"
>{{ item.minimum }} - {{ item.maximum }}</mat-chip-option
>
<mat-chip-option *ngIf="!!item.maximum">{{ item.minimum }} - {{ item.maximum }}</mat-chip-option>
</mat-chip-listbox>
</ng-template>
<div class="flex flex-row flex-wrap -mr-5 -mb-5">
@@ -1,3 +1,4 @@
<h2 mat-dialog-title>Pax</h2>
<mat-dialog-content>
<form [formGroup]="form">
<div class="flex flex-row justify-around content-start items-start">
+1 -4
View File
@@ -12,10 +12,7 @@ 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 }),
@@ -28,3 +28,8 @@
background-color: #424242;
color: #ffffff;
}
.face {
background-color: #3f51b5;
color: #ffffff;
}
@@ -10,7 +10,7 @@
<h3 class="item-name">Back</h3>
</mat-card>
<mat-card
class="flex flex-col square-button mr-5, mb-5"
class="face flex flex-col square-button mr-5, mb-5"
matRipple
*ngFor="let item of list"
(click)="addProduct(item)"
@@ -18,7 +18,7 @@
[class.grey800]="item.isNotAvailable"
>
<h3 class="item-name">{{ item.name }}</h3>
<mat-card-subtitle class="center">{{ item.price | currency : 'INR' }}</mat-card-subtitle>
<mat-card-subtitle class="face center">{{ item.price | currency : 'INR' }}</mat-card-subtitle>
</mat-card>
</div>
</mat-card-content>
@@ -21,10 +21,7 @@
</mat-footer-cell>
</ng-container>
<mat-row
*matRowDef="let row; columns: displayedColumns"
[class.selected]="row === selected"
></mat-row>
<mat-row *matRowDef="let row; columns: displayedColumns" [class.selected]="row === selected"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
</form>
@@ -5,9 +5,7 @@
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef class="bold">Amount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{
row.name
}}</mat-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{ row.name }}</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">Balance</mat-footer-cell>
</ng-container>
@@ -16,19 +14,12 @@
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency : 'INR'
}}</mat-header-cell>
<mat-cell
*matCellDef="let row; let i = index"
class="center"
[formGroupName]="i"
class="flex-auto"
>
<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>
@@ -61,15 +61,10 @@ export class ReceivePaymentComponent {
this.ser
.listForType(data.type)
.pipe(
tap(
(x: SettleOption[]) =>
(this.displayReason = x.reduce((o, n) => o || n.hasReason, this.displayReason)),
),
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) => {
@@ -1,3 +1,7 @@
.face {
background-color: #3f51b5;
color: #ffffff;
}
.running {
background-color: #f53d24;
color: #000000;
@@ -9,24 +9,17 @@
matRipple
*ngFor="let table of list"
(click)="navigateToBill(table)"
[class.face]="table.status !== 'running' && table.status !== 'printed'"
[class.running]="table.status === 'running'"
[class.printed]="table.status === 'printed'"
>
<h3 class="item-name">{{ table.name }}</h3>
<mat-card-subtitle class="center" [class.bold]="table.bold">{{
table.guest
}}</mat-card-subtitle>
<span class="center"
>{{ table.pax ?? '-' }} / {{ table.seats }} / {{ table.section?.name }}</span
>
<mat-card-subtitle class="center" [class.bold]="table.bold">{{ table.guest }}</mat-card-subtitle>
<span class="center">{{ table.pax ?? '-' }} / {{ table.seats }} / {{ table.section?.name }}</span>
<span class="center" *ngIf="table.date">{{ table.date }}</span>
<span class="center" *ngIf="table.amount">{{ table.amount | currency : 'INR' }}</span>
</mat-card>
<mat-card
class="flex flex-col square-button mr-5, mb-5 open-bill"
matRipple
(click)="openBill()"
>
<mat-card class="flex flex-col square-button mr-5, mb-5 open-bill" matRipple (click)="openBill()">
<h3 class="item-name">Open Bill</h3>
</mat-card>
</div>
@@ -35,7 +35,6 @@ export class RunningTablesComponent implements OnInit {
navigateToBill(table: Table): void {
const qp = { table: table.id };
if (table.voucherId) {
// eslint-disable-next-line @typescript-eslint/dot-notation
Object.assign(qp, { voucher: table.voucherId });
}
const navigationExtras: NavigationExtras = {
@@ -42,10 +42,7 @@
<ng-container matColumnDef="copies">
<mat-header-cell *matHeaderCellDef>Copies</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" [formGroupName]="i">
<mat-form-field
*ngIf="!!$any(form.get('saleCategories')).at(i).value.printer"
class="flex-auto"
>
<mat-form-field *ngIf="!!$any(form.get('saleCategories')).at(i).value.printer" class="flex-auto">
<mat-label>Copies</mat-label>
<input matInput type="number" formControlName="copies" />
</mat-form-field>
@@ -59,8 +56,6 @@
</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" *ngIf="sectionId" (click)="confirmDelete()">
Delete
</button>
<button mat-raised-button color="warn" *ngIf="sectionId" (click)="confirmDelete()">Delete</button>
</mat-card-actions>
</mat-card>
@@ -22,9 +22,7 @@ export class SectionPrinterService {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return this.http
.get<SectionPrinter[]>(getUrl)
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<
SectionPrinter[]
>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<SectionPrinter[]>;
}
save(sectionId: string, list: SectionPrinter[]): Observable<SectionPrinter[]> {
@@ -36,8 +34,6 @@ export class SectionPrinterService {
delete(id: string): Observable<SectionPrinter[]> {
return this.http
.delete<SectionPrinter[]>(`${url}/${id}`, httpOptions)
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<
SectionPrinter[]
>;
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<SectionPrinter[]>;
}
}
@@ -14,8 +14,6 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
@@ -2,11 +2,7 @@
<mat-tab label="Prefill Customer Discount">
<mat-card>
<mat-card-content>
<mat-slide-toggle
(click)="togglePrefill()"
class="flex-auto"
[checked]="prefillCustomerDiscount"
>
<mat-slide-toggle (click)="togglePrefill()" class="flex-auto" [checked]="prefillCustomerDiscount">
Prefill the customer discount
</mat-slide-toggle>
</mat-card-content>
+1 -6
View File
@@ -7,12 +7,7 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatNativeDateModule,
} from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
+1 -6
View File
@@ -27,12 +27,7 @@ export class SettingsService {
) as Observable<boolean>;
}
runMaintenance(
startDate: string,
finishDate: string,
beerFile: File,
saleFile: File,
): Observable<boolean> {
runMaintenance(startDate: string, finishDate: string, beerFile: File, saleFile: File): Observable<boolean> {
const options = { params: new HttpParams().set('s', startDate).set('f', finishDate) };
const url = '/api/maintenance';
const fd = new FormData();
@@ -33,8 +33,6 @@
</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>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
@@ -9,10 +9,7 @@ describe('SettleOptionListResolver', () => {
});
});
it('should be created', inject(
[SettleOptionListResolver],
(service: SettleOptionListResolver) => {
expect(service).toBeTruthy();
},
));
it('should be created', inject([SettleOptionListResolver], (service: SettleOptionListResolver) => {
expect(service).toBeTruthy();
}));
});
@@ -23,9 +23,7 @@ export class SettleOptionService {
const getUrl: string = id === null ? url : `${url}/${id}`;
return this.http
.get<SettleOption>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`)),
) as Observable<SettleOption>;
.pipe(catchError(this.log.handleError(serviceName, `get id=${id}`))) as Observable<SettleOption>;
}
list(): Observable<SettleOption[]> {
@@ -37,9 +35,9 @@ export class SettleOptionService {
listForType(voucherType: VoucherType): Observable<SettleOption[]> {
return this.http
.get<SettleOption[]>(`${url}/for-type/${voucherType}`)
.pipe(
catchError(this.log.handleError(serviceName, `listForType voucherType=${voucherType}`)),
) as Observable<SettleOption[]>;
.pipe(catchError(this.log.handleError(serviceName, `listForType voucherType=${voucherType}`))) as Observable<
SettleOption[]
>;
}
save(settleOption: SettleOption): Observable<SettleOption> {
@@ -7,10 +7,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./image-dialog.component.css'],
})
export class ImageDialogComponent {
constructor(
public dialogRef: MatDialogRef<ImageDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: string,
) {}
constructor(public dialogRef: MatDialogRef<ImageDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: string) {}
close(): void {
this.dialogRef.close();
+1 -3
View File
@@ -10,9 +10,7 @@ export class LocalTimePipe implements PipeTransform {
return '';
}
if (value.length === 5) {
return moment(value, 'HH:mm')
.subtract(new Date().getTimezoneOffset(), 'minutes')
.format('HH:mm');
return moment(value, 'HH:mm').subtract(new Date().getTimezoneOffset(), 'minutes').format('HH:mm');
}
return moment(value, 'DD-MMM-YYYY HH:mm')
.subtract(new Date().getTimezoneOffset(), 'minutes')
+1 -7
View File
@@ -11,13 +11,7 @@ import { LocalTimePipe } from './local-time.pipe';
@NgModule({
imports: [CommonModule, MatButtonModule, MatDialogModule],
declarations: [
ConfirmDialogComponent,
ImageDialogComponent,
AccountingPipe,
ClearPipe,
LocalTimePipe,
],
declarations: [ConfirmDialogComponent, ImageDialogComponent, AccountingPipe, ClearPipe, LocalTimePipe],
exports: [AccountingPipe, ClearPipe, LocalTimePipe],
})
export class SharedModule {}
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more