import fix for update so it does not insert person and client case

This commit is contained in:
Simon Pocrnjič
2025-10-16 20:11:45 +02:00
parent ed62311ba4
commit e782bcca7c
11 changed files with 393 additions and 54 deletions
@@ -4,16 +4,21 @@ import { useForm, Link } from '@inertiajs/vue3'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { faKey, faArrowLeft, faPlus } from '@fortawesome/free-solid-svg-icons'
const props = defineProps({
roles: Array,
})
const form = useForm({
name: '',
slug: '',
description: ''
description: '',
roles: [],
})
function submit() {
form.post(route('admin.permissions.store'), {
preserveScroll: true,
onSuccess: () => form.reset('name','slug','description')
onSuccess: () => form.reset('name','slug','description','roles')
})
}
</script>
@@ -51,6 +56,16 @@ function submit() {
<textarea v-model="form.description" rows="3" class="w-full border rounded-md px-3 py-2 text-sm focus:ring-indigo-500 focus:border-indigo-500" />
<p v-if="form.errors.description" class="text-xs text-red-600 mt-1">{{ form.errors.description }}</p>
</div>
<div class="sm:col-span-2 space-y-1">
<label class="block text-xs font-medium uppercase tracking-wide text-gray-600">Veži na vloge</label>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2">
<label v-for="r in props.roles" :key="r.id" class="inline-flex items-center gap-2 text-sm">
<input type="checkbox" :value="r.id" v-model="form.roles" class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"/>
<span><span class="font-medium">{{ r.name }}</span> <span class="text-xs text-gray-500">({{ r.slug }})</span></span>
</label>
</div>
<p v-if="form.errors.roles" class="text-xs text-red-600 mt-1">{{ form.errors.roles }}</p>
</div>
</div>
<div class="flex items-center gap-3 pt-2">