Edit dashboard appearance
This commit is contained in:
@@ -3,18 +3,13 @@ import { computed } from 'vue';
|
||||
import { RouterLink } from 'vue-router';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import type { HomeDashboardTopCustomerDto } from '@mento/shared';
|
||||
import HomePanelEmpty from '@/components/dashboard/HomePanelEmpty.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
customers: HomeDashboardTopCustomerDto[];
|
||||
}>();
|
||||
|
||||
const demo: HomeDashboardTopCustomerDto[] = [
|
||||
{ id: '1', name: 'شرکت آریا', dealCount: 8, rank: 1 },
|
||||
{ id: '2', name: 'گروه پارسیان', dealCount: 4, rank: 2 },
|
||||
{ id: '3', name: 'فناوران نوین', dealCount: 3, rank: 3 },
|
||||
];
|
||||
|
||||
const rows = computed(() => (props.customers.length ? props.customers.slice(0, 3) : demo));
|
||||
const rows = computed(() => props.customers.slice(0, 3));
|
||||
|
||||
function trophy(rank: number) {
|
||||
if (rank === 1) return '🥇';
|
||||
@@ -27,11 +22,21 @@ function trophy(rank: number) {
|
||||
<template>
|
||||
<article class="panel">
|
||||
<header class="panel-head">
|
||||
<h2>مشتریان برتر</h2>
|
||||
<div>
|
||||
<h2>مشتریان برتر</h2>
|
||||
<p class="hint">بر اساس معاملات برندهٔ ۵ ماه اخیر</p>
|
||||
</div>
|
||||
<RouterLink :to="{ name: 'contacts' }">مشاهده همه</RouterLink>
|
||||
</header>
|
||||
|
||||
<ul class="top-list">
|
||||
<HomePanelEmpty
|
||||
v-if="!rows.length"
|
||||
title="هنوز مشتری برتری نیست"
|
||||
description="با بستن معاملات، مشتریان برتر اینجا دیده میشوند."
|
||||
action-label="مشتری جدید"
|
||||
:action-to="{ name: 'person-new' }"
|
||||
/>
|
||||
<ul v-else class="top-list">
|
||||
<li v-for="row in rows" :key="row.id">
|
||||
<span class="cust-avatar">{{ row.name.slice(0, 1) }}</span>
|
||||
<div>
|
||||
@@ -52,13 +57,16 @@ function trophy(rank: number) {
|
||||
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 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.85rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
@@ -66,6 +74,12 @@ h2 {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 0.15rem 0 0;
|
||||
color: #94a3b8;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #14b8a6;
|
||||
font-size: 0.8rem;
|
||||
|
||||
Reference in New Issue
Block a user