Add default price for all price fields
This commit is contained in:
@@ -26,6 +26,8 @@
|
|||||||
submitLabel = 'Save'
|
submitLabel = 'Save'
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
$inspect(fields);
|
||||||
|
|
||||||
function getValue(field: string): unknown {
|
function getValue(field: string): unknown {
|
||||||
return form?.[field] ?? record?.[field] ?? '';
|
return form?.[field] ?? record?.[field] ?? '';
|
||||||
}
|
}
|
||||||
@@ -74,14 +76,26 @@
|
|||||||
class="w-full rounded-lg border border-gray-300 px-3 py-2 transition-shadow outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500"
|
class="w-full rounded-lg border border-gray-300 px-3 py-2 transition-shadow outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500"
|
||||||
/>
|
/>
|
||||||
{:else if type === 'Int' || type === 'Float'}
|
{:else if type === 'Int' || type === 'Float'}
|
||||||
<input
|
{#if field === 'price'}
|
||||||
type="number"
|
<input
|
||||||
id={field}
|
type="number"
|
||||||
name={field}
|
id={field}
|
||||||
value={getValue(field) ?? ''}
|
name={field}
|
||||||
step={type === 'Float' ? '0.01' : '1'}
|
placeholder="0.99"
|
||||||
class="w-full rounded-lg border border-gray-300 px-3 py-2 transition-shadow outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500"
|
value={getValue(field) ?? '0.99'}
|
||||||
/>
|
step={type === 'Float' ? '0.01' : '1'}
|
||||||
|
class="w-full rounded-lg border border-gray-300 px-3 py-2 transition-shadow outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500"
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
id={field}
|
||||||
|
name={field}
|
||||||
|
value={getValue(field) ?? ''}
|
||||||
|
step={type === 'Float' ? '0.01' : '1'}
|
||||||
|
class="w-full rounded-lg border border-gray-300 px-3 py-2 transition-shadow outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{:else if type === 'String'}
|
{:else if type === 'String'}
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
Reference in New Issue
Block a user