mirror of
https://codeberg.org/MarkusThielker/finances.git
synced 2025-07-04 03:59:18 +00:00
N-FIN-7: add payment page UI
This commit is contained in:
parent
8941760827
commit
e0b3063916
2 changed files with 230 additions and 3 deletions
|
@ -1,7 +1,63 @@
|
|||
import { getUser } from '@/auth';
|
||||
import { prismaClient } from '@/prisma';
|
||||
import React from 'react';
|
||||
import PaymentPageClientContent from '@/components/paymentPageClientComponents';
|
||||
import paymentCreateUpdate from '@/lib/actions/paymentCreateUpdate';
|
||||
import paymentDelete from '@/lib/actions/paymentDelete';
|
||||
|
||||
export default async function PaymentsPage() {
|
||||
|
||||
const user = await getUser();
|
||||
|
||||
const payments = await prismaClient.payment.findMany({
|
||||
where: {
|
||||
userId: user?.id,
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
date: 'desc',
|
||||
},
|
||||
{
|
||||
id: 'desc',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const entities = await prismaClient.entity.findMany({
|
||||
where: {
|
||||
userId: user?.id,
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
name: 'asc',
|
||||
},
|
||||
{
|
||||
id: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const categories = await prismaClient.category.findMany({
|
||||
where: {
|
||||
userId: user?.id,
|
||||
},
|
||||
orderBy: [
|
||||
{
|
||||
name: 'asc',
|
||||
},
|
||||
{
|
||||
id: 'asc',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
return (
|
||||
<main className="flex items-center justify-center min-h-screen text-3xl">
|
||||
Payments
|
||||
</main>
|
||||
<PaymentPageClientContent
|
||||
payments={payments}
|
||||
entities={entities}
|
||||
categories={categories}
|
||||
onSubmit={paymentCreateUpdate}
|
||||
onDelete={paymentDelete}
|
||||
className="flex flex-col justify-center space-y-4 p-10"/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue