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

View File

@ -36,9 +36,9 @@ const page = ref(1);
const pageSize = ref(25); const pageSize = ref(25);
const columns = [ const columns = [
{ key: "id", label: "#", sortable: true, class: "w-16" }, { key: "id", label: "#", sortable: true, class: "w-16" },
{ key: "name", label: "Name", sortable: true }, { key: "name", label: "Ime", sortable: true },
{ key: "color_tag", label: "Color tag", sortable: false }, { key: "color_tag", label: "Barva", sortable: false },
{ key: "decisions", label: "Decisions", sortable: false, class: "w-32" }, { key: "decisions", label: "Odločitve", sortable: false, class: "w-32" },
]; ];
const form = useForm({ const form = useForm({
@ -193,7 +193,7 @@ const destroyAction = () => {
class="inline-block h-4 w-4 rounded" class="inline-block h-4 w-4 rounded"
:style="{ backgroundColor: row.color_tag }" :style="{ backgroundColor: row.color_tag }"
></span> ></span>
<span>{{ row.color_tag || "" }}</span> <span>{{ row.color_tag || "" }}</span>
</div> </div>
</template> </template>
<template #cell-decisions="{ row }"> <template #cell-decisions="{ row }">

View File

@ -3,7 +3,7 @@
import { EditIcon, TrashBinIcon } from "@/Utilities/Icons"; import { EditIcon, TrashBinIcon } from "@/Utilities/Icons";
import DialogModal from "@/Components/DialogModal.vue"; import DialogModal from "@/Components/DialogModal.vue";
import ConfirmationModal from "@/Components/ConfirmationModal.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 { router, useForm } from "@inertiajs/vue3";
import InputLabel from "@/Components/InputLabel.vue"; import InputLabel from "@/Components/InputLabel.vue";
import TextInput from "@/Components/TextInput.vue"; import TextInput from "@/Components/TextInput.vue";
@ -36,10 +36,10 @@ const page = ref(1);
const pageSize = ref(25); const pageSize = ref(25);
const columns = [ const columns = [
{ key: "id", label: "#", sortable: true, class: "w-16" }, { key: "id", label: "#", sortable: true, class: "w-16" },
{ key: "name", label: "Name", sortable: true }, { key: "name", label: "Ime", sortable: true },
{ key: "color_tag", label: "Color tag", sortable: false }, { key: "color_tag", label: "Barva", sortable: false },
{ key: "belongs", label: "Belongs to actions", sortable: false, class: "w-40" }, { key: "belongs", label: "Pripada akcijam", sortable: false, class: "w-40" },
{ key: "auto_mail", label: "Auto mail", sortable: false, class: "w-56" }, { key: "auto_mail", label: "Auto mail", sortable: false, class: "w-46" },
]; ];
const form = useForm({ const form = useForm({
@ -59,6 +59,26 @@ const createForm = useForm({
email_template_id: null, 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) => { const openEditDrawer = (item) => {
form.actions = []; form.actions = [];
form.id = item.id; form.id = item.id;
@ -151,16 +171,12 @@ const destroyDecision = () => {
<template> <template>
<div class="p-4 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"> <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"> <div class="flex flex-col sm:flex-row gap-2 items-start sm:items-center">
<TextInput <TextInput v-model="search" placeholder="Iskanje..." class="w-full sm:w-72" />
v-model="search"
placeholder="Search decisions..."
class="w-full sm:w-72"
/>
<select <select
v-model="selectedTemplateId" 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" 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"> <option v-for="t in emailTemplates" :key="t.id" :value="t.id">
{{ t.name }} {{ t.name }}
</option> </option>
@ -171,7 +187,7 @@ const destroyDecision = () => {
v-model="onlyAutoMail" v-model="onlyAutoMail"
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500" class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500"
/> />
Only auto mail Samo auto mail
</label> </label>
</div> </div>
<PrimaryButton @click="openCreateDrawer">+ Dodaj odločitev</PrimaryButton> <PrimaryButton @click="openCreateDrawer">+ Dodaj odločitev</PrimaryButton>
@ -196,7 +212,7 @@ const destroyDecision = () => {
class="inline-block h-4 w-4 rounded" class="inline-block h-4 w-4 rounded"
:style="{ backgroundColor: row.color_tag }" :style="{ backgroundColor: row.color_tag }"
></span> ></span>
<span>{{ row.color_tag || "" }}</span> <span>{{ row.color_tag || "" }}</span>
</div> </div>
</template> </template>
<template #cell-belongs="{ row }"> <template #cell-belongs="{ row }">

View File

@ -1,19 +1,18 @@
<script setup> <script setup>
import AppLayout from '@/Layouts/AppLayout.vue'; import AppLayout from "@/Layouts/AppLayout.vue";
import { ref } from 'vue'; import { ref } from "vue";
import { FwbTab, FwbTabs } from 'flowbite-vue' import { FwbTab, FwbTabs } from "flowbite-vue";
import ActionTable from '../Partials/ActionTable.vue'; import ActionTable from "../Partials/ActionTable.vue";
import DecisionTable from '../Partials/DecisionTable.vue'; import DecisionTable from "../Partials/DecisionTable.vue";
const props = defineProps({ const props = defineProps({
actions: Array, actions: Array,
decisions: Array, decisions: Array,
segments: Array, segments: Array,
email_templates: { type: Array, default: () => [] } email_templates: { type: Array, default: () => [] },
}); });
const activeTab = ref('actions') const activeTab = ref("actions");
</script> </script>
<template> <template>
<AppLayout title="Workflow"> <AppLayout title="Workflow">
@ -22,11 +21,19 @@ const activeTab = ref('actions')
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg"> <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">
<fwb-tabs v-model="activeTab" variant="underline"> <fwb-tabs v-model="activeTab" variant="underline">
<fwb-tab name="actions" title="Actions"> <fwb-tab name="actions" title="Akcije">
<ActionTable :actions="actions" :decisions="decisions" :segments="segments" /> <ActionTable
:actions="actions"
:decisions="decisions"
:segments="segments"
/>
</fwb-tab> </fwb-tab>
<fwb-tab name="decisions" title="Decisions"> <fwb-tab name="decisions" title="Odločitve">
<DecisionTable :decisions="decisions" :actions="actions" :email-templates="email_templates" /> <DecisionTable
:decisions="decisions"
:actions="actions"
:email-templates="email_templates"
/>
</fwb-tab> </fwb-tab>
</fwb-tabs> </fwb-tabs>
</div> </div>