Implement upsert label flow and use-based mark gone handling
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-04-10 15:43:39 +02:00
parent caa6ca6ce1
commit 1dc1bb4912
24 changed files with 948 additions and 76 deletions
+10 -4
View File
@@ -1,7 +1,7 @@
import {
adjustStockEntry,
deleteStockItem,
getStockEntry,
useStockItem,
} from '../../api/stock.js';
import { getRouteContext } from '../../app/router.js';
import { createAsyncState, runAsyncState } from '../shared/ui-state.js';
@@ -207,7 +207,7 @@ export function stockDetailPageData(store) {
await runAsyncState(this.adjustmentState, async () => {
if (this.adjustment.level === 'gone') {
const entryName = this.entry.name;
await deleteStockItem(store, this.entry.uuid_b64);
await useStockItem(store, this.entry.uuid_b64);
store.addAlert({ type: 'success', message: `${entryName} was marked gone.` });
window.__loncApp.navigate('/stock');
return;
@@ -225,8 +225,14 @@ export function stockDetailPageData(store) {
}
await runAsyncState(this.adjustmentState, async () => {
await deleteStockItem(store, this.entry.uuid_b64);
store.addAlert({ type: 'success', message: `${this.entry.name} was marked gone.` });
const result = await useStockItem(store, this.entry.uuid_b64);
const alreadyGone = result.status === 'already_gone';
store.addAlert({
type: alreadyGone ? 'info' : 'success',
message: alreadyGone
? `${this.entry.name} was already out of stock.`
: `${this.entry.name} was marked gone.`,
});
window.__loncApp.navigate('/stock');
}).catch(() => {});
},