diff --git a/src/components/Errors/ErrorBoundary.jsx b/src/components/Errors/ErrorBoundary.jsx index 5e6e37695..ac2b61908 100644 --- a/src/components/Errors/ErrorBoundary.jsx +++ b/src/components/Errors/ErrorBoundary.jsx @@ -136,21 +136,44 @@ const UnprocessableEntityError = ({wrapper: Wrapper, error}) => { UnprocessableEntityError.propTypes = GenericError.propTypes; const ServiceUnavailableError = ({wrapper: Wrapper, error}) => { - if (error.code !== 'form-maintenance') { + if (!['form-maintenance', 'form-maximum-submissions'].includes(error.code)) { return ; } // handle maintenance mode forms - return ( - - } - /> - ); + if (error.code === 'form-maintenance') { + return ( + + } + /> + ); + } + + // handle submission limit forms + if (error.code === 'form-maximum-submissions') { + return ( + + } + > + + + + + ); + } }; // map the type of error to the component to render diff --git a/src/components/FormMaximumSubmissions.jsx b/src/components/FormMaximumSubmissions.jsx new file mode 100644 index 000000000..5e7bd70da --- /dev/null +++ b/src/components/FormMaximumSubmissions.jsx @@ -0,0 +1,17 @@ +import React from 'react'; +import {FormattedMessage} from 'react-intl'; + +import ErrorMessage from 'components/Errors/ErrorMessage'; + +const FormMaximumSubmissions = () => { + return ( + + + + ); +}; + +export default FormMaximumSubmissions; diff --git a/src/components/FormStart/index.jsx b/src/components/FormStart/index.jsx index d0713c563..faa28cf9c 100644 --- a/src/components/FormStart/index.jsx +++ b/src/components/FormStart/index.jsx @@ -6,6 +6,7 @@ import {useAsync} from 'react-use'; import Body from 'components/Body'; import Card from 'components/Card'; import ExistingSubmissionOptions from 'components/ExistingSubmissionOptions'; +import FormMaximumSubmissions from 'components/FormMaximumSubmissions'; import {LiteralsProvider} from 'components/Literal'; import Loader from 'components/Loader'; import LoginOptions from 'components/LoginOptions'; @@ -112,6 +113,10 @@ const FormStart = ({form, submission, onFormStart, onDestroySession, initialData return ( + {form.submissionMaximumAllowed && + form.submissionMaximumAllowed === form.submissionCounter ? ( + + ) : null} {userIsFormDesigner && form.maintenanceMode && } {!!authErrors ? : null} diff --git a/src/i18n/compiled/en.json b/src/i18n/compiled/en.json index faeda5988..5dcf354fd 100644 --- a/src/i18n/compiled/en.json +++ b/src/i18n/compiled/en.json @@ -1549,6 +1549,12 @@ "value": "What would you like to do?" } ], + "j8vJ0Q": [ + { + "type": 0, + "value": "Sorry - this form has reached the maximum submission limit" + } + ], "jAZped": [ { "type": 0, @@ -2075,6 +2081,12 @@ "value": "Abort submission" } ], + "uPtko4": [ + { + "type": 0, + "value": "Unfortunately, this form is no longer available for submissions." + } + ], "uZBPwA": [ { "type": 0, diff --git a/src/i18n/compiled/nl.json b/src/i18n/compiled/nl.json index 9588f3c5c..3c746e3f3 100644 --- a/src/i18n/compiled/nl.json +++ b/src/i18n/compiled/nl.json @@ -234,13 +234,13 @@ "7v8PR6": [ { "type": 0, - "value": "Your session has expired. " + "value": "Je sessie is verlopen. " }, { "children": [ { "type": 0, - "value": "Click here to restart" + "value": "Klik hier om opnieuw te beginnen" } ], "type": 8, @@ -1553,6 +1553,12 @@ "value": "Wat wil je doen?" } ], + "j8vJ0Q": [ + { + "type": 0, + "value": "Sorry - this form has reached the maximum submission limit" + } + ], "jAZped": [ { "type": 0, @@ -2079,6 +2085,12 @@ "value": "Afbreken" } ], + "uPtko4": [ + { + "type": 0, + "value": "Unfortunately, this form is no longer available for submissions." + } + ], "uZBPwA": [ { "type": 0, diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index d3349f361..a509a947f 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -779,6 +779,11 @@ "description": "Email verification mode selection label", "originalDefault": "What would you like to do?" }, + "j8vJ0Q": { + "defaultMessage": "Sorry - this form has reached the maximum submission limit", + "description": "'Maximum submissions' error title", + "originalDefault": "Sorry - this form has reached the maximum submission limit" + }, "jAZped": { "defaultMessage": "Sorry - this form is no longer available", "description": "'Deactivated form' error title", @@ -1004,6 +1009,11 @@ "description": "Button label to abort submission", "originalDefault": "Abort submission" }, + "uPtko4": { + "defaultMessage": "Unfortunately, this form is no longer available for submissions.", + "description": "Maximum form submissions error message", + "originalDefault": "Unfortunately, this form is no longer available for submissions." + }, "uZBPwA": { "defaultMessage": "Number must be {exact, select, true {exactly equal to} other {{inclusive, select, true {less than or equal to} other {less than}}} } {maximum}.", "description": "ZOD 'too_big' error message, for numbers", diff --git a/src/i18n/messages/nl.json b/src/i18n/messages/nl.json index ff87a0823..2649c8d95 100644 --- a/src/i18n/messages/nl.json +++ b/src/i18n/messages/nl.json @@ -788,6 +788,11 @@ "description": "Email verification mode selection label", "originalDefault": "What would you like to do?" }, + "j8vJ0Q": { + "defaultMessage": "Sorry - this form has reached the maximum submission limit", + "description": "'Maximum submissions' error title", + "originalDefault": "Sorry - this form has reached the maximum submission limit" + }, "jAZped": { "defaultMessage": "Onze excuses - dit formulier is niet langer beschikbaar", "description": "'Deactivated form' error title", @@ -1016,6 +1021,11 @@ "description": "Button label to abort submission", "originalDefault": "Abort submission" }, + "uPtko4": { + "defaultMessage": "Unfortunately, this form is no longer available for submissions.", + "description": "Maximum form submissions error message", + "originalDefault": "Unfortunately, this form is no longer available for submissions." + }, "uZBPwA": { "defaultMessage": "Het getal moet {exact, select, true {exact gelijk aan} other {{inclusive, select, true {minder dan of gelijk aan} other {minder dan}}} } {maximum} zijn.", "description": "ZOD 'too_big' error message, for numbers",