Skip to content

Commit

Permalink
verified build
Browse files Browse the repository at this point in the history
  • Loading branch information
subru-37 committed Dec 13, 2024
1 parent 1107145 commit 1fb603a
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 103 deletions.
67 changes: 35 additions & 32 deletions apps/web-admin/src/components/MultiFormEmail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
const response = await fetch('/QrTemplate.txt');
const data = await response.text();
setEmailContent(data);
console.log(data);
// console.log(data);
};
fetchText();
if (emailContent.length === 0) {
console.log('fetching text');
fetchText();
}
}, [selectedProject]);
const { accountDetails, emailProjects, setEmailProjects, participants, setParticipants } =
useContext(account);
Expand Down Expand Up @@ -102,7 +105,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
});
},
onError: (error) => {
console.error('Error updating recipients:', error);
//console.error('Error updating recipients:', error);
showAlert({
title: 'Failure',
description: `Error updating recipients`,
Expand All @@ -122,8 +125,8 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
email: value.email,
payload: value.checkInKey,
}));
console.log('Request');
console.log(myData, recipients);
//console.log('Request');
//console.log(myData, recipients);
// Trigger the mutation
addRecipientsMutation({
projectId: selectedProject.id,
Expand All @@ -132,9 +135,9 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
}
};
useEffect(() => {
console.log(recipients);
//console.log(recipients);
}, [recipients]);
// console.log(`/core/organizations/${accountDetails.orgId}/getRecipients/${selectedProject.id}`);
// //console.log(`/core/organizations/${accountDetails.orgId}/getRecipients/${selectedProject.id}`);
useGetQuery(
`/core/organizations/${accountDetails.orgId}/getRecipients/${
selectedProject.id ? selectedProject.id : ''
Expand All @@ -145,11 +148,11 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
{},
{
onError: (error) => {
console.log(error);
//console.log(error);
},
},
(response) => {
// console.log(response.data.recipients);
// //console.log(response.data.recipients);
// setMailStatus(response.data.recipients);
setRecipients(() => {
const myParts = response.data.recipients.map((value) => value.email);
Expand Down Expand Up @@ -179,7 +182,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
});
},
onError: (error) => {
console.log(error);
//console.log(error);
showAlert({
title: 'Failure',
description: 'Failed to update email template',
Expand All @@ -192,12 +195,12 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
],
},
({ data, variables, context }) => {
console.log(data);
//console.log(data);
},
);
const updateEmailTemplate = async (e) => {
e.preventDefault();
// console.log(renderHtml(emailContent));
// //console.log(renderHtml(emailContent));
if (accountDetails.orgId) {
updateEmailMutation({
projectId: selectedProject.id,
Expand Down Expand Up @@ -238,7 +241,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
// onClose();
},
onError: (error) => {
console.log(error);
//console.log(error);
},
},
);
Expand All @@ -255,7 +258,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
},
{
onSuccess: (response) => {
console.log(response.data);
//console.log(response.data);
// setMailStatus(response.data);
},
},
Expand All @@ -268,7 +271,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
{},
{
onSuccess: (response) => {
console.log(response);
//console.log(response);
showAlert({
title: 'Success',
description: 'Email Project Added',
Expand All @@ -281,7 +284,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
});
},
onError: (error) => {
console.error('Error adding new project:', error);
//console.error('Error adding new project:', error);
showAlert({
title: 'Failure',
description: `Error adding new project`,
Expand All @@ -294,13 +297,13 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
],
},
({ data, variables, context }) => {
console.log(data);
//console.log(data);
},
);
const handleEmailProjectSubmit = async (e) => {
e.preventDefault();
// console.log('Hekki')
console.log(newEmailProject);
// //console.log('Hekki')
//console.log(newEmailProject);
if (emailProjects.length > 9) {
showAlert({
title: 'Failure',
Expand All @@ -325,17 +328,17 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
{},
{
onSuccess: (response) => {
console.log(response.data);
//console.log(response.data);
setMailStatus(response.data);
},
},
);
const nextStep = async () => {
if (step == 3) {
console.log('hi');
//console.log('hi');
addNewRecipients();
}
console.log(step);
//console.log(step);
setStep((prev) => Math.min(prev + 1, 5));
// if(step == 4){
// checkMailStatusMutation({
Expand Down Expand Up @@ -366,13 +369,13 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
placeholder="Select an Email recipient list"
// value={}
onChange={(e) => {
// console.log(emailProjects[e.target.value]['html_template']);
// //console.log(emailProjects[e.target.value]['html_template']);
setSelectedProject(emailProjects[e.target.value]);
setEmailContent(emailProjects[e.target.value]['html_template']);
}}
>
{emailProjects.map((value, index) => {
// console.log(value);
// //console.log(value);
return (
<option key={index} value={index}>
{value.name}
Expand Down Expand Up @@ -496,24 +499,24 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
overflowY="visible"
height="500px"
onRowClick={(value) => {
console.log(value);
//console.log(value);
}}
state={recipients.map((value) => value.email)}
// state={recipients}
setState={(selectedValue) => {
//console.log(selectedValue);
////console.log(selectedValue);
if (Array.isArray(selectedValue)) {
// console.log(selectedValue);
//console.log('hello trigger')
// //console.log(selectedValue);
////console.log('hello trigger')
if (selectedValue.length > 0) {
setRecipients(participants);
} else {
setRecipients([]);
}
} else {
//console.log('trigger')
////console.log('trigger')
setRecipients((prevSelectedRows) => {
console.log(prevSelectedRows);
//console.log(prevSelectedRows);
const myIds = prevSelectedRows.map((value) => value.email);
return myIds.includes(selectedValue.email)
? prevSelectedRows.filter((value) => value.email !== selectedValue.email)
Expand Down Expand Up @@ -615,7 +618,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
<Button
onClick={() => {
nextStep();
// console.log(step);
// //console.log(step);
}}
>
Next
Expand All @@ -631,7 +634,7 @@ const MultiStepModal = ({ isOpen, onClose, emailContent, setEmailContent }) => {
onClick={() => {
onClose();
setStep(1);
// console.log(step);
// //console.log(step);
}}
>
Close
Expand Down
4 changes: 4 additions & 0 deletions apps/web-admin/src/contexts/MyContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const MyContext = ({ children }) => {
});
}
};
const [activeTab, setActiveTab] = useState('Participants');

return (
<div>
<account.Provider
Expand All @@ -56,6 +58,8 @@ const MyContext = ({ children }) => {
emailProjects,
setEmailProjects,
setAccountDetails,
activeTab,
setActiveTab,
updateAccountDetails,
participants,
setParticipants,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default function Attributes() {
headerButton={
<>
<Button onClick={onOpen} isLoading={loading}>
Attribute
Attribute
</Button>
</>
}
Expand Down
14 changes: 1 addition & 13 deletions apps/web-admin/src/pages/[orgId]/events/[eventId]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ export default function EventById() {
// fetchEventAttributes();
// }, []);

const tabStyle = (isActive) => ({
color: isActive ? '#369b97' : '#369b97',
backgroundColor: isActive ? '#e6f7f5' : '#e6f7f5',
padding: '10px 20px',
borderRadius: '8px',
cursor: 'pointer',
fontSize: { base: '14px', md: '17px' },
fontWeight: '600',
width: { base: '100%', md: 'auto' },
});

return (
<DashboardLayout
pageTitle={event?.name}
Expand Down Expand Up @@ -199,8 +188,7 @@ export default function EventById() {
py={6}
>
<Text fontSize={{ base: 'xl', md: '3xl' }}>
Participants:{' '}
<span style={{ fontWeight: 'bold' }}>{event.numberOfParticipants}</span>
Participants: <span style={{ fontWeight: 'bold' }}>{event.numberOfParticipants}</span>
</Text>

<Text fontSize={{ base: 'xl', md: '3xl' }}>
Expand Down
Loading

0 comments on commit 1fb603a

Please sign in to comment.