Implement Omada device management and enhance payment processing

- Added new omada-actions.ts file to handle fetching and updating device groups in Omada.
- Updated authMiddleware to include new payment routes.
- Enhanced createPayment function to add devices to a group upon successful payment verification.
- Improved payment verification process to include device management.
- Refactored PaymentsTable and DevicesToPay components for better UI and state handling.
- Removed unused hasSession function from auth-guard.ts for cleaner code.
This commit is contained in:
2024-12-13 11:24:13 +05:00
parent 36f22c0614
commit e9d81c089a
7 changed files with 222 additions and 25 deletions

View File

@ -11,6 +11,7 @@ import {
import prisma from "@/lib/db";
import Link from "next/link";
import { cn } from "@/lib/utils";
import { Calendar } from "lucide-react";
import Pagination from "./pagination";
import { Badge } from "./ui/badge";
@ -96,7 +97,7 @@ export async function PaymentsTable({
{payments.map((payment) => (
<TableRow key={payment.id}>
<TableCell>
<div className="flex flex-col items-start title-bg border rounded p-2">
<div className={cn("flex flex-col items-start title-bg border rounded p-2", payment?.paid ? "bg-green-500/10 border-dashed border-green=500" : "bg-yellow-500/10 border-dashed border-yellow-500 dark:border-yellow-500/50")}>
<div className="flex items-center gap-2">
<Calendar size={16} opacity={0.5} />
<span className="text-muted-foreground">
@ -114,7 +115,7 @@ export async function PaymentsTable({
View Details
</Button>
</Link>
<Badge className="p-2" variant={payment.paid ? "outline" : "secondary"}>
<Badge className={cn(payment?.paid ? "text-green-500 bg-green-500/20" : "text-yellow-500 bg-yellow-500/20")} variant={payment.paid ? "outline" : "secondary"}>
{payment.paid ? "Paid" : "Unpaid"}
</Badge>
</div>