Add org-scoped activity priority labels/colors and apply them across forms, boards, and routines.
Also fix activity leave-without-save confirm, kanban due-date labels with tone-colored peek chevron, and rename the types manager button. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import {
|
||||
CalendarOutlined,
|
||||
CheckOutlined,
|
||||
DeleteOutlined,
|
||||
FlagFilled,
|
||||
LeftOutlined,
|
||||
MoreOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import {
|
||||
@@ -19,11 +20,11 @@ import {
|
||||
theme,
|
||||
} from 'ant-design-vue';
|
||||
import DealQuickActivityPopover from '@/components/pipeline/DealQuickActivityPopover.vue';
|
||||
import { formatJalaliNumeric } from '@/lib/jalali';
|
||||
import { calendarDaysBetween, formatJalaliNumeric } from '@/lib/jalali';
|
||||
import { userAvatarSrc } from '@/lib/userAvatars';
|
||||
import type { ActivityPriority } from '@mento/shared';
|
||||
import type { PipelineAccent, PipelineDeal, PipelineUiCopy } from '@/lib/pipeline-board';
|
||||
import { DEAL_BOARD_COPY, formatCurrencyParts } from '@/lib/pipeline-board';
|
||||
import { useActivityPriorities } from '@/lib/activity-priorities';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -80,16 +81,18 @@ const dateHint = computed(() => {
|
||||
if (Number.isNaN(d.getTime())) return props.deal.date;
|
||||
return formatJalaliNumeric(d);
|
||||
});
|
||||
const PRIORITY_FLAG: Record<ActivityPriority, { label: string; color: string }> = {
|
||||
very_high: { label: 'خیلی زیاد', color: '#dc2626' },
|
||||
high: { label: 'زیاد', color: '#ea580c' },
|
||||
medium: { label: 'متوسط', color: '#eab308' },
|
||||
low: { label: 'کم', color: '#16a34a' },
|
||||
very_low: { label: 'خیلی کم', color: '#94a3b8' },
|
||||
};
|
||||
const priorityFlag = computed(() =>
|
||||
props.deal.priority ? PRIORITY_FLAG[props.deal.priority] : null,
|
||||
);
|
||||
const activityPriorities = useActivityPriorities();
|
||||
onMounted(() => {
|
||||
void activityPriorities.load();
|
||||
});
|
||||
const priorityFlag = computed(() => {
|
||||
const key = props.deal.priority;
|
||||
if (!key) return null;
|
||||
return {
|
||||
label: activityPriorities.labelOf(key),
|
||||
color: activityPriorities.colorOf(key),
|
||||
};
|
||||
});
|
||||
|
||||
function onTitleClick() {
|
||||
if (props.selectMode) {
|
||||
@@ -100,13 +103,49 @@ function onTitleClick() {
|
||||
else emit('open', props.deal.id);
|
||||
}
|
||||
|
||||
const chevronStyle = computed(() => ({
|
||||
display: 'inline-block',
|
||||
width: '0.42rem',
|
||||
height: '0.42rem',
|
||||
borderRight: '1.6px solid currentColor',
|
||||
borderBottom: '1.6px solid currentColor',
|
||||
transform: props.previewing ? 'rotate(-45deg)' : 'rotate(135deg)',
|
||||
/** موعد: عقبافتاده قرمز · امروز سبز · آینده خاکستری */
|
||||
const dueTone = computed<'overdue' | 'today' | 'upcoming' | 'none'>(() => {
|
||||
if (!props.copy.quickView || !props.deal.dateIso) return 'none';
|
||||
const due = new Date(props.deal.dateIso);
|
||||
if (Number.isNaN(due.getTime())) return 'none';
|
||||
const days = calendarDaysBetween(new Date(), due);
|
||||
if (days < 0) return 'overdue';
|
||||
if (days === 0) return 'today';
|
||||
return 'upcoming';
|
||||
});
|
||||
|
||||
const dueToneColor = computed(() => {
|
||||
if (dueTone.value === 'overdue') return token.value.colorError;
|
||||
if (dueTone.value === 'today') return token.value.colorSuccess;
|
||||
return token.value.colorTextSecondary;
|
||||
});
|
||||
|
||||
const chevronBtnStyle = computed(() => ({
|
||||
boxSizing: 'border-box' as const,
|
||||
width: '22px',
|
||||
height: '22px',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
border: `1.5px solid ${dueToneColor.value}`,
|
||||
borderRadius: '50%',
|
||||
background: 'transparent',
|
||||
color: dueToneColor.value,
|
||||
display: 'inline-grid',
|
||||
placeItems: 'center',
|
||||
cursor: 'pointer',
|
||||
lineHeight: 0,
|
||||
flexShrink: 0,
|
||||
}));
|
||||
|
||||
const chevronIconStyle = computed(() => ({
|
||||
fontSize: '10px',
|
||||
width: '10px',
|
||||
height: '10px',
|
||||
lineHeight: 0,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
transform: props.previewing ? 'rotate(180deg)' : 'none',
|
||||
transition: 'transform 0.15s ease',
|
||||
}));
|
||||
|
||||
@@ -262,16 +301,17 @@ const cardStyle = computed(() => ({
|
||||
{{ money.unit }}
|
||||
</a-typography-text>
|
||||
</a-typography-text>
|
||||
<a-button
|
||||
<button
|
||||
v-if="copy.quickView && !selectMode"
|
||||
type="text"
|
||||
type="button"
|
||||
class="deal-card-peek"
|
||||
:aria-label="previewing ? 'بستن پیشنمایش' : 'پیشنمایش فعالیت'"
|
||||
:aria-expanded="previewing"
|
||||
:style="{ color: token.colorTextSecondary }"
|
||||
:style="chevronBtnStyle"
|
||||
@click.stop="emit('open', deal.id)"
|
||||
>
|
||||
<template #icon><i class="chev" aria-hidden="true" :style="chevronStyle" /></template>
|
||||
</a-button>
|
||||
<LeftOutlined :style="chevronIconStyle" />
|
||||
</button>
|
||||
<a-tooltip v-else-if="priorityFlag" :title="`اولویت: ${priorityFlag.label}`">
|
||||
<span :style="{ display: 'inline-flex', flexShrink: 0, lineHeight: 1 }">
|
||||
<FlagFilled :style="{ color: priorityFlag.color, fontSize: '16px' }" />
|
||||
@@ -292,3 +332,19 @@ const cardStyle = computed(() => ({
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* وسطچین دقیق آیکون داخل دایره (anticon پیشفرض vertical-align دارد) */
|
||||
.deal-card-peek :deep(.anticon) {
|
||||
display: inline-flex !important;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
vertical-align: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
.deal-card-peek :deep(.anticon > svg) {
|
||||
display: block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user