mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
Implements a bulk send feature allowing users to upload a CSV file to create multiple documents from a template. Includes CSV template generation, background processing, and email notifications. <img width="563" alt="image" src="https://github.com/user-attachments/assets/658cee71-6508-4a00-87da-b17c6762b7d8" /> <img width="578" alt="image" src="https://github.com/user-attachments/assets/bbfac70b-c6a0-466a-be98-99ca4c4eb1b9" /> <img width="635" alt="image" src="https://github.com/user-attachments/assets/65b2f55d-d491-45ac-84d6-1a31afe953dd" /> ## Changes Made - Added `TemplateBulkSendDialog` with CSV upload/download functionality - Implemented bulk send job handler using background task system - Created email template for completion notifications - Added bulk send option to template view and actions dropdown - Added CSV parsing with email/name validation ## Testing Performed - CSV upload with valid/invalid data - Bulk send with/without immediate sending - Email notifications and error handling - Team context integration - File size and row count limits Resolves #1550
92 lines
2.9 KiB
TypeScript
92 lines
2.9 KiB
TypeScript
import { Trans, msg } from '@lingui/macro';
|
|
import { useLingui } from '@lingui/react';
|
|
|
|
import { Body, Container, Head, Html, Preview, Section, Text } from '../components';
|
|
import { TemplateFooter } from '../template-components/template-footer';
|
|
|
|
export interface BulkSendCompleteEmailProps {
|
|
userName: string;
|
|
templateName: string;
|
|
totalProcessed: number;
|
|
successCount: number;
|
|
failedCount: number;
|
|
errors: string[];
|
|
assetBaseUrl?: string;
|
|
}
|
|
|
|
export const BulkSendCompleteEmail = ({
|
|
userName,
|
|
templateName,
|
|
totalProcessed,
|
|
successCount,
|
|
failedCount,
|
|
errors,
|
|
}: BulkSendCompleteEmailProps) => {
|
|
const { _ } = useLingui();
|
|
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<Preview>{_(msg`Bulk send operation complete for template "${templateName}"`)}</Preview>
|
|
<Body className="mx-auto my-auto bg-white font-sans">
|
|
<Section>
|
|
<Container className="mx-auto mb-2 mt-8 max-w-xl rounded-lg border border-solid border-slate-200 p-4 backdrop-blur-sm">
|
|
<Section>
|
|
<Text className="text-sm">
|
|
<Trans>Hi {userName},</Trans>
|
|
</Text>
|
|
|
|
<Text className="text-sm">
|
|
<Trans>Your bulk send operation for template "{templateName}" has completed.</Trans>
|
|
</Text>
|
|
|
|
<Text className="text-lg font-semibold">
|
|
<Trans>Summary:</Trans>
|
|
</Text>
|
|
|
|
<ul className="my-2 ml-4 list-inside list-disc">
|
|
<li>
|
|
<Trans>Total rows processed: {totalProcessed}</Trans>
|
|
</li>
|
|
<li className="mt-1">
|
|
<Trans>Successfully created: {successCount}</Trans>
|
|
</li>
|
|
<li className="mt-1">
|
|
<Trans>Failed: {failedCount}</Trans>
|
|
</li>
|
|
</ul>
|
|
|
|
{failedCount > 0 && (
|
|
<Section className="mt-4">
|
|
<Text className="text-lg font-semibold">
|
|
<Trans>The following errors occurred:</Trans>
|
|
</Text>
|
|
|
|
<ul className="my-2 ml-4 list-inside list-disc">
|
|
{errors.map((error, index) => (
|
|
<li key={index} className="text-destructive mt-1 text-sm text-slate-400">
|
|
{error}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</Section>
|
|
)}
|
|
|
|
<Text className="text-sm">
|
|
<Trans>
|
|
You can view the created documents in your dashboard under the "Documents created
|
|
from template" section.
|
|
</Trans>
|
|
</Text>
|
|
</Section>
|
|
</Container>
|
|
|
|
<Container className="mx-auto max-w-xl">
|
|
<TemplateFooter isDocument={false} />
|
|
</Container>
|
|
</Section>
|
|
</Body>
|
|
</Html>
|
|
);
|
|
};
|