fix address map

This commit is contained in:
Casey 2025-12-16 11:57:37 -06:00
parent 3c75ba975e
commit 73f4b3b97a
4 changed files with 20 additions and 26 deletions

View file

@ -32,7 +32,7 @@ class ApiUtils {
static toCamelCaseObject(obj) {
const newObj = Object.entries(obj).reduce((acc, [key, value]) => {
const camelKey = key.replace(/_([a-z])/g, (match, p1) => p1.toUpperCase());
const camelKey = key.replace(/_([a-zA-Z0-9])/g, (match, p1) => p1.toUpperCase());
// check if value is an array
if (Array.isArray(value)) {
value = value.map((item) => {

View file

@ -10,7 +10,6 @@
/>
</template>
<div class="status-cards">
<template v-if="isNew || editMode">
<template v-if="isNew || editMode">
<ClientInformationForm
ref="clientInfoRef"
@ -160,7 +159,7 @@
<!-- Edit Confirmation Dialog -->
<Dialog
v-model:visible="showEditConfirmDialog"
:visible="showEditConfirmDialog"
header="Confirm Edit"
:modal="true"
:closable="false"
@ -318,10 +317,10 @@ const fullAddress = computed(() => {
// Get contacts linked to the selected address
const contactsForAddress = computed(() => {
if (!selectedAddressData.value?.customLinkedContacts || !props.clientData?.contacts) return [];
return selectedAddressData.value.customLinkedContacts
.map((link) => props.clientData.contacts.find((c) => c.name === link.contact))
.filter(Boolean);
console.log("DEBUG: props.clientData:", props.clientData);
console.log("DEBUG: Calculating contacts for address:", props.selectedAddress);
if (!selectedAddressData.value?.customLinkedContacts && !props.clientData?.contacts) return [];
return props.clientData.contacts
});
// Selected contact index for display

View file

@ -121,11 +121,11 @@ const getClient = async (name) => {
selectedAddressObject.value?.customLatitude
) {
geocode.value = {
longitude: selectedAddressObject.value.customLongitude,
latitude: selectedAddressObject.value.customLatitude,
longitude: selectedAddressObject.value.customLongitude || selectedAddressObject.value.longitude,
latitude: selectedAddressObject.value.customLatitude || selectedAddressObject.value.latitude,
};
} else if (selectedAddress.value) {
geocode.value = await Api.getGeocode(selectedAddress.value);
// geocode.value = await Api.getGeocode(selectedAddress.value);
}
} catch (error) {
console.error("Error fetching client data in Client.vue: ", error.message || error);