Files
clinicpro/assets/admin/components/CancelAppointmentDialog.tsx
T
hamed c4f1f25c80 Refactor booking system: Remove unused policies, packages, and related entities
- Removed package consumption flags and related properties from PriceQuote.
- Eliminated unused domain event publishing for policies and waitlist in Schedule.
- Cleaned up BookingEngineSeeder by removing package and policy related logic.
- Updated SeedScenariosCommand to reflect removal of policies from output.
- Dropped policy, package, treatment course, cancellation, waitlist, and domain event tables in migration.
- Removed domain event assertions from tests related to resource blocking.
2026-08-01 20:50:47 +03:30

68 lines
1.7 KiB
TypeScript

import React, { useState } from 'react';
import ConfirmDialog from './ui/ConfirmDialog';
import { useCancelAppointment } from '../hooks/useCancellation';
interface Props {
open: boolean;
appointmentUuid: string;
/** چه کسی لغو می‌کند — وضعیت نهایی نوبت از همین می‌آید. */
by?: 'user' | 'doctor';
onClose: () => void;
onCancelled?: () => void;
}
/** لغو نوبت با تأیید و دلیل اختیاری. */
export default function CancelAppointmentDialog({
open,
appointmentUuid,
by = 'doctor',
onClose,
onCancelled,
}: Props) {
const [reason, setReason] = useState('');
const cancel = useCancelAppointment();
const close = () => {
setReason('');
onClose();
};
return (
<ConfirmDialog
open={open}
title="لغو نوبت"
message="آیا از لغو این نوبت اطمینان دارید؟"
confirmLabel="لغو نوبت"
danger
loading={cancel.isPending}
onConfirm={() =>
cancel.mutate(
{ uuid: appointmentUuid, by, reason },
{
onSuccess: () => {
close();
onCancelled?.();
},
},
)
}
onCancel={close}
>
<div style={{ marginTop: 14 }}>
<label className="cp-label mb-2" htmlFor="cancel-reason">
دلیل لغو (اختیاری)
</label>
<textarea
id="cancel-reason"
className="cp-input"
rows={2}
value={reason}
onChange={(e) => setReason(e.target.value)}
placeholder="دلیل لغو نوبت را وارد کنید..."
style={{ width: '100%', resize: 'vertical' }}
/>
</div>
</ConfirmDialog>
);
}