Product Group renamed to Menu Category
Extracted Product Group -> Group_type to a a new object called Sale Category. Moved tax from product to Sale Category for uniform taxes on types of sales.
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
import {SaleCategoriesRoutingModule} from './sale-categories-routing.module';
|
||||
|
||||
describe('SaleCategoriesRoutingModule', () => {
|
||||
let saleCategoriesRoutingModule: SaleCategoriesRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
saleCategoriesRoutingModule = new SaleCategoriesRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(saleCategoriesRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,64 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { SaleCategoryListResolver } from './sale-category-list-resolver.service';
|
||||
import { SaleCategoryResolver } from './sale-category-resolver.service';
|
||||
import { SaleCategoryListComponent } from './sale-category-list/sale-category-list.component';
|
||||
import { SaleCategoryDetailComponent } from './sale-category-detail/sale-category-detail.component';
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
import { TaxListResolver } from "../taxes/tax-list-resolver.service";
|
||||
|
||||
const saleCategoriesRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: SaleCategoryListComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Products'
|
||||
},
|
||||
resolve: {
|
||||
list: SaleCategoryListResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: SaleCategoryDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Products'
|
||||
},
|
||||
resolve: {
|
||||
item: SaleCategoryResolver,
|
||||
taxes: TaxListResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: SaleCategoryDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
permission: 'Products'
|
||||
},
|
||||
resolve: {
|
||||
item: SaleCategoryResolver,
|
||||
taxes: TaxListResolver
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(saleCategoriesRoutes)
|
||||
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
],
|
||||
providers: [
|
||||
SaleCategoryListResolver,
|
||||
SaleCategoryResolver
|
||||
]
|
||||
})
|
||||
export class SaleCategoriesRoutingModule {
|
||||
}
|
||||
13
bookie/src/app/sale-category/sale-categories.module.spec.ts
Normal file
13
bookie/src/app/sale-category/sale-categories.module.spec.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import {SaleCategoriesModule} from './sale-categories.module';
|
||||
|
||||
describe('SaleCategoriesModule', () => {
|
||||
let saleCategoriesModule: SaleCategoriesModule;
|
||||
|
||||
beforeEach(() => {
|
||||
saleCategoriesModule = new SaleCategoriesModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(saleCategoriesModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
41
bookie/src/app/sale-category/sale-categories.module.ts
Normal file
41
bookie/src/app/sale-category/sale-categories.module.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { SaleCategoryListComponent} from './sale-category-list/sale-category-list.component';
|
||||
import { SaleCategoryDetailComponent } from './sale-category-detail/sale-category-detail.component';
|
||||
import { SaleCategoriesRoutingModule } from './sale-categories-routing.module';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatOptionModule } from '@angular/material/core';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FlexLayoutModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatOptionModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SaleCategoriesRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
SaleCategoryListComponent,
|
||||
SaleCategoryDetailComponent
|
||||
]
|
||||
})
|
||||
export class SaleCategoriesModule {
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
.example-card {
|
||||
max-width: 400px;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<div fxLayout="row" fxFlex="50%" fxLayoutAlign="space-around center" class="example-card">
|
||||
<mat-card fxFlex>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Sale Category</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>Tax</mat-label>
|
||||
<mat-select placeholder="Tax" formControlName="tax">
|
||||
<mat-option *ngFor="let t of taxes" [value]="t.id">
|
||||
{{ t.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button [disabled]="item.isFixture" color="primary" (click)="save()">Save</button>
|
||||
<button mat-raised-button [disabled]="item.isFixture" color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
@ -0,0 +1,25 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {SaleCategoryDetailComponent} from './sale-category-detail.component';
|
||||
|
||||
describe('SaleCategoryDetailComponent', () => {
|
||||
let component: SaleCategoryDetailComponent;
|
||||
let fixture: ComponentFixture<SaleCategoryDetailComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SaleCategoryDetailComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SaleCategoryDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,108 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from "@angular/material";
|
||||
|
||||
import { SaleCategoryService } from '../sale-category.service';
|
||||
import { SaleCategory } from '../../core/sale-category';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { ConfirmDialogComponent } from "../../shared/confirm-dialog/confirm-dialog.component";
|
||||
import { Tax } from "../../core/tax";
|
||||
|
||||
@Component({
|
||||
selector: 'app-sale-category-detail',
|
||||
templateUrl: './sale-category-detail.component.html',
|
||||
styleUrls: ['./sale-category-detail.component.css']
|
||||
})
|
||||
export class SaleCategoryDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
|
||||
form: FormGroup;
|
||||
taxes: Tax[];
|
||||
item: SaleCategory;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private fb: FormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private ser: SaleCategoryService
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
name: '',
|
||||
tax: ''
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { item: SaleCategory, taxes: Tax[] }) => {
|
||||
this.showItem(data.item);
|
||||
this.taxes = data.taxes;
|
||||
});
|
||||
}
|
||||
|
||||
showItem(item: SaleCategory) {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name,
|
||||
tax: this.item.tax.id ? this.item.tax.id : ''
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.nameElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem())
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/sale-categories');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.item.id)
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/sale-categories');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
width: '250px',
|
||||
data: {title: 'Delete Sale Category?', content: 'Are you sure? This cannot be undone.'}
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result: boolean) => {
|
||||
if (result) {
|
||||
this.delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getItem(): SaleCategory {
|
||||
const formModel = this.form.value;
|
||||
this.item.name = formModel.name;
|
||||
this.item.tax.id = formModel.tax;
|
||||
return this.item;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
import {SaleCategoryListResolver} from './sale-category-list-resolver.service';
|
||||
|
||||
describe('SaleCategoryListResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SaleCategoryListResolver]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SaleCategoryListResolver], (service: SaleCategoryListResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { SaleCategory } from '../core/sale-category';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { SaleCategoryService } from './sale-category.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SaleCategoryListResolver implements Resolve<SaleCategory[]> {
|
||||
|
||||
constructor(private ser: SaleCategoryService, private router: Router) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<SaleCategory[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SaleCategory } from '../../core/sale-category';
|
||||
import { tap } from "rxjs/operators";
|
||||
|
||||
export class SaleCategoryListDatasource extends DataSource<SaleCategory> {
|
||||
private data: SaleCategory[];
|
||||
|
||||
constructor(private readonly dataObs: Observable<SaleCategory[]>) {
|
||||
super();
|
||||
this.dataObs = dataObs.pipe(
|
||||
tap(x => this.data = x)
|
||||
);
|
||||
}
|
||||
|
||||
connect(): Observable<SaleCategory[]> {
|
||||
return this.dataObs;
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<mat-card>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Sale Categories</mat-card-title>
|
||||
<a mat-button [routerLink]="['/sale-categories', '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]="['/sale-categories', row.id]">{{row.name}}</a></mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- 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>
|
||||
</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,23 @@
|
||||
import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {SaleCategoryListComponent} from './sale-category-list.component';
|
||||
|
||||
describe('SaleCategoryListComponent', () => {
|
||||
let component: SaleCategoryListComponent;
|
||||
let fixture: ComponentFixture<SaleCategoryListComponent>;
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SaleCategoryListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SaleCategoryListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should compile', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,42 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { SaleCategoryListDatasource } from './sale-category-list-datasource';
|
||||
import { SaleCategory } from '../../core/sale-category';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatTable } from "@angular/material";
|
||||
import { ToasterService } from "../../core/toaster.service";
|
||||
import { SaleCategoryService } from "../sale-category.service";
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'app-sale-category-list',
|
||||
templateUrl: './sale-category-list.component.html',
|
||||
styleUrls: ['./sale-category-list.component.css']
|
||||
})
|
||||
export class SaleCategoryListComponent implements OnInit {
|
||||
@ViewChild('table', { static: true }) table: MatTable<SaleCategory>;
|
||||
dataSource: SaleCategoryListDatasource;
|
||||
list: SaleCategory[];
|
||||
data: BehaviorSubject<SaleCategory[]>;
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'tax'];
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private ser: SaleCategoryService
|
||||
) {
|
||||
this.data = new BehaviorSubject([]);
|
||||
this.data.subscribe((data: SaleCategory[]) => {
|
||||
this.list = data;
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: SaleCategory[] }) => {
|
||||
this.data.next(data.list);
|
||||
});
|
||||
this.dataSource = new SaleCategoryListDatasource(this.data);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import { SaleCategoryResolver } from './sale-category-resolver.service';
|
||||
|
||||
describe('SaleCategoryResolver', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SaleCategoryResolver]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SaleCategoryResolver], (service: SaleCategoryResolver) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { SaleCategoryService } from './sale-category.service';
|
||||
import { SaleCategory } from '../core/sale-category';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SaleCategoryResolver implements Resolve<SaleCategory> {
|
||||
|
||||
constructor(private ser: SaleCategoryService, private router: Router) {
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<SaleCategory> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
}
|
||||
15
bookie/src/app/sale-category/sale-category.service.spec.ts
Normal file
15
bookie/src/app/sale-category/sale-category.service.spec.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import {inject, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {SaleCategoryService} from './sale-category.service';
|
||||
|
||||
describe('SaleCategoryService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SaleCategoryService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SaleCategoryService], (service: SaleCategoryService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
72
bookie/src/app/sale-category/sale-category.service.ts
Normal file
72
bookie/src/app/sale-category/sale-category.service.ts
Normal file
@ -0,0 +1,72 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {SaleCategory} from '../core/sale-category';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/v1/sale-categories';
|
||||
const serviceName = 'SaleCategoryService';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SaleCategoryService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {
|
||||
}
|
||||
|
||||
get(id: string): Observable<SaleCategory> {
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
return <Observable<SaleCategory>>this.http.get<SaleCategory>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
);
|
||||
}
|
||||
|
||||
list(): Observable<SaleCategory[]> {
|
||||
const options = {params: new HttpParams().set('l', '')};
|
||||
return <Observable<SaleCategory[]>>this.http.get<SaleCategory[]>(url, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
}
|
||||
|
||||
save(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>this.http.post<SaleCategory>(`${url}/new`, saleCategory, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
}
|
||||
|
||||
update(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>this.http.put<SaleCategory>(`${url}/${saleCategory.id}`, saleCategory, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'update'))
|
||||
);
|
||||
}
|
||||
|
||||
updateSortOrder(list: SaleCategory[]): Observable<boolean> {
|
||||
return <Observable<boolean>>this.http.post<SaleCategory[]>(url, list, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'updateSortOrder'))
|
||||
);
|
||||
}
|
||||
|
||||
saveOrUpdate(saleCategory: SaleCategory): Observable<SaleCategory> {
|
||||
if (!saleCategory.id) {
|
||||
return this.save(saleCategory);
|
||||
} else {
|
||||
return this.update(saleCategory);
|
||||
}
|
||||
}
|
||||
|
||||
delete(id: string): Observable<SaleCategory> {
|
||||
return <Observable<SaleCategory>>this.http.delete<SaleCategory>(`${url}/${id}`, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'delete'))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user