|
|
@ -21,9 +21,13 @@ import AddIcon from "~icons/carbon/add-filled";
|
|
|
|
import DeleteIcon from "~icons/carbon/trash-can";
|
|
|
|
import DeleteIcon from "~icons/carbon/trash-can";
|
|
|
|
import DragVerticalIcon from "~icons/carbon/drag-vertical";
|
|
|
|
import DragVerticalIcon from "~icons/carbon/drag-vertical";
|
|
|
|
import PositionSettingsIcon from "~icons/carbon/settings-adjust";
|
|
|
|
import PositionSettingsIcon from "~icons/carbon/settings-adjust";
|
|
|
|
import { Checkbox, TextArea, TextInput } from "../Form";
|
|
|
|
import { Checkbox, NumberInput, TextArea, TextInput } from "../Form";
|
|
|
|
import { MarkdownHelpLabel } from "../Markdown";
|
|
|
|
import { MarkdownHelpLabel } from "../Markdown";
|
|
|
|
import { createOptionalNumberInputHandler } from "~/util";
|
|
|
|
import {
|
|
|
|
|
|
|
|
createOptionalNumberInputHandler,
|
|
|
|
|
|
|
|
createNativeInputValue,
|
|
|
|
|
|
|
|
resetInput,
|
|
|
|
|
|
|
|
} from "~/util";
|
|
|
|
|
|
|
|
|
|
|
|
export const PositionsSettings: Component = () => {
|
|
|
|
export const PositionsSettings: Component = () => {
|
|
|
|
const [state, setState] = useContext(StoreContext)!;
|
|
|
|
const [state, setState] = useContext(StoreContext)!;
|
|
|
@ -125,6 +129,12 @@ export const PositionsSettings: Component = () => {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let quantityInputEl: HTMLInputElement = undefined!;
|
|
|
|
|
|
|
|
const quantityValue = createNativeInputValue(
|
|
|
|
|
|
|
|
() => quantityInputEl,
|
|
|
|
|
|
|
|
() => position.quantity
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div class="indicator w-full">
|
|
|
|
<div class="indicator w-full">
|
|
|
|
<div class="indicator-item indicator-middle indicator-end flex items-center">
|
|
|
|
<div class="indicator-item indicator-middle indicator-end flex items-center">
|
|
|
@ -243,24 +253,24 @@ export const PositionsSettings: Component = () => {
|
|
|
|
<Show when={position.type === POSITION_TYPE_QUANTITY}>
|
|
|
|
<Show when={position.type === POSITION_TYPE_QUANTITY}>
|
|
|
|
<div class="flex-1">
|
|
|
|
<div class="flex-1">
|
|
|
|
<input
|
|
|
|
<input
|
|
|
|
|
|
|
|
ref={quantityInputEl}
|
|
|
|
class="w-full input input-bordered input-xs"
|
|
|
|
class="w-full input input-bordered input-xs"
|
|
|
|
value={position.quantity}
|
|
|
|
value={quantityValue()}
|
|
|
|
placeholder="Menge"
|
|
|
|
placeholder="Menge"
|
|
|
|
min="0"
|
|
|
|
|
|
|
|
step="0.01"
|
|
|
|
|
|
|
|
required
|
|
|
|
required
|
|
|
|
type="number"
|
|
|
|
name="Menge"
|
|
|
|
lang="en"
|
|
|
|
|
|
|
|
onInput={createOptionalNumberInputHandler(
|
|
|
|
onInput={createOptionalNumberInputHandler(
|
|
|
|
(v) => {
|
|
|
|
(v) => {
|
|
|
|
|
|
|
|
v != null &&
|
|
|
|
setState(
|
|
|
|
setState(
|
|
|
|
"positions",
|
|
|
|
"positions",
|
|
|
|
idx(),
|
|
|
|
idx(),
|
|
|
|
"quantity",
|
|
|
|
"quantity",
|
|
|
|
v || 0
|
|
|
|
v
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
onBlur={resetInput(0)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Show>
|
|
|
|
</Show>
|
|
|
@ -293,7 +303,7 @@ export const PositionsSettings: Component = () => {
|
|
|
|
</Show>
|
|
|
|
</Show>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<TextInput
|
|
|
|
<NumberInput
|
|
|
|
size="xs"
|
|
|
|
size="xs"
|
|
|
|
value={position.itemPrice}
|
|
|
|
value={position.itemPrice}
|
|
|
|
label="Einzelpreis"
|
|
|
|
label="Einzelpreis"
|
|
|
@ -302,12 +312,9 @@ export const PositionsSettings: Component = () => {
|
|
|
|
? state.defaultItemPrice + ""
|
|
|
|
? state.defaultItemPrice + ""
|
|
|
|
: undefined
|
|
|
|
: undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
step="0.01"
|
|
|
|
onInput={(v) =>
|
|
|
|
min="0"
|
|
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
|
|
onInput={createOptionalNumberInputHandler((v) =>
|
|
|
|
|
|
|
|
setState("positions", idx(), "itemPrice", v)
|
|
|
|
setState("positions", idx(), "itemPrice", v)
|
|
|
|
)}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
use:autoAnimate
|
|
|
|
use:autoAnimate
|
|
|
@ -348,21 +355,18 @@ export const PositionsSettings: Component = () => {
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-span-2">
|
|
|
|
<div class="col-span-2">
|
|
|
|
<TextInput
|
|
|
|
<NumberInput
|
|
|
|
label="Aktionspreis"
|
|
|
|
label="Aktionspreis"
|
|
|
|
suffix="CHF"
|
|
|
|
suffix="CHF"
|
|
|
|
type="number"
|
|
|
|
|
|
|
|
step="0.01"
|
|
|
|
|
|
|
|
min="0"
|
|
|
|
|
|
|
|
value={position.fixedDiscountPrice}
|
|
|
|
value={position.fixedDiscountPrice}
|
|
|
|
onInput={createOptionalNumberInputHandler((v) =>
|
|
|
|
onInput={(v) =>
|
|
|
|
setState(
|
|
|
|
setState(
|
|
|
|
"positions",
|
|
|
|
"positions",
|
|
|
|
idx(),
|
|
|
|
idx(),
|
|
|
|
"fixedDiscountPrice",
|
|
|
|
"fixedDiscountPrice",
|
|
|
|
v
|
|
|
|
v
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-span-2">
|
|
|
|
<div class="col-span-2">
|
|
|
|