changes of giftCard page

This commit is contained in:
2026-10-20 12:11:46 +03:30
parent 2927d64c64
commit e5b3d0c931
55 changed files with 1495 additions and 140 deletions
+24
View File
@@ -4,12 +4,30 @@ import { getMyInformation } from '@/api/user'
import { get } from 'lodash'
import { isDeployAdmin } from '@/utils/deployAdmin'
import { hasSmsPanelAccess, isSmsBillingEnabled } from '@/utils/smsPanelAccess'
import { setAdminAccessState } from '@/utils/adminAccessState'
import { parsePageAccess } from '@/utils/adminPageAccess'
export const useUserStore = defineStore('user', () => {
const userInfo = ref<User | undefined>(undefined)
function syncPageAccess() {
const info = userInfo.value
const deployAdmin = isDeployAdmin(info?.mobile)
const pageAccess = parsePageAccess(info?.page_access)
const unrestricted = deployAdmin || pageAccess == null
setAdminAccessState({
ready: true,
unrestricted,
pageAccess: unrestricted ? null : pageAccess ?? null,
deployAdmin,
smsPanel: hasSmsPanelAccess(info) && isSmsBillingEnabled(info)
})
}
async function getMyInfo() {
try {
userInfo.value = await getMyInformation()
syncPageAccess()
return userInfo.value
} catch (e) {
console.log(e)
@@ -37,6 +55,11 @@ export const useUserStore = defineStore('user', () => {
const isDeployAdminUser = computed(() => isDeployAdmin(userInfo.value?.mobile))
const hasFullPageAccess = computed(() => {
if (isDeployAdminUser.value) return true
return parsePageAccess(userInfo.value?.page_access) == null
})
const smsPanelAccess = computed(() => hasSmsPanelAccess(userInfo.value))
const smsBillingEnabled = computed(() => isSmsBillingEnabled(userInfo.value))
@@ -48,6 +71,7 @@ export const useUserStore = defineStore('user', () => {
canAccess,
isAdmin,
isDeployAdminUser,
hasFullPageAccess,
smsPanelAccess,
smsBillingEnabled
}