Initial commit
This commit is contained in:
45
app/(dashboard)/dashboard/payment-methods/page.tsx
Normal file
45
app/(dashboard)/dashboard/payment-methods/page.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { PaymentMethodsForm } from "@/components/dashboard/payment-methods-form";
|
||||
import { PaymentMethodsList } from "@/components/dashboard/payment-methods-list";
|
||||
import { db } from "@/lib/db";
|
||||
import { requireCurrentUser } from "@/lib/session";
|
||||
|
||||
export default async function DashboardPaymentMethodsPage() {
|
||||
const user = await requireCurrentUser();
|
||||
|
||||
const profile = await db.profile.findUnique({
|
||||
where: { userId: user.id },
|
||||
include: {
|
||||
paymentMethods: {
|
||||
select: {
|
||||
id: true,
|
||||
type: true,
|
||||
label: true,
|
||||
value: true,
|
||||
network: true,
|
||||
description: true,
|
||||
sortOrder: true,
|
||||
isVisible: true
|
||||
},
|
||||
orderBy: [{ sortOrder: "asc" }, { createdAt: "asc" }]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!profile) {
|
||||
return <p className="text-sm text-red-300">Profile not found.</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<header className="space-y-2">
|
||||
<h1 className="text-2xl font-semibold">Payment Methods</h1>
|
||||
<p className="text-sm text-muted">
|
||||
Add, edit, reorder, and toggle payment methods. Validation is format-based only and not authoritative.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<PaymentMethodsForm />
|
||||
<PaymentMethodsList methods={profile.paymentMethods} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user