@7365admin1/layer-common 4.97.1-staging.745 → 4.97.1-staging.746
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -159,18 +159,35 @@
|
|
|
159
159
|
<!-- Entry content -->
|
|
160
160
|
<div class="d-flex flex-column ga-1 pb-4 flex-grow-1">
|
|
161
161
|
<div class="d-flex align-center justify-space-between">
|
|
162
|
-
<StatusChip
|
|
162
|
+
<StatusChip
|
|
163
|
+
:status="historyEntryKind(entry).label"
|
|
164
|
+
:tone="isChangeEntry(entry) ? historyEntryKind(entry).tone : ''"
|
|
165
|
+
>
|
|
163
166
|
<v-icon
|
|
164
167
|
size="13"
|
|
165
168
|
class="mr-1"
|
|
166
|
-
:icon="
|
|
167
|
-
/>{{
|
|
169
|
+
:icon="historyEntryKind(entry).icon"
|
|
170
|
+
/>{{ historyEntryKind(entry).label }}
|
|
168
171
|
</StatusChip>
|
|
169
172
|
<span class="card-details__label">{{ formatDate(entry.createdAt) }}</span>
|
|
170
173
|
</div>
|
|
171
174
|
|
|
175
|
+
<!-- Replace / Delete entry (DV-2277): who, the other card, remarks -->
|
|
176
|
+
<template v-if="isChangeEntry(entry)">
|
|
177
|
+
<div class="card-details__sub">
|
|
178
|
+
By {{ entry.performedByName || "Not recorded" }}
|
|
179
|
+
</div>
|
|
180
|
+
<div v-if="entry.relatedCardNo" class="card-details__sub">
|
|
181
|
+
{{ historyEntryKind(entry).kind === "replaced" ? "Replaced by" : "Replaces" }}
|
|
182
|
+
card {{ entry.relatedCardNo }}
|
|
183
|
+
</div>
|
|
184
|
+
<div v-if="entry.remarks" class="card-details__sub">
|
|
185
|
+
Remarks: {{ entry.remarks }}
|
|
186
|
+
</div>
|
|
187
|
+
</template>
|
|
188
|
+
|
|
172
189
|
<!-- Assignment entry -->
|
|
173
|
-
<template v-if="entry.type === 'assigned' || entry.visitorId">
|
|
190
|
+
<template v-else-if="entry.type === 'assigned' || entry.visitorId">
|
|
174
191
|
<div class="card-details__value">{{ entry.name ?? "N/A" }}</div>
|
|
175
192
|
<div class="card-details__sub">
|
|
176
193
|
<span v-if="entry.nric">NRIC: {{ maskNRIC(entry.nric) }}</span>
|
|
@@ -204,6 +221,7 @@
|
|
|
204
221
|
</template>
|
|
205
222
|
|
|
206
223
|
<script setup lang="ts">
|
|
224
|
+
import { historyEntryKind } from "../utils/card-history-entry";
|
|
207
225
|
const { maskNRIC } = useUtils();
|
|
208
226
|
const props = defineProps({
|
|
209
227
|
modelValue: {
|
|
@@ -309,6 +327,12 @@ function isAssignment(entry: Record<string, any>) {
|
|
|
309
327
|
return entry.type === "assigned" || Boolean(entry.visitorId);
|
|
310
328
|
}
|
|
311
329
|
|
|
330
|
+
/** A Replace or Delete entry (DV-2277), shown with who did it and the remarks. */
|
|
331
|
+
function isChangeEntry(entry: Record<string, any>) {
|
|
332
|
+
const kind = historyEntryKind(entry).kind;
|
|
333
|
+
return kind === "replaced" || kind === "replacement" || kind === "deleted";
|
|
334
|
+
}
|
|
335
|
+
|
|
312
336
|
function formatDate(date: string) {
|
|
313
337
|
if (!date) return "N/A";
|
|
314
338
|
return new Intl.DateTimeFormat("en-GB", {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.746",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Card Details > History entry is, for its chip and icon.
|
|
3
|
+
*
|
|
4
|
+
* Assign and visitor issue have always written history; a return/checkout is
|
|
5
|
+
* the other old kind. Replace and Delete add three more (DV-2277), written by
|
|
6
|
+
* core as `type: "replaced" | "replacement" | "deleted"`.
|
|
7
|
+
*/
|
|
8
|
+
export type HistoryKind = "assigned" | "replaced" | "replacement" | "deleted" | "returned";
|
|
9
|
+
|
|
10
|
+
export type HistoryKindInfo = {
|
|
11
|
+
kind: HistoryKind;
|
|
12
|
+
label: string;
|
|
13
|
+
tone: "ok" | "warn" | "err" | "info" | "neutral";
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const KINDS: Record<Exclude<HistoryKind, "returned" | "assigned">, HistoryKindInfo> = {
|
|
18
|
+
replaced: { kind: "replaced", label: "Replaced", tone: "warn", icon: "mdi-swap-horizontal" },
|
|
19
|
+
replacement: { kind: "replacement", label: "Issued as replacement", tone: "info", icon: "mdi-card-plus-outline" },
|
|
20
|
+
deleted: { kind: "deleted", label: "Deleted", tone: "err", icon: "mdi-delete-outline" },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function historyEntryKind(entry: Record<string, any> | null | undefined): HistoryKindInfo {
|
|
24
|
+
const type = entry?.type;
|
|
25
|
+
if (type === "assigned" || entry?.visitorId) {
|
|
26
|
+
return { kind: "assigned", label: "Assigned", tone: "ok", icon: "mdi-account-arrow-right" };
|
|
27
|
+
}
|
|
28
|
+
if (type === "replaced" || type === "replacement" || type === "deleted") return KINDS[type];
|
|
29
|
+
return { kind: "returned", label: "Returned", tone: "neutral", icon: "mdi-arrow-u-left-top" };
|
|
30
|
+
}
|