Chore: Upgrade to Angular v18
Chore: Upgrade to Python 3.12 Chore: Upgrade to psycopg3
This commit is contained in:
@ -1,13 +0,0 @@
|
||||
import { ModifierCategoriesRoutingModule } from './modifier-categories-routing.module';
|
||||
|
||||
describe('ModifierCategoriesRoutingModule', () => {
|
||||
let rolesRoutingModule: ModifierCategoriesRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
rolesRoutingModule = new ModifierCategoriesRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(rolesRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,53 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
|
||||
import { ModifierCategoryDetailComponent } from './modifier-category-detail/modifier-category-detail.component';
|
||||
import { ModifierCategoryListComponent } from './modifier-category-list/modifier-category-list.component';
|
||||
import { ModifierCategoryListResolver } from './modifier-category-list-resolver.service';
|
||||
import { ModifierCategoryResolver } from './modifier-category-resolver.service';
|
||||
|
||||
const modifierCategoriesRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ModifierCategoryListComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
list: ModifierCategoryListResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: ModifierCategoryDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
item: ModifierCategoryResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ModifierCategoryDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
item: ModifierCategoryResolver,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(modifierCategoriesRoutes)],
|
||||
exports: [RouterModule],
|
||||
providers: [ModifierCategoryListResolver, ModifierCategoryResolver],
|
||||
})
|
||||
export class ModifierCategoriesRoutingModule {}
|
||||
@ -1,13 +0,0 @@
|
||||
import { ModifierCategoriesModule } from './modifier-categories.module';
|
||||
|
||||
describe('ModifierCategoriesModule', () => {
|
||||
let rolesModule: ModifierCategoriesModule;
|
||||
|
||||
beforeEach(() => {
|
||||
rolesModule = new ModifierCategoriesModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(rolesModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { CdkTreeModule } from '@angular/cdk/tree';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTreeModule } from '@angular/material/tree';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import { ModifierCategoriesRoutingModule } from './modifier-categories-routing.module';
|
||||
import { ModifierCategoryDetailComponent } from './modifier-category-detail/modifier-category-detail.component';
|
||||
import { ModifierCategoryListComponent } from './modifier-category-list/modifier-category-list.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CdkTableModule,
|
||||
CdkTreeModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTableModule,
|
||||
MatTreeModule,
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
ModifierCategoriesRoutingModule,
|
||||
],
|
||||
declarations: [ModifierCategoryListComponent, ModifierCategoryDetailComponent],
|
||||
})
|
||||
export class ModifierCategoriesModule {}
|
||||
@ -0,0 +1,44 @@
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
import { authGuard } from '../auth/auth-guard.service';
|
||||
|
||||
import { ModifierCategoryDetailComponent } from './modifier-category-detail/modifier-category-detail.component';
|
||||
import { ModifierCategoryListComponent } from './modifier-category-list/modifier-category-list.component';
|
||||
import { modifierCategoryListResolver } from './modifier-category-list.resolver';
|
||||
import { modifierCategoryResolver } from './modifier-category.resolver';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ModifierCategoryListComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
list: modifierCategoryListResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: ModifierCategoryDetailComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
item: modifierCategoryResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ModifierCategoryDetailComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Modifiers',
|
||||
},
|
||||
resolve: {
|
||||
item: modifierCategoryResolver,
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -8,7 +8,7 @@ describe('ModifierCategoryDetailComponent', () => {
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ModifierCategoryDetailComponent],
|
||||
imports: [ModifierCategoryDetailComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
||||
@ -1,8 +1,23 @@
|
||||
import { NestedTreeControl } from '@angular/cdk/tree';
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatIconButton, MatButton } from '@angular/material/button';
|
||||
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent, MatCardActions } from '@angular/material/card';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatTreeNestedDataSource } from '@angular/material/tree';
|
||||
import { MatDivider } from '@angular/material/divider';
|
||||
import { MatFormField, MatLabel } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import {
|
||||
MatTreeNestedDataSource,
|
||||
MatTree,
|
||||
MatTreeNodeDef,
|
||||
MatTreeNode,
|
||||
MatTreeNodeToggle,
|
||||
MatNestedTreeNode,
|
||||
MatTreeNodeOutlet,
|
||||
} from '@angular/material/tree';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@ -18,6 +33,29 @@ import { NodeItem } from '../node-item';
|
||||
selector: 'app-role-detail',
|
||||
templateUrl: './modifier-category-detail.component.html',
|
||||
styleUrls: ['./modifier-category-detail.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatCheckbox,
|
||||
MatDivider,
|
||||
MatTree,
|
||||
MatTreeNodeDef,
|
||||
MatTreeNode,
|
||||
MatTreeNodeToggle,
|
||||
MatIconButton,
|
||||
MatNestedTreeNode,
|
||||
MatIcon,
|
||||
MatTreeNodeOutlet,
|
||||
MatCardActions,
|
||||
MatButton,
|
||||
],
|
||||
})
|
||||
export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ -106,27 +144,27 @@ export class ModifierCategoryDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe(
|
||||
() => {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/modifier-categories');
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Error', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.item.id as string).subscribe(
|
||||
() => {
|
||||
this.ser.delete(this.item.id as string).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/modifier-categories');
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Error', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
|
||||
import { ModifierCategoryService } from './modifier-category.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ModifierCategoryListResolver {
|
||||
constructor(private ser: ModifierCategoryService) {}
|
||||
|
||||
resolve(): Observable<ModifierCategory[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
|
||||
import { ModifierCategoryService } from './modifier-category.service';
|
||||
|
||||
export const modifierCategoryListResolver: ResolveFn<ModifierCategory[]> = () => {
|
||||
return inject(ModifierCategoryService).list();
|
||||
};
|
||||
@ -46,12 +46,18 @@
|
||||
<mat-header-cell *matHeaderCellDef>Products</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">
|
||||
<ul>
|
||||
<li *ngFor="let mc of row.menuCategories">
|
||||
{{ mc.name }}
|
||||
<ul *ngIf="!mc.enabled">
|
||||
<li *ngFor="let p of mc.products">{{ p.name }}</li>
|
||||
</ul>
|
||||
</li>
|
||||
@for (mc of row.menuCategories; track mc) {
|
||||
<li>
|
||||
{{ mc.name }}
|
||||
@if (!mc.enabled) {
|
||||
<ul>
|
||||
@for (p of mc.products; track p) {
|
||||
<li>{{ p.name }}</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
@ -8,7 +8,7 @@ describe('ModifierCategoryListComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ModifierCategoryListComponent],
|
||||
imports: [ModifierCategoryListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ModifierCategoryListComponent);
|
||||
|
||||
@ -1,5 +1,20 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MatAnchor } from '@angular/material/button';
|
||||
import { MatCard, MatCardHeader, MatCardTitleGroup, MatCardTitle, MatCardContent } from '@angular/material/card';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
} from '@angular/material/table';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
|
||||
import { ModifierCategory } from '../../core/modifier-category';
|
||||
|
||||
@ -9,6 +24,27 @@ import { ModifierCategoryListDatasource } from './modifier-category-list-datasou
|
||||
selector: 'app-modifier-category-list',
|
||||
templateUrl: './modifier-category-list.component.html',
|
||||
styleUrls: ['./modifier-category-list.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitleGroup,
|
||||
MatCardTitle,
|
||||
MatAnchor,
|
||||
RouterLink,
|
||||
MatIcon,
|
||||
MatCardContent,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
],
|
||||
})
|
||||
export class ModifierCategoryListComponent implements OnInit {
|
||||
list: ModifierCategory[] = [];
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
|
||||
import { ModifierCategoryService } from './modifier-category.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ModifierCategoryResolver {
|
||||
constructor(private ser: ModifierCategoryService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<ModifierCategory> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { ModifierCategory } from '../core/modifier-category';
|
||||
|
||||
import { ModifierCategoryService } from './modifier-category.service';
|
||||
|
||||
export const modifierCategoryResolver: ResolveFn<ModifierCategory> = (route) => {
|
||||
const id = route.paramMap.get('id');
|
||||
return inject(ModifierCategoryService).get(id);
|
||||
};
|
||||
Reference in New Issue
Block a user