fix(05-04): pre-select document client and add manual email entry
- PreparePanel now receives separate assignedClientId (nullable) and defaultClientId props so it can distinguish an explicitly locked client from just a default - When document already has assignedClientId: show locked read-only display; user cannot change the primary recipient - When document has no assignedClientId: default to document owner in dropdown but allow changing; option to clear and enter email manually - Added textarea for additional/CC email addresses (comma or newline separated) that is always visible for either mode - POST /api/documents/[id]/prepare now accepts and stores emailAddresses array alongside assignedClientId - Added email_addresses jsonb column to documents table via migration 0004_military_maximus.sql Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,8 @@ export async function POST(
|
||||
const body = await req.json() as {
|
||||
textFillData?: Record<string, string>;
|
||||
assignedClientId?: string;
|
||||
/** Email addresses to send the document to (client email + any CC addresses). */
|
||||
emailAddresses?: string[];
|
||||
};
|
||||
|
||||
const doc = await db.query.documents.findFirst({ where: eq(documents.id, id) });
|
||||
@@ -45,6 +47,7 @@ export async function POST(
|
||||
preparedFilePath: preparedRelPath,
|
||||
textFillData: body.textFillData ?? null,
|
||||
assignedClientId: body.assignedClientId ?? doc.assignedClientId ?? null,
|
||||
emailAddresses: body.emailAddresses ?? null,
|
||||
status: 'Sent',
|
||||
sentAt: new Date(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user