Updated settings for actions and decitions

This commit is contained in:
Simon Pocrnjič
2025-10-18 23:12:48 +02:00
parent 8f2e5e282c
commit 322bd66502
3 changed files with 67 additions and 44 deletions
@@ -36,9 +36,9 @@ const page = ref(1);
const pageSize = ref(25);
const columns = [
{ key: "id", label: "#", sortable: true, class: "w-16" },
{ key: "name", label: "Name", sortable: true },
{ key: "color_tag", label: "Color tag", sortable: false },
{ key: "decisions", label: "Decisions", sortable: false, class: "w-32" },
{ key: "name", label: "Ime", sortable: true },
{ key: "color_tag", label: "Barva", sortable: false },
{ key: "decisions", label: "Odločitve", sortable: false, class: "w-32" },
];
const form = useForm({
@@ -193,7 +193,7 @@ const destroyAction = () => {
class="inline-block h-4 w-4 rounded"
:style="{ backgroundColor: row.color_tag }"
></span>
<span>{{ row.color_tag || "" }}</span>
<span>{{ row.color_tag || "" }}</span>
</div>
</template>
<template #cell-decisions="{ row }">
@@ -3,7 +3,7 @@
import { EditIcon, TrashBinIcon } from "@/Utilities/Icons";
import DialogModal from "@/Components/DialogModal.vue";
import ConfirmationModal from "@/Components/ConfirmationModal.vue";
import { computed, onMounted, ref } from "vue";
import { computed, onMounted, ref, watch } from "vue";
import { router, useForm } from "@inertiajs/vue3";
import InputLabel from "@/Components/InputLabel.vue";
import TextInput from "@/Components/TextInput.vue";
@@ -36,10 +36,10 @@ const page = ref(1);
const pageSize = ref(25);
const columns = [
{ key: "id", label: "#", sortable: true, class: "w-16" },
{ key: "name", label: "Name", sortable: true },
{ key: "color_tag", label: "Color tag", sortable: false },
{ key: "belongs", label: "Belongs to actions", sortable: false, class: "w-40" },
{ key: "auto_mail", label: "Auto mail", sortable: false, class: "w-56" },
{ key: "name", label: "Ime", sortable: true },
{ key: "color_tag", label: "Barva", sortable: false },
{ key: "belongs", label: "Pripada akcijam", sortable: false, class: "w-40" },
{ key: "auto_mail", label: "Auto mail", sortable: false, class: "w-46" },
];
const form = useForm({
@@ -59,6 +59,26 @@ const createForm = useForm({
email_template_id: null,
});
// When auto mail is disabled, also detach email template selection (edit form)
watch(
() => form.auto_mail,
(enabled) => {
if (!enabled) {
form.email_template_id = null;
}
}
);
// Same behavior for create form for consistency
watch(
() => createForm.auto_mail,
(enabled) => {
if (!enabled) {
createForm.email_template_id = null;
}
}
);
const openEditDrawer = (item) => {
form.actions = [];
form.id = item.id;
@@ -151,16 +171,12 @@ const destroyDecision = () => {
<template>
<div class="p-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
<div class="flex flex-col sm:flex-row gap-2 items-start sm:items-center">
<TextInput
v-model="search"
placeholder="Search decisions..."
class="w-full sm:w-72"
/>
<TextInput v-model="search" placeholder="Iskanje..." class="w-full sm:w-72" />
<select
v-model="selectedTemplateId"
class="block w-full sm:w-64 border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
>
<option :value="null">All templates</option>
<option :value="null">Vse predloge</option>
<option v-for="t in emailTemplates" :key="t.id" :value="t.id">
{{ t.name }}
</option>
@@ -171,7 +187,7 @@ const destroyDecision = () => {
v-model="onlyAutoMail"
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500"
/>
Only auto mail
Samo auto mail
</label>
</div>
<PrimaryButton @click="openCreateDrawer">+ Dodaj odločitev</PrimaryButton>
@@ -196,7 +212,7 @@ const destroyDecision = () => {
class="inline-block h-4 w-4 rounded"
:style="{ backgroundColor: row.color_tag }"
></span>
<span>{{ row.color_tag || "" }}</span>
<span>{{ row.color_tag || "" }}</span>
</div>
</template>
<template #cell-belongs="{ row }">