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 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 }">

View File

@ -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 }">

View File

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