feat: implement held orders management with loading, cancel, and display functionality

This commit is contained in:
2026-01-07 15:25:41 +03:30
parent a5bcab0064
commit d0979be722
15 changed files with 261 additions and 16 deletions
+12 -3
View File
@@ -1,7 +1,7 @@
import { Maybe } from '@/core';
import { ICustomerResponse } from '@/modules/customers/models';
import { computed, Inject, Injectable, InjectionToken, signal } from '@angular/core';
import { map } from 'rxjs';
import { map, of } from 'rxjs';
import { IPosInfoResponse, IPosProductCategoriesResponse, IPosStockResponse } from '../models';
import { IPosInOrderProduct } from '../models/types';
import { PosService } from '../services/main.service';
@@ -66,7 +66,7 @@ export class POSStore {
return this.state$().stock;
}
return this.state$().stock?.filter(
(s) => s.product.category.id === this.state$().activeProductCategory,
(s) => s.product.categoryId === this.state$().activeProductCategory,
);
});
@@ -258,6 +258,15 @@ export class POSStore {
unitPrice: item.unitPrice,
})),
};
this.service.submitOrder(this.posId, orderPayload).subscribe();
return this.service.submitOrder(this.posId, orderPayload).subscribe({
next: (res) => {
this.resetInOrderProducts();
this.setSelectedCustomer(null);
return of(res);
},
error: (err) => {
return of(err);
},
});
}
}