Skip to content

Commit 50ca7ba

Browse files
Merge pull request #551 from datasektionen/536-exhibitor-interest
Added "how did you find us" to exhibitor
2 parents 38eef61 + 6718529 commit 50ca7ba

8 files changed

Lines changed: 49 additions & 18 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `howDidYouFindUs` to the `exhibitor_interest_registrations` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "exhibitor_interest_registrations" ADD COLUMN "howDidYouFindUs" TEXT NOT NULL;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "exhibitor_interest_registrations" ALTER COLUMN "howDidYouFindUs" DROP NOT NULL;

prisma/schema.prisma

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ model ExhibitorInterestRegistration {
1818
contactPerson String
1919
phoneNumber String
2020
email String
21+
howDidYouFindUs String?
2122
2223
@@map("exhibitor_interest_registrations")
2324
}
@@ -70,7 +71,7 @@ model Exhibitor {
7071
infoSubmissionStatus Int @default(0)
7172
7273
industry String?
73-
industryType String?
74+
industryType String?
7475
7576
lastChanged DateTime?
7677
@@ -152,9 +153,9 @@ model JobOffers {
152153
summerJob Int[]
153154
internship Int[]
154155
partTimeJob Int[]
155-
masterThesis Boolean
156-
fullTimeJob Boolean
157-
traineeProgram Boolean
156+
masterThesis Boolean
157+
fullTimeJob Boolean
158+
traineeProgram Boolean
158159
exhibitor Exhibitor?
159160
160161
@@map("job_offers")
@@ -198,4 +199,4 @@ model Meetings {
198199
createdAt DateTime @default(now())
199200
200201
@@map("meetings")
201-
}
202+
}

src/components/CompanyForm.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default function CompanyForm({
2323
const [email, setEmail] = useState("");
2424
const [contactPerson, setContactPerson] = useState("");
2525
const [phoneNumber, setPhoneNumber] = useState("");
26+
const [howDidYouFindUs, setHowDidYouFindUs] = useState("");
2627

2728
async function addCompanyDocument(e: FormEvent) {
2829
e.preventDefault();
@@ -32,6 +33,7 @@ export default function CompanyForm({
3233
email,
3334
contactPerson,
3435
phoneNumber,
36+
howDidYouFindUs,
3537
locale: t.locale,
3638
});
3739
}
@@ -90,7 +92,7 @@ export default function CompanyForm({
9092
setValue={setCompanyName}
9193
fields={t.companyForm.fields}
9294
/>
93-
<CheckMarkField
95+
<CheckMarkField
9496
name="foreignOrganization"
9597
checked={foreignOrganization}
9698
onClick={toggleForeignOrganization}
@@ -124,6 +126,14 @@ export default function CompanyForm({
124126
setValue={setPhoneNumber}
125127
fields={t.companyForm.fields}
126128
/>
129+
<InputField
130+
name="howDidYouFindUs"
131+
type="text"
132+
value={howDidYouFindUs}
133+
setValue={setHowDidYouFindUs}
134+
fields={t.companyForm.fields}
135+
required={false}
136+
/>
127137

128138
<div className="flex flex-col items-center justify-between">
129139
<input
@@ -160,7 +170,8 @@ export default function CompanyForm({
160170
`Organisationsnummer: ${organizationNumber}.\n` +
161171
`E-post: ${email}.\n` +
162172
`Kontaktperson: ${contactPerson}.\n` +
163-
`Telefonnummer: ${phoneNumber}.\n`
173+
`Telefonnummer: ${phoneNumber}.\n` +
174+
`Hur hittade ni D-Dagen: ${howDidYouFindUs}\n`
164175
)
165176
}
166177
className="text-cerise hover:underline"

src/locales/en.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ export default {
610610
email: "Email Address",
611611
contactPerson: "Contact Person",
612612
phoneNumber: "Phone Number",
613+
howDidYouFindUs: "How did you find out about D-Dagen? (Optional)"
613614
},
614615
confirm: "Send",
615616
ignoreError: "Continue anyway",
@@ -697,7 +698,8 @@ export default {
697698
organizationNumber: string,
698699
email: string,
699700
contactPerson: string,
700-
phoneNumber: string
701+
phoneNumber: string,
702+
howDidYouFindUs: string
701703
) =>
702704
"<div style=\"padding:0;font-family:Arial, sans-serif;font-size: 16px; line-height:1.6; max-width: 600px; \">" +
703705
"<table style=\"box-sizing:border-box;background:#DE3163; border: 30px solid #14112A; border-width: 30px;border-color: #14112A;border-type: solid; padding: 0;color:#ffffff;border-radius:10px 10px 0 0; max-width: 600px;\" width=\"100%\">" +
@@ -725,6 +727,7 @@ export default {
725727
"<li style=\"margin: 4px; padding: 2px;color:#ffffff;\"> Email address: " + email + "</li>" +
726728
"<li style=\"margin: 4px; padding: 2px;color:#ffffff;\"> Contact person: " + contactPerson + "</li>" +
727729
"<li style=\"margin: 4px; padding: 2px;color:#ffffff;\"> Phone number: " + phoneNumber + "</li>" +
730+
"<li style=\"margin: 4px; padding: 2px;color:#ffffff;\"> How did you find us: " + howDidYouFindUs + "</li>" +
728731
"</ul>" +
729732
"</div>" +
730733
"</tr>" +

src/locales/sv.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ export default {
605605
email: "Mejladress",
606606
contactPerson: "Kontaktperson",
607607
phoneNumber: "Telefonnummer",
608+
howDidYouFindUs: "Hur hittade ni D-Dagen? (Valbar)"
608609
},
609610
confirm: "Skicka",
610611
ignoreError: "Gå vidare ändå",

src/pages/api/export-exhibitor-interest.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default async function handler(
2828
phoneNumber: e.phoneNumber,
2929
email: e.email,
3030
createdAt: e.createdAt,
31+
howDidYouFindUs: e.howDidYouFindUs
3132
}))
3233
)
3334
);
@@ -51,17 +52,17 @@ function importExhibitors() {
5152
5253
const data = JSON.parse(res.getContentText());
5354
54-
sheet.getRange(1, 1, 1, 7).setValues([[
55+
sheet.getRange(1, 1, 1, 8).setValues([[
5556
"Företagsnamn", "Organisationsnummer", "Kontaktperson", "Telefonnummer",
56-
"E-postadress", "Datum", "Anteckningar (kommer ej röras av skript). Senast uppdaterad " + new Date().toLocaleString("se"),
57+
"E-postadress", "Datum", "Hur hittade ni D-Dagen", "Anteckningar (kommer ej röras av skript). Senast uppdaterad " + new Date().toLocaleString("se"),
5758
]]).setFontWeight("bold");
5859
59-
sheet.getRange(2, 1, data.length, 6).setValues(data.map(row => [
60-
row.name, "'" + row.organizationNumber, row.contactPerson, "'" + row.phoneNumber, row.email, row.createdAt,
60+
sheet.getRange(2, 1, data.length, 7).setValues(data.map(row => [
61+
row.name, "'" + row.organizationNumber, row.contactPerson, "'" + row.phoneNumber, row.email, row.createdAt, row.howDidYouFindUs
6162
])).setBackground("#eee");
62-
sheet.getRange(2 + data.length, 1, 1, 6).setBackground("orange");
63+
sheet.getRange(2 + data.length, 1, 1, 7).setBackground("orange");
6364
64-
sheet.autoResizeColumns(1, 7);
65+
sheet.autoResizeColumns(1, 8);
6566
}
6667
```
6768

src/server/api/routers/exhibitor.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const exhibitorRouter = createTRPCRouter({
3131
email: z.string().email().trim(),
3232
contactPerson: z.string().trim(),
3333
phoneNumber: z.string().trim(),
34+
howDidYouFindUs: z.string().trim(),
3435
locale: z.enum(["en", "sv"]),
3536
})
3637
)
@@ -42,6 +43,7 @@ export const exhibitorRouter = createTRPCRouter({
4243
email,
4344
contactPerson,
4445
phoneNumber,
46+
howDidYouFindUs,
4547
locale,
4648
},
4749
ctx,
@@ -64,6 +66,7 @@ export const exhibitorRouter = createTRPCRouter({
6466
contactPerson,
6567
phoneNumber,
6668
email,
69+
howDidYouFindUs,
6770
},
6871
});
6972

@@ -76,7 +79,8 @@ export const exhibitorRouter = createTRPCRouter({
7679
organizationNumber,
7780
email,
7881
contactPerson,
79-
phoneNumber
82+
phoneNumber,
83+
howDidYouFindUs
8084
),
8185
"sales@ddagen.se"
8286
);
@@ -167,7 +171,7 @@ export const exhibitorRouter = createTRPCRouter({
167171
customDrinkCoupons: true,
168172
customRepresentativeSpots: true,
169173
customBanquetTicketsWanted: true,
170-
studentMeetings: true,
174+
studentMeetings: true,
171175
extraMealCoupons: true, // Måste kanske lägga till customMealCoupons i db, känns inte nödvändigt just nu
172176
},
173177
});
@@ -912,8 +916,8 @@ export const exhibitorRouter = createTRPCRouter({
912916
// Add password validation if needed
913917
const exhibitor = await ctx.prisma.exhibitor.update({
914918
where: { id: input.exhibitorId },
915-
data: {
916-
meetingTimeSlots: input.timeSlots
919+
data: {
920+
meetingTimeSlots: input.timeSlots
917921
}
918922
});
919923
return exhibitor;

0 commit comments

Comments
 (0)