same changes applied to this route
This commit is contained in:
2 files changed
+20
-22
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { CalendarPlus, Mail, Phone } from "lucide-react";
|
||||
import { Mail, Phone } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { auth } from "@/auth";
|
||||
@@ -196,11 +196,16 @@ export default async function OwnerAppointmentDetailsPage({
|
||||
|
||||
{loyalty?.isEnabled && (
|
||||
<div className="border-line border-t pt-4">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<span className="text-muted block text-[10px] font-bold tracking-widest uppercase">Loyalty</span>
|
||||
<p className="text-sm font-bold">
|
||||
{loyalty.currentStamps}/{resolveRewardThreshold(loyalty)} stamps
|
||||
{loyalty.availableReward && <span className="text-accent-loyalty"> · Reward available</span>}
|
||||
</p>
|
||||
</div>
|
||||
<AddStampButton customerId={appointment.customerId} appointmentId={appointment.id} iconOnly />
|
||||
</div>
|
||||
{loyaltyTransactions.length > 0 && (
|
||||
<ul className="mt-2 space-y-1">
|
||||
{loyaltyTransactions.map((t) => (
|
||||
@@ -229,32 +234,23 @@ export default async function OwnerAppointmentDetailsPage({
|
||||
)}
|
||||
</Card>
|
||||
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<a
|
||||
href={`/api/appointments/${appointment.id}/calendar.ics`}
|
||||
className="rounded-md border-line flex items-center gap-2 border bg-white px-5 py-3 text-sm font-bold"
|
||||
>
|
||||
<CalendarPlus className="text-accent h-4 w-4" aria-hidden="true" /> Add to Calendar
|
||||
</a>
|
||||
{RESCHEDULABLE.has(appointment.status) && (
|
||||
<Link
|
||||
href={`/owner/appointments/${appointment.id}/reschedule`}
|
||||
className="rounded-md border-line border bg-white px-5 py-3 text-sm font-bold"
|
||||
>
|
||||
Reschedule / Reassign
|
||||
</Link>
|
||||
{appointment.status === "COMPLETED" && (
|
||||
<BookFollowUpButton appointmentId={appointment.id} className="w-full text-center" />
|
||||
)}
|
||||
{appointment.status === "COMPLETED" && <BookFollowUpButton appointmentId={appointment.id} />}
|
||||
</div>
|
||||
|
||||
<AppointmentStatusActions
|
||||
appointmentId={appointment.id}
|
||||
status={appointment.status}
|
||||
actions={ownerAppointmentActions}
|
||||
layout="stack"
|
||||
rescheduleUrl={
|
||||
RESCHEDULABLE.has(appointment.status)
|
||||
? `/owner/appointments/${appointment.id}/reschedule`
|
||||
: undefined
|
||||
}
|
||||
rescheduleLabel="Reschedule / Reassign"
|
||||
/>
|
||||
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{loyalty?.isEnabled && <AddStampButton customerId={appointment.customerId} appointmentId={appointment.id} />}
|
||||
{canRedeemReward && loyalty.availableReward && (
|
||||
<RedeemRewardButton
|
||||
appointmentId={appointment.id}
|
||||
@@ -263,7 +259,6 @@ export default async function OwnerAppointmentDetailsPage({
|
||||
subtotal={subtotal}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -57,14 +57,17 @@ export function AppointmentStatusActions({
|
||||
actions = DEFAULT_ACTIONS,
|
||||
layout = "wrap",
|
||||
rescheduleUrl,
|
||||
rescheduleLabel = "Reschedule",
|
||||
}: {
|
||||
appointmentId: string;
|
||||
status: RawStatus;
|
||||
actions?: AppointmentActionSet;
|
||||
/** "stack" renders one full-width button per row (used by both Current Appointment and Appointment Details); "wrap" (default) keeps the original inline small buttons. */
|
||||
layout?: "wrap" | "stack";
|
||||
/** When given, renders a "Reschedule" link right after the primary status button and before Mark No-Show/Cancel — the caller (Appointment Details) decides whether the status is actually reschedulable, this component just renders what it's given. */
|
||||
/** When given, renders a reschedule link right after the primary status button and before Mark No-Show/Cancel — the caller (Appointment Details) decides whether the status is actually reschedulable, this component just renders what it's given. */
|
||||
rescheduleUrl?: string;
|
||||
/** Owner's variant reads "Reschedule / Reassign" (they can also hand the appointment to a different staff member); staff's own reschedule can't reassign anyone, so it stays plain "Reschedule". */
|
||||
rescheduleLabel?: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isPending, startTransition] = useTransition();
|
||||
@@ -175,7 +178,7 @@ export function AppointmentStatusActions({
|
||||
)}
|
||||
{rescheduleUrl && (
|
||||
<Button asChild size={buttonSize} className={buttonClassName} variant="secondary">
|
||||
<Link href={rescheduleUrl}>Reschedule</Link>
|
||||
<Link href={rescheduleUrl}>{rescheduleLabel}</Link>
|
||||
</Button>
|
||||
)}
|
||||
{status === "CONFIRMED" && (
|
||||
|
||||
Reference in new issue
Block a user