2026-09-05 00:18:39 +03:30
|
|
|
<script setup lang="ts">
|
|
|
|
|
import UiIcon from '@/components/UiIcon.vue';
|
|
|
|
|
import AddDealButton from './AddDealButton.vue';
|
|
|
|
|
import DealCard from './DealCard.vue';
|
|
|
|
|
import type { PipelineDeal, PipelineStage } from '@/lib/pipeline-board';
|
|
|
|
|
import { PIPELINE_ACCENT, toFaDealCount } from '@/lib/pipeline-board';
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
stage: PipelineStage;
|
|
|
|
|
draggingId: string | null;
|
|
|
|
|
dropActive: boolean;
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
dragStart: [deal: PipelineDeal, event: DragEvent];
|
|
|
|
|
dragEnd: [];
|
|
|
|
|
dragOver: [stageId: string, event: DragEvent];
|
|
|
|
|
drop: [stageId: string, event: DragEvent, index?: number];
|
|
|
|
|
addDeal: [stageId: string];
|
|
|
|
|
openDeal: [dealId: string];
|
|
|
|
|
menuDeal: [dealId: string];
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
function onCardDragOver(stageId: string, event: DragEvent) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
emit('dragOver', stageId, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onCardDrop(stageId: string, index: number, event: DragEvent) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
emit('drop', stageId, event, index);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<section
|
|
|
|
|
class="column"
|
|
|
|
|
:class="{ drop: dropActive }"
|
|
|
|
|
:style="{
|
|
|
|
|
'--stage-solid': PIPELINE_ACCENT[stage.color].solid,
|
|
|
|
|
'--stage-soft': PIPELINE_ACCENT[stage.color].soft,
|
|
|
|
|
'--stage-border': PIPELINE_ACCENT[stage.color].border,
|
|
|
|
|
'--stage-text': PIPELINE_ACCENT[stage.color].text,
|
|
|
|
|
}"
|
|
|
|
|
@dragover.prevent="emit('dragOver', stage.id, $event)"
|
|
|
|
|
@drop.prevent="emit('drop', stage.id, $event)"
|
|
|
|
|
>
|
|
|
|
|
<header class="column-head">
|
|
|
|
|
<div class="title-wrap">
|
|
|
|
|
<span class="dot" aria-hidden="true" />
|
|
|
|
|
<h2>{{ stage.title }}</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="head-actions">
|
|
|
|
|
<span class="count">{{ toFaDealCount(stage.deals.length) }}</span>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="plus"
|
|
|
|
|
aria-label="افزودن معامله به این مرحله"
|
|
|
|
|
@click="emit('addDeal', stage.id)"
|
|
|
|
|
>
|
|
|
|
|
<UiIcon name="plus" :size="16" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<div class="cards" role="list" :aria-label="stage.title">
|
|
|
|
|
<div
|
|
|
|
|
v-for="(deal, index) in stage.deals"
|
|
|
|
|
:key="deal.id"
|
|
|
|
|
class="card-slot"
|
|
|
|
|
@dragover="onCardDragOver(stage.id, $event)"
|
|
|
|
|
@drop="onCardDrop(stage.id, index, $event)"
|
|
|
|
|
>
|
|
|
|
|
<DealCard
|
|
|
|
|
:deal="deal"
|
|
|
|
|
:accent="stage.color"
|
|
|
|
|
:dragging="draggingId === deal.id"
|
|
|
|
|
@drag-start="(d, e) => emit('dragStart', d, e)"
|
|
|
|
|
@drag-end="emit('dragEnd')"
|
|
|
|
|
@open="emit('openDeal', $event)"
|
|
|
|
|
@menu="emit('menuDeal', $event)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<p v-if="!stage.deals.length" class="empty">معاملهای نیست</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<AddDealButton :accent="stage.color" @add="emit('addDeal', stage.id)" />
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.column {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.75rem;
|
2026-09-09 13:12:13 +03:30
|
|
|
flex: 1 1 17.5rem;
|
|
|
|
|
min-width: 17.5rem;
|
2026-09-05 00:18:39 +03:30
|
|
|
min-height: 420px;
|
2026-09-09 13:12:13 +03:30
|
|
|
padding: 0.15rem 0.1rem 0.35rem;
|
2026-09-05 00:18:39 +03:30
|
|
|
border-radius: 18px;
|
|
|
|
|
border: 1px solid transparent;
|
|
|
|
|
background: transparent;
|
|
|
|
|
transition: background 0.15s ease, border-color 0.15s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.column.drop {
|
|
|
|
|
background: color-mix(in srgb, var(--stage-soft) 70%, transparent);
|
|
|
|
|
border-color: color-mix(in srgb, var(--stage-border) 80%, transparent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.column-head {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
padding: 0.15rem 0.25rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.title-wrap {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.45rem;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
|
width: 0.55rem;
|
|
|
|
|
height: 0.55rem;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
background: var(--stage-solid);
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.column-head h2 {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 0.98rem;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
color: var(--ink);
|
2026-09-09 13:12:13 +03:30
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2026-09-05 00:18:39 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.head-actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 0.45rem;
|
2026-09-09 13:12:13 +03:30
|
|
|
flex: 0 0 auto;
|
2026-09-05 00:18:39 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.count {
|
|
|
|
|
font-size: 0.78rem;
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.plus {
|
2026-09-09 13:12:13 +03:30
|
|
|
width: 1.75rem;
|
|
|
|
|
height: 1.75rem;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
border: 1.5px solid var(--accent);
|
2026-09-05 00:18:39 +03:30
|
|
|
display: grid;
|
|
|
|
|
place-items: center;
|
2026-09-09 13:12:13 +03:30
|
|
|
background: #fff;
|
2026-09-05 00:18:39 +03:30
|
|
|
color: var(--accent);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.plus:hover,
|
|
|
|
|
.plus:focus-visible {
|
|
|
|
|
background: var(--accent-soft);
|
|
|
|
|
outline: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cards {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 0.7rem;
|
|
|
|
|
flex: 1;
|
2026-09-09 13:12:13 +03:30
|
|
|
min-width: 0;
|
2026-09-05 00:18:39 +03:30
|
|
|
min-height: 4rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.card-slot {
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.empty {
|
|
|
|
|
margin: 1rem 0;
|
|
|
|
|
text-align: center;
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-09 13:12:13 +03:30
|
|
|
@container pipeline (max-width: 720px) {
|
2026-09-05 00:18:39 +03:30
|
|
|
.column {
|
2026-09-09 13:12:13 +03:30
|
|
|
flex: 0 0 min(20rem, 86cqi);
|
|
|
|
|
width: min(20rem, 86cqi);
|
|
|
|
|
min-width: min(20rem, 86cqi);
|
|
|
|
|
max-width: none;
|
|
|
|
|
min-height: 360px;
|
2026-09-05 00:18:39 +03:30
|
|
|
scroll-snap-align: start;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|