fix(routines): keep the daily desk for internal team work
Customer-linked tasks stay on their record and no longer appear in today, calendar, score, or reminders. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
@@ -19,7 +18,14 @@ import RoutineTaskRow, { type RoutineTaskRowAction } from '@/components/routines
|
||||
import RoutineTaskModals from '@/components/routines/RoutineTaskModals.vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { apiError, isOpenStatus } from '@/lib/routines';
|
||||
import {
|
||||
ROUTINE_TASK_STATUS_LABELS,
|
||||
apiError,
|
||||
formatDayNumeric,
|
||||
formatTime,
|
||||
hasExplicitTime,
|
||||
isOpenStatus,
|
||||
} from '@/lib/routines';
|
||||
import { useRoutineTaskActions } from '@/lib/useRoutineTaskActions';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
|
||||
@@ -38,7 +44,6 @@ const props = withDefaults(
|
||||
},
|
||||
);
|
||||
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
|
||||
const enabled = computed(() => {
|
||||
@@ -51,6 +56,7 @@ const loading = ref(false);
|
||||
const error = ref('');
|
||||
const showClosed = ref(false);
|
||||
const quickOpen = ref(false);
|
||||
const detail = ref<RoutineTaskDto | null>(null);
|
||||
|
||||
async function load() {
|
||||
if (!enabled.value || !props.entity.id) return;
|
||||
@@ -73,6 +79,7 @@ watch(() => `${props.entity.type}:${props.entity.id}`, load, { immediate: true }
|
||||
const actions = useRoutineTaskActions((updated) => {
|
||||
const i = items.value.findIndex((t) => t.id === updated.id);
|
||||
if (i >= 0) items.value[i] = updated;
|
||||
if (detail.value?.id === updated.id) detail.value = updated;
|
||||
});
|
||||
|
||||
function onAction(kind: RoutineTaskRowAction, task: RoutineTaskDto) {
|
||||
@@ -88,7 +95,7 @@ const open = computed(() => items.value.filter((t) => isOpenStatus(t.status)));
|
||||
const closed = computed(() => items.value.filter((t) => !isOpenStatus(t.status)));
|
||||
|
||||
function openTask(t: RoutineTaskDto) {
|
||||
void router.push({ path: '/routines', query: { task: t.id } });
|
||||
detail.value = t;
|
||||
}
|
||||
|
||||
function onCreated(t: RoutineTaskDto) {
|
||||
@@ -182,5 +189,27 @@ function onCreated(t: RoutineTaskDto) {
|
||||
|
||||
<QuickTaskModal :open="quickOpen" :preset="entity" @close="quickOpen = false" @created="onCreated" />
|
||||
<RoutineTaskModals :actions="actions" />
|
||||
<a-drawer :open="detail != null" title="جزئیات کار" @close="detail = null">
|
||||
<template v-if="detail">
|
||||
<a-typography-paragraph v-if="detail.description">{{ detail.description }}</a-typography-paragraph>
|
||||
<a-descriptions :column="1">
|
||||
<a-descriptions-item label="وضعیت">
|
||||
{{ ROUTINE_TASK_STATUS_LABELS[detail.status] }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="مسئول">
|
||||
{{ detail.assignee?.fullName || '—' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="روز برنامه">
|
||||
{{ formatDayNumeric(detail.scheduledFor) }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="مهلت">
|
||||
{{ detail.dueAt && hasExplicitTime(detail) ? formatTime(detail.dueAt) : 'تا پایان روز' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<a-typography-paragraph v-if="detail.resultNote" :style="{ marginTop: '12px' }">
|
||||
{{ detail.resultNote }}
|
||||
</a-typography-paragraph>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user