Add per-clinic payment methods (bank accounts + POS/card-reader devices)
under the "مدیریت پرداخت" settings tab at /admin/my-financial, ported from
clinic-pro-tauri's mock-only PaymentManagement tab into a real persisted
feature. These records are referenceable (by uuid) from patient invoices to
record which method a service payment was made with.
Backend (new src/PaymentMethod domain):
- BankAccount + Pos entities, repositories, PaymentMethodService (validation,
ownership scoping, create/update/toggle logic).
- Thin PaymentMethodController exposing /api/v1/my/payment-methods/{bank-accounts,pos}
(GET/POST/PUT + PATCH .../status), guarded to clinic/doctor/secretary/admin.
- Migration for bank_accounts + pos_devices tables.
- Functional tests (success + validation/404/403 + empty boundaries).
- docs/api/payment-method.md.
Frontend:
- Replace MyFinancialPage content with the payment-management UI (two tabs,
tables, add/edit modals, status toggle) using the admin design system.
- usePaymentMethods hook (TanStack Query) + presentational components.
- Update page test to cover tabs, data, empty state and the add modal.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
959 B
TypeScript
33 lines
959 B
TypeScript
import React from 'react';
|
|
|
|
/**
|
|
* سوییچ وضعیت فعال/غیرفعال — معادل MUI Switch مبدأ با دیزاینسیستم مقصد.
|
|
* برچسب فعال/غیرفعال کنار سوییچ نمایش داده میشود (مثل مبدأ).
|
|
*/
|
|
export default function StatusToggle({
|
|
active,
|
|
onToggle,
|
|
disabled,
|
|
}: {
|
|
active: boolean;
|
|
onToggle: () => void;
|
|
disabled?: boolean;
|
|
}) {
|
|
const label = active ? 'فعال' : 'غیرفعال';
|
|
return (
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
<label className="switch" title={label}>
|
|
<input
|
|
type="checkbox"
|
|
checked={active}
|
|
onChange={onToggle}
|
|
disabled={disabled}
|
|
aria-label={label}
|
|
/>
|
|
<span className="switch-track"><span className="switch-thumb" /></span>
|
|
</label>
|
|
<span style={{ fontSize: 13, color: 'var(--text-2)' }}>{label}</span>
|
|
</div>
|
|
);
|
|
}
|