@cryptotaxi247 / CoPilot / commits / 9c0a87f5

updated soc alert card

Davide Di Modica committed Jan 30, 2024 at 19:04 UTC 9c0a87f58872e2a243851c0409dc2880c8502e21
2 files changed +35 -2
src/components/soc/SocAlerts/SocAlertItem.vue
+34 -2
@@ -106,7 +106,25 @@
106 <Icon :name="CustomerIcon" :size="13"></Icon>
107 </template>
108 <template #label>Customer</template>
109 - <template #value>{{ alert.customer?.customer_name || "-" }}</template>
109 + <template #value>
110 + <template
111 + v-if="
112 + alert.customer?.customer_code &&
113 + alert.customer.customer_code !== 'Customer Not Found'
114 + "
115 + >
116 + <code
117 + class="cursor-pointer text-primary-color"
118 + @click="gotoCustomer(alert.customer.customer_code)"
119 + >
120 + {{ alert.customer?.customer_name || alert.customer.customer_code || "-" }}
121 + <Icon :name="LinkIcon" :size="13" class="relative top-0.5" />
122 + </code>
123 + </template>
124 + <template v-else>
125 + {{ alert.customer?.customer_name || "-" }}
126 + </template>
127 + </template>
128 </Badge>
129
130 <SocAssignUser :alert="alert" :users="users" v-slot="{ loading }" @updated="updateAlert">
@@ -194,7 +212,17 @@
212 <div class="grid gap-2 grid-auto-flow-200 p-7 pt-4">
213 <KVCard v-for="(value, key) of alert.customer" :key="key">
214 <template #key>{{ key }}</template>
197 - <template #value>{{ value || "-" }}</template>
215 + <template #value>
216 + <template v-if="key === 'customer_code' && value && value !== 'Customer Not Found'">
217 + <code class="cursor-pointer text-primary-color" @click="gotoCustomer(value)">
218 + #{{ value }}
219 + <Icon :name="LinkIcon" :size="13" class="relative top-0.5" />
220 + </code>
221 + </template>
222 + <template v-else>
223 + {{ value || "-" }}
224 + </template>
225 + </template>
226 </KVCard>
227 </div>
228 </n-tab-pane>
@@ -451,6 +479,10 @@ function deleted() {
479 emit("deleted")
480 }
481
482 +function gotoCustomer(code: any) {
483 + router.push({ name: "Customers", query: { code: code.toString() } })
484 +}
485 +
486 watch(checked, val => {
487 emit("check", val)
488 if (val) {
src/types/soc/alert.d.ts
+1
@@ -64,6 +64,7 @@ export interface Customer {
64 last_update_date: string
65 client_uuid: string
66 customer_id: number
67 + customer_code: string
68 }
69
70 export interface ModificationHistory {