feat: update SMS settings review functionality
- Changed the tab name from 'post-visit-review' to 'post-visit-approved' in SmsPage. - Introduced a new query for fetching approved post-visit texts. - Updated the UI to display approved post-visit texts and their details. - Enhanced the API endpoint to filter SMS settings based on status (pending/approved). - Added entity name resolution for doctors and clinics in the SMS settings. - Updated the SmsWalletPage to include new post-visit text variables for SMS templates. - Improved type definitions in index.ts for better clarity and consistency.
This commit is contained in:
@@ -25,6 +25,15 @@ type ChargeForm = z.infer<typeof chargeSchema>;
|
||||
|
||||
const EMPTY_LOGS: SmsWalletLog[] = [];
|
||||
|
||||
const REMINDER_HOUR_OPTIONS = [1, 2, 3, 4, 6, 12, 24, 48];
|
||||
|
||||
const POST_VISIT_VARS: { key: string; label: string }[] = [
|
||||
{ key: 'patient_name', label: 'نام بیمار' },
|
||||
{ key: 'doctor', label: 'نام پزشک' },
|
||||
{ key: 'clinic', label: 'نام کلینیک' },
|
||||
{ key: 'date', label: 'تاریخ ویزیت' },
|
||||
];
|
||||
|
||||
function SmsWalletPageInner() {
|
||||
const qc = useQueryClient();
|
||||
const [chargeOpen, setChargeOpen] = useState(false);
|
||||
@@ -211,14 +220,16 @@ function SmsWalletPageInner() {
|
||||
{currentSettings.reminder_enabled && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }}>
|
||||
<label style={{ fontSize: 13, color: 'var(--text-2)', whiteSpace: 'nowrap' }}>ارسال</label>
|
||||
<input
|
||||
type="number" min={1} max={72}
|
||||
<select
|
||||
className="cp-select"
|
||||
value={currentSettings.reminder_hours_before}
|
||||
onChange={(e) => setLocalSettings({ ...currentSettings, reminder_hours_before: +e.target.value })}
|
||||
dir="ltr"
|
||||
style={{ width: 72, textAlign: 'center' }}
|
||||
/>
|
||||
<label style={{ fontSize: 13, color: 'var(--text-2)', whiteSpace: 'nowrap' }}>ساعت قبل</label>
|
||||
style={{ width: 130, height: 36 }}
|
||||
>
|
||||
{REMINDER_HOUR_OPTIONS.map((h) => (
|
||||
<option key={h} value={h}>{h} ساعت قبل</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -283,7 +294,33 @@ function SmsWalletPageInner() {
|
||||
direction: 'rtl',
|
||||
}}
|
||||
/>
|
||||
<div style={{ fontSize: 11.5, color: 'var(--text-3)', marginTop: 6 }}>
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<div style={{ fontSize: 12, color: 'var(--text-3)', marginBottom: 6 }}>
|
||||
برای افزودن، روی پارامتر کلیک کنید:
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
||||
{POST_VISIT_VARS.map(({ key, label }) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
onClick={() => setLocalSettings({
|
||||
...currentSettings,
|
||||
post_visit_text: `${currentSettings.post_visit_text_pending ?? currentSettings.post_visit_text ?? ''}{${key}}`,
|
||||
})}
|
||||
style={{
|
||||
fontSize: 12, fontWeight: 600,
|
||||
padding: '4px 10px', borderRadius: 16, cursor: 'pointer',
|
||||
background: 'var(--primary-subtle)', color: 'var(--primary)',
|
||||
border: '1px solid color-mix(in oklch, var(--primary) 30%, transparent)',
|
||||
}}
|
||||
>
|
||||
{label} <span style={{ direction: 'ltr', opacity: 0.7 }}>{`{${key}}`}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{ fontSize: 11.5, color: 'var(--text-3)', marginTop: 8 }}>
|
||||
متن پس از تغییر باید توسط ادمین تأیید شود تا فعال گردد
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user