Skip to content

Commit 1d0d30c

Browse files
authored
Merge pull request #113 from HiEventsDev/add-date-quotestion-type
Add Date question type
2 parents 810621f + d8380f6 commit 1d0d30c

File tree

20 files changed

+252
-153
lines changed

20 files changed

+252
-153
lines changed

backend/app/DomainObjects/Enums/QuestionTypeEnum.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ enum QuestionTypeEnum
1515
case RADIO;
1616
case DROPDOWN;
1717
case MULTI_SELECT_DROPDOWN;
18+
case DATE;
1819
}

frontend/src/components/common/CheckoutQuestion/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import countries from "../../../../data/countries.json";
66
import {InputGroup} from "../InputGroup";
77
import classes from "./CheckoutQuestion.module.scss";
88
import {UserGeneratedContent} from "../UserGeneratedContent";
9+
import {DatePicker} from "@mantine/dates";
910

1011
interface CheckoutQuestionProps {
1112
questions: Question[],
@@ -62,6 +63,18 @@ const MultiLineTextInput = ({question, name, form}: QuestionInputProps) => {
6263
);
6364
}
6465

66+
const DateInput = ({question, name, form}: QuestionInputProps) => {
67+
return (
68+
<>
69+
<TextInput withAsterisk={question.required}
70+
type="date"
71+
{...form.getInputProps(`${name}.answer`)}
72+
label={question.title}
73+
/>
74+
</>
75+
);
76+
}
77+
6578
const SingleLineTextInput = ({question, name, form}: QuestionInputProps) => {
6679
return (
6780
<>
@@ -181,6 +194,9 @@ export const QuestionInput = ({question, name, form}: QuestionInputProps) => {
181194
case QuestionType.SINGLE_LINE_TEXT:
182195
input = <SingleLineTextInput question={question} name={name} form={form}/>;
183196
break;
197+
case QuestionType.DATE:
198+
input = <DateInput question={question} name={name} form={form}/>;
199+
break;
184200
}
185201

186202
return (

frontend/src/components/forms/QuestionForm/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {QuestionBelongsToType, QuestionType, Ticket} from "../../../types.ts";
44
import {Button, Group, MultiSelect, Switch, TextInput} from "@mantine/core";
55
import {
66
IconAlignBoxLeftTop,
7+
IconCalendar,
78
IconCircleCheck,
89
IconForms,
910
IconMapPin,
@@ -129,6 +130,12 @@ export const QuestionForm = ({form, tickets}: QuestionFormProps) => {
129130
value: QuestionType.ADDRESS,
130131
description: t`Shows common address fields, including country`,
131132
},
133+
{
134+
icon: <IconCalendar/>,
135+
label: t`Date`,
136+
value: QuestionType.DATE,
137+
description: t`A date input. Perfect for asking for a date of birth etc.`,
138+
}
132139
];
133140
const multiAnswerQuestionTypes = [
134141
QuestionType.CHECKBOX.toString(),
@@ -151,6 +158,7 @@ export const QuestionForm = ({form, tickets}: QuestionFormProps) => {
151158
mt={20}
152159
label={t`What tickets should this question be apply to?`}
153160
multiple
161+
placeholder={t`Select tickets`}
154162
data={tickets?.map(ticket => {
155163
return {
156164
value: String(ticket.id),
@@ -194,6 +202,7 @@ export const QuestionForm = ({form, tickets}: QuestionFormProps) => {
194202
variant="transparent"
195203
ml={0}
196204
pl={0}
205+
mb={10}
197206
onClick={() => setShowDescription(true)}
198207
>
199208
{t`Add description`}
@@ -217,4 +226,4 @@ export const QuestionForm = ({form, tickets}: QuestionFormProps) => {
217226
/>
218227
</>
219228
)
220-
}
229+
}

frontend/src/locales/de.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/locales/de.po

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ msgstr "01.01.2024 18:00"
109109
msgid "94103"
110110
msgstr "94103"
111111

112+
#: src/components/forms/QuestionForm/index.tsx:136
113+
msgid "A date input. Perfect for asking for a date of birth etc."
114+
msgstr "Ein Datumseingabefeld. Perfekt, um nach einem Geburtsdatum usw. zu fragen."
115+
112116
#: src/components/forms/TaxAndFeeForm/index.tsx:87
113117
msgid "A default {type} is automaticaly applied to all new tickets. You can override this on a per ticket basis."
114118
msgstr "Auf alle neuen Tickets wird automatisch ein Standard-{type} angewendet. Sie können dies für jedes Ticket einzeln überschreiben."
@@ -204,7 +208,7 @@ msgstr "Aktiv"
204208
msgid "Add"
205209
msgstr "Hinzufügen"
206210

207-
#: src/components/forms/QuestionForm/index.tsx:199
211+
#: src/components/forms/QuestionForm/index.tsx:207
208212
msgid "Add description"
209213
msgstr "Beschreibung hinzufügen"
210214

@@ -249,15 +253,15 @@ msgstr "Zusatzoptionen"
249253
msgid "Address"
250254
msgstr "Adresse"
251255

252-
#: src/components/common/CheckoutQuestion/index.tsx:139
256+
#: src/components/common/CheckoutQuestion/index.tsx:152
253257
msgid "Address line 1"
254258
msgstr "Anschrift Zeile 1"
255259

256260
#: src/components/routes/event/Settings/Sections/LocationSettings/index.tsx:113
257261
msgid "Address Line 1"
258262
msgstr "Anschrift Zeile 1"
259263

260-
#: src/components/common/CheckoutQuestion/index.tsx:142
264+
#: src/components/common/CheckoutQuestion/index.tsx:155
261265
msgid "Address line 2"
262266
msgstr "Adresszeile 2"
263267

@@ -592,7 +596,7 @@ msgstr "Wählen Sie eine Farbe für Ihren Hintergrund"
592596
msgid "Choose an account"
593597
msgstr "Wähle einen Account"
594598

595-
#: src/components/common/CheckoutQuestion/index.tsx:145
599+
#: src/components/common/CheckoutQuestion/index.tsx:158
596600
#: src/components/routes/event/Settings/Sections/LocationSettings/index.tsx:125
597601
msgid "City"
598602
msgstr "Stadt"
@@ -772,7 +776,7 @@ msgstr "Link kopieren"
772776
msgid "Copy URL"
773777
msgstr "URL kopieren"
774778

775-
#: src/components/common/CheckoutQuestion/index.tsx:157
779+
#: src/components/common/CheckoutQuestion/index.tsx:170
776780
#: src/components/routes/event/Settings/Sections/LocationSettings/index.tsx:143
777781
msgid "Country"
778782
msgstr "Land"
@@ -907,6 +911,7 @@ msgid "Dashboard"
907911
msgstr "Armaturenbrett"
908912

909913
#: src/components/common/OrderDetails/index.tsx:31
914+
#: src/components/forms/QuestionForm/index.tsx:134
910915
msgid "Date"
911916
msgstr "Datum"
912917

@@ -1420,7 +1425,7 @@ msgstr "versteckte Frage"
14201425
msgid "hidden questions"
14211426
msgstr "versteckte Fragen"
14221427

1423-
#: src/components/forms/QuestionForm/index.tsx:215
1428+
#: src/components/forms/QuestionForm/index.tsx:223
14241429
msgid "Hidden questions are only visible to the event organizer and not to the customer."
14251430
msgstr "Versteckte Fragen sind nur für den Veranstalter und nicht für den Kunden sichtbar."
14261431

@@ -1441,7 +1446,7 @@ msgstr "Versteckte Fragen ausblenden"
14411446
msgid "Hide the getting started page from the sidebar"
14421447
msgstr "Blenden Sie die Seite „Erste Schritte“ in der Seitenleiste aus."
14431448

1444-
#: src/components/forms/QuestionForm/index.tsx:216
1449+
#: src/components/forms/QuestionForm/index.tsx:224
14451450
msgid "Hide this question"
14461451
msgstr "Diese Frage verbergen"
14471452

@@ -1657,7 +1662,7 @@ msgstr "Ausloggen"
16571662
msgid "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam placerat elementum..."
16581663
msgstr "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ich habe das Element platziert …"
16591664

1660-
#: src/components/forms/QuestionForm/index.tsx:209
1665+
#: src/components/forms/QuestionForm/index.tsx:217
16611666
msgid "Make this question mandatory"
16621667
msgstr "Machen Sie diese Frage obligatorisch"
16631668

@@ -1699,7 +1704,7 @@ msgstr "Verwalten Sie Ihre Stripe-Zahlungsdetails"
16991704
msgid "Manage your users and their permissions"
17001705
msgstr "Verwalten Sie Ihre Benutzer und deren Berechtigungen"
17011706

1702-
#: src/components/forms/QuestionForm/index.tsx:208
1707+
#: src/components/forms/QuestionForm/index.tsx:216
17031708
msgid "Mandatory questions must be answered before the customer can checkout."
17041709
msgstr "Bevor der Kunde zur Kasse gehen kann, müssen obligatorische Fragen beantwortet werden."
17051710

@@ -2269,7 +2274,7 @@ msgstr "Promo-Codes"
22692274
msgid "Promo codes can be used to offer discounts, presale access, or provide special access to your event."
22702275
msgstr "Mit Promo-Codes können Sie Rabatte oder Vorverkaufszugang anbieten oder Sonderzugang zu Ihrer Veranstaltung gewähren."
22712276

2272-
#: src/components/forms/QuestionForm/index.tsx:187
2277+
#: src/components/forms/QuestionForm/index.tsx:194
22732278
msgid ""
22742279
"Provide additional context or instructions for this question. Use this field to add terms\n"
22752280
"and conditions, guidelines, or any important information that attendees need to know before answering."
@@ -2288,11 +2293,11 @@ msgstr "Verfügbare Menge"
22882293
msgid "Question deleted"
22892294
msgstr "Frage gelöscht"
22902295

2291-
#: src/components/forms/QuestionForm/index.tsx:186
2296+
#: src/components/forms/QuestionForm/index.tsx:193
22922297
msgid "Question Description"
22932298
msgstr "Fragebeschreibung"
22942299

2295-
#: src/components/forms/QuestionForm/index.tsx:176
2300+
#: src/components/forms/QuestionForm/index.tsx:183
22962301
msgid "Question Title"
22972302
msgstr "Fragentitel"
22982303

@@ -2525,6 +2530,10 @@ msgstr "Ticket auswählen"
25252530
msgid "Select Ticket Tier"
25262531
msgstr "Ticketstufe auswählen"
25272532

2533+
#: src/components/forms/QuestionForm/index.tsx:160
2534+
msgid "Select tickets"
2535+
msgstr "Tickets auswählen"
2536+
25282537
#: src/components/forms/TicketForm/index.tsx:270
25292538
msgid "Select..."
25302539
msgstr "Wählen..."
@@ -2713,7 +2722,7 @@ msgstr "Standardticket zum Festpreis"
27132722
msgid "Start Date"
27142723
msgstr "Startdatum"
27152724

2716-
#: src/components/common/CheckoutQuestion/index.tsx:148
2725+
#: src/components/common/CheckoutQuestion/index.tsx:161
27172726
#: src/components/routes/event/Settings/Sections/LocationSettings/index.tsx:130
27182727
msgid "State or Region"
27192728
msgstr "Staat oder Region"
@@ -3330,15 +3339,15 @@ msgstr "Was sind Stufentickets?"
33303339
msgid "What tickets does this code apply to? (Applies to all by default)"
33313340
msgstr "Für welche Tickets gilt dieser Code? (Gilt standardmäßig für alle)"
33323341

3333-
#: src/components/forms/QuestionForm/index.tsx:152
3342+
#: src/components/forms/QuestionForm/index.tsx:158
33343343
msgid "What tickets should this question be apply to?"
33353344
msgstr "Auf welche Tickets soll sich diese Frage beziehen?"
33363345

3337-
#: src/components/forms/QuestionForm/index.tsx:177
3346+
#: src/components/forms/QuestionForm/index.tsx:184
33383347
msgid "What time will you be arriving?"
33393348
msgstr "Um wie viel Uhr werden Sie ankommen?"
33403349

3341-
#: src/components/forms/QuestionForm/index.tsx:167
3350+
#: src/components/forms/QuestionForm/index.tsx:174
33423351
msgid "What type of question is this?"
33433352
msgstr "Um welche Art von Frage handelt es sich?"
33443353

@@ -3350,7 +3359,7 @@ msgstr "Wer organisiert diese Veranstaltung?"
33503359
msgid "Who is this message to?"
33513360
msgstr "An wen ist diese Nachricht gerichtet?"
33523361

3353-
#: src/components/forms/QuestionForm/index.tsx:143
3362+
#: src/components/forms/QuestionForm/index.tsx:149
33543363
msgid "Who should be asked this question?"
33553364
msgstr "Wem sollte diese Frage gestellt werden?"
33563365

@@ -3545,7 +3554,7 @@ msgstr "Ihre Rückerstattung wird bearbeitet."
35453554
msgid "Your ticket for"
35463555
msgstr "Ihr Ticket für"
35473556

3548-
#: src/components/common/CheckoutQuestion/index.tsx:153
3557+
#: src/components/common/CheckoutQuestion/index.tsx:166
35493558
#: src/components/routes/event/Settings/Sections/LocationSettings/index.tsx:137
35503559
msgid "Zip or Postal Code"
35513560
msgstr "Postleitzahl"

frontend/src/locales/en.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)