Skip to content

Commit

Permalink
Minor bugs + build verified
Browse files Browse the repository at this point in the history
  • Loading branch information
subru-37 committed Dec 1, 2024
1 parent 3e79004 commit 36dea62
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 4 deletions.
5 changes: 3 additions & 2 deletions apps/core-admin/src/controllers/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ export const updateMailProject = async (req: Request, res: Response) => {

export const newMailProject = async (req: Request, res: Response) => {
try {
const { name, desc } = req.body;
const { name, desc, html_template } = req.body;
const { orgId } = req?.params;
if (!name || !desc || !orgId) {
if (!name || !desc || !orgId || !html_template) {
return res.status(400).send({ message: 'Missing required fields' });
}
console.log(name, desc, orgId);
Expand All @@ -321,6 +321,7 @@ export const newMailProject = async (req: Request, res: Response) => {
name: name,
description: desc,
orgId: orgId,
html_template: html_template,
},
});
// console.log(response)
Expand Down
115 changes: 115 additions & 0 deletions apps/web-admin/public/QrTemplate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
### Greetings {{name}}!

<br/>

Thank you for your interest in participating in **< Event Name >** led by **< Speaker 1>**, < designation >, and **< Speaker 2 >**, < designation >
<br/><br/>

#### Following are the details of the event:

<br/>

- **Date of Event**: < Date of event >
- **Time**: < Time >
- **Venue**: < Venue details >

<br/>

Your **QR Code** for the event is attached with this email. Please use it to confirm your attendance at the registration desk tomorrow before **< Time of registration >**.

<br/>

**Entry to the venue will not be entertained after < Time of entry >**

<br/>

Your QR code is your unique entry pass for the event. Please present it to our volunteers to be scanned and checked in. **Only those checked in with the QR code will receive certificates**. The same QR code can also be used as a **food coupon** to avail of your **lunch and snacks**.

<br/>

#### General Guidelines:

<br/>

- < guideline 1 >
- < guideline 2 >

<br/>

In case of any questions or inquiries, please contact:
**< POC 1 >** - < contact no: >
**< POC 2 >** - < contact no: >

<br/><br/>
Looking forward to seeing you at the event tomorrow!
<br/><br/>

Kind regards,
< Organization name >

<table align="center" width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation" style="
max-width: 360px;
background-color: #ffffff;
border: 1px solid #eee;
border-radius: 5px;
box-shadow: 0 5px 10px rgba(20, 50, 70, 0.2);
margin-top: 20px;
margin: 0 auto;
padding: 68px 10px 130px;
min-height: 400px
">
<tbody>
<tr style="width: 100%">
<td>
<p style="
font-size: 11px;
line-height: 16px;
margin: 16px 8px 8px 8px;
color: #e80a5a;
font-weight: 700;
font-family: HelveticaNeue, Helvetica, Arial, sans-serif;
height: 16px;
letter-spacing: 0;
text-transform: uppercase;
text-align: center;
">
Verify Your Identity
</p>
<h1 style="
color: #000;
display: inline-block;
font-family: HelveticaNeue-Medium, Helvetica, Arial, sans-serif;
font-size: 20px;
font-weight: 500;
line-height: 24px;
margin-bottom: 0;
margin-top: 0;
text-align: center;
">
Produce this email to the volunteers at the registration desk
</h1>
<br/><br/>
<div style="width: 100%; display: flex; align-items: center; justify-content: center;">
<img src="https://qrcode.myprojects.studio/qrcode?text={{payload}}&amp;size=150&amp;ecLevel=H" alt="Ticker QR">
</div>
<p style="text-align: center; font-size: 20px; font-weight: bold">
{{payload}}
</p>
<p style="
font-size: 15px;
line-height: 23px;
margin: 0;
color: #444;
font-family: HelveticaNeue, Helvetica, Arial, sans-serif;
letter-spacing: 0;
padding: 0 40px;
text-align: center;
">
Contact
<a href="mailto:[email protected]" style="color: #444; text-decoration: underline" target="_blank">[email protected]</a>
if you face any issues
</p>
</td>
</tr>
</tbody>
</table>
12 changes: 11 additions & 1 deletion apps/web-admin/src/components/MultiFormEmail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
const [selectedProject, setSelectedProject] = useState({});
const [recipients, setRecipients] = useState([]);
const [mailStatus, setMailStatus] = useState(null);
useEffect(() => {
const fetchText = async () => {
const response = await fetch('/QrTemplate.txt');
const data = await response.text();
setEmailContent(data);
console.log(data);
};
fetchText();
}, [selectedProject]);
const { accountDetails, emailProjects, setEmailProjects, participants, setParticipants } =
useContext(account);

Expand Down Expand Up @@ -280,7 +289,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
});
},
invalidateKeys: [
`core/organizations/${accountDetails.orgId}/getEmailProjects`,
`/core/organizations/${accountDetails.orgId}/getEmailProjects`,
`/core/organizations/${accountDetails.orgId}/getRecipients/${selectedProject.id}`,
],
},
Expand All @@ -302,6 +311,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
emailProjectMutation({
name: newEmailProject.name,
desc: newEmailProject.desc,
html_template: emailContent,
});
}
};
Expand Down
7 changes: 6 additions & 1 deletion apps/web-admin/src/pages/[orgId]/events/[eventId]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export default function EventById() {
const [event, setEvent] = useState([]);
const [activeTab, setActiveTab] = useState('participants');
const isDrawer = useBreakpointValue({ base: true, md: false });
const [attributes, setAttributes] = useState(['firstName', 'lastName', 'email', 'phone']);
const [attributes, setAttributes] = useState([
{ key: 'firstName', name: 'First Name: ' },
{ key: 'lastName', name: 'Last Name: ' },
{ key: 'email', name: 'Email: ' },
{ key: 'phone', name: 'Phone No:' },
]);

const { data, status, error } = useGetQuery(
`/core/organizations/${orgId}/events/${eventId}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AddParticipant from '@/components/AddParticipant';
import MultiStepModal from '@/components/MultiFormEmail';
import { useContext } from 'react';
import { account } from '@/contexts/MyContext';
import axios from 'axios';
import useWrapper from '@/hooks/useWrapper';

const columns = [
Expand Down Expand Up @@ -58,6 +59,7 @@ export default function Participants() {
setFormData((prevData) => ({ ...prevData, [name]: value }));
};
const [emailContent, setEmailContent] = useState('');

const handleSubmit = async (e) => {
e.preventDefault();
//console.log(formData);
Expand Down

0 comments on commit 36dea62

Please sign in to comment.