removed grid showing dummy text
This commit is contained in:
parent
6ed96a76be
commit
86689f019f
|
|
@ -177,14 +177,6 @@ export async function previewBulkEmail(type) {
|
|||
subject: rendered.subject,
|
||||
text: rendered.text,
|
||||
recipientCount: doctors.length,
|
||||
recipients:
|
||||
type === 'reminder'
|
||||
? doctors.map((doctor) => ({
|
||||
email: doctor.email,
|
||||
name: doctorGreetingName(doctor.hcp_name),
|
||||
steps: doctor.steps,
|
||||
}))
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,41 +202,8 @@ describe('bulk study email', () => {
|
|||
url: '/api/admin/emails/preview?type=reminder',
|
||||
headers: { cookie: sessionCookie(login) },
|
||||
});
|
||||
expect(preview.result.recipients).toEqual([
|
||||
{
|
||||
email: 'new@example.com',
|
||||
name: 'New Doctor',
|
||||
steps: {
|
||||
login: 'Pending',
|
||||
consent: 'Pending',
|
||||
agreement: 'Pending',
|
||||
approval: 'Pending',
|
||||
survey: 'Pending',
|
||||
},
|
||||
},
|
||||
{
|
||||
email: 'testdoc1@yopmail.com',
|
||||
name: 'Asha Rao',
|
||||
steps: {
|
||||
login: 'Completed',
|
||||
consent: 'Completed',
|
||||
agreement: 'Completed',
|
||||
approval: 'Completed',
|
||||
survey: 'Pending',
|
||||
},
|
||||
},
|
||||
{
|
||||
email: 'amey@stratawiz.com',
|
||||
name: 'Amey',
|
||||
steps: {
|
||||
login: 'Pending',
|
||||
consent: 'Pending',
|
||||
agreement: 'Pending',
|
||||
approval: 'Pending',
|
||||
survey: 'Pending',
|
||||
},
|
||||
},
|
||||
]);
|
||||
expect(preview.result.recipientCount).toBe(3);
|
||||
expect(preview.result.recipients).toBeUndefined();
|
||||
|
||||
const response = await server.inject({
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
import { useEffect, useRef, useState } from 'react';
|
||||
import { adminApi } from './adminApi.js';
|
||||
|
||||
const PROGRESS = [
|
||||
['login', 'Login'],
|
||||
['consent', 'Consent'],
|
||||
['agreement', 'Agreement'],
|
||||
['approval', 'Approval'],
|
||||
['survey', 'Survey'],
|
||||
];
|
||||
|
||||
const TYPES = [
|
||||
{
|
||||
id: 'invitation',
|
||||
|
|
@ -116,7 +108,6 @@ function LetterScreen({ subject, body, onSubject, onBody, onClose }) {
|
|||
export default function SendEmailsPage() {
|
||||
const [type, setType] = useState('invitation');
|
||||
const [recipientCount, setRecipientCount] = useState(null);
|
||||
const [recipients, setRecipients] = useState([]);
|
||||
const [subject, setSubject] = useState('');
|
||||
const [body, setBody] = useState('');
|
||||
const [ready, setReady] = useState(false);
|
||||
|
|
@ -131,7 +122,6 @@ export default function SendEmailsPage() {
|
|||
setReady(false);
|
||||
setFullScreen(false);
|
||||
setError('');
|
||||
setRecipients([]);
|
||||
|
||||
adminApi(`/api/admin/emails/preview?type=${type}`)
|
||||
.then((data) => {
|
||||
|
|
@ -139,7 +129,6 @@ export default function SendEmailsPage() {
|
|||
setSubject(data.subject);
|
||||
setBody(data.text);
|
||||
setRecipientCount(data.recipientCount);
|
||||
setRecipients(Array.isArray(data.recipients) ? data.recipients : []);
|
||||
setReady(true);
|
||||
}
|
||||
})
|
||||
|
|
@ -232,27 +221,6 @@ export default function SendEmailsPage() {
|
|||
<p className="m-0 text-sm text-stone-600">
|
||||
{recipientCount === null ? 'Counting doctors…' : `${recipientCount} doctors`}
|
||||
</p>
|
||||
{type === 'reminder' && recipients.length > 0 ? (
|
||||
<ul className="m-0 grid gap-3 p-0 text-sm">
|
||||
{recipients.map((doctor) => (
|
||||
<li key={doctor.email} className="list-none">
|
||||
<p className="m-0 font-medium text-[#134e4a]">{doctor.email}</p>
|
||||
{doctor.name ? <p className="m-0 text-stone-600">Dr {doctor.name}</p> : null}
|
||||
<ul className="m-0 mt-1 grid gap-0.5 p-0">
|
||||
{PROGRESS.map(([key, label]) => (
|
||||
<li key={key} className="list-none text-stone-700">
|
||||
{label} — {doctor.steps?.[key] === 'Completed' ? 'Completed' : 'Pending'}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
<p className="m-0 text-sm text-stone-600">
|
||||
Edit the letter on the right. Only text inside {'{ }'} is replaced for each doctor.
|
||||
A letter with no tokens is saved as written.
|
||||
</p>
|
||||
{error ? <p className="m-0 text-red-700">{error}</p> : null}
|
||||
{result ? (
|
||||
<p className="admin-card-status admin-card-status-success" role="status">
|
||||
|
|
|
|||
|
|
@ -34,19 +34,6 @@ describe('send emails page', () => {
|
|||
subject: 'Reminder Email for Extended-Dose-Pack Study',
|
||||
text: 'Dear Dr {Name},',
|
||||
recipientCount: 1,
|
||||
recipients: [
|
||||
{
|
||||
email: 'testdoc1@yopmail.com',
|
||||
name: 'Asha Rao',
|
||||
steps: {
|
||||
login: 'Completed',
|
||||
consent: 'Pending',
|
||||
agreement: 'Pending',
|
||||
approval: 'Pending',
|
||||
survey: 'Pending',
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
|
@ -92,9 +79,8 @@ describe('send emails page', () => {
|
|||
'/api/admin/emails/preview?type=reminder',
|
||||
expect.objectContaining({ method: 'GET' }),
|
||||
);
|
||||
expect(screen.getByText('testdoc1@yopmail.com')).toBeInTheDocument();
|
||||
expect(screen.getByText('Login — Completed')).toBeInTheDocument();
|
||||
expect(screen.getByText('Survey — Pending')).toBeInTheDocument();
|
||||
expect(screen.getByText('1 doctors')).toBeInTheDocument();
|
||||
expect(screen.queryByText('testdoc1@yopmail.com')).not.toBeInTheDocument();
|
||||
|
||||
fireEvent.change(screen.getByLabelText('Letter'), {
|
||||
target: { value: 'Hello {Name}' },
|
||||
|
|
|
|||
Loading…
Reference in New Issue