changes 0328092025

This commit is contained in:
Simon Pocrnjič
2025-09-28 22:36:47 +02:00
parent b40ee9dcde
commit 7e8e0a479b
61 changed files with 4306 additions and 654 deletions
@@ -14,6 +14,7 @@ const props = defineProps({
client_case: Object,
show: { type: Boolean, default: false },
types: Array,
account_types: { type: Array, default: () => [] },
// Optional: when provided, drawer acts as edit mode
contract: { type: Object, default: null },
});
@@ -40,6 +41,7 @@ const formContract = useForm({
// nested account fields, if exists
initial_amount: props.contract?.account?.initial_amount ?? null,
balance_amount: props.contract?.account?.balance_amount ?? null,
account_type_id: props.contract?.account?.type_id ?? null,
});
// keep form in sync when switching between create and edit
@@ -51,6 +53,7 @@ const applyContract = (c) => {
formContract.description = c?.description ?? ''
formContract.initial_amount = c?.account?.initial_amount ?? null
formContract.balance_amount = c?.account?.balance_amount ?? null
formContract.account_type_id = c?.account?.type_id ?? null
}
watch(() => props.contract, (c) => {
@@ -160,6 +163,18 @@ const storeOrUpdate = () => {
Račun
</template>
</SectionTitle>
<div class="col-span-6 sm:col-span-4">
<InputLabel for="accountTypeSelect" value="Tip računa"/>
<select
id="accountTypeSelect"
v-model="formContract.account_type_id"
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
>
<option :value="null"></option>
<option v-for="at in account_types" :key="at.id" :value="at.id">{{ at.name ?? ('#' + at.id) }}</option>
</select>
<InputError :message="formContract.errors.account_type_id" />
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<InputLabel for="initialAmount" value="Predani znesek"/>