]> _ Git - ccv-wordpress.git/commitdiff
WIP #3462 @1.75
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 27 Oct 2020 17:48:43 +0000 (18:48 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 27 Oct 2020 17:48:43 +0000 (18:48 +0100)
wp-content/mu-plugins/cube/src/Forms/Base.php
wp-content/mu-plugins/cube/src/Forms/Consultation.php
wp-content/themes/CCV/resources/views/forms/consultation.blade.php

index 45c58a348277380f56e4130f06f1c3eb28d39b24..0bf5a882ae1f03e43be4e6ac98731b349169ac1b 100644 (file)
@@ -288,6 +288,10 @@ class Base
         return $default;
     }
 
+    public function set_data($name, $value) {
+        $this->data[$name] = $value;
+    }
+
     public function get_destination() {
         return $this->destination;
     }
index 3b8b409c9470fafc0758b6bc63ba0a9528d7c510..7a16b3dcfcf2a2473ac12a47a075535ec1832faf 100644 (file)
@@ -51,7 +51,7 @@ class Consultation extends Base
             Textarea::field('message', __('Avez vous un message (ou une demande) spécifique à nous formuler ?', 'ccv'))->required(false),
 
             // Special field: if a surgeon is selected, their e-mail address will be override the default delivery address
-            Select::field('surgeon', __('Chirurgien spécifique'))
+            Select::field('surgeon', __('Chirurgien spécifique', 'ccv'))
                 ->required(false)
                 ->options([
                     'Dr Guilhaume GENESTE' => 'dr.geneste@ccv-montpellier.fr',
@@ -123,9 +123,16 @@ class Consultation extends Base
 
     public function pre_process() {
 
+        // Due to the complexity of the "Imagery" section of the form, there's no validation on these fields
+        // so it's possible to submit the form without ever selecting an imagery-type. In this case, we update
+        // the field value so it is clear to CCV that the client never filled out this section...
+        if (empty($this->get_data('imagery-type'))) {
+            $this->set_data('imagery-type', __('Aucune image envoyée', 'ccv'));
+        }
+
         // If the user didn't select the NAS upload option, there's no point including the NAS ID in the form data
         // NOTE: This relies on the value of the field so make sure it is always the same in both places (consultation.blade.php)
-        if ($this->get_data('imagery-type') !== __('Images téléversées depuis portable')) {
+        if ($this->get_data('imagery-type') !== __('Images téléversées depuis portable', 'ccv')) {
             $this->remove_field('imagery-phone-token');
         }
 
index 516231a15c33f9cbfef25d496ff9f2b8cdff0675..2ecce5f6fc4c9e9a6f66b3e22897f49247463d12 100644 (file)
 
     {{-- IMAGES FROM CD --}}
     <div class="imagery-type-wrapper flex mb-8">
-      <input type="radio" id="imagery_cd" name="imagery-type" value="{{ __('Images sur CD (Purview)') }}">
+      <input type="radio" id="imagery_cd" name="imagery-type" value="{{ __('Images sur CD (Purview)', 'ccv') }}">
       <label for="imagery_cd" class="imagery-icon">@svg('imagery-cd', 'w-22 md:w-20 sm:w-16')</label>
       <div class="ml-4">
         <div class="text-lg sm:text-base font-normal leading-tight mb-1">
       {!! $form->input('imagery-phone-token') !!}
       {{-- ### NOTE: when this option isn't selected, the 'imagery-phone-token' field will be removed from the form --}}
       {{-- This field is matched based on the value of the translated text below, so make sure to update Consultation::pre_process() too --}}
-      <input type="radio" id="imagery_phone" name="imagery-type" value="{{ __('Images téléversées depuis portable') }}">
+      <input type="radio" id="imagery_phone" name="imagery-type" value="{{ __('Images téléversées depuis portable', 'ccv') }}">
       <label for="imagery_phone" class="imagery-icon">@svg('imagery-phone', 'w-22 md:w-20 sm:w-16')</label>
       <div class="ml-4">
         <div class="text-lg sm:text-base font-normal leading-tight mb-1">
           </ul>
         </div>
 
-        <a href="#" class="btn mt-6" data-update-imagery-type id="phone-image-browse">{{ __('Parcourir') }}</a>
+        <a href="#" class="btn mt-6" data-update-imagery-type id="phone-image-browse">{{ __('Parcourir', 'ccv') }}</a>
       </div>
     </div>
 
     {{-- IMAGES SENT BY POST --}}
     <div class="imagery-type-wrapper flex mb-8">
-      <input type="radio" id="imagery_post" name="imagery-type" value="{{ __('Images envoyé par courrier', 'ccv') }}">
+      <input type="radio" id="imagery_post" name="imagery-type" value="{{ __('Images envoyées par courrier', 'ccv') }}">
       <label for="imagery_post" class="imagery-icon">@svg('imagery-post', 'w-22 md:w-20 sm:w-16')</label>
       <div class="ml-4">
         <div class="text-lg sm:text-base font-normal leading-tight mb-1">
       <div class="mt-4">
         <div class="custom-checkbox mb-1">
           <label>
-            <input type="checkbox" name="send-to-team" value="{{ __('Oui') }}" checked class="ml-2">
+            <input type="checkbox" name="send-to-team" value="{{ __('Oui', 'ccv') }}" checked class="ml-2">
             <span class="form-label-reversed">{{ __("J'envoie ma demande à l'équipe du CCV", 'ccv') }}</span>
           </label>
         </div>