162 lines
5.2 KiB
Vue
162 lines
5.2 KiB
Vue
<script setup lang="ts">
|
|
import { Head, Link } from '@inertiajs/vue3';
|
|
import { route } from 'ziggy-js';
|
|
|
|
defineOptions({
|
|
layout: (props: any) => ({
|
|
breadcrumbs: [
|
|
{
|
|
title: 'Dynamics',
|
|
href: route('dynamics.index'),
|
|
},
|
|
{
|
|
title: props.dynamic.name,
|
|
href: route('dynamics.show', props.dynamic.id),
|
|
},
|
|
{
|
|
title: props.participant.display_name ?? props.participant.name,
|
|
href: route('dynamics.users.show', [
|
|
props.dynamic.id,
|
|
props.participant.id,
|
|
]),
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
|
|
const props = defineProps<{
|
|
dynamic: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
participant: {
|
|
id: number;
|
|
name: string;
|
|
display_name: string | null;
|
|
role: string;
|
|
};
|
|
mutations: Array<{
|
|
id: number;
|
|
amount: number;
|
|
description: string;
|
|
status: string;
|
|
created_at: string;
|
|
ledger: { id: number; name: string };
|
|
}>;
|
|
}>();
|
|
</script>
|
|
|
|
<template>
|
|
<Head :title="participant.display_name ?? participant.name" />
|
|
|
|
<div class="c-participant-show">
|
|
<div class="c-participant-show__container">
|
|
<h2 class="c-participant-show__title">
|
|
Activity for
|
|
{{ participant.display_name ?? participant.name }} ({{
|
|
participant.role.toUpperCase()
|
|
}}) in {{ dynamic.name }}
|
|
</h2>
|
|
|
|
<div class="c-participant-show__activity-list">
|
|
<div
|
|
v-for="mutation in mutations"
|
|
:key="mutation.id"
|
|
class="c-participant-show__activity-item"
|
|
>
|
|
<Link
|
|
:href="
|
|
route('dynamics.ledgers.show', [
|
|
dynamic.id,
|
|
mutation.ledger.id,
|
|
])
|
|
"
|
|
class="block"
|
|
>
|
|
<div class="c-participant-show__activity-meta">
|
|
<span class="c-participant-show__activity-time">
|
|
{{
|
|
new Date(
|
|
mutation.created_at,
|
|
).toLocaleString()
|
|
}}
|
|
</span>
|
|
<span
|
|
class="ml-2 font-semibold"
|
|
:class="
|
|
mutation.amount > 0
|
|
? 'text-green-600 dark:text-green-400'
|
|
: 'text-red-600 dark:text-red-400'
|
|
"
|
|
>
|
|
{{ mutation.amount > 0 ? '+' : ''
|
|
}}{{ mutation.amount }}
|
|
</span>
|
|
<span class="ml-2 text-neutral-400"
|
|
>on {{ mutation.ledger.name }}</span
|
|
>
|
|
<span
|
|
class="ml-auto rounded px-1.5 py-0.5 text-xs uppercase"
|
|
:class="
|
|
mutation.status === 'approved'
|
|
? 'bg-green-100 text-green-700 dark:bg-green-950/30 dark:text-green-400'
|
|
: 'bg-yellow-100 text-yellow-700 dark:bg-yellow-950/30 dark:text-yellow-400'
|
|
"
|
|
>
|
|
{{ mutation.status }}
|
|
</span>
|
|
</div>
|
|
<p class="c-participant-show__activity-desc">
|
|
{{ mutation.description }}
|
|
</p>
|
|
</Link>
|
|
</div>
|
|
<div
|
|
v-if="mutations.length === 0"
|
|
class="text-sm text-neutral-500"
|
|
>
|
|
No mutations recorded for this participant in this Dynamic
|
|
yet.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
@reference "../../../../css/app.css";
|
|
|
|
.c-participant-show {
|
|
@apply py-12;
|
|
}
|
|
|
|
.c-participant-show__container {
|
|
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
|
}
|
|
|
|
.c-participant-show__title {
|
|
@apply mb-6 text-xl font-bold tracking-tight text-neutral-900 dark:text-neutral-100;
|
|
}
|
|
|
|
.c-participant-show__activity-list {
|
|
@apply space-y-4;
|
|
}
|
|
|
|
.c-participant-show__activity-item {
|
|
@apply rounded-lg border p-4 transition-colors hover:bg-neutral-50 dark:border-neutral-800 dark:hover:bg-neutral-900;
|
|
background-color: var(--card);
|
|
}
|
|
|
|
.c-participant-show__activity-meta {
|
|
@apply mb-1.5 flex items-center text-xs;
|
|
}
|
|
|
|
.c-participant-show__activity-time {
|
|
@apply text-neutral-400 dark:text-neutral-500;
|
|
}
|
|
|
|
.c-participant-show__activity-desc {
|
|
@apply mt-1 text-sm text-neutral-600 dark:text-neutral-400;
|
|
}
|
|
</style>
|