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.             {% if CompanyDetailsService.companyDetails.contactFormIncludeTelNumber ==1 %}
  63.                 <div class="user-box">
  64.                     {{ form_label(form.mobile, 'Phone', { 'label_attr': {'class': 'form-label'} }) }}<sup
  65.                             style="padding-left:5px">*</sup>
  66.                     {{ form_widget(form.mobile, { 'attr': {'class': 'form-control', 'required': 'required'} }) }}
  67.                 </div>
  68.             {% endif %}
  69.             {% if ProductService.getProductContactFormCount() > 1 %}
  70.                 <div class="user-box-radio products_requested">
  71.                     {{ form_row(form.productsRequested) }}
  72.                 </div>
  73.             {% endif %}
  74.             {% if CompanyDetailsService.companyDetails.contactFormIncludeMessage ==1 %}
  75.                 <div class="user-box">
  76.                     {{ form_label(form.notes, 'Message', { 'label_attr': {'class': 'form-label pr-5'} }) }}
  77.                     {{ form_widget(form.notes, { 'attr': {'class': 'form-control', 'style': 'width: 100%', 'rows': '7'} }) }}
  78.                 </div>
  79.             {% endif %}
  80.             <button class="btn btn-outline-success mt-3" type="submit" onclick="showThankYouMessage(event)">Submit
  81.             </button>
  82.             {{ form_end(form, { 'render_rest': false }) }}
  83.         </div>
  84.     </div>
  85. </div>
  86. <!-- Popup message -->
  87. <div id="thankYouPopup" class="popup">
  88.     <p>Thank you for submitting your details</p>
  89.     {% if CompanyDetailsService.companyDetails.WebsiteContactsAutoReply == 'Auto' %}
  90.         <p>Please check your email.</p>
  91.     {% else %}
  92.         <p>We will be in contact shortly.</p>
  93.     {% endif %}
  94. </div>
  95. <script>
  96.     function showThankYouMessage(event) {
  97.         event.preventDefault();  // Prevent form from submitting immediately
  98.         // Show the popup
  99.         document.getElementById('thankYouPopup').classList.add('show');
  100.         // Simulate form submission after a delay
  101.         setTimeout(function () {
  102.             // Here you can trigger the form submission after showing the popup
  103.             event.target.closest('form').submit();
  104.         }, 2000);  // Delay to allow popup to be visible for 2 seconds
  105.     }
  106. </script>