Fixes
CI / ci (push) Canceled after 0s

fixed super admin showing in client list

added a reconnect button to google calendar syncying

fixed ui issue with whatsapp undo link
This commit is contained in:
Stefan Lazic committed 2026-10-17 09:35:52 +01:00
1 parent 2ed9c5ecca
commit 05ea83e059
21 files changed
+1180 -118

No files matched your search

+8 -14
View File
@@ -11,6 +11,7 @@ import { EmptyState } from "@/components/feedback/empty-state";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { TopNav } from "@/components/navigation/top-nav";
import { prisma } from "@/lib/db/prisma";
import { clientDirectoryWhere } from "@/services/customer/client-directory";
import { getActingBusinessContext } from "@/lib/business/get-acting-business-context";
import { getLoyaltyHistory, getLoyaltySummary } from "@/services/loyalty/loyalty.service";
import { resolveRewardThreshold } from "@/services/loyalty/reward-threshold";
@@ -52,19 +53,12 @@ export default async function StaffCustomerDetailsPage({
});
if (!customer) notFound();
// "Belongs to this business" mirrors the Clients list query exactly
// (see (staff)/staff/clients/page.tsx) — either a real appointment here,
// or a registered client with no appointment anywhere yet (added via
// /staff/clients/add, or self-registered but never booked). Without the
// second branch, a client visible in the list because of that same
// broadening would 404 the moment staff actually clicked into them —
// confirmed live, this exact gap.
const [appointmentsHereCount, totalAppointmentCount] = await Promise.all([
prisma.appointment.count({ where: { customerId: id, businessId: context.businessId } }),
prisma.appointment.count({ where: { customerId: id } }),
]);
const belongsToBusiness = appointmentsHereCount > 0 || (!customer.isGuest && totalAppointmentCount === 0);
if (!belongsToBusiness) notFound();
// The same rule the Clients list uses (clientDirectoryWhere), asked about this
// one person — so anyone the list shows opens, and anyone it hides (the
// Super Administrator, a barber with no bookings) 404s here too.
const inDirectory =
(await prisma.customerProfile.count({ where: { AND: [{ id }, clientDirectoryWhere(context.businessId)] } })) > 0;
if (!inDirectory) notFound();
const [upcoming, past, cancelled, notesRaw, loyalty] = await Promise.all([
listAppointments(prisma, {
@@ -220,7 +214,7 @@ export default async function StaffCustomerDetailsPage({
: undefined
}
className="min-w-[104px] flex-1"
linkClassName="h-12 w-full justify-center rounded-md px-4 py-0"
buttonClassName="h-12 w-full rounded-md"
/>
<Button asChild size="md" className="min-w-[104px] flex-1">
<Link href={`/staff/book?customerId=${customer.id}`}>Book Appointment</Link>