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
+64 -25
View File
@@ -1,30 +1,39 @@
<script setup>
import AppLayout from '@/Layouts/AppLayout.vue'
import SectionTitle from '@/Components/SectionTitle.vue'
import DataTableServer from '@/Components/DataTable/DataTableServer.vue'
import { Link, router } from '@inertiajs/vue3'
import AppLayout from "@/Layouts/AppLayout.vue";
import SectionTitle from "@/Components/SectionTitle.vue";
import DataTableServer from "@/Components/DataTable/DataTableServer.vue";
import { Link, router } from "@inertiajs/vue3";
const props = defineProps({
activities: { type: Object, required: true },
today: { type: String, required: true },
})
});
function fmtDate(d) {
if (!d) return ''
try { return new Date(d).toLocaleDateString('sl-SI') } catch { return String(d) }
if (!d) return "";
try {
return new Date(d).toLocaleDateString("sl-SI");
} catch {
return String(d);
}
}
function fmtEUR(value) {
if (value === null || value === undefined) return '—'
const num = typeof value === 'string' ? Number(value) : 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)
return formatted.replace('\u00A0', ' ')
if (value === null || value === undefined) return "—";
const num = typeof value === "string" ? Number(value) : 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);
return formatted.replace("\u00A0", " ");
}
async function markRead(id) {
try {
await window.axios.post(route('notifications.activity.read'), { activity_id: id })
router.reload({ only: ['activities'] })
await window.axios.post(route("notifications.activity.read"), { activity_id: id });
router.reload({ only: ["activities"] });
} catch (e) {}
}
</script>
@@ -45,8 +54,14 @@ async function markRead(id) {
<DataTableServer
:columns="[
{ key: 'what', label: 'Kaj', sortable: false },
{ key: 'balance', label: 'Stanje', sortable: false, align: 'right', class: 'w-40' },
{ key: 'what', label: 'Zadeva', sortable: false },
{
key: 'balance',
label: 'Stanje',
sortable: false,
align: 'right',
class: 'w-40',
},
{ key: 'due', label: 'Zapadlost', sortable: true, class: 'w-28' },
]"
:rows="activities.data || []"
@@ -64,23 +79,39 @@ async function markRead(id) {
<div class="font-medium text-gray-800 truncate">
<template v-if="row.contract?.uuid">
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">
{{ row.contract?.reference || '' }}
<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"
>
{{ row.contract?.reference || "—" }}
</Link>
<span v-else>{{ row.contract?.reference || '' }}</span>
<span v-else>{{ row.contract?.reference || "" }}</span>
</template>
<template v-else>
Primer:
<Link 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
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>
<span v-else>{{ row.client_case?.person?.full_name || '' }}</span>
<span v-else>{{ row.client_case?.person?.full_name || "" }}</span>
</template>
</div>
</template>
<template #cell-balance="{ row }">
<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>
</div>
</template>
@@ -88,10 +119,18 @@ async function markRead(id) {
{{ fmtDate(row.due_date) }}
</template>
<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 #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>
</DataTableServer>
</div>