@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, reactive, ref, watch, type Component } from 'vue'
|
import { computed, onMounted, reactive, ref, watch, type Component } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { message } from 'ant-design-vue'
|
import { message, Modal } from 'ant-design-vue'
|
||||||
import {
|
import {
|
||||||
AccountBookOutlined,
|
AccountBookOutlined,
|
||||||
ArrowRightOutlined,
|
ArrowRightOutlined,
|
||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
CalculatorOutlined,
|
CalculatorOutlined,
|
||||||
ClusterOutlined,
|
ClusterOutlined,
|
||||||
CreditCardOutlined,
|
CreditCardOutlined,
|
||||||
|
DeleteOutlined,
|
||||||
DollarOutlined,
|
DollarOutlined,
|
||||||
EllipsisOutlined,
|
EllipsisOutlined,
|
||||||
FileTextOutlined,
|
FileTextOutlined,
|
||||||
@@ -60,6 +61,7 @@ const auth = useAuthStore()
|
|||||||
const canWrite = computed(() => auth.can('khanegi:write'))
|
const canWrite = computed(() => auth.can('khanegi:write'))
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const importing = ref(false)
|
const importing = ref(false)
|
||||||
|
const purging = ref(false)
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
const filterType = ref<string | undefined>()
|
const filterType = ref<string | undefined>()
|
||||||
const tenant = ref<TenantMeta | null>(null)
|
const tenant = ref<TenantMeta | null>(null)
|
||||||
@@ -399,6 +401,47 @@ async function applyImport() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* بعد از restore لوکال روی سرور همان پروژه: بقیهٔ کلیدها (غیر دسترسی مشتری)
|
||||||
|
* را از جدول settings همین tenant در سوپرادمین حذف میکند.
|
||||||
|
*/
|
||||||
|
function confirmPurgeNonOwned() {
|
||||||
|
if (!canWrite.value) {
|
||||||
|
message.warning('دسترسی نوشتن ندارید')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: 'حذف تنظیمات غیر دسترسی مشتری؟',
|
||||||
|
content:
|
||||||
|
'فقط ۱۳ کلید «دسترسی مشتری به قابلیتها» روی این پروژه در سوپرادمین میماند. ' +
|
||||||
|
'بقیه از جدول settings همین پروژه در سوپرادمین پاک میشود. ' +
|
||||||
|
'قبل از این کار باید روی سرور همان نصب، settings:restore-from-backup را اجرا کرده باشی.',
|
||||||
|
okText: 'حذف کن',
|
||||||
|
okType: 'danger',
|
||||||
|
cancelText: 'انصراف',
|
||||||
|
onOk: () => purgeNonOwned(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function purgeNonOwned() {
|
||||||
|
purging.value = true
|
||||||
|
try {
|
||||||
|
const { data } = await api.post(`/tenants/${route.params.id}/program-settings/purge-non-owned`)
|
||||||
|
tenant.value = data.tenant
|
||||||
|
applyItems(Array.isArray(data.items) ? data.items : [])
|
||||||
|
const removed = Number(data.removed || 0)
|
||||||
|
message.success(
|
||||||
|
removed > 0
|
||||||
|
? `${removed} کلید غیر دسترسی از این پروژه حذف شد.`
|
||||||
|
: 'چیزی برای حذف نبود؛ همین حالا فقط کلیدهای دسترسی مشتری روی این پروژه است.',
|
||||||
|
)
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(errText(e) || 'حذف ناموفق بود')
|
||||||
|
} finally {
|
||||||
|
purging.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultOpenGroupId = computed(() => {
|
const defaultOpenGroupId = computed(() => {
|
||||||
const visibleIds = visibleSettingGroups.value.map((g) => g.id)
|
const visibleIds = visibleSettingGroups.value.map((g) => g.id)
|
||||||
const preferred = ['customer_features', 'chart', 'pricing', 'payping', 'store', 'general']
|
const preferred = ['customer_features', 'chart', 'pricing', 'payping', 'store', 'general']
|
||||||
@@ -433,7 +476,7 @@ onMounted(load)
|
|||||||
<p class="page-sub">
|
<p class="page-sub">
|
||||||
{{ tenant?.nameFa || 'نسخه خانگی' }}
|
{{ tenant?.nameFa || 'نسخه خانگی' }}
|
||||||
<template v-if="tenant?.domain"> · {{ tenant.domain }}</template>
|
<template v-if="tenant?.domain"> · {{ tenant.domain }}</template>
|
||||||
· کنترل کامل از سوپرادمین (جایگزین تنظیمات پیشرفته ادمین خانگی)
|
· فقط کلیدهای «دسترسی مشتری به قابلیتها»؛ بقیه مالک دیتابیس هر نصب است
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="head-aside">
|
<div class="head-aside">
|
||||||
@@ -449,6 +492,20 @@ onMounted(load)
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<section v-if="canWrite" class="form-section purge-section">
|
||||||
|
<h3>مهاجرت مالکیت به دیتابیس نصب</h3>
|
||||||
|
<p class="field-hint">
|
||||||
|
ترتیب: ۱) روی سرور همان پروژه
|
||||||
|
<code dir="ltr">php artisan settings:restore-from-backup --fill-from-superadmin</code>
|
||||||
|
۲) همین دکمه را بزن تا همهٔ کلیدها غیر از «دسترسی مشتری به قابلیتها»
|
||||||
|
از جدول settings این پروژه در سوپرادمین حذف شوند.
|
||||||
|
</p>
|
||||||
|
<a-button danger type="primary" html-type="button" size="large" :loading="purging" @click="confirmPurgeNonOwned">
|
||||||
|
<DeleteOutlined />
|
||||||
|
حذف تنظیمات غیر دسترسی از این پروژه
|
||||||
|
</a-button>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="form-section">
|
<section class="form-section">
|
||||||
<h3>انتقال از اپ خانگی</h3>
|
<h3>انتقال از اپ خانگی</h3>
|
||||||
<p class="field-hint">
|
<p class="field-hint">
|
||||||
|
|||||||
Reference in New Issue
Block a user