@mrfylke/contact-form 0.1.10 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +393 -2
- package/lib/ContactFormRoot.d.ts +11 -1
- package/lib/ContactFormRoot.d.ts.map +1 -1
- package/lib/ContactFormRoot.js +2 -2
- package/lib/commoneEvents.d.ts +1 -1
- package/lib/commoneEvents.d.ts.map +1 -1
- package/lib/components/form/date-selector.d.ts.map +1 -1
- package/lib/components/form/date-selector.js +5 -4
- package/lib/components/form/departure-time-field.d.ts +16 -0
- package/lib/components/form/departure-time-field.d.ts.map +1 -0
- package/lib/components/form/departure-time-field.js +28 -0
- package/lib/components/form/description-modal.d.ts.map +1 -1
- package/lib/components/form/description-modal.js +2 -1
- package/lib/components/form/file-input.d.ts.map +1 -1
- package/lib/components/form/file-input.js +2 -1
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/form/index.d.ts.map +1 -1
- package/lib/components/form/index.js +3 -1
- package/lib/components/form/input.d.ts.map +1 -1
- package/lib/components/form/input.js +2 -1
- package/lib/components/form/searchable-select/utils.js +6 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -1
- package/lib/contact.module.css +9 -0
- package/lib/error-content/error-content.d.ts.map +1 -1
- package/lib/error-content/error-content.js +2 -1
- package/lib/group-travel/index.d.ts.map +1 -1
- package/lib/group-travel/index.js +3 -1
- package/lib/index.d.ts +16 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -1
- package/lib/journey-info/index.d.ts.map +1 -1
- package/lib/journey-info/index.js +14 -8
- package/lib/journey-info/journeyInfoStateMachine.d.ts +8 -8
- package/lib/layouts/contact-page-layout.d.ts +2 -2
- package/lib/layouts/contact-page-layout.d.ts.map +1 -1
- package/lib/layouts/contact-page-layout.js +29 -20
- package/lib/layouts/container.module.css +1 -1
- package/lib/layouts/layout.module.css +23 -2
- package/lib/lines/use-departures.d.ts +12 -0
- package/lib/lines/use-departures.d.ts.map +1 -0
- package/lib/lines/use-departures.js +35 -0
- package/lib/lines/use-lines.d.ts +5 -6
- package/lib/lines/use-lines.d.ts.map +1 -1
- package/lib/lines/use-lines.js +75 -42
- package/lib/lost-property/LostPropertyForm.d.ts +10 -0
- package/lib/lost-property/LostPropertyForm.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyForm.js +65 -0
- package/lib/lost-property/LostPropertyMachine.d.ts +116 -0
- package/lib/lost-property/LostPropertyMachine.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyMachine.js +187 -0
- package/lib/lost-property/index.d.ts.map +1 -1
- package/lib/lost-property/index.js +27 -3
- package/lib/means-of-transport/forms/delayForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/delayForm.js +26 -18
- package/lib/means-of-transport/forms/driverForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/driverForm.js +26 -18
- package/lib/means-of-transport/forms/injuryForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/injuryForm.js +26 -18
- package/lib/means-of-transport/forms/serviceOfferingForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/serviceOfferingForm.js +10 -10
- package/lib/means-of-transport/forms/stopForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/stopForm.js +13 -12
- package/lib/means-of-transport/forms/transportationForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/transportationForm.js +26 -18
- package/lib/means-of-transport/index.d.ts.map +1 -1
- package/lib/means-of-transport/index.js +13 -4
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts +10 -8
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts.map +1 -1
- package/lib/means-of-transport/means-of-transport-form-machine.js +6 -1
- package/lib/modules/config/types.d.ts +56 -1
- package/lib/modules/config/types.d.ts.map +1 -1
- package/lib/refund/events.d.ts +1 -1
- package/lib/refund/events.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.js +7 -5
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +39 -29
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +37 -28
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +46 -25
- package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/index.js +9 -6
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +56 -30
- package/lib/refund/forms/residualValueOnTravelCard/index.d.ts.map +1 -1
- package/lib/refund/forms/residualValueOnTravelCard/index.js +5 -3
- package/lib/refund/index.d.ts.map +1 -1
- package/lib/refund/index.js +39 -6
- package/lib/refund/refundFormMachine.d.ts +37 -13
- package/lib/refund/refundFormMachine.d.ts.map +1 -1
- package/lib/refund/refundFormMachine.js +107 -11
- package/lib/server/journey-planner/index.d.ts.map +1 -1
- package/lib/server/journey-planner/index.js +15 -6
- package/lib/server/journey-planner/validators.d.ts +2 -0
- package/lib/server/journey-planner/validators.d.ts.map +1 -1
- package/lib/server/journey-planner/validators.js +1 -0
- package/lib/success-content/success-content.d.ts.map +1 -1
- package/lib/success-content/success-content.js +2 -1
- package/lib/test-utils/setup.d.ts +2 -0
- package/lib/test-utils/setup.d.ts.map +1 -0
- package/lib/test-utils/setup.js +3 -0
- package/lib/ticket-control/events.d.ts +1 -1
- package/lib/ticket-control/events.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.js +39 -36
- package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feedbackForm.js +26 -14
- package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -1
- package/lib/ticket-control/forms/postponePayment.js +8 -7
- package/lib/ticket-control/index.d.ts.map +1 -1
- package/lib/ticket-control/index.js +23 -8
- package/lib/ticket-control/ticket-control-form-machine.d.ts +19 -11
- package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -1
- package/lib/ticket-control/ticket-control-form-machine.js +25 -5
- package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appAccountForm.js +9 -8
- package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTicketingForm.js +13 -12
- package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTravelSuggestionForm.js +6 -5
- package/lib/ticketing/forms/app/index.d.ts.map +1 -1
- package/lib/ticketing/forms/app/index.js +2 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts.map +1 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.js +6 -5
- package/lib/ticketing/forms/travel-card/index.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/index.js +2 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.js +2 -2
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.js +9 -8
- package/lib/ticketing/forms/webshop/index.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/index.js +2 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.js +9 -8
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopTicketingForm.js +12 -11
- package/lib/ticketing/index.d.ts.map +1 -1
- package/lib/ticketing/index.js +21 -6
- package/lib/ticketing/ticketingStateMachine.d.ts +12 -12
- package/lib/translations/index.d.ts +1 -1
- package/lib/translations/index.d.ts.map +1 -1
- package/lib/translations/index.js +2 -1
- package/lib/translations/merge-overrides.d.ts.map +1 -1
- package/lib/translations/merge-overrides.js +8 -1
- package/lib/translations/pages/contact.d.ts +61 -0
- package/lib/translations/pages/contact.d.ts.map +1 -1
- package/lib/translations/pages/contact.js +64 -2
- package/lib/translations/translations-context.d.ts +2 -0
- package/lib/translations/translations-context.d.ts.map +1 -1
- package/lib/translations/translations-context.js +39 -0
- package/lib/types/submit-payloads.d.ts +40 -11
- package/lib/types/submit-payloads.d.ts.map +1 -1
- package/lib/types/submit-payloads.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/url-form-type.d.ts +6 -0
- package/lib/url-form-type.d.ts.map +1 -0
- package/lib/url-form-type.js +21 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +10 -0
- package/lib/validation/validationRules.d.ts.map +1 -1
- package/lib/validation/validationRules.js +31 -0
- package/package.json +11 -3
|
@@ -7,45 +7,53 @@ const components_1 = require("../../components");
|
|
|
7
7
|
const translations_1 = require("../../translations");
|
|
8
8
|
const typography_1 = require("../../components/typography");
|
|
9
9
|
const DelayForm = ({ state, send }) => {
|
|
10
|
+
const PageText = (0, translations_1.usePageText)();
|
|
10
11
|
const { t } = (0, translations_1.useTranslation)();
|
|
11
12
|
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
12
13
|
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.delay.description), children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.delay.info) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.delay.about.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.delay.about.description) }), (0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
14
15
|
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
15
16
|
value: value,
|
|
16
17
|
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
17
18
|
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
18
|
-
: undefined, valueToId: (val) => val, valueToText: (val) => t(
|
|
19
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
19
20
|
send({
|
|
20
21
|
type: 'ON_LINE_CHANGE',
|
|
21
22
|
value: value,
|
|
22
23
|
});
|
|
23
24
|
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
24
|
-
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(
|
|
25
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(PageText.Contact.input.fromStop.label), value: state.context.fromStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
25
26
|
send({
|
|
26
27
|
type: 'ON_INPUT_CHANGE',
|
|
27
28
|
inputName: 'fromStop',
|
|
28
29
|
value: value,
|
|
29
30
|
});
|
|
30
|
-
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(
|
|
31
|
+
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['fromStop']?.[0]
|
|
31
32
|
? t(state.context?.errorMessages['fromStop']?.[0])
|
|
32
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(
|
|
33
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(PageText.Contact.input.toStop.label), value: state.context.toStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
33
34
|
send({
|
|
34
35
|
type: 'ON_INPUT_CHANGE',
|
|
35
36
|
inputName: 'toStop',
|
|
36
37
|
value: value,
|
|
37
38
|
});
|
|
38
|
-
}, placeholder: t(
|
|
39
|
+
}, placeholder: t(PageText.Contact.input.toStop.optionLabel), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), isRequired: true, error: state.context?.errorMessages['toStop']?.[0]
|
|
39
40
|
? t(state.context?.errorMessages['toStop']?.[0])
|
|
40
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(
|
|
41
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({
|
|
41
42
|
type: 'ON_INPUT_CHANGE',
|
|
42
43
|
inputName: 'date',
|
|
43
44
|
value: date,
|
|
44
|
-
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.DepartureTimeField, { date: state.context.date, lineId: state.context.line?.id, fromStopId: state.context.fromStop?.id, toStopId: state.context.toStop?.id, selectedTripId: state.context.tripId, plannedDepartureTime: state.context.plannedDepartureTime, onChange: (time, tripId) => {
|
|
46
|
+
send({
|
|
47
|
+
type: 'ON_INPUT_CHANGE',
|
|
48
|
+
inputName: 'plannedDepartureTime',
|
|
49
|
+
value: time,
|
|
50
|
+
});
|
|
51
|
+
send({
|
|
52
|
+
type: 'ON_INPUT_CHANGE',
|
|
53
|
+
inputName: 'tripId',
|
|
54
|
+
value: tripId,
|
|
55
|
+
});
|
|
56
|
+
}, isRequired: true, errorMessage: state.context?.errorMessages['plannedDepartureTime']?.[0] })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
49
57
|
type: 'ON_INPUT_CHANGE',
|
|
50
58
|
inputName: 'feedback',
|
|
51
59
|
value: e.target.value,
|
|
@@ -54,7 +62,7 @@ const DelayForm = ({ state, send }) => {
|
|
|
54
62
|
: undefined, fileInputProps: {
|
|
55
63
|
id: 'attachments',
|
|
56
64
|
name: 'attachments',
|
|
57
|
-
iconLabel: t(
|
|
65
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
58
66
|
onChange: (files) => {
|
|
59
67
|
send({
|
|
60
68
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -62,23 +70,23 @@ const DelayForm = ({ state, send }) => {
|
|
|
62
70
|
value: files,
|
|
63
71
|
});
|
|
64
72
|
},
|
|
65
|
-
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
73
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.optionalTitle), isRequired: true, children: [(0, jsx_runtime_1.jsxs)(components_1.FieldWrapperWithError, { errorMessage: state.context?.errorMessages['isResponseWanted']?.[0], children: [(0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.yes), checked: state.context.isResponseWanted === true, onChange: () => send({
|
|
66
74
|
type: 'ON_INPUT_CHANGE',
|
|
67
75
|
inputName: 'isResponseWanted',
|
|
68
76
|
value: true,
|
|
69
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(
|
|
77
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.no), checked: state.context.isResponseWanted === false, onChange: () => send({
|
|
70
78
|
type: 'ON_INPUT_CHANGE',
|
|
71
79
|
inputName: 'isResponseWanted',
|
|
72
80
|
value: false,
|
|
73
|
-
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(
|
|
81
|
+
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
74
82
|
type: 'ON_INPUT_CHANGE',
|
|
75
83
|
inputName: 'firstName',
|
|
76
84
|
value: e.target.value,
|
|
77
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
85
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", name: "lastName", isRequired: true, value: state.context.lastName || '', errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
78
86
|
type: 'ON_INPUT_CHANGE',
|
|
79
87
|
inputName: 'lastName',
|
|
80
88
|
value: e.target.value,
|
|
81
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
89
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", name: "email", isRequired: true, value: state.context.email || '', errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
82
90
|
type: 'ON_INPUT_CHANGE',
|
|
83
91
|
inputName: 'email',
|
|
84
92
|
value: e.target.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/driverForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAiBvD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,iBAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"driverForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/driverForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAiBvD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,iBAAiB,eAAe,4CAkR1D,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -7,45 +7,53 @@ const components_1 = require("../../components");
|
|
|
7
7
|
const translations_1 = require("../../translations");
|
|
8
8
|
const typography_1 = require("../../components/typography");
|
|
9
9
|
const DriverForm = ({ state, send }) => {
|
|
10
|
+
const PageText = (0, translations_1.usePageText)();
|
|
10
11
|
const { t } = (0, translations_1.useTranslation)();
|
|
11
12
|
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
12
13
|
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.driver.description), children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.driver.info) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.driver.about.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.driver.about.description) }), (0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
14
15
|
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
15
16
|
value: value,
|
|
16
17
|
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
17
18
|
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
18
|
-
: undefined, valueToId: (val) => val, valueToText: (val) => t(
|
|
19
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
19
20
|
send({
|
|
20
21
|
type: 'ON_LINE_CHANGE',
|
|
21
22
|
value: value,
|
|
22
23
|
});
|
|
23
24
|
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
24
|
-
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(
|
|
25
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(PageText.Contact.input.fromStop.label), value: state.context.fromStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
25
26
|
send({
|
|
26
27
|
type: 'ON_INPUT_CHANGE',
|
|
27
28
|
inputName: 'fromStop',
|
|
28
29
|
value: value,
|
|
29
30
|
});
|
|
30
|
-
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(
|
|
31
|
+
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['fromStop']?.[0]
|
|
31
32
|
? t(state.context?.errorMessages['fromStop']?.[0])
|
|
32
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(
|
|
33
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(PageText.Contact.input.toStop.label), value: state.context.toStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
33
34
|
send({
|
|
34
35
|
type: 'ON_INPUT_CHANGE',
|
|
35
36
|
inputName: 'toStop',
|
|
36
37
|
value: value,
|
|
37
38
|
});
|
|
38
|
-
}, placeholder: t(
|
|
39
|
+
}, placeholder: t(PageText.Contact.input.toStop.optionLabel), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), isRequired: true, error: state.context?.errorMessages['toStop']?.[0]
|
|
39
40
|
? t(state.context?.errorMessages['toStop']?.[0])
|
|
40
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(
|
|
41
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({
|
|
41
42
|
type: 'ON_INPUT_CHANGE',
|
|
42
43
|
inputName: 'date',
|
|
43
44
|
value: date,
|
|
44
|
-
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.DepartureTimeField, { date: state.context.date, lineId: state.context.line?.id, fromStopId: state.context.fromStop?.id, toStopId: state.context.toStop?.id, selectedTripId: state.context.tripId, plannedDepartureTime: state.context.plannedDepartureTime, onChange: (time, tripId) => {
|
|
46
|
+
send({
|
|
47
|
+
type: 'ON_INPUT_CHANGE',
|
|
48
|
+
inputName: 'plannedDepartureTime',
|
|
49
|
+
value: time,
|
|
50
|
+
});
|
|
51
|
+
send({
|
|
52
|
+
type: 'ON_INPUT_CHANGE',
|
|
53
|
+
inputName: 'tripId',
|
|
54
|
+
value: tripId,
|
|
55
|
+
});
|
|
56
|
+
}, isRequired: true, errorMessage: state.context?.errorMessages['plannedDepartureTime']?.[0] })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
49
57
|
type: 'ON_INPUT_CHANGE',
|
|
50
58
|
inputName: 'feedback',
|
|
51
59
|
value: e.target.value,
|
|
@@ -54,7 +62,7 @@ const DriverForm = ({ state, send }) => {
|
|
|
54
62
|
: undefined, fileInputProps: {
|
|
55
63
|
id: 'attachments',
|
|
56
64
|
name: 'attachments',
|
|
57
|
-
iconLabel: t(
|
|
65
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
58
66
|
onChange: (files) => {
|
|
59
67
|
send({
|
|
60
68
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -62,23 +70,23 @@ const DriverForm = ({ state, send }) => {
|
|
|
62
70
|
value: files,
|
|
63
71
|
});
|
|
64
72
|
},
|
|
65
|
-
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
73
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.optionalTitle), isRequired: true, children: [(0, jsx_runtime_1.jsxs)(components_1.FieldWrapperWithError, { errorMessage: state.context?.errorMessages['isResponseWanted']?.[0], children: [(0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.yes), checked: state.context.isResponseWanted === true, onChange: () => send({
|
|
66
74
|
type: 'ON_INPUT_CHANGE',
|
|
67
75
|
inputName: 'isResponseWanted',
|
|
68
76
|
value: true,
|
|
69
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(
|
|
77
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.no), checked: state.context.isResponseWanted === false, onChange: () => send({
|
|
70
78
|
type: 'ON_INPUT_CHANGE',
|
|
71
79
|
inputName: 'isResponseWanted',
|
|
72
80
|
value: false,
|
|
73
|
-
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(
|
|
81
|
+
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
74
82
|
type: 'ON_INPUT_CHANGE',
|
|
75
83
|
inputName: 'firstName',
|
|
76
84
|
value: e.target.value,
|
|
77
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
85
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", name: "lastName", isRequired: true, value: state.context.lastName || '', errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
78
86
|
type: 'ON_INPUT_CHANGE',
|
|
79
87
|
inputName: 'lastName',
|
|
80
88
|
value: e.target.value,
|
|
81
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
89
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", name: "email", isRequired: true, value: state.context.email || '', errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
82
90
|
type: 'ON_INPUT_CHANGE',
|
|
83
91
|
inputName: 'email',
|
|
84
92
|
value: e.target.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injuryForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/injuryForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAiBvD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,iBAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"injuryForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/injuryForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAiBvD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,iBAAiB,eAAe,4CAiR1D,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -7,45 +7,53 @@ const components_1 = require("../../components");
|
|
|
7
7
|
const translations_1 = require("../../translations");
|
|
8
8
|
const typography_1 = require("../../components/typography");
|
|
9
9
|
const InjuryForm = ({ state, send }) => {
|
|
10
|
+
const PageText = (0, translations_1.usePageText)();
|
|
10
11
|
const { t } = (0, translations_1.useTranslation)();
|
|
11
12
|
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
12
13
|
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.injury.description), children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.injury.info) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.injury.about.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.injury.about.description) }), (0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
14
15
|
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
15
16
|
value: value,
|
|
16
17
|
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
17
18
|
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
18
|
-
: undefined, valueToId: (val) => val, valueToText: (val) => t(
|
|
19
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
19
20
|
send({
|
|
20
21
|
type: 'ON_LINE_CHANGE',
|
|
21
22
|
value: value,
|
|
22
23
|
});
|
|
23
24
|
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
24
|
-
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(
|
|
25
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(PageText.Contact.input.fromStop.label), value: state.context.fromStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
25
26
|
send({
|
|
26
27
|
type: 'ON_INPUT_CHANGE',
|
|
27
28
|
inputName: 'fromStop',
|
|
28
29
|
value: value,
|
|
29
30
|
});
|
|
30
|
-
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(
|
|
31
|
+
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['fromStop']?.[0]
|
|
31
32
|
? t(state.context?.errorMessages['fromStop']?.[0])
|
|
32
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(
|
|
33
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(PageText.Contact.input.toStop.label), value: state.context.toStop, isDisabled: !state.context.line, onChange: (value) => {
|
|
33
34
|
send({
|
|
34
35
|
type: 'ON_INPUT_CHANGE',
|
|
35
36
|
inputName: 'toStop',
|
|
36
37
|
value: value,
|
|
37
38
|
});
|
|
38
|
-
}, placeholder: t(
|
|
39
|
+
}, placeholder: t(PageText.Contact.input.toStop.optionLabel), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), isRequired: true, error: state.context?.errorMessages['toStop']?.[0]
|
|
39
40
|
? t(state.context?.errorMessages['toStop']?.[0])
|
|
40
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(
|
|
41
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({
|
|
41
42
|
type: 'ON_INPUT_CHANGE',
|
|
42
43
|
inputName: 'date',
|
|
43
44
|
value: date,
|
|
44
|
-
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
}), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.DepartureTimeField, { date: state.context.date, lineId: state.context.line?.id, fromStopId: state.context.fromStop?.id, toStopId: state.context.toStop?.id, selectedTripId: state.context.tripId, plannedDepartureTime: state.context.plannedDepartureTime, onChange: (time, tripId) => {
|
|
46
|
+
send({
|
|
47
|
+
type: 'ON_INPUT_CHANGE',
|
|
48
|
+
inputName: 'plannedDepartureTime',
|
|
49
|
+
value: time,
|
|
50
|
+
});
|
|
51
|
+
send({
|
|
52
|
+
type: 'ON_INPUT_CHANGE',
|
|
53
|
+
inputName: 'tripId',
|
|
54
|
+
value: tripId,
|
|
55
|
+
});
|
|
56
|
+
}, isRequired: true, errorMessage: state.context?.errorMessages['plannedDepartureTime']?.[0] })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
49
57
|
type: 'ON_INPUT_CHANGE',
|
|
50
58
|
inputName: 'feedback',
|
|
51
59
|
value: e.target.value,
|
|
@@ -54,7 +62,7 @@ const InjuryForm = ({ state, send }) => {
|
|
|
54
62
|
: undefined, fileInputProps: {
|
|
55
63
|
id: 'attachments',
|
|
56
64
|
name: 'attachments',
|
|
57
|
-
iconLabel: t(
|
|
65
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
58
66
|
onChange: (files) => {
|
|
59
67
|
send({
|
|
60
68
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -62,23 +70,23 @@ const InjuryForm = ({ state, send }) => {
|
|
|
62
70
|
value: files,
|
|
63
71
|
});
|
|
64
72
|
},
|
|
65
|
-
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
73
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.optionalTitle), isRequired: true, children: [(0, jsx_runtime_1.jsxs)(components_1.FieldWrapperWithError, { errorMessage: state.context?.errorMessages['isResponseWanted']?.[0], children: [(0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.yes), checked: state.context.isResponseWanted === true, onChange: () => send({
|
|
66
74
|
type: 'ON_INPUT_CHANGE',
|
|
67
75
|
inputName: 'isResponseWanted',
|
|
68
76
|
value: true,
|
|
69
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(
|
|
77
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.no), checked: state.context.isResponseWanted === false, onChange: () => send({
|
|
70
78
|
type: 'ON_INPUT_CHANGE',
|
|
71
79
|
inputName: 'isResponseWanted',
|
|
72
80
|
value: false,
|
|
73
|
-
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(
|
|
81
|
+
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
74
82
|
type: 'ON_INPUT_CHANGE',
|
|
75
83
|
inputName: 'firstName',
|
|
76
84
|
value: e.target.value,
|
|
77
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
85
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", name: "lastName", isRequired: true, value: state.context.lastName || '', errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
78
86
|
type: 'ON_INPUT_CHANGE',
|
|
79
87
|
inputName: 'lastName',
|
|
80
88
|
value: e.target.value,
|
|
81
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
89
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", name: "email", isRequired: true, value: state.context.email || '', errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
82
90
|
type: 'ON_INPUT_CHANGE',
|
|
83
91
|
inputName: 'email',
|
|
84
92
|
value: e.target.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceOfferingForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/serviceOfferingForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAcvD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,kBAGjC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"serviceOfferingForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/serviceOfferingForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAcvD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,kBAGjC,wBAAwB,4CA+L1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -7,21 +7,21 @@ const components_1 = require("../../components");
|
|
|
7
7
|
const translations_1 = require("../../translations");
|
|
8
8
|
const typography_1 = require("../../components/typography");
|
|
9
9
|
const ServiceOfferingForm = ({ state, send, }) => {
|
|
10
|
+
const PageText = (0, translations_1.usePageText)();
|
|
10
11
|
const { t } = (0, translations_1.useTranslation)();
|
|
11
12
|
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
12
13
|
const { getLinesByMode } = (0, use_lines_1.useLines)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.serviceOffering.description), children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.serviceOffering.info) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.serviceOffering.about.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.serviceOffering.about.description) }), (0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
14
15
|
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
15
16
|
value: value,
|
|
16
17
|
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
17
18
|
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
18
|
-
: undefined, valueToId: (val) => val, valueToText: (val) => t(
|
|
19
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
19
20
|
send({
|
|
20
21
|
type: 'ON_LINE_CHANGE',
|
|
21
22
|
value: value,
|
|
22
23
|
});
|
|
23
|
-
}, isRequired: true,
|
|
24
|
-
t(state.context?.errorMessages['line']?.[0]) })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(translations_1.PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(translations_1.PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
24
|
+
} })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
25
25
|
type: 'ON_INPUT_CHANGE',
|
|
26
26
|
inputName: 'feedback',
|
|
27
27
|
value: e.target.value,
|
|
@@ -30,7 +30,7 @@ const ServiceOfferingForm = ({ state, send, }) => {
|
|
|
30
30
|
: undefined, fileInputProps: {
|
|
31
31
|
id: 'attachments',
|
|
32
32
|
name: 'attachments',
|
|
33
|
-
iconLabel: t(
|
|
33
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
34
34
|
onChange: (files) => {
|
|
35
35
|
send({
|
|
36
36
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -38,23 +38,23 @@ const ServiceOfferingForm = ({ state, send, }) => {
|
|
|
38
38
|
value: files,
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
|
-
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
41
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.optionalTitle), isRequired: true, children: [(0, jsx_runtime_1.jsxs)(components_1.FieldWrapperWithError, { errorMessage: state.context?.errorMessages['isResponseWanted']?.[0], children: [(0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.yes), checked: state.context.isResponseWanted === true, onChange: () => send({
|
|
42
42
|
type: 'ON_INPUT_CHANGE',
|
|
43
43
|
inputName: 'isResponseWanted',
|
|
44
44
|
value: true,
|
|
45
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(
|
|
45
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.no), checked: state.context.isResponseWanted === false, onChange: () => send({
|
|
46
46
|
type: 'ON_INPUT_CHANGE',
|
|
47
47
|
inputName: 'isResponseWanted',
|
|
48
48
|
value: false,
|
|
49
|
-
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(
|
|
49
|
+
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
50
50
|
type: 'ON_INPUT_CHANGE',
|
|
51
51
|
inputName: 'firstName',
|
|
52
52
|
value: e.target.value,
|
|
53
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
53
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", name: "lastName", isRequired: true, value: state.context.lastName || '', errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
54
54
|
type: 'ON_INPUT_CHANGE',
|
|
55
55
|
inputName: 'lastName',
|
|
56
56
|
value: e.target.value,
|
|
57
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
57
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", name: "email", isRequired: true, value: state.context.email || '', errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
58
58
|
type: 'ON_INPUT_CHANGE',
|
|
59
59
|
inputName: 'email',
|
|
60
60
|
value: e.target.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/stopForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAgBvD,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,iBAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"stopForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/stopForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAgBvD,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,iBAAiB,aAAa,4CAkOtD,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -7,33 +7,34 @@ const components_1 = require("../../components");
|
|
|
7
7
|
const translations_1 = require("../../translations");
|
|
8
8
|
const typography_1 = require("../../components/typography");
|
|
9
9
|
const StopForm = ({ state, send }) => {
|
|
10
|
+
const PageText = (0, translations_1.usePageText)();
|
|
10
11
|
const { t } = (0, translations_1.useTranslation)();
|
|
11
12
|
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
12
13
|
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.stop.description), children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.stop.info) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.modeOfTransport.stop.about.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.modeOfTransport.stop.about.description) }), (0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
14
15
|
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
15
16
|
value: value,
|
|
16
17
|
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
17
18
|
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
18
|
-
: undefined, valueToId: (val) => val, valueToText: (val) => t(
|
|
19
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
19
20
|
send({
|
|
20
21
|
type: 'ON_LINE_CHANGE',
|
|
21
22
|
value: value,
|
|
22
23
|
});
|
|
23
24
|
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
24
|
-
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "stop", label: t(
|
|
25
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "stop", label: t(PageText.Contact.input.stop.label), value: state.context.stop, isDisabled: !state.context.line, onChange: (value) => {
|
|
25
26
|
send({
|
|
26
27
|
type: 'ON_INPUT_CHANGE',
|
|
27
28
|
inputName: 'stop',
|
|
28
29
|
value: value,
|
|
29
30
|
});
|
|
30
|
-
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(
|
|
31
|
+
}, options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['stop']?.[0]
|
|
31
32
|
? t(state.context?.errorMessages['stop']?.[0])
|
|
32
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(
|
|
33
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({
|
|
33
34
|
type: 'ON_INPUT_CHANGE',
|
|
34
35
|
inputName: 'date',
|
|
35
36
|
value: date,
|
|
36
|
-
}) })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
37
|
+
}) })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.input.feedback.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.input.feedback.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
37
38
|
type: 'ON_INPUT_CHANGE',
|
|
38
39
|
inputName: 'feedback',
|
|
39
40
|
value: e.target.value,
|
|
@@ -42,7 +43,7 @@ const StopForm = ({ state, send }) => {
|
|
|
42
43
|
: undefined, fileInputProps: {
|
|
43
44
|
id: 'attachments',
|
|
44
45
|
name: 'attachments',
|
|
45
|
-
iconLabel: t(
|
|
46
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
46
47
|
onChange: (files) => {
|
|
47
48
|
send({
|
|
48
49
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -50,23 +51,23 @@ const StopForm = ({ state, send }) => {
|
|
|
50
51
|
value: files,
|
|
51
52
|
});
|
|
52
53
|
},
|
|
53
|
-
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
54
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.optionalTitle), isRequired: true, children: [(0, jsx_runtime_1.jsxs)(components_1.FieldWrapperWithError, { errorMessage: state.context?.errorMessages['isResponseWanted']?.[0], children: [(0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.yes), checked: state.context.isResponseWanted === true, onChange: () => send({
|
|
54
55
|
type: 'ON_INPUT_CHANGE',
|
|
55
56
|
inputName: 'isResponseWanted',
|
|
56
57
|
value: true,
|
|
57
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(
|
|
58
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.input.wantedResponse.options.no), checked: state.context.isResponseWanted === false, onChange: () => send({
|
|
58
59
|
type: 'ON_INPUT_CHANGE',
|
|
59
60
|
inputName: 'isResponseWanted',
|
|
60
61
|
value: false,
|
|
61
|
-
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(
|
|
62
|
+
}) })] }), state.context.isResponseWanted && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
62
63
|
type: 'ON_INPUT_CHANGE',
|
|
63
64
|
inputName: 'firstName',
|
|
64
65
|
value: e.target.value,
|
|
65
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
66
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", name: "lastName", isRequired: true, value: state.context.lastName || '', errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
66
67
|
type: 'ON_INPUT_CHANGE',
|
|
67
68
|
inputName: 'lastName',
|
|
68
69
|
value: e.target.value,
|
|
69
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
70
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", name: "email", isRequired: true, value: state.context.email || '', errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
70
71
|
type: 'ON_INPUT_CHANGE',
|
|
71
72
|
inputName: 'email',
|
|
72
73
|
value: e.target.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transportationForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/transportationForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAKlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAevD,KAAK,uBAAuB,GAAG;IAC7B,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,kBAGhC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"transportationForm.d.ts","sourceRoot":"","sources":["../../../src/means-of-transport/forms/transportationForm.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAKlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAevD,KAAK,uBAAuB,GAAG;IAC7B,KAAK,EAAE;QAAE,OAAO,EAAE,4BAA4B,CAAA;KAAE,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,0BAA0B,KAAK,IAAI,CAAC;CAC1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,kBAGhC,uBAAuB,4CAsRzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|