Some changes to UI and emails are now searchable

This commit is contained in:
Simon Pocrnjič 2025-10-17 21:22:30 +02:00
parent 04f31e62aa
commit 761799bdbe
4 changed files with 85 additions and 28 deletions

View File

@ -68,7 +68,7 @@ protected static function booted()
protected function makeAllSearchableUsing(Builder $query): Builder protected function makeAllSearchableUsing(Builder $query): Builder
{ {
return $query->with(['addresses', 'phones']); return $query->with(['addresses', 'phones', 'emails']);
} }
public function toSearchableArray(): array public function toSearchableArray(): array
@ -79,6 +79,7 @@ public function toSearchableArray(): array
'full_name' => '', 'full_name' => '',
'person_addresses.address' => '', 'person_addresses.address' => '',
'person_phones.nu' => '', 'person_phones.nu' => '',
'emails.value' => '',
]; ];
} }

View File

@ -93,6 +93,7 @@ const confirmDeleteAction = () => {
> >
<thead> <thead>
<tr> <tr>
<th></th>
<th>Pogodba</th> <th>Pogodba</th>
<th>Odločitev</th> <th>Odločitev</th>
<th>Opomba</th> <th>Opomba</th>
@ -107,6 +108,15 @@ const confirmDeleteAction = () => {
:key="row.id" :key="row.id"
class="border-b last:border-b-0" class="border-b last:border-b-0"
> >
<td class="py-2 decision-dot text-center">
<span
v-if="row.decision?.color_tag"
class="inline-block h-4 w-4 rounded-full ring-1 ring-gray-300 dark:ring-gray-600"
:style="{ backgroundColor: row.decision?.color_tag }"
:title="row.decision?.color_tag"
aria-hidden="true"
></span>
</td>
<td class="py-2 pr-4 align-top"> <td class="py-2 pr-4 align-top">
<template v-if="row.contract?.reference"> <template v-if="row.contract?.reference">
{{ row.contract.reference }} {{ row.contract.reference }}
@ -115,6 +125,7 @@ const confirmDeleteAction = () => {
<span class="text-gray-400"></span> <span class="text-gray-400"></span>
</template> </template>
</td> </td>
<td class="py-2 pr-4 align-top"> <td class="py-2 pr-4 align-top">
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
<span <span
@ -257,6 +268,10 @@ const confirmDeleteAction = () => {
vertical-align: top; vertical-align: top;
padding: 0.625rem 1rem; /* match header horizontal padding */ padding: 0.625rem 1rem; /* match header horizontal padding */
} }
/* Center the decision dot in its column */
.activity-basic-table td.decision-dot {
vertical-align: middle;
}
/* Ensure first column lines up exactly (no extra offset) */ /* Ensure first column lines up exactly (no extra offset) */
.activity-basic-table th:first-child, .activity-basic-table th:first-child,
.activity-basic-table td:first-child { .activity-basic-table td:first-child {
@ -268,11 +283,11 @@ const confirmDeleteAction = () => {
/* Column sizing hints (optional fine tuning) */ /* Column sizing hints (optional fine tuning) */
.activity-basic-table th:nth-child(1), .activity-basic-table th:nth-child(1),
.activity-basic-table td:nth-child(1) { .activity-basic-table td:nth-child(1) {
width: 14%; width: 6%;
} }
.activity-basic-table th:nth-child(2), .activity-basic-table th:nth-child(2),
.activity-basic-table td:nth-child(2) { .activity-basic-table td:nth-child(2) {
width: 16%; width: 14%;
} }
.activity-basic-table th:nth-child(3), .activity-basic-table th:nth-child(3),
.activity-basic-table td:nth-child(3) { .activity-basic-table td:nth-child(3) {

View File

@ -1,30 +1,39 @@
<script setup> <script setup>
import AppLayout from '@/Layouts/AppLayout.vue' import AppLayout from "@/Layouts/AppLayout.vue";
import SectionTitle from '@/Components/SectionTitle.vue' import SectionTitle from "@/Components/SectionTitle.vue";
import DataTableServer from '@/Components/DataTable/DataTableServer.vue' import DataTableServer from "@/Components/DataTable/DataTableServer.vue";
import { Link, router } from '@inertiajs/vue3' import { Link, router } from "@inertiajs/vue3";
const props = defineProps({ const props = defineProps({
activities: { type: Object, required: true }, activities: { type: Object, required: true },
today: { type: String, required: true }, today: { type: String, required: true },
}) });
function fmtDate(d) { function fmtDate(d) {
if (!d) return '' if (!d) return "";
try { return new Date(d).toLocaleDateString('sl-SI') } catch { return String(d) } try {
return new Date(d).toLocaleDateString("sl-SI");
} catch {
return String(d);
}
} }
function fmtEUR(value) { function fmtEUR(value) {
if (value === null || value === undefined) return '—' if (value === null || value === undefined) return "—";
const num = typeof value === 'string' ? Number(value) : value const num = typeof value === "string" ? Number(value) : value;
if (Number.isNaN(num)) return String(value) if (Number.isNaN(num)) return String(value);
const formatted = new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR', minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(num) const formatted = new Intl.NumberFormat("de-DE", {
return formatted.replace('\u00A0', ' ') style: "currency",
currency: "EUR",
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(num);
return formatted.replace("\u00A0", " ");
} }
async function markRead(id) { async function markRead(id) {
try { try {
await window.axios.post(route('notifications.activity.read'), { activity_id: id }) await window.axios.post(route("notifications.activity.read"), { activity_id: id });
router.reload({ only: ['activities'] }) router.reload({ only: ["activities"] });
} catch (e) {} } catch (e) {}
} }
</script> </script>
@ -45,8 +54,14 @@ async function markRead(id) {
<DataTableServer <DataTableServer
:columns="[ :columns="[
{ key: 'what', label: 'Kaj', sortable: false }, { key: 'what', label: 'Zadeva', sortable: false },
{ key: 'balance', label: 'Stanje', sortable: false, align: 'right', class: 'w-40' }, {
key: 'balance',
label: 'Stanje',
sortable: false,
align: 'right',
class: 'w-40',
},
{ key: 'due', label: 'Zapadlost', sortable: true, class: 'w-28' }, { key: 'due', label: 'Zapadlost', sortable: true, class: 'w-28' },
]" ]"
:rows="activities.data || []" :rows="activities.data || []"
@ -64,23 +79,39 @@ async function markRead(id) {
<div class="font-medium text-gray-800 truncate"> <div class="font-medium text-gray-800 truncate">
<template v-if="row.contract?.uuid"> <template v-if="row.contract?.uuid">
Pogodba: Pogodba:
<Link v-if="row.contract?.client_case?.uuid" :href="route('clientCase.show', { client_case: row.contract.client_case.uuid })" class="text-indigo-600 hover:underline"> <Link
{{ row.contract?.reference || '—' }} v-if="row.contract?.client_case?.uuid"
:href="
route('clientCase.show', {
client_case: row.contract.client_case.uuid,
})
"
class="text-indigo-600 hover:underline"
>
{{ row.contract?.reference || "—" }}
</Link> </Link>
<span v-else>{{ row.contract?.reference || '' }}</span> <span v-else>{{ row.contract?.reference || "" }}</span>
</template> </template>
<template v-else> <template v-else>
Primer: Primer:
<Link v-if="row.client_case?.uuid" :href="route('clientCase.show', { client_case: row.client_case.uuid })" class="text-indigo-600 hover:underline"> <Link
{{ row.client_case?.person?.full_name || '—' }} v-if="row.client_case?.uuid"
:href="
route('clientCase.show', { client_case: row.client_case.uuid })
"
class="text-indigo-600 hover:underline"
>
{{ row.client_case?.person?.full_name || "—" }}
</Link> </Link>
<span v-else>{{ row.client_case?.person?.full_name || '' }}</span> <span v-else>{{ row.client_case?.person?.full_name || "" }}</span>
</template> </template>
</div> </div>
</template> </template>
<template #cell-balance="{ row }"> <template #cell-balance="{ row }">
<div class="text-right"> <div class="text-right">
<span v-if="row.contract">{{ fmtEUR(row.contract?.account?.balance_amount) }}</span> <span v-if="row.contract">{{
fmtEUR(row.contract?.account?.balance_amount)
}}</span>
<span v-else></span> <span v-else></span>
</div> </div>
</template> </template>
@ -88,10 +119,18 @@ async function markRead(id) {
{{ fmtDate(row.due_date) }} {{ fmtDate(row.due_date) }}
</template> </template>
<template #actions="{ row }"> <template #actions="{ row }">
<button type="button" class="text-[12px] text-gray-500 hover:text-gray-700" @click="markRead(row.id)">Označi kot prikazano</button> <button
type="button"
class="text-[12px] text-gray-500 hover:text-gray-700"
@click="markRead(row.id)"
>
Označi kot prebrano
</button>
</template> </template>
<template #empty> <template #empty>
<div class="p-6 text-center text-gray-500">Trenutno ni neprikazanih obvestil.</div> <div class="p-6 text-center text-gray-500">
Trenutno ni neprikazanih obvestil.
</div>
</template> </template>
</DataTableServer> </DataTableServer>
</div> </div>

View File

@ -119,6 +119,7 @@
$builder->join('clients', 'person.id', '=', 'clients.person_id') $builder->join('clients', 'person.id', '=', 'clients.person_id')
->leftJoin('person_addresses', 'person.id', '=', 'person_addresses.person_id') ->leftJoin('person_addresses', 'person.id', '=', 'person_addresses.person_id')
->leftJoin('person_phones', 'person.id', '=', 'person_phones.person_id') ->leftJoin('person_phones', 'person.id', '=', 'person_phones.person_id')
->leftJoin('emails', 'person.id', '=', 'emails.person_id')
->select('person.*', 'clients.uuid as client_uuid') ->select('person.*', 'clients.uuid as client_uuid')
->limit($request->input('limit')); ->limit($request->input('limit'));
}) })
@ -129,6 +130,7 @@
$builder->join('client_cases', 'person.id', '=', 'client_cases.person_id') $builder->join('client_cases', 'person.id', '=', 'client_cases.person_id')
->leftJoin('person_addresses', 'person.id', '=', 'person_addresses.person_id') ->leftJoin('person_addresses', 'person.id', '=', 'person_addresses.person_id')
->leftJoin('person_phones', 'person.id', '=', 'person_phones.person_id') ->leftJoin('person_phones', 'person.id', '=', 'person_phones.person_id')
->leftJoin('emails', 'person.id', '=', 'emails.person_id')
->select('person.*', 'client_cases.uuid as case_uuid', 'client_cases.id as case_id') ->select('person.*', 'client_cases.uuid as case_uuid', 'client_cases.id as case_id')
->limit($request->input('limit')); ->limit($request->input('limit'));
}) })