mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-08-09 03:25:57 +00:00
refactor: update axios client import, enhance device and payment handling, and add cancel payment button component
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 6m28s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 6m28s
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { getPayment } from "@/actions/payment";
|
||||
import { authOptions } from "@/app/auth";
|
||||
import CancelPaymentButton from "@/components/billing/cancel-payment-button";
|
||||
import DevicesToPay from "@/components/devices-to-pay";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { tryCatch } from "@/utils/tryCatch";
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { headers } from "next/headers";
|
||||
import React from "react";
|
||||
export default async function PaymentPage({
|
||||
params,
|
||||
}: {
|
||||
@@ -16,22 +17,25 @@ export default async function PaymentPage({
|
||||
const paymentId = (await params).paymentId;
|
||||
const [error, payment] = await tryCatch(getPayment({ id: paymentId }));
|
||||
if (error) {
|
||||
return <div>Error getting payment: {error.message}</div>;
|
||||
return <span>Error getting payment: {error.message}</span>;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<div className="flex justify-between items-center border-[1px] rounded-md border-dashed font-bold title-bg py-4 px-2 mb-4">
|
||||
<div className="flex justify-between items-center border-[1px] rounded-md border-dashed font-bold title-bg py-4 px-4 mb-4 mx-2">
|
||||
<h3 className="text-sarLinkOrange text-2xl">Payment</h3>
|
||||
<span
|
||||
className={cn(
|
||||
"text-sm border px-4 py-2 rounded-md uppercase font-semibold",
|
||||
payment?.paid
|
||||
? "text-green-500 bg-green-500/20"
|
||||
: "text-yellow-500 bg-yellow-700",
|
||||
)}
|
||||
>
|
||||
{payment?.paid ? "Paid" : "Pending"}
|
||||
</span>
|
||||
<div className="flex gap-4 items-center">
|
||||
<span
|
||||
className={cn(
|
||||
"text-sm border px-4 py-2 rounded-md uppercase font-semibold",
|
||||
payment?.paid
|
||||
? "text-green-500 bg-green-500/20"
|
||||
: "text-yellow-500 bg-yellow-700",
|
||||
)}
|
||||
>
|
||||
{payment?.paid ? "Paid" : "Pending"}
|
||||
</span>
|
||||
<CancelPaymentButton paymentId={paymentId} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
Reference in New Issue
Block a user