Commit
·
553dc7c
1
Parent(s):
c049d8c
updated
Browse files- backend/controller/applicantController.js +2 -2
- backend/controller/contactController.js +2 -2
- backend/controller/demoRequestController.js +2 -2
- backend/utils/contactRequestDB.js +3 -3
- backend/utils/demoRequestDB.js +4 -4
- backend/utils/jobRequestDB.js +3 -3
- backend/utils/setupDB.js +6 -3
- frontend/src/sections/contact/Forms.jsx +10 -4
- frontend/src/sections/jobs/JobPageSection.jsx +6 -10
backend/controller/applicantController.js
CHANGED
@@ -3,7 +3,7 @@ const { checkExistingJobApplication, insertJobApplication } = require('../utils/
|
|
3 |
const { sendEmail } = require('../utils/sendEmail');
|
4 |
|
5 |
const submitJobApplication = async (req, res) => {
|
6 |
-
const { name, email, phone, experience, role, linkedin } = req.body;
|
7 |
const resume = req.file;
|
8 |
|
9 |
console.log('Received job application:', req.body);
|
@@ -35,7 +35,7 @@ const submitJobApplication = async (req, res) => {
|
|
35 |
const filename = resume.originalname;
|
36 |
|
37 |
// Insert application into the database
|
38 |
-
await insertJobApplication(name, email, phone, experience, role, linkedin, resume.buffer, filename);
|
39 |
console.log('Job Application added to DB successfully');
|
40 |
|
41 |
try{
|
|
|
3 |
const { sendEmail } = require('../utils/sendEmail');
|
4 |
|
5 |
const submitJobApplication = async (req, res) => {
|
6 |
+
const { name, email, phone, experience, role, linkedin, consent } = req.body;
|
7 |
const resume = req.file;
|
8 |
|
9 |
console.log('Received job application:', req.body);
|
|
|
35 |
const filename = resume.originalname;
|
36 |
|
37 |
// Insert application into the database
|
38 |
+
await insertJobApplication(name, email, phone, experience, role, linkedin, resume.buffer, filename, consent);
|
39 |
console.log('Job Application added to DB successfully');
|
40 |
|
41 |
try{
|
backend/controller/contactController.js
CHANGED
@@ -9,7 +9,7 @@ const { useVapi} = require("../config");
|
|
9 |
const assistant_url = 'https://api.vapi.ai/call';
|
10 |
|
11 |
const submitContactForm = async (req, res) => {
|
12 |
-
const { name, email, phone, subject, message } = req.body;
|
13 |
console.log('Received contact form submission:', req.body);
|
14 |
|
15 |
if (!name || !email || !phone || !subject || !message) {
|
@@ -24,7 +24,7 @@ const submitContactForm = async (req, res) => {
|
|
24 |
return res.status(400).send({ error: 'Your contact request with the same subject is in queue' });
|
25 |
}
|
26 |
|
27 |
-
await insertContactRequest(name, email, phone, subject, message);
|
28 |
console.log('Contact request added successfully');
|
29 |
|
30 |
try{
|
|
|
9 |
const assistant_url = 'https://api.vapi.ai/call';
|
10 |
|
11 |
const submitContactForm = async (req, res) => {
|
12 |
+
const { name, email, phone, subject, message, consent } = req.body;
|
13 |
console.log('Received contact form submission:', req.body);
|
14 |
|
15 |
if (!name || !email || !phone || !subject || !message) {
|
|
|
24 |
return res.status(400).send({ error: 'Your contact request with the same subject is in queue' });
|
25 |
}
|
26 |
|
27 |
+
await insertContactRequest(name, email, phone, subject, message, consent);
|
28 |
console.log('Contact request added successfully');
|
29 |
|
30 |
try{
|
backend/controller/demoRequestController.js
CHANGED
@@ -12,7 +12,7 @@ const { useVapi} = require("../config");
|
|
12 |
const assistant_url = 'https://api.vapi.ai/call';
|
13 |
|
14 |
const demoRequest = async (req, res) => {
|
15 |
-
const { name, email, company, product, demoDate, selectedSlot, phone, additionalComments, timezone } = req.body;
|
16 |
console.log('Received demo request:', req.body);
|
17 |
|
18 |
// Basic validation on the server side
|
@@ -61,7 +61,7 @@ const demoRequest = async (req, res) => {
|
|
61 |
console.log('Converted time range to Asia/Kolkata:', formattedRange);
|
62 |
|
63 |
// 2. Insert the new demo request into the database
|
64 |
-
await insertDemoRequest(name, email, company, product, convertedDemoDate, formattedRange, phone, additionalComments);
|
65 |
console.log('Demo request added successfully');
|
66 |
|
67 |
const [ eventData, icsContent ] = await createGoogleCalendarEvent(name, email, demoDate, selectedSlot, product, timezone);
|
|
|
12 |
const assistant_url = 'https://api.vapi.ai/call';
|
13 |
|
14 |
const demoRequest = async (req, res) => {
|
15 |
+
const { name, email, company, product, demoDate, selectedSlot, phone, additionalComments, timezone, consent } = req.body;
|
16 |
console.log('Received demo request:', req.body);
|
17 |
|
18 |
// Basic validation on the server side
|
|
|
61 |
console.log('Converted time range to Asia/Kolkata:', formattedRange);
|
62 |
|
63 |
// 2. Insert the new demo request into the database
|
64 |
+
await insertDemoRequest(name, email, company, product, convertedDemoDate, formattedRange, phone, additionalComments, consent);
|
65 |
console.log('Demo request added successfully');
|
66 |
|
67 |
const [ eventData, icsContent ] = await createGoogleCalendarEvent(name, email, demoDate, selectedSlot, product, timezone);
|
backend/utils/contactRequestDB.js
CHANGED
@@ -8,9 +8,9 @@ async function checkExistingContactRequest(name, email, subject) {
|
|
8 |
}
|
9 |
|
10 |
// Insert contact request
|
11 |
-
async function insertContactRequest(name, email, phone, subject, message) {
|
12 |
-
const insertQuery = `INSERT INTO contact_requests (date, time, name, email, phone, subject, message) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?);`;
|
13 |
-
await runQuery(insertQuery, [name, email, phone, subject, message]);
|
14 |
}
|
15 |
|
16 |
module.exports = { checkExistingContactRequest, insertContactRequest };
|
|
|
8 |
}
|
9 |
|
10 |
// Insert contact request
|
11 |
+
async function insertContactRequest(name, email, phone, subject, message, consent) {
|
12 |
+
const insertQuery = `INSERT INTO contact_requests (date, time, name, email, phone, subject, message, consent) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?);`;
|
13 |
+
await runQuery(insertQuery, [name, email, phone, subject, message, consent]);
|
14 |
}
|
15 |
|
16 |
module.exports = { checkExistingContactRequest, insertContactRequest };
|
backend/utils/demoRequestDB.js
CHANGED
@@ -11,12 +11,12 @@ async function checkExistingDemoRequest(name, email, product, demoDate, phone) {
|
|
11 |
}
|
12 |
|
13 |
// Insert demo request
|
14 |
-
async function insertDemoRequest(name, email, company, product, demoDate, slot, phone, message) {
|
15 |
const insertQuery = `
|
16 |
-
INSERT INTO demo_requests (date, time, name, email, company, product, demo_date, slot, phone, comments)
|
17 |
-
VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?);
|
18 |
`;
|
19 |
-
await runQuery(insertQuery, [name, email, company, product, demoDate, slot, phone, message]);
|
20 |
}
|
21 |
|
22 |
module.exports = { checkExistingDemoRequest, insertDemoRequest };
|
|
|
11 |
}
|
12 |
|
13 |
// Insert demo request
|
14 |
+
async function insertDemoRequest(name, email, company, product, demoDate, slot, phone, message, consent) {
|
15 |
const insertQuery = `
|
16 |
+
INSERT INTO demo_requests (date, time, name, email, company, product, demo_date, slot, phone, comments, consent)
|
17 |
+
VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
18 |
`;
|
19 |
+
await runQuery(insertQuery, [name, email, company, product, demoDate, slot, phone, message, consent]);
|
20 |
}
|
21 |
|
22 |
module.exports = { checkExistingDemoRequest, insertDemoRequest };
|
backend/utils/jobRequestDB.js
CHANGED
@@ -9,9 +9,9 @@ async function checkExistingJobApplication(name, email, role) {
|
|
9 |
}
|
10 |
|
11 |
// Insert job application
|
12 |
-
async function insertJobApplication(name, email, phone, experience, role, linkedin, resume, filename) {
|
13 |
-
const insertQuery = `INSERT INTO applicants (date, time, name, email, phone, experience, role, linkedin, resume, filename) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?);`;
|
14 |
-
await runQuery(insertQuery, [name, email, phone, experience, role, linkedin, resume, filename]);
|
15 |
}
|
16 |
|
17 |
module.exports = { checkExistingJobApplication, insertJobApplication };
|
|
|
9 |
}
|
10 |
|
11 |
// Insert job application
|
12 |
+
async function insertJobApplication(name, email, phone, experience, role, linkedin, resume, filename, consent) {
|
13 |
+
const insertQuery = `INSERT INTO applicants (date, time, name, email, phone, experience, role, linkedin, resume, filename, consent) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?);`;
|
14 |
+
await runQuery(insertQuery, [name, email, phone, experience, role, linkedin, resume, filename, consent]);
|
15 |
}
|
16 |
|
17 |
module.exports = { checkExistingJobApplication, insertJobApplication };
|
backend/utils/setupDB.js
CHANGED
@@ -24,7 +24,8 @@ async function initializeDatabase() {
|
|
24 |
experience TEXT,
|
25 |
linkedin TEXT,
|
26 |
resume BLOB,
|
27 |
-
filename TEXT NOT NULL
|
|
|
28 |
)`,
|
29 |
demo_requests: `CREATE TABLE IF NOT EXISTS demo_requests (
|
30 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
@@ -37,7 +38,8 @@ async function initializeDatabase() {
|
|
37 |
demo_date TEXT,
|
38 |
slot TEXT,
|
39 |
phone TEXT,
|
40 |
-
comments TEXT
|
|
|
41 |
)`,
|
42 |
contact_requests: `CREATE TABLE IF NOT EXISTS contact_requests (
|
43 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
@@ -47,7 +49,8 @@ async function initializeDatabase() {
|
|
47 |
email TEXT NOT NULL,
|
48 |
phone TEXT,
|
49 |
subject TEXT,
|
50 |
-
message TEXT
|
|
|
51 |
)`,
|
52 |
purchases: `CREATE TABLE IF NOT EXISTS purchases (
|
53 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
24 |
experience TEXT,
|
25 |
linkedin TEXT,
|
26 |
resume BLOB,
|
27 |
+
filename TEXT NOT NULL,
|
28 |
+
consent INTEGER NOT NULL
|
29 |
)`,
|
30 |
demo_requests: `CREATE TABLE IF NOT EXISTS demo_requests (
|
31 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
38 |
demo_date TEXT,
|
39 |
slot TEXT,
|
40 |
phone TEXT,
|
41 |
+
comments TEXT,
|
42 |
+
consent INTEGER NOT NULL
|
43 |
)`,
|
44 |
contact_requests: `CREATE TABLE IF NOT EXISTS contact_requests (
|
45 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
49 |
email TEXT NOT NULL,
|
50 |
phone TEXT,
|
51 |
subject TEXT,
|
52 |
+
message TEXT,
|
53 |
+
consent INTEGER NOT NULL
|
54 |
)`,
|
55 |
purchases: `CREATE TABLE IF NOT EXISTS purchases (
|
56 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
frontend/src/sections/contact/Forms.jsx
CHANGED
@@ -231,8 +231,8 @@ const ContactForm = ({ formType, demoProduct }) => {
|
|
231 |
|
232 |
let formData =
|
233 |
formType === 'general'
|
234 |
-
? { name, email, phone, subject, message }
|
235 |
-
: { name, email, phone, company, product, demoDate, selectedSlot, additionalComments, timezone };
|
236 |
|
237 |
// Validate required fields
|
238 |
// if(formType === 'general' && (!name || !email || !phone || !subject || !message) ){
|
@@ -429,7 +429,10 @@ const ContactForm = ({ formType, demoProduct }) => {
|
|
429 |
/>
|
430 |
<label htmlFor="gdpr-consent">
|
431 |
I consent to the processing of my submitted data in accordance with the{' '}
|
432 |
-
<a href="/privacy-policy" target="_blank" rel="noopener noreferrer"
|
|
|
|
|
|
|
433 |
</label>
|
434 |
</ConsentWrapper>
|
435 |
|
@@ -537,7 +540,10 @@ const ContactForm = ({ formType, demoProduct }) => {
|
|
537 |
/>
|
538 |
<label htmlFor="gdpr-consent">
|
539 |
I consent to the processing of my submitted data in accordance with the{' '}
|
540 |
-
<a href="/privacy-policy" target="_blank" rel="noopener noreferrer"
|
|
|
|
|
|
|
541 |
</label>
|
542 |
</ConsentWrapper>
|
543 |
|
|
|
231 |
|
232 |
let formData =
|
233 |
formType === 'general'
|
234 |
+
? { name, email, phone, subject, message, consent }
|
235 |
+
: { name, email, phone, company, product, demoDate, selectedSlot, additionalComments, timezone, consent };
|
236 |
|
237 |
// Validate required fields
|
238 |
// if(formType === 'general' && (!name || !email || !phone || !subject || !message) ){
|
|
|
429 |
/>
|
430 |
<label htmlFor="gdpr-consent">
|
431 |
I consent to the processing of my submitted data in accordance with the{' '}
|
432 |
+
<a href="/privacy-policy" target="_blank" rel="noopener noreferrer">
|
433 |
+
<i style={{ color: "#3f7ad3" }}>Privacy Policy</i>
|
434 |
+
</a>.{' '}
|
435 |
+
<span style={{ color: "red", marginLeft: "5px" }}>*</span>
|
436 |
</label>
|
437 |
</ConsentWrapper>
|
438 |
|
|
|
540 |
/>
|
541 |
<label htmlFor="gdpr-consent">
|
542 |
I consent to the processing of my submitted data in accordance with the{' '}
|
543 |
+
<a href="/privacy-policy" target="_blank" rel="noopener noreferrer">
|
544 |
+
<i style={{ color: "#3f7ad3" }}>Privacy Policy</i>
|
545 |
+
</a>.{' '}
|
546 |
+
<span style={{ color: "red", marginLeft: "5px" }}>*</span>
|
547 |
</label>
|
548 |
</ConsentWrapper>
|
549 |
|
frontend/src/sections/jobs/JobPageSection.jsx
CHANGED
@@ -309,6 +309,7 @@ const JobPageSection = ({ job }) => {
|
|
309 |
formData.append('phone', phone);
|
310 |
formData.append('experience', experience);
|
311 |
formData.append('linkedin', linkedin);
|
|
|
312 |
formData.append('role', role); // Add role to the form data
|
313 |
formData.append('resume', document.getElementById('fileInput').files[0]);
|
314 |
|
@@ -613,7 +614,7 @@ const JobPageSection = ({ job }) => {
|
|
613 |
</IntlTelInputWrapper>
|
614 |
{errors.phone && <span style={{ color: '#de493e', fontSize: '0.875rem' }}>{errors.phone}</span>}
|
615 |
|
616 |
-
<label style={{ display: "flex" }}>Experience </label>{" "}
|
617 |
{/*<div style={{color:'red', marginLeft:"10px"}}>*</div> */}
|
618 |
<Textarea
|
619 |
value={experience}
|
@@ -713,16 +714,11 @@ const JobPageSection = ({ job }) => {
|
|
713 |
required
|
714 |
/>
|
715 |
<label htmlFor="gdpr-consent">
|
716 |
-
I consent to the processing of my submitted data in
|
717 |
-
|
718 |
-
<a
|
719 |
-
href="/privacy-policy"
|
720 |
-
target="_blank"
|
721 |
-
rel="noopener noreferrer"
|
722 |
-
>
|
723 |
<i style={{ color: "#3f7ad3" }}>Privacy Policy</i>
|
724 |
-
</a
|
725 |
-
|
726 |
</label>
|
727 |
</ConsentWrapper>
|
728 |
<SubmitButton type="submit" data-testid="submit-btn">
|
|
|
309 |
formData.append('phone', phone);
|
310 |
formData.append('experience', experience);
|
311 |
formData.append('linkedin', linkedin);
|
312 |
+
formData.append('consent', consent);
|
313 |
formData.append('role', role); // Add role to the form data
|
314 |
formData.append('resume', document.getElementById('fileInput').files[0]);
|
315 |
|
|
|
614 |
</IntlTelInputWrapper>
|
615 |
{errors.phone && <span style={{ color: '#de493e', fontSize: '0.875rem' }}>{errors.phone}</span>}
|
616 |
|
617 |
+
<label style={{ display: "flex" }}>Experience <div style={{ color: "red", marginLeft: "10px" }}>*</div> </label>{" "}
|
618 |
{/*<div style={{color:'red', marginLeft:"10px"}}>*</div> */}
|
619 |
<Textarea
|
620 |
value={experience}
|
|
|
714 |
required
|
715 |
/>
|
716 |
<label htmlFor="gdpr-consent">
|
717 |
+
I consent to the processing of my submitted data in accordance with the{' '}
|
718 |
+
<a href="/privacy-policy" target="_blank" rel="noopener noreferrer">
|
|
|
|
|
|
|
|
|
|
|
719 |
<i style={{ color: "#3f7ad3" }}>Privacy Policy</i>
|
720 |
+
</a>.{' '}
|
721 |
+
<span style={{ color: "red", marginLeft: "5px" }}>*</span>
|
722 |
</label>
|
723 |
</ConsentWrapper>
|
724 |
<SubmitButton type="submit" data-testid="submit-btn">
|