FEAT: Enhance interest fetching in InterestDetailsModal and update getBerths and getBerthById to retrieve full details for interested parties
This commit is contained in:
@@ -777,7 +777,31 @@ watch(
|
||||
async (newInterest) => {
|
||||
if (newInterest) {
|
||||
hasUnsavedChanges.value = false;
|
||||
interest.value = { ...newInterest };
|
||||
|
||||
// If we only have an ID, or if the interest seems incomplete, fetch the full record
|
||||
if (newInterest.Id && (!newInterest['Full Name'] || !newInterest['Sales Process Level'])) {
|
||||
console.log('[InterestDetailsModal] Fetching full interest record for ID:', newInterest.Id);
|
||||
try {
|
||||
const fullInterest = await $fetch<Interest>(`/api/get-interest-by-id`, {
|
||||
params: {
|
||||
id: newInterest.Id,
|
||||
},
|
||||
});
|
||||
if (fullInterest) {
|
||||
interest.value = { ...fullInterest };
|
||||
} else {
|
||||
// Fallback to what we have
|
||||
interest.value = { ...newInterest };
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[InterestDetailsModal] Failed to fetch full interest:', error);
|
||||
// Fallback to what we have
|
||||
interest.value = { ...newInterest };
|
||||
}
|
||||
} else {
|
||||
interest.value = { ...newInterest };
|
||||
}
|
||||
|
||||
// Load linked berths and recommendations
|
||||
await loadLinkedBerths();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user