File tree Expand file tree Collapse file tree 3 files changed +7
-554
lines changed
Expand file tree Collapse file tree 3 files changed +7
-554
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ import CRMloyalty from "./pages/CRM/loyalty";
2727import ProductList from "./pages/Products/ProductManager/ProductList" ;
2828import CRMreport from "./pages/CRM/report" ;
2929import AttendanceManagement from "./pages/HR/AttendanceManagement" ;
30- import DisposalCreate from "./pages/Inventory/disposal/DisposalCreate" ;
3130import DisposalDetail from "./pages/Inventory/disposal/DisposalDetail" ;
3231import DisposalList from "./pages/Inventory/disposal/DisposalList" ;
3332import ReportforCashier from "./pages/Pos/ReportforCashier" ;
@@ -167,7 +166,7 @@ function App() {
167166 < Route path = "inventory-counts/:id" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < InventoryCountDetail /> </ ProtectedRoute > } />
168167 < Route path = "inventory/locations" element = { < ProtectedRoute allowedRoles = { INVENTORY_OVERVIEW_ROLES } > < LocationManagement /> </ ProtectedRoute > } />
169168 < Route path = "inventory/disposal" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < DisposalList /> </ ProtectedRoute > } />
170- < Route path = "inventory/disposal/create" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < DisposalCreate /> </ ProtectedRoute > } />
169+ < Route path = "inventory/disposal/create" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < DisposalDetail /> </ ProtectedRoute > } />
171170 < Route path = "inventory/disposal/:id" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < DisposalDetail /> </ ProtectedRoute > } />
172171 < Route path = "inventory/purchase-orders" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < PurchaseOrderList /> </ ProtectedRoute > } />
173172 < Route path = "inventory/purchase-orders/create" element = { < ProtectedRoute allowedRoles = { INVENTORY_FULL_ROLES } > < CreatePurchaseOrder /> </ ProtectedRoute > } />
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import {
1212 getExpiredBatches ,
1313 saveDisposalDraft ,
1414 approveDisposalVoucher ,
15- createAndApproveDisposalVoucher ,
1615} from "../../../services/inventory/disposalService" ;
1716
1817export function useDisposalVoucher ( voucherId = null ) {
@@ -249,9 +248,12 @@ export function useDisposalVoucher(voucherId = null) {
249248 items,
250249 } ;
251250
252- const confirmedVoucher = currentVoucherId
253- ? await approveDisposalVoucher ( currentVoucherId , userId )
254- : await createAndApproveDisposalVoucher ( voucherData , userId ) ;
251+ const draftVoucher = currentVoucherId
252+ ? null
253+ : await saveDisposalDraft ( voucherData , userId ) ;
254+
255+ const approvalTargetId = currentVoucherId || draftVoucher ?. id ;
256+ const confirmedVoucher = await approveDisposalVoucher ( approvalTargetId , userId ) ;
255257
256258 setVoucher ( confirmedVoucher ) ;
257259 return confirmedVoucher ;
You can’t perform that action at this time.
0 commit comments