58 lines
1.8 KiB
Vue
58 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|||
|
|
import { onMounted, ref } from 'vue';
|
||
|
|
import { api } from '@/lib/api';
|
||
|
|
import { UiPageHeader } from '@/components/ui';
|
||
|
|
import TreasuryNav from '@/components/treasury/TreasuryNav.vue';
|
||
|
|
import { formatJalaliNumeric } from '@/lib/jalali';
|
||
|
|
|
||
|
|
type Row = {
|
||
|
|
id: string;
|
||
|
|
action: string;
|
||
|
|
entityType: string;
|
||
|
|
createdAt: string;
|
||
|
|
before: unknown;
|
||
|
|
after: unknown;
|
||
|
|
};
|
||
|
|
|
||
|
|
const rows = ref<Row[]>([]);
|
||
|
|
const error = ref('');
|
||
|
|
const actionLabel: Record<string, string> = {
|
||
|
|
settle: 'تسویه سند',
|
||
|
|
cash_post: 'نشستن وجه در حساب',
|
||
|
|
};
|
||
|
|
|
||
|
|
onMounted(async () => {
|
||
|
|
try {
|
||
|
|
const { data } = await api.get<Row[]>('/treasury/audit');
|
||
|
|
rows.value = data;
|
||
|
|
} catch {
|
||
|
|
error.value = 'سوابق بارگذاری نشد.';
|
||
|
|
}
|
||
|
|
});
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<template>
|
||
|
|
<section class="page">
|
||
|
|
<UiPageHeader title="سوابق تغییرات مالی" description="تسویه سند و نشستن وجه در صندوق، با مقدار ثبتشده." />
|
||
|
|
<TreasuryNav />
|
||
|
|
<p v-if="error" class="err">{{ error }}</p>
|
||
|
|
<p v-if="!error && !rows.length" class="muted">سابقهای نیست.</p>
|
||
|
|
<article v-for="row in rows" :key="row.id">
|
||
|
|
<header>
|
||
|
|
<strong>{{ actionLabel[row.action] ?? row.action }}</strong>
|
||
|
|
<time>{{ formatJalaliNumeric(new Date(row.createdAt)) }}</time>
|
||
|
|
</header>
|
||
|
|
<pre>{{ JSON.stringify(row.after ?? row.before, null, 2) }}</pre>
|
||
|
|
</article>
|
||
|
|
</section>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.page { display: grid; gap: 0.8rem; }
|
||
|
|
article { background: #fff; border: 1px solid #e7eef2; border-radius: 14px; padding: 0.8rem 1rem; }
|
||
|
|
header { display: flex; justify-content: space-between; gap: 0.75rem; }
|
||
|
|
time, .muted { color: #64748b; }
|
||
|
|
pre { margin: 0.45rem 0 0; white-space: pre-wrap; font: inherit; color: #334155; }
|
||
|
|
.err { color: #b91c1c; font-weight: 700; }
|
||
|
|
</style>
|