Chore: Upgrade to Angular v18

Chore: Upgrade to Python 3.12
Chore: Upgrade to psycopg3
This commit is contained in:
2024-06-03 13:22:56 +05:30
parent 56c1be5e05
commit 010e9a84db
573 changed files with 5727 additions and 6528 deletions
@@ -23,9 +23,11 @@
<mat-form-field class="flex-auto">
<mat-label>Category</mat-label>
<mat-select formControlName="modifierCategory">
<mat-option *ngFor="let mc of modifierCategories" [value]="mc.id">
{{ mc.name }}
</mat-option>
@for (mc of modifierCategories; track mc) {
<mat-option [value]="mc.id">
{{ mc.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
</div>
@@ -36,6 +38,8 @@
</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>
@if (!!item.id) {
<button mat-raised-button color="warn" (click)="confirmDelete()">Delete</button>
}
</mat-card-actions>
</mat-card>
@@ -8,7 +8,7 @@ describe('ModifierDetailComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ModifierDetailComponent],
imports: [ModifierDetailComponent],
}).compileComponents();
}));
@@ -1,6 +1,13 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatButton } from '@angular/material/button';
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent, MatCardActions } from '@angular/material/card';
import { MatCheckbox } from '@angular/material/checkbox';
import { MatOption } from '@angular/material/core';
import { MatDialog } from '@angular/material/dialog';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { MatSelect } from '@angular/material/select';
import { ActivatedRoute, Router } from '@angular/router';
import { Modifier } from '../../core/modifier';
@@ -13,6 +20,22 @@ import { ModifierService } from '../modifier.service';
selector: 'app-modifier-detail',
templateUrl: './modifier-detail.component.html',
styleUrls: ['./modifier-detail.component.css'],
standalone: true,
imports: [
MatCard,
MatCardHeader,
MatCardTitle,
MatCardContent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
MatCheckbox,
MatSelect,
MatOption,
MatCardActions,
MatButton,
],
})
export class ModifierDetailComponent implements OnInit, AfterViewInit {
@ViewChild('name', { static: true }) nameElement?: ElementRef;
@@ -72,27 +95,27 @@ export class ModifierDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem()).subscribe(
() => {
this.ser.saveOrUpdate(this.getItem()).subscribe({
next: () => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/modifiers');
},
(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('/modifiers');
},
(error) => {
error: (error) => {
this.toaster.show('Error', error);
},
);
});
}
confirmDelete(): void {