diff --git a/components/EOISection.vue b/components/EOISection.vue index 3576d32..81abba8 100644 --- a/components/EOISection.vue +++ b/components/EOISection.vue @@ -474,10 +474,27 @@ const signatureStatus = ref(null); const isCheckingSignatures = ref(false); const hasGeneratedEOI = computed(() => { - return !!(props.interest['Signature Link Client'] || - props.interest['Signature Link CC'] || - props.interest['Signature Link Developer'] || - props.interest['documensoID']); + // Primary check: documensoID must exist for a generated EOI + // If documensoID is null/undefined, then there's no generated EOI regardless of signature links + + // DEBUG: Log detailed information about the documensoID field + console.log('[EOISection] DEBUGGING hasGeneratedEOI computation:', { + interestId: props.interest.Id, + documensoID: props.interest['documensoID'], + documensoID_type: typeof props.interest['documensoID'], + documensoID_raw: JSON.stringify(props.interest['documensoID']), + documensoID_exists: 'documensoID' in props.interest, + documensoID_truthy: !!props.interest['documensoID'], + signature_links: { + client: props.interest['Signature Link Client'], + cc: props.interest['Signature Link CC'], + developer: props.interest['Signature Link Developer'] + }, + all_interest_keys: Object.keys(props.interest).filter(key => key.toLowerCase().includes('documen')), + result: !!props.interest['documensoID'] + }); + + return !!(props.interest['documensoID']); }); const eoiDocuments = computed(() => { diff --git a/server/api/email/generate-eoi-document.ts b/server/api/email/generate-eoi-document.ts index dd67899..39d42ca 100644 --- a/server/api/email/generate-eoi-document.ts +++ b/server/api/email/generate-eoi-document.ts @@ -308,6 +308,18 @@ export default defineEventHandler(async (event) => { 'documensoID': documentResponse.documentId.toString() }; + // DEBUG: Log the documensoID being saved + console.log('[generate-eoi] DEBUGGING documensoID save:', { + interestId: interestId, + documentId: documentResponse.documentId, + documentId_type: typeof documentResponse.documentId, + documensoID_string: documentResponse.documentId.toString(), + documensoID_string_type: typeof documentResponse.documentId.toString(), + updateData_documensoID: updateData['documensoID'], + updateData_documensoID_type: typeof updateData['documensoID'], + full_updateData: updateData + }); + // Add signing links to update data with new column names if (signingLinks['Client']) { updateData['Signature Link Client'] = signingLinks['Client']; diff --git a/server/api/get-interest-by-id.ts b/server/api/get-interest-by-id.ts index c7f79d3..d01d1b1 100644 --- a/server/api/get-interest-by-id.ts +++ b/server/api/get-interest-by-id.ts @@ -20,6 +20,23 @@ export default defineEventHandler(async (event) => { console.log('[get-interest-by-id] Fetching interest:', id); const interest = await getInterestById(id as string); console.log('[get-interest-by-id] Successfully fetched interest:', id); + + // Debug documensoID field specifically + console.log('[get-interest-by-id] DEBUGGING documensoID field:', { + id: interest.Id, + documensoID: interest['documensoID'], + documensoID_type: typeof interest['documensoID'], + documensoID_raw: JSON.stringify(interest['documensoID']), + documensoID_exists: 'documensoID' in interest, + documensoID_truthy: !!interest['documensoID'], + all_keys: Object.keys(interest).filter(key => key.toLowerCase().includes('documen')), + signature_links: { + client: interest['Signature Link Client'], + cc: interest['Signature Link CC'], + developer: interest['Signature Link Developer'] + } + }); + return interest; } catch (error: any) { console.error('[get-interest-by-id] Error occurred:', error); diff --git a/server/utils/nocodb.ts b/server/utils/nocodb.ts index fb56547..e86db0a 100644 --- a/server/utils/nocodb.ts +++ b/server/utils/nocodb.ts @@ -37,12 +37,29 @@ export const getInterests = async () => }, }); -export const getInterestById = async (id: string) => - $fetch(`${createTableUrl(Table.Interest)}/${id}`, { +export const getInterestById = async (id: string) => { + console.log('[nocodb.getInterestById] Fetching interest ID:', id); + + const result = await $fetch(`${createTableUrl(Table.Interest)}/${id}`, { headers: { "xc-token": getNocoDbConfiguration().token, }, }); + + console.log('[nocodb.getInterestById] Raw result from NocoDB:', { + id: result.Id, + documensoID: result['documensoID'], + documensoID_type: typeof result['documensoID'], + documensoID_value: JSON.stringify(result['documensoID']), + signatureLinks: { + client: result['Signature Link Client'], + cc: result['Signature Link CC'], + developer: result['Signature Link Developer'] + } + }); + + return result; +}; export const updateInterest = async (id: string, data: Partial, retryCount = 0): Promise => { console.log('[nocodb.updateInterest] Updating interest:', id, 'Retry:', retryCount);