Fix: convert select values to number or null before submit

This commit is contained in:
csr4422
2025-09-29 17:18:36 +05:30
parent 98f16854c8
commit ec63604163

View File

@@ -57,9 +57,8 @@
<Input type="number" placeholder="0" v-bind="componentField" /> <Input type="number" placeholder="0" v-bind="componentField" />
</FormControl> </FormControl>
<FormDescription> <FormDescription>
Maximum number of conversations that can be auto-assigned to an agent, Maximum number of conversations that can be auto-assigned to an agent, conversations in
conversations in "Resolved" or "Closed" states do not count toward this limit. Set to 0 "Resolved" or "Closed" states do not count toward this limit. Set to 0 for unlimited.
for unlimited.
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
@@ -97,6 +96,7 @@
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem :value=0>None</SelectItem>
<SelectItem v-for="bh in businessHours" :key="bh.id" :value="bh.id"> <SelectItem v-for="bh in businessHours" :key="bh.id" :value="bh.id">
{{ bh.name }} {{ bh.name }}
</SelectItem> </SelectItem>
@@ -121,6 +121,7 @@
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem :value=0>None</SelectItem>
<SelectItem <SelectItem
v-for="sla in slaStore.options" v-for="sla in slaStore.options"
:key="sla.value" :key="sla.value"
@@ -226,7 +227,11 @@ const fetchBusinessHours = async () => {
} }
const onSubmit = form.handleSubmit((values) => { const onSubmit = form.handleSubmit((values) => {
props.submitForm(values) props.submitForm({
...values,
business_hours_id: values.business_hours_id ? Number(values.business_hours_id) : null,
sla_policy_id: values.sla_policy_id ? Number(values.sla_policy_id) : null
})
}) })
watch( watch(