| 1 | <template> |
| 2 | <CardEntity :embedded header-box-class="flex-nowrap!" header-main-box-class="truncate"> |
| 3 | <template #header-main> |
| 4 | {{ caseData.name }} |
| 5 | </template> |
| 6 | <template #header-extra> |
| 7 | <Chip :type="getStatusColor(caseData.status)" size="small"> |
| 8 | {{ caseData.status }} |
| 9 | </Chip> |
| 10 | </template> |
| 11 | <template #default> |
| 12 | {{ caseData.description }} |
| 13 | </template> |
| 14 | <template #footer-main> |
| 15 | {{ formatTimeAgo(caseData.created_at, dFormats.datetime) }} |
| 16 | </template> |
| 17 | <template #footer-extra> |
| 18 | <CaseDetailsButton :case-id="caseData.id" size="small" @status-updated="handleStatusUpdated" /> |
| 19 | </template> |
| 20 | </CardEntity> |
| 21 | </template> |
| 22 | |
| 23 | <script setup lang="ts"> |
| 24 | import type { CaseStatusUpdateSuccessPayload } from "../cases/CaseStatusSelect.vue" |
| 25 | import type { DashboardCase } from "./types" |
| 26 | import CaseDetailsButton from "@/components/cases/CaseDetailsButton.vue" |
| 27 | import CardEntity from "@/components/common/cards/CardEntity.vue" |
| 28 | import Chip from "@/components/common/Chip.vue" |
| 29 | import { useSettingsStore } from "@/stores/settings" |
| 30 | import { getStatusColor } from "@/utils" |
| 31 | import { formatTimeAgo } from "@/utils/format" |
| 32 | |
| 33 | const props = defineProps<{ |
| 34 | caseData: DashboardCase |
| 35 | embedded?: boolean |
| 36 | }>() |
| 37 | |
| 38 | const emit = defineEmits<{ |
| 39 | (e: "updated", value: DashboardCase): void |
| 40 | }>() |
| 41 | |
| 42 | const dFormats = useSettingsStore().dateFormat |
| 43 | |
| 44 | function handleStatusUpdated(payload: CaseStatusUpdateSuccessPayload) { |
| 45 | emit("updated", { ...props.caseData, status: payload.status }) |
| 46 | } |
| 47 | </script> |