160 lines
3.3 KiB
Vue
160 lines
3.3 KiB
Vue
<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>
|