Implement upsert label flow and use-based mark gone handling
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -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(() => {});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user