diff --git a/app/Exports/ClientContractsExport.php b/app/Exports/ClientContractsExport.php
index 2153f74..226c3e7 100644
--- a/app/Exports/ClientContractsExport.php
+++ b/app/Exports/ClientContractsExport.php
@@ -34,6 +34,7 @@ class ClientContractsExport extends DefaultValueBinder implements FromQuery, Sho
public const COLUMN_METADATA = [
'reference' => ['label' => 'Referenca'],
'customer' => ['label' => 'Stranka'],
+ 'address' => ['label' => 'Naslov'],
'start' => ['label' => 'Začetek'],
'segment' => ['label' => 'Segment'],
'balance' => ['label' => 'Stanje'],
@@ -105,6 +106,7 @@ private function resolveValue(Contract $contract, string $column): mixed
return match ($column) {
'reference' => $contract->reference,
'customer' => optional($contract->clientCase?->person)->full_name,
+ 'address' => optional($contract->clientCase?->person?->address)->address,
'start' => $this->formatDate($contract->start_date),
'segment' => $contract->segments?->first()?->name,
'balance' => optional($contract->account)->balance_amount,
diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php
index 4ccccbb..5f365f5 100644
--- a/app/Http/Controllers/ClientController.php
+++ b/app/Http/Controllers/ClientController.php
@@ -132,6 +132,7 @@ public function contracts(Client $client, Request $request)
->with([
'clientCase:id,uuid,person_id',
'clientCase.person:id,full_name',
+ 'clientCase.person.address',
'segments' => function ($q) {
$q->wherePivot('active', true)->select('segments.id', 'segments.name');
},
@@ -197,6 +198,7 @@ public function exportContracts(ExportClientContractsRequest $request, Client $c
->with([
'clientCase:id,uuid,person_id',
'clientCase.person:id,full_name',
+ 'clientCase.person.address',
'segments' => function ($q) {
$q->wherePivot('active', true)->select('segments.id', 'segments.name');
},
diff --git a/resources/js/Pages/Client/Contracts.vue b/resources/js/Pages/Client/Contracts.vue
index ea74a0b..9e7c5ae 100644
--- a/resources/js/Pages/Client/Contracts.vue
+++ b/resources/js/Pages/Client/Contracts.vue
@@ -34,13 +34,14 @@ const segmentForm = useForm({ segment_id: null, contracts: [] });
const exportDialogOpen = ref(false);
const exportScope = ref("current");
-const exportColumns = ref(["reference", "customer", "start", "segment", "balance"]);
+const exportColumns = ref(["reference", "customer", "address", "start", "segment", "balance"]);
const exportError = ref("");
const isExporting = ref(false);
const exportableColumns = [
{ key: "reference", label: "Referenca" },
{ key: "customer", label: "Stranka" },
+ { key: "address", label: "Naslov" },
{ key: "start", label: "Začetek" },
{ key: "segment", label: "Segment" },
{ key: "balance", label: "Stanje" },
@@ -445,6 +446,7 @@ function extractFilenameFromHeaders(headers) {
{ key: 'select', label: '', sortable: false, width: '50px' },
{ key: 'reference', label: 'Referenca', sortable: false },
{ key: 'customer', label: 'Stranka', sortable: false },
+ { key: 'address', label: 'Naslov', sortable: false },
{ key: 'start', label: 'Začetek', sortable: false },
{ key: 'segment', label: 'Segment', sortable: false },
{ key: 'balance', label: 'Stanje', sortable: false, align: 'right' },
@@ -545,6 +547,9 @@ function extractFilenameFromHeaders(headers) {
{{ row.client_case?.person?.full_name || "-" }}
+
+ {{ row.client_case?.person?.address?.address || "-" }}
+
{{ formatDate(row.start_date) }}