Componentize dashboard middle section and add Mento brand assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 762 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
||||||
|
<rect width="64" height="64" rx="16" fill="#ECFDF8"/>
|
||||||
|
<path d="M14 46V18.5c0-1.4 1.6-2.2 2.7-1.4L32 28.2l15.3-11.1c1.1-.8 2.7 0 2.7 1.4V46c0 1.1-.9 2-2 2H16c-1.1 0-2-.9-2-2Z" fill="#134E4A"/>
|
||||||
|
<path d="M18 44V22.8L32 33.2 46 22.8V44H18Z" fill="#2EB29B"/>
|
||||||
|
<path d="M32 33.2 18 22.8V44h14V33.2Z" fill="#14B8A6"/>
|
||||||
|
<path d="M32 33.2 46 22.8V44H32V33.2Z" fill="#0D9488"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 456 B |
@@ -0,0 +1,78 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
size?: number;
|
||||||
|
bubble?: string;
|
||||||
|
showBubble?: boolean;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
size: 140,
|
||||||
|
bubble: 'من دستیار فروش هوشمند سیستم هستم',
|
||||||
|
showBubble: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="ai-avatar" :style="{ width: `${size}px` }">
|
||||||
|
<div v-if="showBubble" class="bubble">{{ bubble }}</div>
|
||||||
|
<div class="figure">
|
||||||
|
<img
|
||||||
|
class="img"
|
||||||
|
src="/brand/mento-ai-avatar.png"
|
||||||
|
alt="دستیار هوشمند منتو"
|
||||||
|
:width="size"
|
||||||
|
:height="size"
|
||||||
|
/>
|
||||||
|
<span class="glow" aria-hidden="true" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.ai-avatar {
|
||||||
|
display: grid;
|
||||||
|
justify-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bubble {
|
||||||
|
max-width: 170px;
|
||||||
|
padding: 0.55rem 0.75rem;
|
||||||
|
border-radius: 16px 16px 4px 16px;
|
||||||
|
background: rgba(255, 255, 255, 0.18);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.figure {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
filter: drop-shadow(0 12px 28px rgba(14, 165, 233, 0.35));
|
||||||
|
}
|
||||||
|
|
||||||
|
.glow {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8%;
|
||||||
|
width: 55%;
|
||||||
|
height: 14%;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: radial-gradient(circle, rgba(56, 189, 248, 0.75), transparent 70%);
|
||||||
|
filter: blur(4px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
size?: number;
|
||||||
|
showText?: boolean;
|
||||||
|
variant?: 'full' | 'mark';
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
size: 40,
|
||||||
|
showText: true,
|
||||||
|
variant: 'full',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mento-logo" :class="variant">
|
||||||
|
<img
|
||||||
|
class="mark"
|
||||||
|
src="/brand/mento-logo.svg"
|
||||||
|
alt="Mento"
|
||||||
|
:width="size"
|
||||||
|
:height="size"
|
||||||
|
/>
|
||||||
|
<div v-if="showText && variant === 'full'" class="text">
|
||||||
|
<strong>Mento</strong>
|
||||||
|
<small>by Mentech</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mento-logo {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.7rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mark {
|
||||||
|
display: block;
|
||||||
|
border-radius: 12px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
object-fit: cover;
|
||||||
|
background: #ecfdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.05rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text strong {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
color: #0f172a;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text small {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
askQuery: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:askQuery': [value: string];
|
||||||
|
ask: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const shortcuts = [
|
||||||
|
{ label: 'خلاصه مشتری شرکت آریانا را بده', to: '/contacts', icon: 'users' as const },
|
||||||
|
{ label: 'متن پیگیری برای مشتری بفرست', to: '/notes', icon: 'send' as const },
|
||||||
|
{ label: 'گزارش فروش این هفته را نشان بده', to: '/reports', icon: 'chart' as const },
|
||||||
|
{ label: 'معاملات در خطر را لیست کن', to: '/pipeline', icon: 'warning' as const },
|
||||||
|
];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel ai-panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>
|
||||||
|
<UiIcon name="sparkle" :size="16" />
|
||||||
|
دستیار هوشمند منتو
|
||||||
|
</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<p class="ai-lead">چه کمکی میتونم بکنم؟</p>
|
||||||
|
|
||||||
|
<div class="ai-shortcuts">
|
||||||
|
<RouterLink
|
||||||
|
v-for="item in shortcuts"
|
||||||
|
:key="item.label"
|
||||||
|
class="ai-chip"
|
||||||
|
:to="item.to"
|
||||||
|
>
|
||||||
|
<span class="chip-ico"><UiIcon :name="item.icon" :size="15" /></span>
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</RouterLink>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form class="ai-input" @submit.prevent="emit('ask')">
|
||||||
|
<input
|
||||||
|
:value="askQuery"
|
||||||
|
type="search"
|
||||||
|
placeholder="از منتو بپرس..."
|
||||||
|
@input="emit('update:askQuery', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
<button type="submit" aria-label="ارسال">
|
||||||
|
<UiIcon name="send" :size="16" />
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.1rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
margin-bottom: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-lead {
|
||||||
|
margin: 0 0 0.85rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-shortcuts {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.45rem;
|
||||||
|
margin-bottom: 0.95rem;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-chip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
padding: 0.7rem 0.8rem;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
color: #334155;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background 0.15s ease, border-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-chip:hover {
|
||||||
|
background: #ecfdf8;
|
||||||
|
border-color: #99f6e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-ico {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ecfdf8;
|
||||||
|
color: #14b8a6;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-input {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.45rem;
|
||||||
|
margin-top: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-input input {
|
||||||
|
flex: 1;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 0.7rem 0.85rem;
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-input button {
|
||||||
|
width: 44px;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #14b8a6;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
import MentoAiAvatar from '@/components/brand/MentoAiAvatar.vue';
|
||||||
|
import type { HomeDashboardAlertDto } from '@mento/shared';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
greeting: string;
|
||||||
|
firstName: string;
|
||||||
|
userInitial: string;
|
||||||
|
alerts: HomeDashboardAlertDto[];
|
||||||
|
askQuery: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:askQuery': [value: string];
|
||||||
|
ask: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function alertIcon(tone: string) {
|
||||||
|
if (tone === 'urgent') return 'fire' as const;
|
||||||
|
if (tone === 'warning') return 'warning' as const;
|
||||||
|
if (tone === 'success') return 'trend' as const;
|
||||||
|
return 'sparkle' as const;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<header class="hero">
|
||||||
|
<div class="hero-pattern" aria-hidden="true" />
|
||||||
|
<div class="hero-glow a" />
|
||||||
|
<div class="hero-glow b" />
|
||||||
|
|
||||||
|
<div class="hero-body">
|
||||||
|
<div class="hero-top">
|
||||||
|
<div class="hero-greet">
|
||||||
|
<span class="hero-avatar">
|
||||||
|
{{ userInitial }}
|
||||||
|
<i class="online" />
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h1>{{ greeting }} {{ firstName }}</h1>
|
||||||
|
<p>منتو اینها رو برات پیدا کرده</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hero-chips">
|
||||||
|
<RouterLink
|
||||||
|
v-for="alert in alerts.slice(0, 3)"
|
||||||
|
:key="alert.key"
|
||||||
|
class="chip"
|
||||||
|
:class="`chip-${alert.tone}`"
|
||||||
|
:to="alert.link || '/'"
|
||||||
|
>
|
||||||
|
<span class="chip-ico"><UiIcon :name="alertIcon(alert.tone)" :size="14" /></span>
|
||||||
|
<span>{{ alert.text }}</span>
|
||||||
|
</RouterLink>
|
||||||
|
<span v-if="!alerts.length" class="chip chip-success">
|
||||||
|
<span class="chip-ico"><UiIcon name="trend" :size="14" /></span>
|
||||||
|
امروز آمادهاید برای فروش بیشتر
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form class="hero-ask" @submit.prevent="emit('ask')">
|
||||||
|
<UiIcon name="sparkle" :size="16" />
|
||||||
|
<input
|
||||||
|
:value="askQuery"
|
||||||
|
type="search"
|
||||||
|
placeholder="از منتو بپرس..."
|
||||||
|
@input="emit('update:askQuery', ($event.target as HTMLInputElement).value)"
|
||||||
|
/>
|
||||||
|
<kbd>⌘K</kbd>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<MentoAiAvatar class="hero-bot" :size="150" />
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.hero {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) 180px;
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 196px;
|
||||||
|
padding: 1.35rem 1.4rem;
|
||||||
|
border-radius: 28px;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(110deg, #5eead4 0%, #14b8a6 26%, #0f766e 55%, #163a5f 100%);
|
||||||
|
box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-pattern {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
opacity: 0.12;
|
||||||
|
background-image:
|
||||||
|
radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
|
||||||
|
radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.25) 0 1.5px, transparent 2.5px);
|
||||||
|
background-size: 28px 28px, 18px 18px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-glow {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-glow.a {
|
||||||
|
width: 220px;
|
||||||
|
height: 220px;
|
||||||
|
top: -90px;
|
||||||
|
inset-inline-end: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-glow.b {
|
||||||
|
width: 140px;
|
||||||
|
height: 140px;
|
||||||
|
bottom: -55px;
|
||||||
|
inset-inline-start: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-body {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-top {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-greet {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-avatar {
|
||||||
|
position: relative;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(255, 255, 255, 0.22);
|
||||||
|
border: 2px solid rgba(255, 255, 255, 0.45);
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.online {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2px;
|
||||||
|
inset-inline-start: 2px;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #22c55e;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(1.4rem, 2.2vw, 1.8rem);
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0.2rem 0 0;
|
||||||
|
opacity: 0.9;
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-chips {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0.48rem 0.75rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #fff;
|
||||||
|
color: #0f172a;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-ico {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 999px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-urgent .chip-ico {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #ef4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-warning .chip-ico {
|
||||||
|
background: #fef3c7;
|
||||||
|
color: #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-success .chip-ico,
|
||||||
|
.chip-info .chip-ico {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #16a34a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-ask {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem;
|
||||||
|
max-width: 440px;
|
||||||
|
background: rgba(255, 255, 255, 0.96);
|
||||||
|
color: #0f172a;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.58rem 0.9rem;
|
||||||
|
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-ask input {
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
flex: 1;
|
||||||
|
outline: none;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-ask kbd {
|
||||||
|
font-size: 0.68rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 7px;
|
||||||
|
padding: 0.12rem 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-bot {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.hero {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-bot {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
import type { HomeDashboardKpiDto } from '@mento/shared';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
kpis: HomeDashboardKpiDto[];
|
||||||
|
currency: string;
|
||||||
|
formatValue: (key: string, value: number) => string;
|
||||||
|
formatChange: (value: number | null) => string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const icons: Record<string, 'calendar' | 'users' | 'briefcase' | 'check'> = {
|
||||||
|
sales: 'calendar',
|
||||||
|
customers: 'users',
|
||||||
|
'open-deals': 'briefcase',
|
||||||
|
followups: 'check',
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="kpi-row">
|
||||||
|
<article v-for="kpi in kpis" :key="kpi.key" class="kpi-card">
|
||||||
|
<div class="kpi-icon">
|
||||||
|
<UiIcon :name="icons[kpi.key] ?? 'chart'" :size="20" />
|
||||||
|
</div>
|
||||||
|
<div class="kpi-text">
|
||||||
|
<p class="kpi-label">{{ kpi.label }}</p>
|
||||||
|
<strong class="kpi-value">{{ formatValue(kpi.key, kpi.value) }}</strong>
|
||||||
|
<span
|
||||||
|
v-if="kpi.changePercent != null"
|
||||||
|
class="kpi-change"
|
||||||
|
:class="{ down: kpi.changePercent < 0 }"
|
||||||
|
>
|
||||||
|
{{ formatChange(kpi.changePercent) }} {{ kpi.changeLabel }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.kpi-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
gap: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-card {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.85rem;
|
||||||
|
align-items: flex-start;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.1rem 1.15rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #ecfdf8;
|
||||||
|
color: #14b8a6;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-label {
|
||||||
|
margin: 0;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.84rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-value {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
font-size: 1.18rem;
|
||||||
|
color: #0f172a;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-change {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 0.45rem;
|
||||||
|
padding: 0.18rem 0.5rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #16a34a;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kpi-change.down {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1200px) {
|
||||||
|
.kpi-row {
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.kpi-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
|
import type { PipelineBoardDto } from '@mento/shared';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
board: PipelineBoardDto | null;
|
||||||
|
formatMoney: (amount: number, currency: string) => string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const stages = computed(() => props.board?.stages.slice(0, 3) ?? []);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>جریان فروش</h2>
|
||||||
|
<RouterLink :to="{ name: 'pipeline' }">کاریز کامل</RouterLink>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div v-if="stages.length" class="mini-pipeline">
|
||||||
|
<div v-for="stage in stages" :key="stage.id" class="pipe-col">
|
||||||
|
<header>
|
||||||
|
<strong>{{ stage.name }}</strong>
|
||||||
|
<span>{{ toFaDigits(stage.deals.length) }}</span>
|
||||||
|
</header>
|
||||||
|
<div class="pipe-cards">
|
||||||
|
<RouterLink
|
||||||
|
v-for="deal in stage.deals.slice(0, 3)"
|
||||||
|
:key="deal.id"
|
||||||
|
class="pipe-card"
|
||||||
|
:to="{ name: 'deal-detail', params: { id: deal.id } }"
|
||||||
|
>
|
||||||
|
<span class="deal-mark">
|
||||||
|
{{ (deal.company?.name || deal.person?.fullName || deal.title).slice(0, 1) }}
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<strong>{{ deal.company?.name || deal.person?.fullName || deal.title }}</strong>
|
||||||
|
<span v-if="deal.amount">{{ formatMoney(deal.amount, deal.currency) }}</span>
|
||||||
|
</div>
|
||||||
|
</RouterLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p v-else class="muted">کاریزی برای نمایش نیست.</p>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.1rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #14b8a6;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-pipeline {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(140px, 1fr));
|
||||||
|
gap: 0.75rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-col > header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin-bottom: 0.55rem;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-col > header span {
|
||||||
|
color: #64748b;
|
||||||
|
background: #f1f5f9;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.05rem 0.45rem;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-cards {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem;
|
||||||
|
padding: 0.65rem 0.7rem;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
color: inherit;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-card div {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.12rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-card strong {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe-card span {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deal-mark {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #ecfdf8;
|
||||||
|
color: #0f766e;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
font-weight: 800;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted {
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.mini-pipeline {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { RouterLink } from 'vue-router';
|
||||||
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
import type { ActivityDto } from '@mento/shared';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
activities: ActivityDto[];
|
||||||
|
formatWhen: (value: string | null) => string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const typeLabel: Record<string, string> = {
|
||||||
|
call: 'تماس',
|
||||||
|
meeting: 'جلسه',
|
||||||
|
task: 'وظیفه',
|
||||||
|
note: 'یادداشت',
|
||||||
|
};
|
||||||
|
|
||||||
|
function activityStatus(act: ActivityDto) {
|
||||||
|
if (act.status === 'done') return { label: 'انجام شد', tone: 'done' };
|
||||||
|
if (act.dueAt && new Date(act.dueAt) < new Date()) {
|
||||||
|
return { label: 'عقبافتاده', tone: 'late' };
|
||||||
|
}
|
||||||
|
return { label: 'در انتظار پاسخ', tone: 'pending' };
|
||||||
|
}
|
||||||
|
|
||||||
|
function activityIcon(type: string) {
|
||||||
|
if (type === 'call') return 'phone' as const;
|
||||||
|
if (type === 'meeting') return 'calendar' as const;
|
||||||
|
if (type === 'task') return 'check' as const;
|
||||||
|
return 'mail' as const;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>فعالیتهای اخیر</h2>
|
||||||
|
<RouterLink :to="{ name: 'activities' }">مشاهده همه</RouterLink>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<ul v-if="activities.length" class="activity-list">
|
||||||
|
<li v-for="act in activities" :key="act.id">
|
||||||
|
<span class="act-icon">
|
||||||
|
<UiIcon :name="activityIcon(act.type)" :size="16" />
|
||||||
|
</span>
|
||||||
|
<div class="act-body">
|
||||||
|
<strong>{{ act.title }}</strong>
|
||||||
|
<span>
|
||||||
|
{{ typeLabel[act.type] ?? act.type }} ·
|
||||||
|
{{ formatWhen(act.dueAt || act.createdAt) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="status-pill" :class="activityStatus(act).tone">
|
||||||
|
{{ activityStatus(act).label }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p v-else class="muted">فعالیتی ثبت نشده.</p>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.1rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #14b8a6;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-list li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.act-icon {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: #ecfdf8;
|
||||||
|
color: #14b8a6;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.act-body {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.act-body strong {
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.act-body span {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.74rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pill {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 0.24rem 0.55rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pill.done {
|
||||||
|
background: #dcfce7;
|
||||||
|
color: #166534;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pill.pending {
|
||||||
|
background: #dbeafe;
|
||||||
|
color: #1d4ed8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-pill.late {
|
||||||
|
background: #fee2e2;
|
||||||
|
color: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted {
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import type { HomeDashboardTrendPointDto } from '@mento/shared';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
trend: HomeDashboardTrendPointDto[];
|
||||||
|
changePercent: number | null;
|
||||||
|
formatChange: (value: number | null) => string;
|
||||||
|
formatAmount: (value: number) => string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const points = computed(() => {
|
||||||
|
const trend = props.trend;
|
||||||
|
if (!trend.length) return [];
|
||||||
|
const max = Math.max(...trend.map((p) => p.amount), 1);
|
||||||
|
const w = 360;
|
||||||
|
const h = 150;
|
||||||
|
const padX = 16;
|
||||||
|
const padY = 18;
|
||||||
|
return trend.map((p, i) => ({
|
||||||
|
...p,
|
||||||
|
x: padX + (i / Math.max(trend.length - 1, 1)) * (w - padX * 2),
|
||||||
|
y: h - padY - (p.amount / max) * (h - padY * 2),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
const line = computed(() => points.value.map((p) => `${p.x},${p.y}`).join(' '));
|
||||||
|
|
||||||
|
const area = computed(() => {
|
||||||
|
if (!points.value.length) return '';
|
||||||
|
const first = points.value[0]!;
|
||||||
|
const last = points.value[points.value.length - 1]!;
|
||||||
|
return `${line.value} ${last.x},160 ${first.x},160`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const highlight = computed(() => {
|
||||||
|
if (!points.value.length) return null;
|
||||||
|
return points.value.reduce((best, cur) => (cur.amount >= best.amount ? cur : best));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>روند فروش</h2>
|
||||||
|
<span
|
||||||
|
v-if="changePercent != null"
|
||||||
|
class="mini-badge"
|
||||||
|
:class="{ down: changePercent < 0 }"
|
||||||
|
>
|
||||||
|
{{ formatChange(changePercent) }} نسبت به ماه قبل
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="chart-wrap">
|
||||||
|
<svg viewBox="0 0 360 170" class="line-chart" aria-hidden="true">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="homeTrendFill" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0%" stop-color="#14b8a6" stop-opacity="0.3" />
|
||||||
|
<stop offset="100%" stop-color="#14b8a6" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<line
|
||||||
|
v-for="y in [40, 75, 110, 145]"
|
||||||
|
:key="y"
|
||||||
|
x1="12"
|
||||||
|
:y1="y"
|
||||||
|
x2="348"
|
||||||
|
:y2="y"
|
||||||
|
stroke="#eef2f7"
|
||||||
|
stroke-width="1"
|
||||||
|
/>
|
||||||
|
<polygon v-if="area" :points="area" fill="url(#homeTrendFill)" />
|
||||||
|
<polyline
|
||||||
|
v-if="line"
|
||||||
|
:points="line"
|
||||||
|
fill="none"
|
||||||
|
stroke="#14b8a6"
|
||||||
|
stroke-width="3.4"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
<g v-for="(p, i) in points" :key="i">
|
||||||
|
<circle :cx="p.x" :cy="p.y" r="5" fill="#fff" stroke="#14b8a6" stroke-width="2.6" />
|
||||||
|
</g>
|
||||||
|
<g v-if="highlight">
|
||||||
|
<rect
|
||||||
|
:x="highlight.x - 52"
|
||||||
|
:y="highlight.y - 36"
|
||||||
|
width="104"
|
||||||
|
height="26"
|
||||||
|
rx="10"
|
||||||
|
fill="#0f766e"
|
||||||
|
/>
|
||||||
|
<text
|
||||||
|
:x="highlight.x"
|
||||||
|
:y="highlight.y - 18"
|
||||||
|
text-anchor="middle"
|
||||||
|
fill="#fff"
|
||||||
|
font-size="10"
|
||||||
|
font-family="Vazirmatn, Tahoma, sans-serif"
|
||||||
|
>
|
||||||
|
{{ formatAmount(highlight.amount) }}
|
||||||
|
</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
<div class="chart-labels">
|
||||||
|
<span v-for="p in trend" :key="p.monthKey">{{ p.monthLabel }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.15rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-bottom: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-badge {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #16a34a;
|
||||||
|
background: #dcfce7;
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 0.2rem 0.55rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mini-badge.down {
|
||||||
|
color: #dc2626;
|
||||||
|
background: #fee2e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-wrap {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-chart {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-labels {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.74rem;
|
||||||
|
padding: 0 0.4rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
|
import type { HomeDashboardSourceDto } from '@mento/shared';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
sources: HomeDashboardSourceDto[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const colors = ['#14b8a6', '#38bdf8', '#fb923c', '#fbbf24', '#94a3b8', '#a78bfa'];
|
||||||
|
|
||||||
|
const segments = computed(() => {
|
||||||
|
let offset = 0;
|
||||||
|
return props.sources.map((s, i) => {
|
||||||
|
const seg = { ...s, color: colors[i % colors.length], offset };
|
||||||
|
offset += s.percent;
|
||||||
|
return seg;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const total = computed(() => props.sources.reduce((a, s) => a + s.count, 0));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>منابع مشتریان</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="donut-wrap">
|
||||||
|
<div class="donut-chart-box">
|
||||||
|
<svg viewBox="0 0 140 140" class="donut-chart" aria-hidden="true">
|
||||||
|
<circle cx="70" cy="70" r="48" fill="none" stroke="#eef2f7" stroke-width="16" />
|
||||||
|
<circle
|
||||||
|
v-for="seg in segments"
|
||||||
|
:key="seg.label"
|
||||||
|
cx="70"
|
||||||
|
cy="70"
|
||||||
|
r="48"
|
||||||
|
fill="none"
|
||||||
|
:stroke="seg.color"
|
||||||
|
stroke-width="16"
|
||||||
|
stroke-linecap="butt"
|
||||||
|
:stroke-dasharray="`${seg.percent * 3.016} 301.6`"
|
||||||
|
:stroke-dashoffset="`${-seg.offset * 3.016}`"
|
||||||
|
transform="rotate(-90 70 70)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<div class="donut-center">
|
||||||
|
<strong>{{ toFaDigits(total) }}</strong>
|
||||||
|
<span>مشتری</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="donut-legend">
|
||||||
|
<li v-for="seg in segments" :key="seg.label">
|
||||||
|
<span class="dot" :style="{ background: seg.color }" />
|
||||||
|
<span class="lbl">{{ seg.label }}</span>
|
||||||
|
<em>{{ toFaDigits(seg.percent) }}٪</em>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.15rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-wrap {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 140px 1fr;
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-chart-box {
|
||||||
|
position: relative;
|
||||||
|
width: 140px;
|
||||||
|
height: 140px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-chart {
|
||||||
|
width: 140px;
|
||||||
|
height: 140px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-center {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: grid;
|
||||||
|
place-content: center;
|
||||||
|
text-align: center;
|
||||||
|
gap: 0.05rem;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-center strong {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-center span {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-legend {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donut-legend li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbl {
|
||||||
|
flex: 1;
|
||||||
|
color: #475569;
|
||||||
|
}
|
||||||
|
|
||||||
|
em {
|
||||||
|
font-style: normal;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 999px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
.donut-wrap {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
justify-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { toFaDigits } from '@/lib/jalali';
|
||||||
|
import type { HomeDashboardTopCustomerDto } from '@mento/shared';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
customers: HomeDashboardTopCustomerDto[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
function trophy(rank: number) {
|
||||||
|
if (rank === 1) return '🥇';
|
||||||
|
if (rank === 2) return '🥈';
|
||||||
|
if (rank === 3) return '🥉';
|
||||||
|
return `#${toFaDigits(rank)}`;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="panel">
|
||||||
|
<header class="panel-head">
|
||||||
|
<h2>مشتریان برتر</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<ul v-if="customers.length" class="top-list">
|
||||||
|
<li v-for="row in customers" :key="row.id">
|
||||||
|
<span class="cust-avatar">{{ row.name.slice(0, 1) }}</span>
|
||||||
|
<div>
|
||||||
|
<strong>{{ row.name }}</strong>
|
||||||
|
<span>{{ toFaDigits(row.dealCount) }} معامله</span>
|
||||||
|
</div>
|
||||||
|
<span class="rank">{{ trophy(row.rank) }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p v-else class="muted">هنوز داده کافی برای رتبهبندی نیست.</p>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 22px;
|
||||||
|
padding: 1.05rem 1.1rem;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-head {
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.98rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-list li {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cust-avatar {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: linear-gradient(145deg, #ccfbf1, #99f6e4);
|
||||||
|
color: #0f766e;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
font-weight: 800;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-list div {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.12rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-list strong {
|
||||||
|
font-size: 0.88rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-list span {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.74rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rank {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted {
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,6 +5,7 @@ import { useAuthStore } from '@/stores/auth';
|
|||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
import { formatJalaliShort, toFaDigits } from '@/lib/jalali';
|
import { formatJalaliShort, toFaDigits } from '@/lib/jalali';
|
||||||
import UiIcon from '@/components/UiIcon.vue';
|
import UiIcon from '@/components/UiIcon.vue';
|
||||||
|
import MentoLogo from '@/components/brand/MentoLogo.vue';
|
||||||
import type {
|
import type {
|
||||||
ActivitySummaryDto,
|
ActivitySummaryDto,
|
||||||
NotificationDto,
|
NotificationDto,
|
||||||
@@ -209,13 +210,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<aside id="app-sidebar" class="sidebar" :class="{ open: menuOpen }">
|
<aside id="app-sidebar" class="sidebar" :class="{ open: menuOpen }">
|
||||||
<div class="brand-row">
|
<div class="brand-row">
|
||||||
<div class="brand">
|
<MentoLogo :size="40" />
|
||||||
<span class="mark">M</span>
|
|
||||||
<div>
|
|
||||||
<strong>Mento</strong>
|
|
||||||
<small>by Mentech</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
<button
|
||||||
class="icon-btn ghost mobile-only"
|
class="icon-btn ghost mobile-only"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -380,7 +375,7 @@ onUnmounted(() => {
|
|||||||
<span class="burger" :class="{ open: menuOpen }" />
|
<span class="burger" :class="{ open: menuOpen }" />
|
||||||
</button>
|
</button>
|
||||||
<div class="top-brand">
|
<div class="top-brand">
|
||||||
<span class="mark sm">M</span>
|
<MentoLogo :size="32" :show-text="false" variant="mark" />
|
||||||
<strong>Mento</strong>
|
<strong>Mento</strong>
|
||||||
</div>
|
</div>
|
||||||
<button class="round-btn" type="button" aria-label="اعلانها" @click="toggleNotif">
|
<button class="round-btn" type="button" aria-label="اعلانها" @click="toggleNotif">
|
||||||
@@ -582,9 +577,13 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-item.router-link-active {
|
.nav-item.router-link-active {
|
||||||
background: #14b8a6;
|
background: #d1faf2;
|
||||||
color: #fff;
|
color: #0f766e;
|
||||||
box-shadow: 0 10px 22px rgba(20, 184, 166, 0.28);
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item.router-link-active :deep(.ico) {
|
||||||
|
color: #0f766e;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-badge {
|
.nav-badge {
|
||||||
@@ -601,7 +600,8 @@ onUnmounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav-item.router-link-active .nav-badge {
|
.nav-item.router-link-active .nav-badge {
|
||||||
background: rgba(255, 255, 255, 0.25);
|
background: #14b8a6;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-group {
|
.nav-group {
|
||||||
|
|||||||
+40
-1003
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user