@cryptotaxi247 / CoPilot / commits / e81384b3

feat: add scalable unit formatting for customer provision fields (#657)

Implements a formatValue function to append appropriate units to customer provision field values. Currently adds "days" suffix to customer_meta_index_retention field. The solution uses a formatRules map for easy extension to additional fields.

oliver-oat committed Feb 2, 2026 at 19:51 UTC e81384b3f07f982260a68fa09550adffa93b7de1
1 file changed +14 -1
frontend/src/components/customers/provision/CustomerProvision.vue
+14 -1
@@ -36,7 +36,7 @@
36 {{ key }}
37 </template>
38 <template #value>
39 - {{ value || "-" }}
39 + {{ formatValue(key, value) }}
40 </template>
41 </CardKV>
42 </div>
@@ -77,6 +77,19 @@ const message = useMessage()
77
78 const customerNameSanitized = computed<string>(() => customerName.value || customerMeta.value?.customer_name || "")
79
80 +function formatValue(key: string, value: any): string {
81 + if (!value) return "-"
82 +
83 + // Add field-specific formatting rules here
84 + const formatRules: Record<string, (val: any) => string> = {
85 + customer_meta_index_retention: (val) => `${val} days`
86 + // Add more formatting rules as needed:
87 + // another_field: (val) => `${val} units`,
88 + }
89 +
90 + return formatRules[key] ? formatRules[key](value) : value
91 +}
92 +
93 function submitted(newData: CustomerMeta) {
94 emit("submitted", newData)
95 editing.value = false