|
|
@@ -12,6 +12,8 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
|
import { z } from 'zod';
|
|
|
import { OptionGroupConfiguration, optionGroupSchema, OptionGroupsEditor } from './option-groups-editor.js';
|
|
|
+import { MoneyInput } from '@/vdb/components/data-input/index.js';
|
|
|
+import { useChannel } from '@/vdb/hooks/use-channel.js';
|
|
|
|
|
|
const getStockLocationsDocument = graphql(`
|
|
|
query GetStockLocations($options: StockLocationListOptions) {
|
|
|
@@ -90,6 +92,7 @@ export function CreateProductVariants({
|
|
|
queryKey: ['stockLocations'],
|
|
|
queryFn: () => api.query(getStockLocationsDocument, { options: { take: 100 } }),
|
|
|
});
|
|
|
+ const { activeChannel } = useChannel();
|
|
|
const stockLocations = stockLocationsResult?.stockLocations.items ?? [];
|
|
|
|
|
|
const [optionGroups, setOptionGroups] = useState<OptionGroupConfiguration['optionGroups']>([]);
|
|
|
@@ -262,16 +265,12 @@ export function CreateProductVariants({
|
|
|
render={({ field }) => (
|
|
|
<FormItem>
|
|
|
<FormControl>
|
|
|
- <div className="relative">
|
|
|
- <span className="absolute left-3 top-2.5">
|
|
|
- {currencyCode}
|
|
|
- </span>
|
|
|
- <Input
|
|
|
+ <MoneyInput
|
|
|
{...field}
|
|
|
- className="pl-12"
|
|
|
- placeholder="0.00"
|
|
|
+ value={Number(field.value) || 0}
|
|
|
+ onChange={value => field.onChange(value.toString())}
|
|
|
+ currency={activeChannel?.defaultCurrencyCode}
|
|
|
/>
|
|
|
- </div>
|
|
|
</FormControl>
|
|
|
<FormMessage />
|
|
|
</FormItem>
|