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:
@@ -32,6 +32,7 @@ import {
|
||||
UiTextarea,
|
||||
} from '@/components/ui';
|
||||
import ActivityFieldsEditor from '@/components/activities/ActivityFieldsEditor.vue';
|
||||
import { useActivityPriorities } from '@/lib/activity-priorities';
|
||||
import { typeColorStyle, useActivityTypes } from '@/lib/activity-types';
|
||||
import type {
|
||||
ActivityBoardDto,
|
||||
@@ -89,6 +90,8 @@ const boardId = ref('');
|
||||
const defaultBoardId = computed(() => boards.value.find((b) => b.isDefault)?.id ?? '');
|
||||
|
||||
const activityTypes = useActivityTypes();
|
||||
const activityPriorities = useActivityPriorities();
|
||||
void activityPriorities.load();
|
||||
const title = ref('');
|
||||
const type = ref<ActivityType | ''>('');
|
||||
const typeDefId = ref('');
|
||||
@@ -271,13 +274,13 @@ function isEmptyValue(v: ActivityFieldValue | undefined): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
const priorityOptions: Array<{ value: ActivityPriority; label: string; tone: string }> = [
|
||||
{ value: 'very_high', label: 'خیلی زیاد', tone: 'very-high' },
|
||||
{ value: 'high', label: 'زیاد', tone: 'high' },
|
||||
{ value: 'medium', label: 'متوسط', tone: 'medium' },
|
||||
{ value: 'low', label: 'کم', tone: 'low' },
|
||||
{ value: 'very_low', label: 'خیلی کم', tone: 'very-low' },
|
||||
];
|
||||
const priorityOptions = computed(() =>
|
||||
activityPriorities.items.value.map((row) => ({
|
||||
value: row.key,
|
||||
label: row.label,
|
||||
color: row.color,
|
||||
})),
|
||||
);
|
||||
|
||||
const typeMeta = computed(() => activityTypes.byId.value.get(typeDefId.value) ?? null);
|
||||
const typeFields = computed(() => typeMeta.value?.fields ?? []);
|
||||
@@ -402,7 +405,7 @@ const duePreview = computed(() => {
|
||||
|
||||
const statusText = computed(() => (isDone.value ? 'انجام شده' : 'انجام نشده'));
|
||||
const priorityText = computed(
|
||||
() => priorityOptions.find((p) => p.value === priority.value)?.label || '—',
|
||||
() => priorityOptions.value.find((p) => p.value === priority.value)?.label || '—',
|
||||
);
|
||||
const pageTitle = computed(() => (isNew.value ? 'ایجاد فعالیت جدید' : 'ویرایش فعالیت'));
|
||||
const summaryReady = computed(() => Boolean(title.value.trim() || type.value || selectedPerson.value));
|
||||
@@ -1442,7 +1445,13 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
<div class="card">
|
||||
<p class="pri-label">اولویت</p>
|
||||
<div class="priorities">
|
||||
<label v-for="opt in priorityOptions" :key="opt.value" :class="['pri', opt.tone, { on: priority === opt.value }]">
|
||||
<label
|
||||
v-for="opt in priorityOptions"
|
||||
:key="opt.value"
|
||||
class="pri"
|
||||
:class="{ on: priority === opt.value }"
|
||||
:style="{ color: opt.color }"
|
||||
>
|
||||
<input v-model="priority" type="radio" :value="opt.value" />
|
||||
<UiIcon name="flag" :size="16" />
|
||||
<span>{{ opt.label }}</span>
|
||||
@@ -2365,26 +2374,6 @@ watch([id, isNew], () => void load(), { immediate: true });
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.pri.very-high {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.pri.high {
|
||||
color: #ea580c;
|
||||
}
|
||||
|
||||
.pri.medium {
|
||||
color: #eab308;
|
||||
}
|
||||
|
||||
.pri.low {
|
||||
color: #16a34a;
|
||||
}
|
||||
|
||||
.pri.very-low {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.pri.on span {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user