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.
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
import React, { useState } from 'react';
|
||||
import ConfirmDialog from './ui/ConfirmDialog';
|
||||
import { useCancellationPreview, useCancelAppointment } from '../hooks/useCancellation';
|
||||
import { formatRial } from '../lib/utils';
|
||||
import { useCancelAppointment } from '../hooks/useCancellation';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
appointmentUuid: string;
|
||||
/** چه کسی لغو میکند — جریمه برای لغو کلینیک همیشه صفر است. */
|
||||
/** چه کسی لغو میکند — وضعیت نهایی نوبت از همین میآید. */
|
||||
by?: 'user' | 'doctor';
|
||||
onClose: () => void;
|
||||
onCancelled?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* لغو نوبت با نمایش پیامد مالی **قبل از** تأیید.
|
||||
*
|
||||
* پیشنمایش از همان محاسبهای میآید که خودِ لغو انجام میدهد، پس عددی که اپراتور
|
||||
* میبیند همان است که کسر میشود. دکمهٔ لغوِ بیپیشنمایش یعنی اپراتور جریمهٔ بیمار را
|
||||
* بعد از وقوعش کشف میکند.
|
||||
*/
|
||||
/** لغو نوبت با تأیید و دلیل اختیاری. */
|
||||
export default function CancelAppointmentDialog({
|
||||
open,
|
||||
appointmentUuid,
|
||||
@@ -27,7 +20,6 @@ export default function CancelAppointmentDialog({
|
||||
onCancelled,
|
||||
}: Props) {
|
||||
const [reason, setReason] = useState('');
|
||||
const { preview, loading } = useCancellationPreview(open ? appointmentUuid : undefined, by);
|
||||
const cancel = useCancelAppointment();
|
||||
|
||||
const close = () => {
|
||||
@@ -56,54 +48,6 @@ export default function CancelAppointmentDialog({
|
||||
}
|
||||
onCancel={close}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
marginTop: 14,
|
||||
padding: 12,
|
||||
borderRadius: 'var(--r-sm)',
|
||||
background: 'var(--surface-2)',
|
||||
fontSize: 13,
|
||||
lineHeight: 1.9,
|
||||
}}
|
||||
>
|
||||
{loading ? (
|
||||
<span style={{ color: 'var(--text-3)' }}>در حال محاسبهٔ پیامد لغو…</span>
|
||||
) : !preview ? (
|
||||
<span style={{ color: 'var(--text-3)' }}>
|
||||
پیامد مالی لغو در دسترس نیست؛ لغو انجام میشود ولی مبلغ را دستی بررسی کنید.
|
||||
</span>
|
||||
) : (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: 'var(--text-2)' }}>جریمهٔ لغو</span>
|
||||
<strong style={{ color: preview.penalty_rials > 0 ? 'var(--danger)' : 'var(--success)' }}>
|
||||
{preview.penalty_rials > 0 ? formatRial(preview.penalty_rials) : 'بدون جریمه'}
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: 'var(--text-2)' }}>مبلغ پرداختشده</span>
|
||||
<span>{formatRial(preview.paid_rials)}</span>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: 'var(--text-2)' }}>بازگشت اعتبار پکیج</span>
|
||||
<span>{preview.credit_refundable ? 'بله' : 'خیر'}</span>
|
||||
</div>
|
||||
|
||||
{preview.within_free_window && (
|
||||
<div style={{ color: 'var(--success)' }}>در بازهٔ لغو رایگان است.</div>
|
||||
)}
|
||||
|
||||
{preview.notes.map((note, i) => (
|
||||
<div key={i} style={{ color: 'var(--text-3)', fontSize: 12 }}>
|
||||
{note}
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 14 }}>
|
||||
<label className="cp-label mb-2" htmlFor="cancel-reason">
|
||||
دلیل لغو (اختیاری)
|
||||
|
||||
@@ -32,14 +32,7 @@ export const SETTINGS_MENU: SettingsMenuItem[] = [
|
||||
{ key: 'branches', label: 'شعبهها و اتاقها', icon: MapPinIcon, to: '/admin/branches', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'resources', label: 'منابع', icon: CubeIcon, to: '/admin/resources', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'holidays', label: 'تعطیلات رسمی', icon: CalendarDaysIcon, to: '/admin/holidays', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'policies', label: 'قوانین', icon: ScaleIcon, to: '/admin/policies', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'packages', label: 'پکیجها', icon: RectangleStackIcon, to: '/admin/packages', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'course-protocols', label: 'پروتکل دوره', icon: ArrowPathRoundedSquareIcon, to: '/admin/course-protocols', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'price-lists', label: 'لیستهای قیمت', icon: BanknotesIcon, to: '/admin/price-lists', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'cancellation', label: 'سیاست لغو', icon: NoSymbolIcon, to: '/admin/cancellation-policy', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'waitlist', label: 'لیست انتظار', icon: QueueListIcon, to: '/admin/waitlist', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'utilization', label: 'بهرهوری منابع', icon: ChartBarIcon, to: '/admin/reports/resource-utilization', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'plan-accuracy', label: 'دقت برنامه', icon: ChartBarIcon, to: '/admin/reports/plan-accuracy', roles: ['doctor', 'clinic'], perm: ['appointment_settings', 'view'] },
|
||||
{ key: 'payment', label: 'مدیریت پرداخت', icon: BanknotesIcon, to: '/admin/my-financial', perm: ['payments', 'view'] },
|
||||
{ key: 'secretary', label: 'مدیریت منشی', icon: UsersIcon, to: '/admin/my-secretaries' },
|
||||
{ key: 'staff', label: 'پرسنل', icon: UserPlusIcon, to: '/admin/staff', perm: ['staff', 'view'] },
|
||||
|
||||
Reference in New Issue
Block a user