Skip to content

Commit

Permalink
Merge pull request #1225 from cultuurnet/PPF-516-uitpas-checkbox
Browse files Browse the repository at this point in the history
PPF-516-UiTPAS checkbox
  • Loading branch information
vhande authored Jun 28, 2024
2 parents 59f7d65 + 0c4d4ff commit bb2fd05
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace App\Domain\Integrations\FormRequests;

use App\Domain\Integrations\IntegrationType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

final class StoreIntegrationRequest extends FormRequest
{
Expand All @@ -26,6 +28,7 @@ public function rules(): array
'lastNameTechnicalContact' => ['required', 'string', 'max:255'],
'emailTechnicalContact' => ['required', 'string', 'email', 'max:255'],
'agreement' => ['required', 'string'],
'uitpasAgreement' => [Rule::requiredIf($this->input('integrationType') === IntegrationType::UiTPAS->value), 'nullable', 'string'],
'coupon' => ['nullable', 'string'],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Domain\Integrations\FormRequests;

use App\Domain\Integrations\IntegrationType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

Expand All @@ -18,7 +19,7 @@ public function rules(): array
'integrationName' => ['required_without:description', 'string', 'max:255'],
'description' => ['required_without:integrationName', 'string', 'max:255'],
'website' => [
Rule::requiredIf($this->input('integrationType') === 'uitpas'),
Rule::requiredIf($this->input('integrationType') === IntegrationType::UiTPAS->value),
'nullable',
'url:http,https',
'max:255',
Expand Down
1 change: 1 addition & 0 deletions lang/nl/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
'lastName' => 'achternaam',
'email' => 'email',
'agreement' => 'gebruikersvoorwaarden',
'uitpasAgreement' => 'verwerkingsvoorwaarden van UiTPAS',
'functional.email' => 'email',
'functional.lastName' => 'achternaam',
'functional.firstName' => 'voornaam',
Expand Down
4 changes: 4 additions & 0 deletions resources/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
},
"error": "Not all mandatory fields were filled in correctly. Check your input.",
"agree": "I agree to the <1>terms of use</1> and the <2>privacy policy</2>",
"uitpasAgreement": {
"label": "I agree with the <1>processing conditions of UiTPAS<1>",
"link": "https://www.publiq.be/en/projects/publiq-platform/processing-conditions"
},
"terms_of_use_link": "https://docs.publiq.be/docs/uitdatabank/terms-of-use/terms-of-use",
"privacy_link": "https://www.publiq.be/en/privacy",
"coupon": "I have a coupon",
Expand Down
4 changes: 4 additions & 0 deletions resources/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
},
"error": "Niet alle verplichte velden werden correct ingevuld. Controleer je invoer.",
"agree": "Ik ga akkoord met de <1>gebruiksvoorwaarden</1> en de <2>privacyverklaring</2>",
"uitpasAgreement": {
"label": "Ik ga akkoord met de <1>verwerkingsvoorwaarden van UiTPAS<1>",
"link": "https://www.publiq.be/nl/projecten/publiq-platform/algemene-verwerkingsvoorwaarden"
},
"terms_of_use_link": "https://docs.publiq.be/docs/uitdatabank/terms-of-use/terms-of-use",
"privacy_link": "https://www.publiq.be/nl/privacy",
"coupon": "Ik heb een coupon",
Expand Down
37 changes: 37 additions & 0 deletions resources/ts/Pages/Integrations/New.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const New = ({ subscriptions }: Props) => {
lastNameTechnicalContact: "",
emailTechnicalContact: "",
agreement: "",
uitpasAgreement: "",
coupon: "",
};

Expand Down Expand Up @@ -379,6 +380,42 @@ const New = ({ subscriptions }: Props) => {
}
error={errors.agreement}
/>
{activeType === IntegrationType.UiTPAS && (
<FormElement
label={
<Trans
i18nKey="integration_form.uitpasAgreement.label"
t={t}
components={{
1: (
<Link
href={t("integration_form.uitpasAgreement.link")}
className="text-publiq-blue-dark hover:underline"
/>
),
}}
/>
}
labelPosition="right"
labelSize="base"
labelWeight="normal"
component={
<input
type="checkbox"
name="uitpasAgreement"
className="text-publiq-blue-dark focus:ring-publiq-blue-dark rounded-sm"
checked={data.uitpasAgreement === "true"}
onChange={() =>
setData(
"uitpasAgreement",
data.uitpasAgreement === "true" ? "" : "true"
)
}
/>
}
error={errors.uitpasAgreement}
/>
)}
{isCouponFieldVisible && (
<>
<FormElement
Expand Down

0 comments on commit bb2fd05

Please sign in to comment.