Update frontend validation to use translations

This commit is contained in:
Benjamin Beganović 2021-10-13 15:24:05 +02:00
parent cb38a366d4
commit 8b9d0b9762
3 changed files with 8 additions and 3 deletions

View File

@ -109,21 +109,21 @@ class ProcessSEPA {
if (document.getElementById('sepa-name').value === "") { if (document.getElementById('sepa-name').value === "") {
document.getElementById('sepa-name').focus(); document.getElementById('sepa-name').focus();
errors.textContent = "Name required."; errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
errors.hidden = false; errors.hidden = false;
return; return;
} }
if (document.getElementById('sepa-email-address').value === "") { if (document.getElementById('sepa-email-address').value === "") {
document.getElementById('sepa-email-address').focus(); document.getElementById('sepa-email-address').focus();
errors.textContent = "Email required."; errors.textContent = document.querySelector('meta[name=translation-email-required]').content;
errors.hidden = false; errors.hidden = false;
return; return;
} }
if (!document.getElementById('sepa-mandate-acceptance').checked) { if (!document.getElementById('sepa-mandate-acceptance').checked) {
errors.textContent = "Accept Terms"; errors.textContent = document.querySelector('meta[name=translation-terms-required]').content;
errors.hidden = false; errors.hidden = false;
console.log("Terms"); console.log("Terms");
return; return;

View File

@ -4325,6 +4325,7 @@ $LANG = array(
'giropay' => 'GiroPay', 'giropay' => 'GiroPay',
'giropay_law' => 'By entering your Customer information (such as name, sort code and account number) you (the Customer) agree that this information is given voluntarily.', 'giropay_law' => 'By entering your Customer information (such as name, sort code and account number) you (the Customer) agree that this information is given voluntarily.',
'eps' => 'EPS', 'eps' => 'EPS',
'you_need_to_accept_the_terms_before_proceeding' => 'You need to accept the terms before proceeding.',
); );
return $LANG; return $LANG;

View File

@ -8,6 +8,10 @@
<meta name="customer" content="{{ $customer }}"> <meta name="customer" content="{{ $customer }}">
<meta name="pi-client-secret" content="{{ $pi_client_secret }}"> <meta name="pi-client-secret" content="{{ $pi_client_secret }}">
<meta name="si-client-secret" content="{{ $si_client_secret ?? '' }}"> <meta name="si-client-secret" content="{{ $si_client_secret ?? '' }}">
<meta name="translation-name-required" content="{{ ctrans('texts.missing_account_holder_name') }}">
<meta name="translation-email-required" content="{{ ctrans('texts.provide_email') }}">
<meta name="translation-terms-required" content="{{ ctrans('texts.you_need_to_accept_the_terms_before_proceeding') }}">
@endsection @endsection
@section('gateway_content') @section('gateway_content')