This commit is contained in:
2025-10-08 18:26:47 +02:00
parent ee1af56d03
commit f40c3d0f2e
6 changed files with 134 additions and 15 deletions
@@ -8,7 +8,7 @@ import SectionTitle from "@/Components/SectionTitle.vue";
import TextInput from "@/Components/TextInput.vue";
import CurrencyInput from "@/Components/CurrencyInput.vue";
import DatePickerField from "@/Components/DatePickerField.vue";
import { useForm } from "@inertiajs/vue3";
import { useForm, router } from "@inertiajs/vue3";
import { watch, nextTick, ref as vRef } from "vue";
const props = defineProps({
@@ -95,6 +95,10 @@ watch(
const storeOrUpdate = () => {
const isEdit = !!formContract.uuid;
// Debug: log payload being sent to verify balance_amount presence
try {
console.debug('Submitting contract form', JSON.parse(JSON.stringify(formContract)));
} catch (e) {}
const options = {
onBefore: () => {
formContract.start_date = formContract.start_date;
@@ -103,6 +107,21 @@ const storeOrUpdate = () => {
close();
// keep state clean; reset to initial
if (!isEdit) formContract.reset();
// After edit ensure contracts list reflects updated balance
if (isEdit) {
try {
const params = {};
try {
const url = new URL(window.location.href);
const seg = url.searchParams.get('segment');
if (seg) params.segment = seg;
} catch (e) {}
router.visit(route('clientCase.show', { client_case: props.client_case.uuid, ...params }), {
preserveScroll: true,
replace: true,
});
} catch (e) {}
}
},
preserveScroll: true,
};
@@ -34,6 +34,11 @@ const props = defineProps({
all_segments: { type: Array, default: () => [] },
});
// Debug: log incoming contract balances (remove after fix)
try {
console.debug('Contracts received (balances):', props.contracts.map(c => ({ ref: c.reference, bal: c?.account?.balance_amount })));
} catch (e) {}
const emit = defineEmits(["edit", "delete", "add-activity"]);
const formatDate = (d) => {