Fix: Checkboxes de eventos en formulario de webhook
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m2s

This commit is contained in:
2025-12-02 20:39:16 -06:00
parent 738584514d
commit ae8e4e37a7
6 changed files with 214 additions and 5 deletions

View File

@@ -42,13 +42,19 @@
<UFormField label="Eventos">
<div class="grid grid-cols-2 gap-2">
<UCheckbox
<label
v-for="event in availableEvents"
:key="event.value"
v-model="form.events"
:value="event.value"
:label="event.label"
/>
class="flex items-center gap-2 cursor-pointer text-sm text-[var(--wa-text)]"
>
<input
type="checkbox"
:checked="form.events.includes(event.value)"
@change="toggleEvent(event.value)"
class="w-4 h-4 rounded border-gray-600 bg-gray-700 text-[var(--wa-green-light)] focus:ring-[var(--wa-green-light)] focus:ring-offset-0"
/>
{{ event.label }}
</label>
</div>
</UFormField>
@@ -145,6 +151,15 @@ const isValid = computed(() => {
return form.value.name.trim() && form.value.url.trim() && form.value.events.length > 0
})
const toggleEvent = (eventValue: string) => {
const index = form.value.events.indexOf(eventValue)
if (index === -1) {
form.value.events.push(eventValue)
} else {
form.value.events.splice(index, 1)
}
}
// Watch for webhook changes to populate form
watch(() => props.webhook, (webhook) => {
if (webhook) {