fix(admin): resolve TypeScript errors and unused variables in SmsSettingsPage
This commit is contained in:
parent
29f5122f14
commit
330d960502
@ -8,12 +8,10 @@ import {
|
|||||||
Coins,
|
Coins,
|
||||||
User,
|
User,
|
||||||
Hash,
|
Hash,
|
||||||
HelpCircle,
|
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
Eye,
|
Eye,
|
||||||
EyeOff,
|
EyeOff,
|
||||||
Sparkles,
|
|
||||||
Smartphone,
|
Smartphone,
|
||||||
Plus,
|
Plus,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
@ -30,7 +28,6 @@ import {
|
|||||||
Search,
|
Search,
|
||||||
Trash2,
|
Trash2,
|
||||||
TrendingUp,
|
TrendingUp,
|
||||||
RotateCcw,
|
|
||||||
Info,
|
Info,
|
||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
@ -432,7 +429,7 @@ export default function SmsSettingsPage() {
|
|||||||
setRuleFormVariables(rule.variables ? [...rule.variables] : []);
|
setRuleFormVariables(rule.variables ? [...rule.variables] : []);
|
||||||
setRuleFormDescription(rule.description ? `${rule.description} (رونوشت)` : '');
|
setRuleFormDescription(rule.description ? `${rule.description} (رونوشت)` : '');
|
||||||
setIsRuleModalOpen(true);
|
setIsRuleModalOpen(true);
|
||||||
toast.info('اطلاعات سناریو تکثیر شد. پس از بازبینی، ذخیره نمایید.');
|
toast('اطلاعات سناریو تکثیر شد. پس از بازبینی، ذخیره نمایید.', { icon: '📋' });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSaveRule = async (e: React.FormEvent) => {
|
const handleSaveRule = async (e: React.FormEvent) => {
|
||||||
@ -617,22 +614,6 @@ export default function SmsSettingsPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAssignPattern = async (type: keyof SmsConfigState, patternId: number) => {
|
|
||||||
const updated = { ...config, [type]: String(patternId) };
|
|
||||||
setConfig(updated);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await api.patch('/settings/sms', {
|
|
||||||
...updated,
|
|
||||||
[type]: Number(patternId),
|
|
||||||
});
|
|
||||||
toast.success(`الگوی ${patternId} به عنوان رویداد مورد نظر تنظیم شد`);
|
|
||||||
refreshPatterns();
|
|
||||||
} catch {
|
|
||||||
toast.error('خطا در ذخیره اتصال پترن');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDeleteLog = async (id: string) => {
|
const handleDeleteLog = async (id: string) => {
|
||||||
if (!window.confirm('آیا از حذف این لاگ پیامک اطمینان دارید؟')) return;
|
if (!window.confirm('آیا از حذف این لاگ پیامک اطمینان دارید؟')) return;
|
||||||
try {
|
try {
|
||||||
@ -1221,6 +1202,18 @@ export default function SmsSettingsPage() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-bold text-gray-700 mb-1">متغیر تستی ۲ (مبلغ یا نام)</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={testArg2}
|
||||||
|
onChange={(e) => setTestArg2(e.target.value)}
|
||||||
|
placeholder="150000"
|
||||||
|
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-blue-500 text-xs font-mono font-bold"
|
||||||
|
dir="ltr"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{testResult && (
|
{testResult && (
|
||||||
<div
|
<div
|
||||||
className={`p-3 rounded-xl border text-xs flex items-start gap-2 ${
|
className={`p-3 rounded-xl border text-xs flex items-start gap-2 ${
|
||||||
@ -1267,7 +1260,7 @@ export default function SmsSettingsPage() {
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleOpenAddRuleModal}
|
onClick={() => handleOpenAddRuleModal()}
|
||||||
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-3 px-5 rounded-xl transition-all flex items-center gap-2 shadow-md shadow-amber-200 shrink-0"
|
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-3 px-5 rounded-xl transition-all flex items-center gap-2 shadow-md shadow-amber-200 shrink-0"
|
||||||
>
|
>
|
||||||
<Plus className="w-4 h-4" />
|
<Plus className="w-4 h-4" />
|
||||||
@ -1289,7 +1282,7 @@ export default function SmsSettingsPage() {
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={handleOpenAddRuleModal}
|
onClick={() => handleOpenAddRuleModal()}
|
||||||
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-2.5 px-5 rounded-xl transition-all inline-flex items-center gap-2 shadow-sm"
|
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-2.5 px-5 rounded-xl transition-all inline-flex items-center gap-2 shadow-sm"
|
||||||
>
|
>
|
||||||
<Plus className="w-4 h-4" />
|
<Plus className="w-4 h-4" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user