changes to import added activity entity
This commit is contained in:
@@ -28,6 +28,8 @@ const form = useForm({
|
||||
delimiter: "",
|
||||
// Payments import mode
|
||||
payments_import: false,
|
||||
// History import mode
|
||||
history_import: false,
|
||||
// For payments mode: how to locate Contract - use single key 'reference'
|
||||
contract_key_mode: null,
|
||||
},
|
||||
@@ -59,6 +61,9 @@ const prevEntities = ref([]);
|
||||
watch(
|
||||
() => form.meta.payments_import,
|
||||
(enabled) => {
|
||||
if (enabled && form.meta.history_import) {
|
||||
form.meta.history_import = false;
|
||||
}
|
||||
if (enabled) {
|
||||
// Save current selection and lock to the required chain
|
||||
prevEntities.value = Array.isArray(form.entities) ? [...form.entities] : [];
|
||||
@@ -74,6 +79,35 @@ watch(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// History import: restrict entities and auto-add accounts when contracts selected
|
||||
watch(
|
||||
() => form.meta.history_import,
|
||||
(enabled) => {
|
||||
if (enabled && form.meta.payments_import) {
|
||||
form.meta.payments_import = false;
|
||||
form.meta.contract_key_mode = null;
|
||||
}
|
||||
const allowed = ["person", "person_addresses", "person_phones", "contracts", "activities", "client_cases"];
|
||||
if (enabled) {
|
||||
const current = Array.isArray(form.entities) ? [...form.entities] : [];
|
||||
let filtered = current.filter((e) => allowed.includes(e));
|
||||
if (filtered.includes("contracts") && !filtered.includes("accounts")) {
|
||||
filtered = [...filtered, "accounts"];
|
||||
}
|
||||
form.entities = filtered;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => form.entities,
|
||||
(vals) => {
|
||||
if (form.meta.history_import && Array.isArray(vals) && vals.includes("contracts") && ! vals.includes("accounts")) {
|
||||
form.entities = [...vals, "accounts"];
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -112,14 +146,24 @@ watch(
|
||||
<label class="block text-sm font-medium text-gray-700"
|
||||
>Entities (tables)</label
|
||||
>
|
||||
<label class="inline-flex items-center gap-2 text-sm">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="form.meta.payments_import"
|
||||
class="rounded"
|
||||
/>
|
||||
<span>Payments import</span>
|
||||
</label>
|
||||
<div class="flex items-center gap-4 text-sm">
|
||||
<label class="inline-flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="form.meta.history_import"
|
||||
class="rounded"
|
||||
/>
|
||||
<span>History import</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="form.meta.payments_import"
|
||||
class="rounded"
|
||||
/>
|
||||
<span>Payments import</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="!form.meta.payments_import">
|
||||
<Multiselect
|
||||
@@ -128,11 +172,13 @@ watch(
|
||||
{ value: 'person', label: 'Person' },
|
||||
{ value: 'person_addresses', label: 'Person Addresses' },
|
||||
{ value: 'person_phones', label: 'Person Phones' },
|
||||
{ value: 'client_cases', label: 'Client Cases' },
|
||||
{ value: 'emails', label: 'Emails' },
|
||||
{ value: 'accounts', label: 'Accounts' },
|
||||
{ value: 'contracts', label: 'Contracts' },
|
||||
{ value: 'case_objects', label: 'Case Objects' },
|
||||
{ value: 'payments', label: 'Payments' },
|
||||
{ value: 'activities', label: 'Activities' },
|
||||
]"
|
||||
:multiple="true"
|
||||
track-by="value"
|
||||
@@ -156,6 +202,9 @@ watch(
|
||||
Choose which tables this template targets. You can still define per-column
|
||||
mappings later.
|
||||
</p>
|
||||
<div v-if="form.meta.history_import" class="mt-2 text-xs text-gray-600">
|
||||
History mode allows only person/address/phone/contracts/activities/client cases. Accounts are auto-added when contracts are present and balances stay unchanged.
|
||||
</div>
|
||||
<div v-if="form.meta.payments_import" class="mt-2 text-xs text-gray-600">
|
||||
Payments mode locks entities to:
|
||||
<span class="font-medium">Contracts → Accounts → Payments</span> and
|
||||
|
||||
Reference in New Issue
Block a user