feat: Implement Ledgers CRUD
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<script setup>
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { Head, Link } from '@inertiajs/vue3';
|
||||
import { route } from 'ziggy-js';
|
||||
|
||||
const props = defineProps({
|
||||
dynamic: Object,
|
||||
ledger: Object,
|
||||
});
|
||||
|
||||
const breadcrumbs = [
|
||||
{
|
||||
name: 'Dynamics',
|
||||
href: route('dynamics.index'),
|
||||
},
|
||||
{
|
||||
name: props.dynamic.name,
|
||||
href: route('dynamics.show', props.dynamic.id),
|
||||
},
|
||||
{
|
||||
name: props.ledger.name,
|
||||
href: route('dynamics.ledgers.show', { dynamic: props.dynamic.id, ledger: props.ledger.id }),
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="ledger.name" />
|
||||
|
||||
<AppLayout :breadcrumbs="breadcrumbs">
|
||||
<div class="py-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
||||
<div class="p-6 text-gray-900 dark:text-gray-100">
|
||||
<h3 class="text-lg font-medium">{{ ledger.name }}</h3>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">Score: {{ ledger.score }}</p>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">{{ ledger.rules }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-8">
|
||||
<h4 class="text-lg font-medium text-gray-900 dark:text-gray-100">Mutations</h4>
|
||||
<ul class="mt-4 space-y-4">
|
||||
<li v-for="mutation in ledger.mutations" :key="mutation.id" class="p-4 bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
||||
<div class="flex justify-between">
|
||||
<span class="font-semibold">{{ mutation.user.name }}</span>
|
||||
<span :class="{
|
||||
'text-green-500': mutation.amount > 0,
|
||||
'text-red-500': mutation.amount < 0,
|
||||
}">{{ mutation.amount > 0 ? '+' : '' }}{{ mutation.amount }}</span>
|
||||
</div>
|
||||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">{{ mutation.description }}</p>
|
||||
<div class="mt-2 text-xs text-gray-500">{{ new Date(mutation.created_at).toLocaleString() }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="ledger.mutations.length === 0" class="mt-4 text-gray-500">
|
||||
No mutations found for this ledger.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
Reference in New Issue
Block a user