Expand SuperAdmin web for SMS, servers, plugins, admins, and UI config.

Align SMS tenant panel with Hamkar, add Jalali dates, and support hamkar/khanegi appearance editing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-30 18:19:54 +03:30
co-authored by Cursor
parent 3371015b96
commit cfee6b0546
27 changed files with 4528 additions and 408 deletions
+68 -1
View File
@@ -1,10 +1,15 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import { LogoutOutlined, HomeOutlined } from '@ant-design/icons-vue'
import { useAuthStore } from '@/stores/auth'
import api from '@/api/http'
const auth = useAuthStore()
const router = useRouter()
const adminSmsEnabled = ref(true)
const smsToggleLoading = ref(false)
function goHome() {
router.push({ name: 'home' })
@@ -14,6 +19,35 @@ function logout() {
auth.logout()
router.push({ name: 'login' })
}
async function loadSmsToggle() {
try {
const { data } = await api.get('/settings/admin-sms')
adminSmsEnabled.value = data.adminSmsEnabled !== false
} catch {
// keep default on; non-blocking for layout
}
}
async function onSmsToggle(checked: boolean) {
smsToggleLoading.value = true
const previous = adminSmsEnabled.value
adminSmsEnabled.value = checked
try {
const { data } = await api.patch('/settings/admin-sms', { enabled: checked })
adminSmsEnabled.value = data.adminSmsEnabled !== false
message.success(
adminSmsEnabled.value ? 'پیامک هشدار روشن شد' : 'پیامک هشدار خاموش شد',
)
} catch (e: any) {
adminSmsEnabled.value = previous
message.error(e?.response?.data?.message || 'تغییر وضعیت پیامک ناموفق')
} finally {
smsToggleLoading.value = false
}
}
onMounted(loadSmsToggle)
</script>
<template>
@@ -28,6 +62,16 @@ function logout() {
</button>
<div class="topbar-actions">
<div class="sms-toggle" :class="{ off: !adminSmsEnabled }">
<span class="sms-toggle-label">پیامک هشدار</span>
<a-switch
:checked="adminSmsEnabled"
:loading="smsToggleLoading"
checked-children="روشن"
un-checked-children="خاموش"
@change="onSmsToggle"
/>
</div>
<button type="button" class="icon-btn" title="داشبورد" @click="goHome">
<HomeOutlined />
</button>
@@ -107,6 +151,28 @@ function logout() {
gap: 8px;
}
.sms-toggle {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
border-radius: 999px;
background: #e8f8f1;
border: 1px solid #b7ebd4;
}
.sms-toggle.off {
background: #fff1f0;
border-color: #ffccc7;
}
.sms-toggle-label {
font-size: 0.8rem;
font-weight: 700;
color: #334155;
white-space: nowrap;
}
.icon-btn {
width: 40px;
height: 40px;
@@ -162,7 +228,8 @@ function logout() {
.content { padding: 24px; }
}
@media (max-width: 520px) {
@media (max-width: 640px) {
.sms-toggle-label { display: none; }
.user-name { display: none; }
}
</style>