feat(sms): add log viewing functionality for SMS messages
This commit is contained in:
@@ -57,6 +57,7 @@ export default function SmsPage() {
|
|||||||
const [postVisitRejectId, setPostVisitRejectId] = useState<number | null>(null);
|
const [postVisitRejectId, setPostVisitRejectId] = useState<number | null>(null);
|
||||||
const [postVisitRejectReason, setPostVisitRejectReason] = useState('');
|
const [postVisitRejectReason, setPostVisitRejectReason] = useState('');
|
||||||
const [tagFilter, setTagFilter] = useState('');
|
const [tagFilter, setTagFilter] = useState('');
|
||||||
|
const [viewLog, setViewLog] = useState<SmsLog | null>(null);
|
||||||
const [editMsg, setEditMsg] = useState<SmsMessageText | null>(null);
|
const [editMsg, setEditMsg] = useState<SmsMessageText | null>(null);
|
||||||
const [editBody, setEditBody] = useState('');
|
const [editBody, setEditBody] = useState('');
|
||||||
const [editTemplate, setEditTemplate] = useState<SmsTemplate | null>(null);
|
const [editTemplate, setEditTemplate] = useState<SmsTemplate | null>(null);
|
||||||
@@ -222,7 +223,17 @@ export default function SmsPage() {
|
|||||||
{
|
{
|
||||||
key: 'message',
|
key: 'message',
|
||||||
header: 'پیام',
|
header: 'پیام',
|
||||||
render: (l) => <span className="muted" style={{ fontSize: 12, display: 'block', maxWidth: 280, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{l.message}</span>,
|
render: (l) => (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
title="نمایش متن کامل"
|
||||||
|
onClick={() => setViewLog(l)}
|
||||||
|
className="muted"
|
||||||
|
style={{ fontSize: 12, display: 'block', maxWidth: 280, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', textAlign: 'right', background: 'none', border: 'none', padding: 0, cursor: 'pointer', color: 'var(--primary)', width: '100%' }}
|
||||||
|
>
|
||||||
|
{l.message}
|
||||||
|
</button>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'status',
|
key: 'status',
|
||||||
@@ -643,6 +654,24 @@ export default function SmsPage() {
|
|||||||
onConfirm={() => deleteTarget && deleteMutation.mutate(deleteTarget)}
|
onConfirm={() => deleteTarget && deleteMutation.mutate(deleteTarget)}
|
||||||
onCancel={() => setDeleteTarget(null)}
|
onCancel={() => setDeleteTarget(null)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Modal open={!!viewLog} title="متن کامل پیامک" onClose={() => setViewLog(null)}>
|
||||||
|
{viewLog && (
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, minWidth: 320 }}>
|
||||||
|
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', fontSize: 12.5 }}>
|
||||||
|
<div><span className="muted">گیرنده: </span><span dir="ltr">{viewLog.recipient}</span></div>
|
||||||
|
<div><span className="muted">تگ: </span>{TAG_LABELS[viewLog.tag] ?? viewLog.tag}</div>
|
||||||
|
<div><span className="muted">زمان: </span>{formatDateTime(viewLog.sent_at)}</div>
|
||||||
|
</div>
|
||||||
|
<div style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', lineHeight: 1.9, fontSize: 14, padding: '12px 14px', borderRadius: 'var(--r-sm)', background: 'var(--surface-3)', border: '1px solid var(--border)' }}>
|
||||||
|
{viewLog.message}
|
||||||
|
</div>
|
||||||
|
<div className="muted" style={{ fontSize: 11, textAlign: 'left' }}>
|
||||||
|
{viewLog.message.length} کاراکتر
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user