feat: migrate CRM screens to Ant Design Vue and expand home dashboard
Preserve the local Ant UI work across views/components and add the new home dashboard chart panels before merging latest main.
This commit is contained in:
@@ -144,6 +144,15 @@ const moreSectionActive = computed(
|
||||
|
||||
const enabledModules = computed(() => auth.user?.enabledModules ?? null);
|
||||
const subscription = computed(() => auth.user?.subscription ?? null);
|
||||
const subscriptionTone = computed(() => {
|
||||
const sub = subscription.value;
|
||||
if (!sub || sub.planCode === 'lifetime') return 'ok';
|
||||
if (sub.status === 'expired' || sub.status === 'suspended' || sub.daysRemaining <= 0) {
|
||||
return 'expired';
|
||||
}
|
||||
if (sub.warn) return 'warn';
|
||||
return 'ok';
|
||||
});
|
||||
|
||||
function moduleAllowed(module?: string) {
|
||||
if (!module) return true;
|
||||
@@ -289,6 +298,29 @@ function toggleCollapsed() {
|
||||
}
|
||||
}
|
||||
|
||||
const notifAnchor = ref<HTMLElement | null>(null);
|
||||
const notifPos = ref<{ top: string; left: string; width: string } | null>(null);
|
||||
|
||||
function placeNotif(anchor: HTMLElement) {
|
||||
const rect = anchor.getBoundingClientRect();
|
||||
const margin = 8;
|
||||
const width = Math.min(360, window.innerWidth - margin * 2);
|
||||
const left = Math.max(
|
||||
margin,
|
||||
Math.min(rect.right - width, window.innerWidth - width - margin),
|
||||
);
|
||||
const top = rect.bottom + margin;
|
||||
notifPos.value = {
|
||||
top: `${Math.round(top)}px`,
|
||||
left: `${Math.round(left)}px`,
|
||||
width: `${Math.round(width)}px`,
|
||||
};
|
||||
}
|
||||
|
||||
function onNotifReflow() {
|
||||
if (notifOpen.value && notifAnchor.value) placeNotif(notifAnchor.value);
|
||||
}
|
||||
|
||||
function closeNotif() {
|
||||
notifOpen.value = false;
|
||||
}
|
||||
@@ -386,10 +418,15 @@ function toggleMore() {
|
||||
moreOpen.value = true;
|
||||
}
|
||||
|
||||
function toggleNotif() {
|
||||
function toggleNotif(event: MouseEvent) {
|
||||
moreOpen.value = false;
|
||||
notifOpen.value = !notifOpen.value;
|
||||
if (notifOpen.value) void refreshNotifs();
|
||||
const opening = !notifOpen.value;
|
||||
notifOpen.value = opening;
|
||||
if (!opening) return;
|
||||
const anchor = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;
|
||||
notifAnchor.value = anchor;
|
||||
if (anchor) placeNotif(anchor);
|
||||
void refreshNotifs();
|
||||
}
|
||||
|
||||
function formatTime(iso: string) {
|
||||
@@ -406,12 +443,20 @@ function submitSearch() {
|
||||
|
||||
function syncBodyLock() {
|
||||
const overlay = moreOpen.value || Boolean(openHubKey.value);
|
||||
document.body.style.overflow =
|
||||
overlay || notifOpen.value ? 'hidden' : '';
|
||||
document.body.style.overflow = overlay ? 'hidden' : '';
|
||||
document.body.classList.toggle('mobile-nav-overlay', overlay);
|
||||
}
|
||||
watch(moreOpen, syncBodyLock);
|
||||
watch(notifOpen, syncBodyLock);
|
||||
watch(notifOpen, (open) => {
|
||||
syncBodyLock();
|
||||
if (open) {
|
||||
window.addEventListener('resize', onNotifReflow);
|
||||
window.addEventListener('scroll', onNotifReflow, true);
|
||||
} else {
|
||||
window.removeEventListener('resize', onNotifReflow);
|
||||
window.removeEventListener('scroll', onNotifReflow, true);
|
||||
}
|
||||
});
|
||||
watch(openHubKey, syncBodyLock);
|
||||
watch(
|
||||
() => route.fullPath,
|
||||
@@ -447,6 +492,8 @@ onUnmounted(() => {
|
||||
document.body.style.overflow = '';
|
||||
document.body.classList.remove('mobile-nav-overlay');
|
||||
mobileMq?.removeEventListener('change', onMobileMqChange);
|
||||
window.removeEventListener('resize', onNotifReflow);
|
||||
window.removeEventListener('scroll', onNotifReflow, true);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -502,7 +549,14 @@ onUnmounted(() => {
|
||||
<div class="rail-stem">
|
||||
<nav class="side-nav">
|
||||
<div class="nav-primary">
|
||||
<RouterLink to="/" class="nav-item" title="داشبورد" @click="closeHub(); closeMenu()">
|
||||
<RouterLink
|
||||
to="/"
|
||||
class="nav-item"
|
||||
active-class=""
|
||||
exact-active-class="router-link-active"
|
||||
title="داشبورد"
|
||||
@click="closeHub(); closeMenu()"
|
||||
>
|
||||
<UiIcon name="home" :size="collapsed ? 20 : 18" />
|
||||
<span>داشبورد</span>
|
||||
</RouterLink>
|
||||
@@ -807,42 +861,49 @@ onUnmounted(() => {
|
||||
</form>
|
||||
|
||||
<div class="topbar-actions">
|
||||
<RouterLink class="round-btn accent" :to="{ name: 'notes' }" title="هوش مصنوعی">
|
||||
<UiIcon name="sparkle" :size="18" />
|
||||
</RouterLink>
|
||||
<button class="round-btn" type="button" aria-label="اعلانها" @click="toggleNotif">
|
||||
<UiIcon name="bell" :size="18" />
|
||||
<span v-if="hasUnread" class="badge">{{ toFaDigits(unreadCount) }}</span>
|
||||
</button>
|
||||
<RouterLink class="round-btn" :to="{ name: 'activities-calendar' }" title="تقویم">
|
||||
<UiIcon name="calendar" :size="18" />
|
||||
</RouterLink>
|
||||
<RouterLink class="round-btn" :to="{ name: 'tickets' }" title="پیامها">
|
||||
<UiIcon name="mail" :size="18" />
|
||||
</RouterLink>
|
||||
<SmsHeaderWallet />
|
||||
<div
|
||||
v-if="subscription"
|
||||
class="sub-chip"
|
||||
:class="{ warn: subscription.warn }"
|
||||
:title="`انقضا: ${subscription.expiresAt}`"
|
||||
>
|
||||
<UiIcon name="clock" :size="15" />
|
||||
<span v-if="subscription.planCode === 'lifetime'">اشتراک دائمی</span>
|
||||
<span v-else>
|
||||
{{ toFaDigits(subscription.daysRemaining) }} روز باقیمانده
|
||||
</span>
|
||||
<div class="topbar-tools" role="toolbar" aria-label="میانبرها">
|
||||
<RouterLink class="round-btn accent" :to="{ name: 'notes' }" title="هوش مصنوعی">
|
||||
<UiIcon name="sparkle" :size="18" />
|
||||
</RouterLink>
|
||||
<button class="round-btn" type="button" aria-label="اعلانها" @click="toggleNotif">
|
||||
<UiIcon name="bell" :size="18" />
|
||||
<span v-if="hasUnread" class="badge">{{ toFaDigits(unreadCount) }}</span>
|
||||
</button>
|
||||
<RouterLink class="round-btn" :to="{ name: 'activities-calendar' }" title="تقویم">
|
||||
<UiIcon name="calendar" :size="18" />
|
||||
</RouterLink>
|
||||
<RouterLink class="round-btn" :to="{ name: 'tickets' }" title="پیامها">
|
||||
<UiIcon name="mail" :size="18" />
|
||||
</RouterLink>
|
||||
</div>
|
||||
<div class="date-chip">
|
||||
<UiIcon name="calendar" :size="16" />
|
||||
<span>{{ todayLabel }}</span>
|
||||
<div class="topbar-context" aria-label="وضعیت حساب">
|
||||
<span class="context-date" :title="todayLabel">{{ todayLabel }}</span>
|
||||
<span v-if="subscription" class="context-sep" aria-hidden="true" />
|
||||
<span
|
||||
v-if="subscription"
|
||||
class="context-sub"
|
||||
:class="subscriptionTone"
|
||||
:title="
|
||||
subscription.planCode === 'lifetime'
|
||||
? 'اشتراک دائمی'
|
||||
: `${toFaDigits(subscription.daysRemaining)} روز تا پایان اشتراک. انقضا: ${subscription.expiresAt}`
|
||||
"
|
||||
>
|
||||
<template v-if="subscription.planCode === 'lifetime'">اشتراک دائمی</template>
|
||||
<template v-else-if="subscriptionTone === 'expired'">
|
||||
{{ subscription.status === 'suspended' ? 'اشتراک معلق' : 'اشتراک منقضی' }}
|
||||
</template>
|
||||
<template v-else>{{ toFaDigits(subscription.daysRemaining) }} روز مانده</template>
|
||||
</span>
|
||||
<span class="context-sep" aria-hidden="true" />
|
||||
<SmsHeaderWallet />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="notifOpen" class="notif-layer">
|
||||
<div class="notif-backdrop" @click="closeNotif" />
|
||||
<div class="notif-panel" role="dialog" aria-label="اعلانها">
|
||||
<div class="notif-panel" role="dialog" aria-label="اعلانها" :style="notifPos ?? undefined">
|
||||
<header class="notif-head">
|
||||
<strong>اعلانها</strong>
|
||||
<div class="notif-head-actions">
|
||||
@@ -1262,7 +1323,7 @@ onUnmounted(() => {
|
||||
.hub-layer :deep(.hub) {
|
||||
pointer-events: auto;
|
||||
position: absolute;
|
||||
top: 42px;
|
||||
top: calc(16px + var(--control-h) + 12px);
|
||||
inset-inline-start: var(--hub-offset);
|
||||
inset-inline-end: auto;
|
||||
}
|
||||
@@ -1912,7 +1973,7 @@ onUnmounted(() => {
|
||||
|
||||
.desktop-topbar {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
grid-template-columns: minmax(12rem, 1fr) minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
@@ -1928,12 +1989,165 @@ onUnmounted(() => {
|
||||
.topbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
/* مرکز عمودی نسبت به ارتفاع جستجو (~49px) */
|
||||
justify-content: flex-end;
|
||||
width: 100%;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
min-height: var(--control-h);
|
||||
}
|
||||
|
||||
.topbar-tools {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
height: var(--control-h);
|
||||
padding: 2px;
|
||||
gap: 2px;
|
||||
background: #fff;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.topbar-tools .round-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
border-radius: calc(var(--radius) - 2px);
|
||||
}
|
||||
|
||||
.topbar-tools .round-btn:hover {
|
||||
background: var(--surface-subtle);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.topbar-tools .round-btn.accent {
|
||||
color: var(--accent-deep);
|
||||
background: var(--accent-subtle);
|
||||
}
|
||||
|
||||
.topbar-tools .round-btn.accent:hover {
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.topbar-context {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
height: var(--control-h);
|
||||
padding-inline: 12px;
|
||||
gap: 8px;
|
||||
background: #fff;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow-xs);
|
||||
color: var(--ink-secondary);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.context-date {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.context-sub {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
padding-inline: 8px;
|
||||
border-radius: 8px;
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-semibold);
|
||||
}
|
||||
|
||||
.context-sub.ok {
|
||||
background: var(--accent-subtle);
|
||||
color: var(--accent-deep);
|
||||
}
|
||||
|
||||
.context-sub.warn {
|
||||
background: var(--warning-soft);
|
||||
color: var(--warning-deep);
|
||||
}
|
||||
|
||||
.context-sub.expired {
|
||||
background: var(--danger-soft);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.context-sep {
|
||||
flex-shrink: 0;
|
||||
width: 1px;
|
||||
height: 14px;
|
||||
background: var(--line);
|
||||
}
|
||||
|
||||
.topbar-context > .context-sep:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.topbar-context :deep(.sms-wallet) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip) {
|
||||
height: 32px;
|
||||
gap: 6px;
|
||||
padding-inline: 2px 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
color: var(--ink);
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip.warning),
|
||||
.topbar-context :deep(.chip.critical),
|
||||
.topbar-context :deep(.chip.negative),
|
||||
.topbar-context :deep(.chip.healthy) {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.label) {
|
||||
color: var(--muted);
|
||||
opacity: 1;
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.amount) {
|
||||
font-weight: var(--fw-semibold);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip.warning .amount) {
|
||||
color: var(--warning-deep);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip.critical .amount),
|
||||
.topbar-context :deep(.chip.negative .amount) {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip.is-debt) {
|
||||
height: 28px;
|
||||
padding-inline: 8px;
|
||||
border-radius: 8px;
|
||||
background: var(--danger);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.topbar-context :deep(.chip.is-debt .label),
|
||||
.topbar-context :deep(.chip.is-debt .amount) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.global-search:focus-within {
|
||||
background: #fff;
|
||||
border-color: #e2e8f0;
|
||||
@@ -1983,40 +2197,6 @@ onUnmounted(() => {
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.sub-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.35rem 0.7rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent-subtle);
|
||||
color: var(--accent-deep);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 800;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sub-chip.warn {
|
||||
background: color-mix(in srgb, var(--danger) 12%, white);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.date-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
height: var(--control-h);
|
||||
box-sizing: border-box;
|
||||
padding: 0 0.75rem;
|
||||
border-radius: var(--radius);
|
||||
background: #fff;
|
||||
color: #64748b;
|
||||
font-size: 0.84rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
@@ -2037,29 +2217,27 @@ onUnmounted(() => {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 40;
|
||||
display: grid;
|
||||
place-items: start end;
|
||||
padding: 5rem 1rem 1rem;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.notif-backdrop {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(15, 23, 42, 0.22);
|
||||
background: transparent;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.notif-panel {
|
||||
position: relative;
|
||||
width: min(360px, calc(100vw - 2rem));
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
width: min(360px, calc(100vw - 1rem));
|
||||
max-height: min(70vh, 480px);
|
||||
overflow: auto;
|
||||
background: #fff;
|
||||
border: 1px solid #e8eef3;
|
||||
border-radius: 18px;
|
||||
border-radius: var(--radius);
|
||||
padding: 0.85rem;
|
||||
box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
|
||||
box-shadow: var(--shadow-lg);
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
@@ -2277,13 +2455,8 @@ onUnmounted(() => {
|
||||
padding: 16px 16px calc(16px + var(--mobile-tabbar-h));
|
||||
}
|
||||
|
||||
.notif-layer {
|
||||
padding: 4.25rem 0.65rem calc(1rem + var(--mobile-tabbar-h));
|
||||
place-items: start stretch;
|
||||
}
|
||||
|
||||
.notif-panel {
|
||||
width: 100%;
|
||||
max-height: min(70vh, calc(100dvh - var(--mobile-tabbar-h) - 5rem));
|
||||
}
|
||||
|
||||
.mobile-tabbar {
|
||||
|
||||
Reference in New Issue
Block a user