Activity client case archived contract not auto-selected
This commit is contained in:
@@ -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)`,
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user