Chore: Upgrade to Angular v18
Chore: Upgrade to Python 3.12 Chore: Upgrade to psycopg3
This commit is contained in:
@ -14,17 +14,21 @@
|
||||
<mat-form-field class="flex-auto mr-5">
|
||||
<mat-label>Voucher Type</mat-label>
|
||||
<mat-select formControlName="voucherType">
|
||||
<mat-option *ngFor="let vt of voucherTypes" [value]="vt.id">
|
||||
{{ vt.name }}
|
||||
</mat-option>
|
||||
@for (vt of voucherTypes; track vt) {
|
||||
<mat-option [value]="vt.id">
|
||||
{{ vt.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="flex-auto mr-5">
|
||||
<mat-label>Reporting Level</mat-label>
|
||||
<mat-select formControlName="reportingLevel">
|
||||
<mat-option *ngFor="let rl of reportingLevel" [value]="rl.id">
|
||||
{{ rl.name }}
|
||||
</mat-option>
|
||||
@for (rl of reportingLevel; track rl) {
|
||||
<mat-option [value]="rl.id">
|
||||
{{ rl.name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-checkbox formControlName="hasReason">Has Reason?</mat-checkbox>
|
||||
@ -33,6 +37,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('SettleOptionDetailComponent', () => {
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SettleOptionDetailComponent],
|
||||
imports: [SettleOptionDetailComponent],
|
||||
}).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 { ReportingLevel } from '../../core/reporting-level';
|
||||
@ -14,6 +21,22 @@ import { SettleOptionService } from '../settle-option.service';
|
||||
selector: 'app-settle-option-detail',
|
||||
templateUrl: './settle-option-detail.component.html',
|
||||
styleUrls: ['./settle-option-detail.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatSelect,
|
||||
MatOption,
|
||||
MatCheckbox,
|
||||
MatCardActions,
|
||||
MatButton,
|
||||
],
|
||||
})
|
||||
export class SettleOptionDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ -76,27 +99,27 @@ export class SettleOptionDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe(
|
||||
() => {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/settle-options');
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Error', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.item.id).subscribe(
|
||||
() => {
|
||||
this.ser.delete(this.item.id).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/settle-options');
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Error', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SettleOptionListResolver {
|
||||
constructor(private ser: SettleOptionService) {}
|
||||
|
||||
resolve(): Observable<SettleOption[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
10
bookie/src/app/settle-option/settle-option-list.resolver.ts
Normal file
10
bookie/src/app/settle-option/settle-option-list.resolver.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
export const settleOptionListResolver: ResolveFn<SettleOption[]> = () => {
|
||||
return inject(SettleOptionService).list();
|
||||
};
|
||||
@ -8,7 +8,7 @@ describe('SettleOptionListComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SettleOptionListComponent],
|
||||
imports: [SettleOptionListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SettleOptionListComponent);
|
||||
|
||||
@ -1,6 +1,20 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } 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, Router, RouterLink } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@ -16,6 +30,27 @@ import { SettleOptionListDatasource } from './settle-option-list-datasource';
|
||||
selector: 'app-settle-option-list',
|
||||
templateUrl: './settle-option-list.component.html',
|
||||
styleUrls: ['./settle-option-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 SettleOptionListComponent implements OnInit {
|
||||
@ViewChild('table', { static: true }) table?: MatTable<SettleOption>;
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SettleOptionResolver {
|
||||
constructor(private ser: SettleOptionService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<SettleOption> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
}
|
||||
11
bookie/src/app/settle-option/settle-option.resolver.ts
Normal file
11
bookie/src/app/settle-option/settle-option.resolver.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
export const settleOptionResolver: ResolveFn<SettleOption> = (route) => {
|
||||
const id = route.paramMap.get('id');
|
||||
return inject(SettleOptionService).get(id);
|
||||
};
|
||||
@ -1,13 +0,0 @@
|
||||
import { SettleOptionsRoutingModule } from './settle-options-routing.module';
|
||||
|
||||
describe('SettleOptionsRoutingModule', () => {
|
||||
let settleOptionsRoutingModule: SettleOptionsRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
settleOptionsRoutingModule = new SettleOptionsRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(settleOptionsRoutingModule).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 { SettleOptionDetailComponent } from './settle-option-detail/settle-option-detail.component';
|
||||
import { SettleOptionListComponent } from './settle-option-list/settle-option-list.component';
|
||||
import { SettleOptionListResolver } from './settle-option-list-resolver.service';
|
||||
import { SettleOptionResolver } from './settle-option-resolver.service';
|
||||
|
||||
const settleOptionsRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: SettleOptionListComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
list: SettleOptionListResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: SettleOptionDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
item: SettleOptionResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: SettleOptionDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
item: SettleOptionResolver,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(settleOptionsRoutes)],
|
||||
exports: [RouterModule],
|
||||
providers: [SettleOptionListResolver, SettleOptionResolver],
|
||||
})
|
||||
export class SettleOptionsRoutingModule {}
|
||||
@ -1,13 +0,0 @@
|
||||
import { SettleOptionsModule } from './settle-options.module';
|
||||
|
||||
describe('SettleOptionsModule', () => {
|
||||
let settleOptionsModule: SettleOptionsModule;
|
||||
|
||||
beforeEach(() => {
|
||||
settleOptionsModule = new SettleOptionsModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(settleOptionsModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,35 +0,0 @@
|
||||
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 { MatOptionModule } from '@angular/material/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
|
||||
import { SettleOptionDetailComponent } from './settle-option-detail/settle-option-detail.component';
|
||||
import { SettleOptionListComponent } from './settle-option-list/settle-option-list.component';
|
||||
import { SettleOptionsRoutingModule } from './settle-options-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatOptionModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SettleOptionsRoutingModule,
|
||||
],
|
||||
declarations: [SettleOptionListComponent, SettleOptionDetailComponent],
|
||||
})
|
||||
export class SettleOptionsModule {}
|
||||
44
bookie/src/app/settle-option/settle-options.routes.ts
Normal file
44
bookie/src/app/settle-option/settle-options.routes.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
import { authGuard } from '../auth/auth-guard.service';
|
||||
|
||||
import { SettleOptionDetailComponent } from './settle-option-detail/settle-option-detail.component';
|
||||
import { SettleOptionListComponent } from './settle-option-list/settle-option-list.component';
|
||||
import { settleOptionListResolver } from './settle-option-list.resolver';
|
||||
import { settleOptionResolver } from './settle-option.resolver';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: SettleOptionListComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
list: settleOptionListResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: SettleOptionDetailComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
item: settleOptionResolver,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: SettleOptionDetailComponent,
|
||||
canActivate: [authGuard],
|
||||
data: {
|
||||
permission: 'Owner',
|
||||
},
|
||||
resolve: {
|
||||
item: settleOptionResolver,
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user