feat(gift-card): show admin menu from has_page_gift_card

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-07 09:36:10 +03:30
co-authored by Cursor
parent 0f60c1e1a5
commit 2d5e8da2cb
3 changed files with 25 additions and 4 deletions
+6 -1
View File
@@ -210,7 +210,7 @@ import SettingCard from './SettingCard.vue'
import { configurationPageIntro, websiteSettingsPageIntro } from '@/utils/adminHelpCopy'
import { refreshAppModeMenu } from '@/router'
import { useUserStore } from '@/store/userStore'
import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyAutomationEnabledFromRows, applyProductFundsEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, applyPriceChannelAccessFromRows, applySupportChatMenuEnabledFromRows, applyGroupSmsFromRows, applyCustomerSpecialPricingFromRows, applyGoldCreditEnabledFromRows, applyCustomerDirectSmsFromRows, applyCustomerLevelProfitEnabledFromRows, applySuperAdminAccessFlagsFromItems, invalidateSettingsBootstrap, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setAutomationEnabledFromSettings, setProductFundsEnabledFromSettings, setPriceTriggerEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setPriceChannelAccessFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings, setGroupSmsEnabledFromSettings, setCustomerSpecialPricingEnabledFromSettings, setGoldCreditEnabledFromSettings, applyHasLandingFromRows, setHasLandingFromSettings } from '@/utils/config'
import { applyBannerEnabledFromRows, applyTrackingSystemsEnabledFromRows, applyConditionalOrderEnabledFromRows, applyAutomationEnabledFromRows, applyProductFundsEnabledFromRows, applyPriceTriggerEnabledFromRows, applyAppNotificationEnabledFromRows, applyPriceProviderFromRows, applyPriceChannelAccessFromRows, applySupportChatMenuEnabledFromRows, applyGroupSmsFromRows, applyCustomerSpecialPricingFromRows, applyGoldCreditEnabledFromRows, applyCustomerDirectSmsFromRows, applyCustomerLevelProfitEnabledFromRows, applySuperAdminAccessFlagsFromItems, invalidateSettingsBootstrap, setBannerEnabledFromSettings, setConditionalOrderEnabledFromSettings, setAutomationEnabledFromSettings, setProductFundsEnabledFromSettings, setPriceTriggerEnabledFromSettings, setGiftCardEnabledFromSettings, setAppNotificationEnabledFromSettings, setPriceProviderFromSettings, setPriceChannelAccessFromSettings, setStoreModeFromSettings, setTrackingSystemsEnabledFromSettings, setGroupSmsEnabledFromSettings, setCustomerSpecialPricingEnabledFromSettings, setGoldCreditEnabledFromSettings, applyHasLandingFromRows, setHasLandingFromSettings } from '@/utils/config'
import {
EDITABLE_SETTING_GROUPS,
SYSTEM_SETTING_GROUPS,
@@ -718,6 +718,11 @@ function syncMenuFlagsFromSetting(key: string | undefined, value: string) {
setPriceTriggerEnabledFromSettings(isSwitchOn(value))
return
}
if (key === 'has_page_gift_card') {
setGiftCardEnabledFromSettings(isSwitchOn(value))
refreshMenuAfterStoreChange()
return
}
if (key === 'has_page_notification') {
setAppNotificationEnabledFromSettings(isSwitchOn(value))
return
+3 -3
View File
@@ -2,7 +2,7 @@
//import router from '@/core/router/index'
import { useRouterStore } from '@core/stores/router'
import type { Router, RouteRecordRaw } from 'vue-router'
import { getConfigApp, isStoreApp } from '@/utils/config'
import { getConfigApp, giftCardEnabledSetting, isStoreApp } from '@/utils/config'
import { isDeployAdmin } from '@/utils/deployAdmin'
import { hasSmsPanelAccess, isSmsBillingEnabled } from '@/utils/smsPanelAccess'
import { useUserStore } from '@/store/userStore'
@@ -42,7 +42,7 @@ function applyAppModeMeta(route: RouteRecordRaw, appName: string | null) {
for (const child of route.children) {
if (child.name === 'giftCardMain' && child.meta) {
child.meta.title = store ? 'کارت هدیه و تخفیف' : 'کارت هدیه'
child.meta.hideMenu = !store && appName !== 'garoosi'
child.meta.hideMenu = !giftCardEnabledSetting.value
}
if (child.name === 'discounts' && child.meta) {
child.meta.hideMenu = store || appName !== 'goldsun'
@@ -60,7 +60,7 @@ function filterRoutesByApp(routes: RouteRecordRaw, appName: string | null) {
routes.children = routes.children.filter((item) => {
if (item.name === 'discounts' && (isStoreApp() || appName !== 'goldsun')) return false
if (item.name === 'authentication' && appName !== 'garoosi') return false
if (item.name === 'giftCardMain' && !isStoreApp() && appName !== 'garoosi') return false
if (item.name === 'giftCardMain' && !giftCardEnabledSetting.value) return false
return true
})
+16
View File
@@ -65,6 +65,9 @@ export const customerLevelProfitEnabledSetting = ref(false)
/** reactive — منو و UI هشدار قیمت */
export const priceTriggerEnabledSetting = ref(false)
/** reactive — منوی کارت هدیه ادمین (همان has_page_gift_card اپ کاربر) */
export const giftCardEnabledSetting = ref(false)
/** reactive — دکمه ارسال پیامک گروهی در صفحه پیامک‌ها */
export const groupSmsEnabledSetting = ref(false)
@@ -206,6 +209,10 @@ export function setPriceTriggerEnabledFromSettings(value: boolean): void {
priceTriggerEnabledSetting.value = value
}
export function setGiftCardEnabledFromSettings(value: boolean): void {
giftCardEnabledSetting.value = value
}
export function setAppNotificationEnabledFromSettings(value: boolean): void {
appNotificationEnabledSetting.value = value
}
@@ -338,6 +345,7 @@ export function applySuperAdminAccessFlagsFromItems(
applyProductFundsEnabledFromRows(rows)
applyCustomerLevelProfitEnabledFromRows(rows)
applyPriceTriggerEnabledFromRows(rows)
applyGiftCardEnabledFromRows(rows)
applyAppNotificationEnabledFromRows(rows)
applySupportChatMenuEnabledFromRows(rows)
applyHasLandingFromRows(rows)
@@ -378,6 +386,13 @@ export function applyPriceTriggerEnabledFromRows(
if (row) setPriceTriggerEnabledFromSettings(isSwitchOn(row.value))
}
export function applyGiftCardEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
const row = rows.find((item) => item.key === 'has_page_gift_card')
if (row) setGiftCardEnabledFromSettings(isSwitchOn(row.value))
}
export function applyAppNotificationEnabledFromRows(
rows: Array<{ key?: string; value?: string | null }>
) {
@@ -432,6 +447,7 @@ async function bootstrapSettingsFromApi(): Promise<void> {
applyProductFundsEnabledFromRows(list)
applyCustomerLevelProfitEnabledFromRows(list)
applyPriceTriggerEnabledFromRows(list)
applyGiftCardEnabledFromRows(list)
applyAppNotificationEnabledFromRows(list)
applySupportChatMenuEnabledFromRows(list)
applyHasLandingFromRows(list)