Refactor EOI management into dedicated component

Extract EOI links and generation functionality from InterestDetailsModal
into a new reusable EOISection component. This improves code organization
and maintainability while adding debounce support for form submissions.

- Create new EOISection.vue component for EOI management
- Remove inline EOI links section from InterestDetailsModal
- Add debounce utility for form submission handling
- Update email generation and thread fetching logic
- Update related types and utilities
This commit is contained in:
2025-06-10 00:37:43 +02:00
parent 76d04a1e2a
commit d9fb94a76c
9 changed files with 356 additions and 88 deletions

View File

@@ -203,12 +203,12 @@ async function fetchImapEmails(
console.log(`Searching in folder: ${folderName}`);
// Search for emails both sent and received with this client
// Note: BCC search might not be supported by all IMAP servers
const searchCriteria = [
'OR',
['FROM', clientEmail],
['TO', clientEmail],
['CC', clientEmail],
['BCC', clientEmail]
['CC', clientEmail]
];
imap.search(searchCriteria, (err, results) => {

View File

@@ -43,6 +43,21 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 404, statusMessage: "Interest not found" });
}
// Check if EOI already exists (has signature links)
if (interest['Signature Link Client'] && interest['Signature Link CC'] && interest['Signature Link Developer']) {
console.log('EOI already exists, returning existing links');
return {
success: true,
documentId: 'existing',
clientSigningUrl: interest['Signature Link Client'],
signingLinks: {
'Client': interest['Signature Link Client'],
'CC': interest['Signature Link CC'],
'Developer': interest['Signature Link Developer']
}
};
}
// Validate required fields
const requiredFields = [
{ field: 'Full Name', value: interest['Full Name'] },
@@ -260,15 +275,15 @@ export default defineEventHandler(async (event) => {
'Extra Comments': updatedComments
};
// Add signing links to update data
// Add signing links to update data with new column names
if (signingLinks['Client']) {
updateData['EOI Client Link'] = signingLinks['Client'];
updateData['Signature Link Client'] = signingLinks['Client'];
}
if (signingLinks['David Mizrahi']) {
updateData['EOI David Link'] = signingLinks['David Mizrahi'];
updateData['Signature Link Developer'] = signingLinks['David Mizrahi'];
}
if (signingLinks['Oscar Faragher']) {
updateData['EOI Oscar Link'] = signingLinks['Oscar Faragher'];
updateData['Signature Link CC'] = signingLinks['Oscar Faragher'];
}
await updateInterest(interestId, updateData);

View File

@@ -98,9 +98,13 @@ export const updateInterest = async (id: string, data: Partial<Interest>, retryC
"Contract Status",
// Add the EOI link fields
"EOI Client Link",
"EOI David Link",
"EOI David Link",
"EOI Oscar Link",
"EOI Document"
"EOI Document",
// Add the new signature link fields
"Signature Link Client",
"Signature Link CC",
"Signature Link Developer"
];
// Filter the data to only include allowed fields