Settle Options are now stored in the Database and can be updated
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
.example-card {
|
||||
max-width: 400px;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<div fxLayout="row" fxFlex="50%" fxLayoutAlign="space-around center" class="example-card">
|
||||
<mat-card fxFlex>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Settle Option</mat-card-title>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<form [formGroup]="form" fxLayout="column">
|
||||
<div
|
||||
fxLayout="row"
|
||||
fxLayoutAlign="space-around start"
|
||||
fxLayout.lt-md="column"
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput #nameElement placeholder="Name" formControlName="name" />
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div
|
||||
fxLayout="row"
|
||||
fxLayoutAlign="space-around start"
|
||||
fxLayout.lt-md="column"
|
||||
fxLayoutGap="20px"
|
||||
fxLayoutGap.lt-md="0px"
|
||||
>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Voucher Type</mat-label>
|
||||
<mat-select placeholder="Voucher Type" formControlName="voucherType">
|
||||
<mat-option *ngFor="let vt of voucherTypes" [value]="vt.id">
|
||||
{{ vt.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Reporting Level</mat-label>
|
||||
<mat-select placeholder="Reporting Level" formControlName="reportingLevel">
|
||||
<mat-option *ngFor="let rl of reportingLevel" [value]="rl.id">
|
||||
{{ rl.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-checkbox formControlName="hasReason">Has Reason?</mat-checkbox>
|
||||
</div>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" (click)="save()">Save</button>
|
||||
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">
|
||||
Delete
|
||||
</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
@ -0,0 +1,26 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { SettleOptionDetailComponent } from './settle-option-detail.component';
|
||||
|
||||
describe('SettleOptionDetailComponent', () => {
|
||||
let component: SettleOptionDetailComponent;
|
||||
let fixture: ComponentFixture<SettleOptionDetailComponent>;
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SettleOptionDetailComponent],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SettleOptionDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,118 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ReportingLevel } from '../../core/reporting-level';
|
||||
import { SettleOption } from '../../core/settle-option';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { VoucherType } from '../../sales/bills/voucher-type';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { SettleOptionService } from '../settle-option.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settle-option-detail',
|
||||
templateUrl: './settle-option-detail.component.html',
|
||||
styleUrls: ['./settle-option-detail.component.css'],
|
||||
})
|
||||
export class SettleOptionDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
item: SettleOption = new SettleOption();
|
||||
voucherTypes: { id: number; name: string }[];
|
||||
reportingLevel: { id: number; name: string }[];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: SettleOptionService,
|
||||
) {
|
||||
// Create form
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
voucherType: '',
|
||||
reportingLevel: '',
|
||||
hasReason: '',
|
||||
});
|
||||
this.voucherTypes = Object.keys(VoucherType)
|
||||
.filter((e) => !isNaN(+e))
|
||||
.map((o) => ({ id: +o, name: VoucherType[+o] as string }));
|
||||
this.reportingLevel = Object.keys(ReportingLevel)
|
||||
.filter((e) => !isNaN(+e))
|
||||
.map((o) => ({ id: +o, name: ReportingLevel[+o] as string }));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { item: SettleOption };
|
||||
this.showItem(data.item);
|
||||
});
|
||||
}
|
||||
|
||||
showItem(item: SettleOption) {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name,
|
||||
voucherType: this.item.voucherType,
|
||||
reportingLevel: this.item.reportingLevel,
|
||||
hasReason: this.item.hasReason,
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
if (this.nameElement !== undefined) {
|
||||
this.nameElement.nativeElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe(
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/settle-options');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.item.id).subscribe(
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/settle-options');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
width: '250px',
|
||||
data: { title: 'Delete Settle Option?', content: 'Are you sure? This cannot be undone.' },
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result: boolean) => {
|
||||
if (result) {
|
||||
this.delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getItem(): SettleOption {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.voucherType = formModel.voucherType;
|
||||
this.item.reportingLevel = formModel.reportingLevel;
|
||||
this.item.hasReason = formModel.hasReason;
|
||||
return this.item;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SettleOptionListResolver } from './settle-option-list-resolver.service';
|
||||
|
||||
describe('SettleOptionListResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SettleOptionListResolver],
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject(
|
||||
[SettleOptionListResolver],
|
||||
(service: SettleOptionListResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
},
|
||||
));
|
||||
});
|
||||
@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SettleOptionListResolver implements Resolve<SettleOption[]> {
|
||||
constructor(private ser: SettleOptionService) {}
|
||||
|
||||
resolve(): Observable<SettleOption[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
import { SettleOption } from '../../core/settle-option';
|
||||
|
||||
export class SettleOptionListDatasource extends DataSource<SettleOption> {
|
||||
private data: SettleOption[] = [];
|
||||
|
||||
constructor(private readonly dataObs: Observable<SettleOption[]>) {
|
||||
super();
|
||||
this.dataObs = dataObs.pipe(
|
||||
tap((x) => {
|
||||
this.data = x;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
connect(): Observable<SettleOption[]> {
|
||||
return this.dataObs;
|
||||
}
|
||||
|
||||
disconnect() {}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
<mat-card>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Settle Options</mat-card-title>
|
||||
<a mat-button [routerLink]="['/settle-options', 'new']">
|
||||
<mat-icon>add_box</mat-icon>
|
||||
Add
|
||||
</a>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"
|
||||
><a [routerLink]="['/settle-options', row.id]">{{ row.name }}</a></mat-cell
|
||||
>
|
||||
</ng-container>
|
||||
|
||||
<!-- Voucher Type Column -->
|
||||
<ng-container matColumnDef="voucherType">
|
||||
<mat-header-cell *matHeaderCellDef>Voucher Type</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ voucherType(row.voucherType) }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Reporting Level Column -->
|
||||
<ng-container matColumnDef="reportingLevel">
|
||||
<mat-header-cell *matHeaderCellDef>Reporting Level</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ reportingLevel(row.reportingLevel) }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Has Reason Column -->
|
||||
<ng-container matColumnDef="hasReason">
|
||||
<mat-header-cell *matHeaderCellDef>Has Reason?</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.hasReason }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Is Fixture Column -->
|
||||
<ng-container matColumnDef="isFixture">
|
||||
<mat-header-cell *matHeaderCellDef>Fixture?</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{ row.isFixture }}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
</mat-table>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@ -0,0 +1,22 @@
|
||||
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SettleOptionListComponent } from './settle-option-list.component';
|
||||
|
||||
describe('SettleOptionListComponent', () => {
|
||||
let component: SettleOptionListComponent;
|
||||
let fixture: ComponentFixture<SettleOptionListComponent>;
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SettleOptionListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SettleOptionListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should compile', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,69 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ReportingLevel } from '../../core/reporting-level';
|
||||
import { SettleOption } from '../../core/settle-option';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { VoucherType } from '../../sales/bills/voucher-type';
|
||||
import { SettleOptionService } from '../settle-option.service';
|
||||
|
||||
import { SettleOptionListDatasource } from './settle-option-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settle-option-list',
|
||||
templateUrl: './settle-option-list.component.html',
|
||||
styleUrls: ['./settle-option-list.component.css'],
|
||||
})
|
||||
export class SettleOptionListComponent implements OnInit {
|
||||
@ViewChild('table', { static: true }) table?: MatTable<SettleOption>;
|
||||
data: BehaviorSubject<SettleOption[]> = new BehaviorSubject<SettleOption[]>([]);
|
||||
dataSource: SettleOptionListDatasource = new SettleOptionListDatasource(this.data);
|
||||
list: SettleOption[] = [];
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'voucherType', 'reportingLevel', 'hasReason', 'isFixture'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private ser: SettleOptionService,
|
||||
) {
|
||||
this.data.subscribe((data: SettleOption[]) => {
|
||||
this.list = data;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.pipe(
|
||||
map((x) => {
|
||||
const data = (x as { list: SettleOption[] }).list;
|
||||
return data.map((y) => {
|
||||
y.voucherType = y.voucherType;
|
||||
y.reportingLevel = y.reportingLevel;
|
||||
return y;
|
||||
});
|
||||
}),
|
||||
)
|
||||
.subscribe((list) => {
|
||||
this.data.next(list);
|
||||
});
|
||||
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { list: SettleOption[] };
|
||||
this.data.next(data.list);
|
||||
});
|
||||
this.dataSource = new SettleOptionListDatasource(this.data);
|
||||
}
|
||||
|
||||
voucherType(input: VoucherType): string {
|
||||
return VoucherType[input];
|
||||
}
|
||||
|
||||
reportingLevel(input: ReportingLevel): string {
|
||||
return ReportingLevel[input];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SettleOptionResolver } from './settle-option-resolver.service';
|
||||
|
||||
describe('SettleOptionResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SettleOptionResolver],
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SettleOptionResolver], (service: SettleOptionResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SettleOptionResolver implements Resolve<SettleOption> {
|
||||
constructor(private ser: SettleOptionService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<SettleOption> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
}
|
||||
15
bookie/src/app/settle-option/settle-option.service.spec.ts
Normal file
15
bookie/src/app/settle-option/settle-option.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SettleOptionService } from './settle-option.service';
|
||||
|
||||
describe('SettleOptionService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SettleOptionService],
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SettleOptionService], (service: SettleOptionService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
69
bookie/src/app/settle-option/settle-option.service.ts
Normal file
69
bookie/src/app/settle-option/settle-option.service.ts
Normal file
@ -0,0 +1,69 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { SettleOption } from '../core/settle-option';
|
||||
import { VoucherType } from '../sales/bills/voucher-type';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
};
|
||||
const url = '/api/settle-options';
|
||||
const serviceName = 'SettleOptionService';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SettleOptionService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
get(id: string | null): Observable<SettleOption> {
|
||||
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>;
|
||||
}
|
||||
|
||||
list(): Observable<SettleOption[]> {
|
||||
return this.http
|
||||
.get<SettleOption[]>(`${url}/list`)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<SettleOption[]>;
|
||||
}
|
||||
|
||||
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[]>;
|
||||
}
|
||||
|
||||
save(settleOption: SettleOption): Observable<SettleOption> {
|
||||
return this.http
|
||||
.post<SettleOption>(url, settleOption, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'save'))) as Observable<SettleOption>;
|
||||
}
|
||||
|
||||
update(settleOption: SettleOption): Observable<SettleOption> {
|
||||
return this.http
|
||||
.put<SettleOption>(`${url}/${settleOption.id}`, settleOption, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'update'))) as Observable<SettleOption>;
|
||||
}
|
||||
|
||||
saveOrUpdate(settleOption: SettleOption): Observable<SettleOption> {
|
||||
if (!settleOption.id) {
|
||||
return this.save(settleOption);
|
||||
}
|
||||
return this.update(settleOption);
|
||||
}
|
||||
|
||||
delete(id: number): Observable<SettleOption> {
|
||||
return this.http
|
||||
.delete<SettleOption>(`${url}/${id}`, httpOptions)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'delete'))) as Observable<SettleOption>;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
import { SettleOptionsRoutingModule } from './settle-options-routing.module';
|
||||
|
||||
describe('SettleOptionsRoutingModule', () => {
|
||||
let settleOptionsRoutingModule: SettleOptionsRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
settleOptionsRoutingModule = new SettleOptionsRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(settleOptionsRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,54 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
import { TaxListResolver } from '../taxes/tax-list-resolver.service';
|
||||
|
||||
import { SettleOptionDetailComponent } from './settle-option-detail/settle-option-detail.component';
|
||||
import { SettleOptionListResolver } from './settle-option-list-resolver.service';
|
||||
import { SettleOptionListComponent } from './settle-option-list/settle-option-list.component';
|
||||
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 {}
|
||||
13
bookie/src/app/settle-option/settle-options.module.spec.ts
Normal file
13
bookie/src/app/settle-option/settle-options.module.spec.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { SettleOptionsModule } from './settle-options.module';
|
||||
|
||||
describe('SettleOptionsModule', () => {
|
||||
let settleOptionsModule: SettleOptionsModule;
|
||||
|
||||
beforeEach(() => {
|
||||
settleOptionsModule = new SettleOptionsModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(settleOptionsModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
37
bookie/src/app/settle-option/settle-options.module.ts
Normal file
37
bookie/src/app/settle-option/settle-options.module.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
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,
|
||||
FlexLayoutModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatOptionModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SettleOptionsRoutingModule,
|
||||
],
|
||||
declarations: [SettleOptionListComponent, SettleOptionDetailComponent],
|
||||
})
|
||||
export class SettleOptionsModule {}
|
||||
Reference in New Issue
Block a user