templates/home/parts/contact_us.html.twig line 1

  1. <style>
  2.     .user-box {
  3.         position: relative;
  4.     }
  5.     .user-box input {
  6.         width: 100%;
  7.         font-size: 16px;
  8.         color: #fff !important;
  9.         margin-bottom: 30px;
  10.         border: none;
  11.         border-bottom: 1px solid white !important;
  12.         outline: none;
  13.         background: transparent;
  14.     }
  15.     .user-box .form-control:focus {
  16.         color: black !important;
  17.     }
  18.     .user-box label {
  19.         font-size: 16px;
  20.         color: white;
  21.     }
  22.     .user-box-radio {
  23.         color: white;
  24.     }
  25.     textarea {
  26.         width: 100%;
  27.     }
  28.     /* Popup style */
  29.     .popup {
  30.         display: none;
  31.         position: fixed;
  32.         top: 50%;
  33.         left: 50%;
  34.         transform: translate(-50%, -50%);
  35.         background: rgba(0, 0, 0, 0.8);
  36.         color: white;
  37.         padding: 20px;
  38.         border-radius: 8px;
  39.         text-align: center;
  40.     }
  41.     .popup.show {
  42.         display: block;
  43.     }
  44. </style>
  45. <div class="container bg-gradient-dark">
  46.     <div class="row">
  47.         <div class="col-12 col-md-4 mx-auto">
  48.             {{ form_start(form, {
  49.                 'attr': {'class': 'py-5'},
  50.                 'action': path('new_website_contact_from_contact_form')
  51.             }) }}
  52.             {{ form_widget(form._token) }}
  53.             <div class="user-box">
  54.                 {{ form_row(form.firstName) }}
  55.             </div>
  56.             <div class="user-box">
  57.                 {{ form_row(form.lastName) }}
  58.             </div>
  59.             <div class="user-box">
  60.                 {{ form_row(form.email) }}
  61.             </div>
  62.             <div class="user-box">
  63.                 {{ form_label(form.mobile, 'Phone', { 'label_attr': {'class': 'form-label'} }) }}<sup
  64.                         style="padding-left:5px">*</sup>
  65.                 {{ form_widget(form.mobile, { 'attr': {'class': 'form-control', 'required': 'required'} }) }}
  66.             </div>
  67.             {% if ProductService.getProductContactFormCount() > 1 %}
  68.                 <div class="user-box-radio products_requested">
  69.                     {{ form_row(form.productsRequested) }}
  70.                 </div>
  71.             {% endif %}
  72.             <div class="user-box">
  73.                 {{ form_label(form.notes, 'Message', { 'label_attr': {'class': 'form-label pr-5'} }) }}
  74.                 {{ form_widget(form.notes, { 'attr': {'class': 'form-control', 'style': 'width: 100%', 'rows': '7'} }) }}
  75.             </div>
  76.             <button class="btn btn-outline-success mt-3" type="submit" onclick="showThankYouMessage(event)">Submit</button>
  77.             {{ form_end(form) }}
  78.         </div>
  79.     </div>
  80. </div>
  81. <!-- Popup message -->
  82. <div id="thankYouPopup" class="popup">
  83.     <p>Thank you for your submission!</p>
  84. </div>
  85. <script>
  86.     function showThankYouMessage(event) {
  87.         event.preventDefault();  // Prevent form from submitting immediately
  88.         // Show the popup
  89.         document.getElementById('thankYouPopup').classList.add('show');
  90.         // Simulate form submission after a delay
  91.         setTimeout(function() {
  92.             // Here you can trigger the form submission after showing the popup
  93.             event.target.closest('form').submit();
  94.         }, 2000);  // Delay to allow popup to be visible for 2 seconds
  95.     }
  96. </script>