", device.name);
- console.log("paid date -> ", device.payments[0]?.paidAt);
- console.log("no of months paid -> ", device.payments[0]?.numberOfMonths);
- console.log("calculated expire date -> ", expiryDate);
- console.log("notification threshold -> ", notificationThreshold);
- console.log("current date -> ", currentDate);
+ // console.log("device name -> ", device.name);
+ // console.log("paid date -> ", device.payments[0]?.paidAt);
+ // console.log("no of months paid -> ", device.payments[0]?.numberOfMonths);
+ // console.log("calculated expire date -> ", expiryDate);
+ // console.log("notification threshold -> ", notificationThreshold);
+ // console.log("current date -> ", currentDate);
- // Check if device is within notification period
- if (
- isWithinInterval(currentDate, {
- start: notificationThreshold,
- end: expiryDate,
- })
- ) {
- // Device is within 5 days of expiring
- if (device.User?.phoneNumber) {
- await sendNotifySms(
- new Date(expiryDate),
- device.User?.phoneNumber ?? "",
- device.name,
- );
- devicesNeedingNotification++;
- }
- }
+ // // Check if device is within notification period
+ // if (
+ // isWithinInterval(currentDate, {
+ // start: notificationThreshold,
+ // end: expiryDate,
+ // })
+ // ) {
+ // // Device is within 5 days of expiring
+ // if (device.User?.phoneNumber) {
+ // await sendNotifySms(
+ // new Date(expiryDate),
+ // device.User?.phoneNumber ?? "",
+ // device.name,
+ // );
+ // devicesNeedingNotification++;
+ // }
+ // }
- // Check if device has expired
- if (isAfter(currentDate, expiryDate)) {
- // Device has expired, block it
- // TODO: add a reason for blocking
- await blockDevice({
- macAddress: device.mac,
- type: "block",
- });
- await prisma.device.update({
- where: { id: device.id },
- data: {
- isActive: false,
- blocked: true,
- },
- });
- devicesBlocked++;
- }
- }
+ // // Check if device has expired
+ // if (isAfter(currentDate, expiryDate)) {
+ // // Device has expired, block it
+ // // TODO: add a reason for blocking
+ // await blockDevice({
+ // macAddress: device.mac,
+ // type: "block",
+ // });
+ // await prisma.device.update({
+ // where: { id: device.id },
+ // data: {
+ // isActive: false,
+ // blocked: true,
+ // },
+ // });
+ // devicesBlocked++;
+ // }
+ // }
- if (hoursSinceLastRun < 24) {
- return Response.json({
- totalActiveDevices: devices.length,
- devicesChecked: {
- notified: devicesNeedingNotification,
- blocked: devicesBlocked,
- },
- message: "Check was run recently",
- nextCheckIn: `${Math.round(24 - hoursSinceLastRun)} hours`,
- });
- }
+ // if (hoursSinceLastRun < 24) {
+ // return Response.json({
+ // totalActiveDevices: devices.length,
+ // devicesChecked: {
+ // notified: devicesNeedingNotification,
+ // blocked: devicesBlocked,
+ // },
+ // message: "Check was run recently",
+ // nextCheckIn: `${Math.round(24 - hoursSinceLastRun)} hours`,
+ // });
+ // }
- return Response.json({
- success: true,
- totalActiveDevices: devices.length,
- devicesChecked: {
- notified: devicesNeedingNotification,
- blocked: devicesBlocked,
- },
- runAt: currentTime,
- });
- } catch (error) {
- if (error instanceof Error) {
- if (error.message === "API key is missing") {
- return Response.json({ error: "API key is required" }, { status: 401 });
- }
- if (error.message === "Invalid API key") {
- return Response.json({ error: "Invalid API key" }, { status: 403 });
- }
- }
+ // return Response.json({
+ // success: true,
+ // totalActiveDevices: devices.length,
+ // devicesChecked: {
+ // notified: devicesNeedingNotification,
+ // blocked: devicesBlocked,
+ // },
+ // runAt: currentTime,
+ // });
+ // } catch (error) {
+ // if (error instanceof Error) {
+ // if (error.message === "API key is missing") {
+ // return Response.json({ error: "API key is required" }, { status: 401 });
+ // }
+ // if (error.message === "Invalid API key") {
+ // return Response.json({ error: "Invalid API key" }, { status: 403 });
+ // }
+ // }
- console.error("Error in device check:", error);
- return Response.json({ error: "Failed to check devices" }, { status: 500 });
- }
-}
-
-// Mock function - replace with your actual SMS implementation
-async function sendNotifySms(
- expireDate: Date,
- phoneNumber: string,
- deviceName?: string,
-) {
- const respose = await fetch(`${process.env.SMS_API_BASE_URL}/api/sms`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Bearer ${process.env.SMS_API_KEY}`,
- },
- body: JSON.stringify({
- check_delivery: false,
- number: phoneNumber,
- message: `REMINDER! Your device [${deviceName}] will expire on ${new Date(expireDate)}.`,
- }),
- });
- const data = await respose.json();
- console.log(data);
- return data;
- // Implement your SMS logic here
+ // console.error("Error in device check:", error);
+ // return Response.json({ error: "Failed to check devices" }, { status: 500 });
+ // }
+ // }
+
+ // // Mock function - replace with your actual SMS implementation
+ // async function sendNotifySms(
+ // expireDate: Date,
+ // phoneNumber: string,
+ // deviceName?: string,
+ // ) {
+ // const respose = await fetch(`${process.env.SMS_API_BASE_URL}/api/sms`, {
+ // method: "POST",
+ // headers: {
+ // "Content-Type": "application/json",
+ // Authorization: `Bearer ${process.env.SMS_API_KEY}`,
+ // },
+ // body: JSON.stringify({
+ // check_delivery: false,
+ // number: phoneNumber,
+ // message: `REMINDER! Your device [${deviceName}] will expire on ${new Date(expireDate)}.`,
+ // }),
+ // });
+ // const data = await respose.json();
+ // console.log(data);
+ // return data;
+ //
}
diff --git a/components/admin/admin-devices-table.tsx b/components/admin/admin-devices-table.tsx
index ea6b3f1..7dcd06b 100644
--- a/components/admin/admin-devices-table.tsx
+++ b/components/admin/admin-devices-table.tsx
@@ -8,8 +8,6 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
-import { auth } from "@/app/auth";
-import prisma from "@/lib/db";
import { headers } from "next/headers";
import Link from "next/link";
import BlockDeviceDialog from "../block-device-dialog";
@@ -27,178 +25,178 @@ export async function AdminDevicesTable({
}>;
parentalControl?: boolean;
}) {
- const session = await auth.api.getSession({
- headers: await headers(),
- });
- const isAdmin = session?.user.role === "ADMIN";
- const query = (await searchParams)?.query || "";
- const page = (await searchParams)?.page;
- const sortBy = (await searchParams)?.sortBy || "asc";
- const totalDevices = await prisma.device.count({
- where: {
- OR: [
- {
- name: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- mac: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- ],
- },
- });
+ // const session = await auth.api.getSession({
+ // headers: await headers(),
+ // });
+ // const isAdmin = session?.user.role === "ADMIN";
+ // const query = (await searchParams)?.query || "";
+ // const page = (await searchParams)?.page;
+ // const sortBy = (await searchParams)?.sortBy || "asc";
+ // const totalDevices = await prisma.device.count({
+ // where: {
+ // OR: [
+ // {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // mac: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // ],
+ // },
+ // });
- const totalPages = Math.ceil(totalDevices / 10);
- const limit = 10;
- const offset = (Number(page) - 1) * limit || 0;
+ // const totalPages = Math.ceil(totalDevices / 10);
+ // const limit = 10;
+ // const offset = (Number(page) - 1) * limit || 0;
- const devices = await prisma.device.findMany({
- where: {
- OR: [
- {
- name: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- mac: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- ],
- },
- include: {
- User: true,
- payments: true,
- },
- skip: offset,
- take: limit,
- orderBy: {
- name: `${sortBy}` as "asc" | "desc",
- },
- });
+ // const devices = await prisma.device.findMany({
+ // where: {
+ // OR: [
+ // {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // mac: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // ],
+ // },
+ // include: {
+ // User: true,
+ // payments: true,
+ // },
+ // skip: offset,
+ // take: limit,
+ // orderBy: {
+ // name: `${sortBy}` as "asc" | "desc",
+ // },
+ // });
+ return null;
+ // return (
+ //
+ // {devices.length === 0 ? (
+ //
+ //
No devices yet.
+ //
+ // ) : (
+ // <>
+ //
+ //
+ // Table of all devices.
+ //
+ //
+ // Device Name
+ // User
+ // MAC Address
+ // isActive
+ // blocked
+ // blockedBy
+ // expiryDate
+ //
+ //
+ //
+ // {devices.map((device) => (
+ //
+ //
+ //
+ //
+ // {device.name}
+ //
+ // {device.isActive && (
+ //
+ // Active until{" "}
+ // {new Date().toLocaleDateString("en-US", {
+ // month: "short",
+ // day: "2-digit",
+ // year: "numeric",
+ // })}
+ //
+ // )}
- return (
-
- {devices.length === 0 ? (
-
-
No devices yet.
-
- ) : (
- <>
-
-
- Table of all devices.
-
-
- Device Name
- User
- MAC Address
- isActive
- blocked
- blockedBy
- expiryDate
-
-
-
- {devices.map((device) => (
-
-
-
-
- {device.name}
-
- {device.isActive && (
-
- Active until{" "}
- {new Date().toLocaleDateString("en-US", {
- month: "short",
- day: "2-digit",
- year: "numeric",
- })}
-
- )}
+ // {device.blocked && (
+ //
+ //
Comment:
+ //
+ // blocked because he was watching youtube
+ //
+ //
+ // )}
+ //
+ //
+ //
+ // {device.User?.name}
+ //
- {device.blocked && (
-
-
Comment:
-
- blocked because he was watching youtube
-
-
- )}
-
-
-
- {device.User?.name}
-
-
- {device.mac}
-
- {device.isActive ? "Active" : "Inactive"}
-
-
- {device.blocked ? "Blocked" : "Not Blocked"}
-
-
- {device.blocked ? device.blockedBy : ""}
-
-
- {new Date().toLocaleDateString("en-US", {
- month: "short",
- day: "2-digit",
- year: "numeric",
- })}
-
-
-
-
-
- ))}
-
-
-
-
- {query.length > 0 && (
-
- Showing {devices.length} locations for "{query}
- "
-
- )}
-
-
- {totalDevices} devices
-
-
-
-
-
-
-
- {devices.map((device) => (
-
- ))}
-
- >
- )}
-
- );
+ //
{device.mac}
+ //
+ // {device.isActive ? "Active" : "Inactive"}
+ //
+ //
+ // {device.blocked ? "Blocked" : "Not Blocked"}
+ //
+ //
+ // {device.blocked ? device.blockedBy : ""}
+ //
+ //
+ // {new Date().toLocaleDateString("en-US", {
+ // month: "short",
+ // day: "2-digit",
+ // year: "numeric",
+ // })}
+ //
+ //
+ //
+ //
+ //
+ // ))}
+ //
+ //
+ //
+ //
+ // {query.length > 0 && (
+ //
+ // Showing {devices.length} locations for "{query}
+ // "
+ //
+ // )}
+ //
+ //
+ // {totalDevices} devices
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ // {devices.map((device) => (
+ //
+ // ))}
+ //
+ // >
+ // )}
+ //
+ // );
}
diff --git a/components/admin/user-payments-table.tsx b/components/admin/user-payments-table.tsx
index 7d0ae08..d6d9e42 100644
--- a/components/admin/user-payments-table.tsx
+++ b/components/admin/user-payments-table.tsx
@@ -2,228 +2,234 @@ import Pagination from "@/components/pagination";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
- Table,
- TableBody,
- TableCaption,
- TableCell,
- TableFooter,
- TableHead,
- TableHeader,
- TableRow,
+ Table,
+ TableBody,
+ TableCaption,
+ TableCell,
+ TableFooter,
+ TableHead,
+ TableHeader,
+ TableRow,
} from "@/components/ui/table";
-import prisma from "@/lib/db";
import Link from "next/link";
export async function UsersPaymentsTable({
- searchParams,
+ searchParams,
}: {
- searchParams: Promise<{
- query: string;
- page: number;
- sortBy: string;
- status: string;
- }>;
+ searchParams: Promise<{
+ query: string;
+ page: number;
+ sortBy: string;
+ status: string;
+ }>;
}) {
- const query = (await searchParams)?.query || "";
- const page = (await searchParams)?.page;
- const sortBy = (await searchParams)?.sortBy || "asc";
- const totalPayments = await prisma.payment.count({
- where: {
- OR: [
- {
- user: {
- name: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- phoneNumber: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- address: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- id_card: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- ],
- },
- });
+ const query = (await searchParams)?.query || "";
+ const page = (await searchParams)?.page;
+ const sortBy = (await searchParams)?.sortBy || "asc";
+ // const totalPayments = await prisma.payment.count({
+ // where: {
+ // OR: [
+ // {
+ // user: {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // phoneNumber: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // address: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // id_card: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // ],
+ // },
+ // });
- const totalPages = Math.ceil(totalPayments / 10);
- const limit = 10;
- const offset = (Number(page) - 1) * limit || 0;
+ // const totalPages = Math.ceil(totalPayments / 10);
+ // const limit = 10;
+ // const offset = (Number(page) - 1) * limit || 0;
- const payments = await prisma.payment.findMany({
- where: {
- OR: [
- {
- user: {
- name: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- phoneNumber: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- address: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- {
- user: {
- id_card: {
- contains: query || "",
- mode: "insensitive",
- }
- },
- },
- ],
- },
- include: {
- user: true,
- devices: true,
- },
- skip: offset,
- take: limit,
- orderBy: {
- id: `${sortBy}` as "asc" | "desc",
- },
- });
+ // const payments = await prisma.payment.findMany({
+ // where: {
+ // OR: [
+ // {
+ // user: {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // phoneNumber: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // address: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // {
+ // user: {
+ // id_card: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // }
+ // },
+ // },
+ // ],
+ // },
+ // include: {
+ // user: true,
+ // devices: true,
+ // },
+ // skip: offset,
+ // take: limit,
+ // orderBy: {
+ // id: `${sortBy}` as "asc" | "desc",
+ // },
+ // });
- // const users = await prisma.user.findMany({
- // where: {
- // role: "USER",
- // },
- // include: {
- // atoll: true,
- // island: true,
- // },
- // });
- return (
-
- {payments.length === 0 ? (
-
-
No user payments yet.
-
- ) : (
- <>
-
- Table of all users.
-
-
- Devices paid
- User
- Amount
- Duration
- Payment Status
- Payment Method
- Paid At
- Action
-
-
-
- {payments.map((payment) => (
-
-
-
- {payment.devices.map((device) => (
- -
- {device.name}
-
- ))}
-
-
- {payment.user.id_card}
- {payment.user?.name}
- {payment.user?.name}
- {payment.id}
+ // const users = await prisma.user.findMany({
+ // where: {
+ // role: "USER",
+ // },
+ // include: {
+ // atoll: true,
+ // island: true,
+ // },
+ // });
+ return null;
+ // return (
+ //
+ // {payments.length === 0 ? (
+ //
+ //
No user payments yet.
+ //
+ // ) : (
+ // <>
+ //
+ // Table of all users.
+ //
+ //
+ // Devices paid
+ // User
+ // Amount
+ // Duration
+ // Payment Status
+ // Payment Method
+ // Paid At
+ // Action
+ //
+ //
+ //
+ // {payments.map((payment) => (
+ //
+ //
+ //
+ // {payment.devices.map((device) => (
+ // -
+ // {device.name}
+ //
+ // ))}
+ //
+ //
+ //
+ // {payment.user.id_card}
+ //
+ // {payment.user?.name}
+ // {payment.user?.name}
+ // {payment.id}
-
- {payment.paid ? (
-
- Verified
-
- ) : (
-
- Unverified
-
- )}
-
-
- {new Date(payment.paidAt ?? "").toLocaleDateString("en-US", {
- month: "short",
- day: "2-digit",
- year: "numeric",
- })}
-
+ //
+ // {payment.paid ? (
+ //
+ // Verified
+ //
+ // ) : (
+ //
+ // Unverified
+ //
+ // )}
+ //
+ //
+ // {new Date(payment.paidAt ?? "").toLocaleDateString(
+ // "en-US",
+ // {
+ // month: "short",
+ // day: "2-digit",
+ // year: "numeric",
+ // },
+ // )}
+ //
- {payment.id}
-
-
-
-
-
-
- ))}
-
-
-
-
- {query.length > 0 && (
-
- Showing {payments.length} locations for "{query}
- "
-
- )}
-
-
- {totalPayments} payments
-
-
-
-
-
- >
- )}
-
- );
+ // {payment.id}
+ //
+ //
+ //
+ //
+ //
+ //
+ // ))}
+ //
+ //
+ //
+ //
+ // {query.length > 0 && (
+ //
+ // Showing {payments.length} locations for "{query}
+ // "
+ //
+ // )}
+ //
+ //
+ // {totalPayments} payments
+ //
+ //
+ //
+ //
+ //
+ // >
+ // )}
+ //
+ // );
}
diff --git a/components/user-table.tsx b/components/user-table.tsx
index 2ec9f72..1e54966 100644
--- a/components/user-table.tsx
+++ b/components/user-table.tsx
@@ -8,7 +8,6 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
-import prisma from "@/lib/db";
import Link from "next/link";
import Pagination from "./pagination";
import { Badge } from "./ui/badge";
@@ -28,84 +27,84 @@ export async function UsersTable({
const page = (await searchParams)?.page;
const sortBy = (await searchParams)?.sortBy || "asc";
const verified = (await searchParams)?.status || "all";
- const totalUsers = await prisma.user.count({
- where: {
- OR: [
- {
- name: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- phoneNumber: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- address: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- id_card: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- ],
- verified: verified === "all" ? undefined : verified === "verified",
- },
+ // const totalUsers = await prisma.user.count({
+ // where: {
+ // OR: [
+ // {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // phoneNumber: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // address: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // id_card: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // ],
+ // verified: verified === "all" ? undefined : verified === "verified",
+ // },
- });
+ // });
- const totalPages = Math.ceil(totalUsers / 10);
- const limit = 10;
- const offset = (Number(page) - 1) * limit || 0;
+ // const totalPages = Math.ceil(totalUsers / 10);
+ // const limit = 10;
+ // const offset = (Number(page) - 1) * limit || 0;
- const users = await prisma.user.findMany({
- where: {
- OR: [
- {
- name: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- phoneNumber: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- address: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- {
- id_card: {
- contains: query || "",
- mode: "insensitive",
- },
- },
- ],
- verified: verified === "all" ? undefined : verified === "verified",
+ // const users = await prisma.user.findMany({
+ // where: {
+ // OR: [
+ // {
+ // name: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // phoneNumber: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // address: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // {
+ // id_card: {
+ // contains: query || "",
+ // mode: "insensitive",
+ // },
+ // },
+ // ],
+ // verified: verified === "all" ? undefined : verified === "verified",
- },
- include: {
- island: true,
- atoll: true,
- },
- skip: offset,
- take: limit,
- orderBy: {
- id: `${sortBy}` as "asc" | "desc",
- },
- });
+ // },
+ // include: {
+ // island: true,
+ // atoll: true,
+ // },
+ // skip: offset,
+ // take: limit,
+ // orderBy: {
+ // id: `${sortBy}` as "asc" | "desc",
+ // },
+ // });
// const users = await prisma.user.findMany({
// where: {
@@ -116,96 +115,95 @@ export async function UsersTable({
// island: true,
// },
// });
- return (
-
- {users.length === 0 ? (
-
-
No Users yet.
-
- ) : (
- <>
-
- Table of all users.
-
-
- Name
- ID Card
- Atoll
- Island
- House Name
- Status
- Dob
- Phone Number
- Action
-
-
-
- {users.map((user) => (
-
- {user.name}
- {user.id_card}
- {user.atoll?.name}
- {user.island?.name}
- {user.address}
+ return null;
+ // return (
+ //
+ // {users.length === 0 ? (
+ //
+ //
No Users yet.
+ //
+ // ) : (
+ // <>
+ //
+ // Table of all users.
+ //
+ //
+ // Name
+ // ID Card
+ // Atoll
+ // Island
+ // House Name
+ // Status
+ // Dob
+ // Phone Number
+ // Action
+ //
+ //
+ //
+ // {users.map((user) => (
+ //
+ // {user.name}
+ // {user.id_card}
+ // {user.atoll?.name}
+ // {user.island?.name}
+ // {user.address}
-
- {user.verified ? (
-
- Verified
-
- ) : (
-
- Unverified
-
- )}
-
-
- {new Date(user.dob ?? "").toLocaleDateString("en-US", {
- month: "short",
- day: "2-digit",
- year: "numeric",
- })}
-
+ //
+ // {user.verified ? (
+ //
+ // Verified
+ //
+ // ) : (
+ //
+ // Unverified
+ //
+ // )}
+ //
+ //
+ // {new Date(user.dob ?? "").toLocaleDateString("en-US", {
+ // month: "short",
+ // day: "2-digit",
+ // year: "numeric",
+ // })}
+ //
- {user.phoneNumber}
-
-
-
-
-
-
- ))}
-
-
-
-
- {query.length > 0 && (
-
- Showing {users.length} locations for "{query}
- "
-
- )}
-
-
- {totalUsers} users
-
-
-
-
-
- >
- )}
-
- );
+ // {user.phoneNumber}
+ //
+ //
+ //
+ //
+ //
+ //
+ // ))}
+ //
+ //
+ //
+ //
+ // {query.length > 0 && (
+ //
+ // Showing {users.length} locations for "{query}
+ // "
+ //
+ // )}
+ //
+ //
+ // {totalUsers} users
+ //
+ //
+ //
+ //
+ //
+ // >
+ // )}
+ //
+ // );
}
diff --git a/hooks/use-formula.ts b/hooks/use-formula.ts
deleted file mode 100644
index 10b2f7e..0000000
--- a/hooks/use-formula.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-"use server";
-
-import prisma from "@/lib/db";
-
-export async function useFormula() {
- const formula = await prisma.billFormula.findFirst();
- return formula;
-}
diff --git a/lib/auth-guard.ts b/lib/auth-guard.ts
deleted file mode 100644
index 8c9416e..0000000
--- a/lib/auth-guard.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-"use server";
-import { auth } from "@/app/auth";
-import { headers } from "next/headers";
-import { redirect } from "next/navigation";
-
-export async function AdminAuthGuard() {
- const session = await auth.api.getSession({
- headers: await headers(),
- });
- if (session?.user.role !== "ADMIN") {
- return redirect("/login");
- }
- return true;
-}