From 256b311c43d610624d646a53421002dce60a9a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pocrnji=C4=8D?= Date: Sun, 17 May 2026 23:55:17 +0200 Subject: [PATCH] Activity client case archived contract not auto-selected --- .../Pages/Cases/Partials/ActivityDrawer.vue | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/resources/js/Pages/Cases/Partials/ActivityDrawer.vue b/resources/js/Pages/Cases/Partials/ActivityDrawer.vue index 7eab1b8..52a4b3b 100644 --- a/resources/js/Pages/Cases/Partials/ActivityDrawer.vue +++ b/resources/js/Pages/Cases/Partials/ActivityDrawer.vue @@ -54,7 +54,9 @@ const form = useInertiaForm({ props.actions[0].decisions.length > 0 ? props.actions[0].decisions[0].id : null, - contract_uuids: props.contractUuid ? [props.contractUuid] : (props.contracts || []).map((c) => c.uuid), + contract_uuids: props.contractUuid + ? [props.contractUuid] + : (props.contracts || []).filter((item) => item.active == 1).map((c) => c.uuid), send_auto_mail: true, attach_documents: false, attachment_document_ids: [], @@ -98,7 +100,9 @@ watch( watch( () => props.contractUuid, (cu) => { - form.contract_uuids = cu ? [cu] : (props.contracts || []).map((c) => c.uuid); + form.contract_uuids = cu + ? [cu] + : (props.contracts || []).filter((item) => item.active == 1).map((c) => c.uuid); } ); @@ -106,7 +110,9 @@ watch( () => props.show, (visible) => { if (visible) { - form.contract_uuids = props.contractUuid ? [props.contractUuid] : (props.contracts || []).map((c) => c.uuid); + form.contract_uuids = props.contractUuid + ? [props.contractUuid] + : (props.contracts || []).filter((item) => item.active == 1).map((c) => c.uuid); } } ); @@ -131,15 +137,15 @@ const store = async () => { const buildCallBackAt = (date, time) => { if (!date) return null; - const t = time || '00:00'; - const [h, m] = t.split(':'); + const t = time || "00:00"; + const [h, m] = t.split(":"); const d = date instanceof Date ? date : new Date(date); if (isNaN(d.getTime())) return null; const y = d.getFullYear(); - const mo = String(d.getMonth() + 1).padStart(2, '0'); - const dy = String(d.getDate()).padStart(2, '0'); - const hh = String(Number(h || 0)).padStart(2, '0'); - const mm = String(Number(m || 0)).padStart(2, '0'); + const mo = String(d.getMonth() + 1).padStart(2, "0"); + const dy = String(d.getDate()).padStart(2, "0"); + const hh = String(Number(h || 0)).padStart(2, "0"); + const mm = String(Number(m || 0)).padStart(2, "0"); return `${y}-${mo}-${dy} ${hh}:${mm}:00`; }; @@ -163,7 +169,14 @@ const store = async () => { .post(route("clientCase.activity.store", props.client_case), { onSuccess: () => { close(); - form.reset("due_date", "amount", "note", "contract_uuids", "call_back_at_date", "call_back_at_time"); + form.reset( + "due_date", + "amount", + "note", + "contract_uuids", + "call_back_at_date", + "call_back_at_time" + ); emit("saved"); }, }); @@ -181,7 +194,7 @@ const currentDecision = () => { const hasCallLaterEvent = computed(() => { const d = currentDecision(); if (!d) return false; - return Array.isArray(d.events) && d.events.some((e) => e.key === 'add_call_later'); + return Array.isArray(d.events) && d.events.some((e) => e.key === "add_call_later"); }); watch( @@ -215,7 +228,7 @@ const autoMailRequiresContract = computed(() => { const contractItems = computed(() => { return pageContracts.value.map((c) => ({ value: c.uuid, - label: `${c.reference}${c.name ? ` - ${c.name}` : ""}`, + label: c.active == 1 ? `${c.reference}` : `${c.reference} (Arhivirano)`, })); });