feat(plugins): SuperAdmin store tabs, pricing, and request approval
Khanegi plugin prices and purchase requests sit beside existing version cards. Also rewrite leftover nerkh upload URLs on tenant forms. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,7 +9,9 @@ import api from '@/api/http'
|
||||
const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
const adminSmsEnabled = ref(true)
|
||||
const pluginStoreEnabled = ref(false)
|
||||
const smsToggleLoading = ref(false)
|
||||
const storeToggleLoading = ref(false)
|
||||
const canSettingsWrite = computed(() => auth.can('settings:write'))
|
||||
|
||||
function goHome() {
|
||||
@@ -26,6 +28,7 @@ async function loadSmsToggle() {
|
||||
try {
|
||||
const { data } = await api.get('/settings/admin-sms')
|
||||
adminSmsEnabled.value = data.adminSmsEnabled !== false
|
||||
pluginStoreEnabled.value = data.pluginStoreEnabled === true
|
||||
} catch {
|
||||
// keep default on; non-blocking for layout
|
||||
}
|
||||
@@ -50,6 +53,25 @@ async function onSmsToggle(checked: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
async function onStoreToggle(checked: boolean) {
|
||||
if (!canSettingsWrite.value) return
|
||||
storeToggleLoading.value = true
|
||||
const previous = pluginStoreEnabled.value
|
||||
pluginStoreEnabled.value = checked
|
||||
try {
|
||||
const { data } = await api.patch('/settings/plugin-store', { enabled: checked })
|
||||
pluginStoreEnabled.value = data.pluginStoreEnabled === true
|
||||
message.success(
|
||||
pluginStoreEnabled.value ? 'فروشگاه افزونه روشن شد' : 'فروشگاه افزونه خاموش شد',
|
||||
)
|
||||
} catch (e: any) {
|
||||
pluginStoreEnabled.value = previous
|
||||
message.error(e?.response?.data?.message || 'تغییر فروشگاه افزونه ناموفق')
|
||||
} finally {
|
||||
storeToggleLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadSmsToggle)
|
||||
</script>
|
||||
|
||||
@@ -79,6 +101,20 @@ onMounted(loadSmsToggle)
|
||||
@change="onSmsToggle"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="canSettingsWrite"
|
||||
class="sms-toggle"
|
||||
:class="{ off: !pluginStoreEnabled }"
|
||||
>
|
||||
<span class="sms-toggle-label">فروشگاه افزونه</span>
|
||||
<a-switch
|
||||
:checked="pluginStoreEnabled"
|
||||
:loading="storeToggleLoading"
|
||||
checked-children="روشن"
|
||||
un-checked-children="خاموش"
|
||||
@change="onStoreToggle"
|
||||
/>
|
||||
</div>
|
||||
<button type="button" class="icon-btn" title="داشبورد" @click="goHome">
|
||||
<HomeOutlined />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user