updated soc case modal
Davide Di Modica committed
Jan 29, 2024 at 20:35 UTC
c5f700d4f54cb492b01ea5a60462244af8a18cce
2 files changed
+25
-5
src/components/soc/SocCases/SocCaseItem.vue
+23
-5
@@ -168,7 +168,22 @@
168
<div class="grid gap-2 grid-auto-flow-200 p-7 pt-4" v-if="properties">
169
<KVCard v-for="(value, key) of properties" :key="key">
170
<template #key>{{ key }}</template>
171
- <template #value>{{ value || "-" }}</template>
171
+ <template #value>
172
+ <template
173
+ v-if="key === 'customer_code' && value && value !== 'Customer Not Found'"
174
+ >
175
+ <code
176
+ class="cursor-pointer text-primary-color"
177
+ @click="gotoCustomer(value)"
178
+ >
179
+ #{{ value }}
180
+ <Icon :name="LinkIcon" :size="13" class="relative top-0.5" />
181
+ </code>
182
+ </template>
183
+ <template v-else>
184
+ {{ value || "-" }}
185
+ </template>
186
+ </template>
187
</KVCard>
188
</div>
189
</n-spin>
@@ -181,8 +196,7 @@
196
readonly
197
placeholder="Empty"
198
:autosize="{
184
- minRows: 3,
185
- maxRows: 10
199
+ minRows: 3
200
}"
201
/>
202
</div>
@@ -230,8 +244,6 @@
244
</template>
245
246
<script setup lang="ts">
233
-// TODO: add customer goto function ??
234
-
247
import Icon from "@/components/common/Icon.vue"
248
import KVCard from "@/components/common/KVCard.vue"
249
import Badge from "@/components/common/Badge.vue"
@@ -262,6 +274,7 @@ import dayjs from "@/utils/dayjs"
274
import { type SocCase, StateName, type SocCaseExt } from "@/types/soc/case.d"
275
import _omit from "lodash/omit"
276
import _split from "lodash/split"
277
+import { useRouter } from "vue-router"
278
279
const { caseData, caseId, embedded, hideSocCaseAction } = defineProps<{
280
caseData?: SocCase
@@ -283,6 +296,7 @@ const OwnerIcon = "carbon:user-military"
296
const StatusIcon = "fluent:status-20-regular"
297
const AddIcon = "carbon:add-alt"
298
299
+const router = useRouter()
300
const showSocAlertDetails = ref(false)
301
const showDetails = ref(false)
302
const loadingDetails = ref(false)
@@ -415,6 +429,10 @@ function getDetails() {
429
}
430
}
431
432
+function gotoCustomer(code: string | number) {
433
+ router.push({ name: "Customers", query: { code } })
434
+}
435
+
436
watch(showDetails, val => {
437
if (val && !extendedInfo.value) {
438
getDetails()
src/types/soc/case.d.ts
+2
@@ -10,6 +10,7 @@ export interface SocCase {
10
classification_id: number | null
11
classification: string | null
12
client_name: string
13
+ customer_code: string
14
opened_by_user_id: number
15
opened_by: string
16
owner_id: number
@@ -42,6 +43,7 @@ export interface SocCaseExt {
43
custom_attributes: string | null
44
customer_id: number
45
customer_name: string
46
+ customer_code: string
47
initial_date: Date | string
48
modification_history: { [key: string]: ModificationHistory }
49
open_by_user: string