templates/front/product/reservation/subform_reservation.html.twig line 1

Open in your IDE?
  1. <form method="post" action="{{ path('reservation_new', {'product': product.id}) }}" id="form_reservation">
  2.     {% if is_granted('ROLE_ENTERPRISE') == false %}
  3.         {% if product.company.isConfirmed %}
  4.             <div class="form-group d-none">
  5.                 <label for="quantity_product">Quantité</label><br>
  6.                 <div class="quantity buttons_added">
  7.                     <input type="button" value="-" class="minus">
  8.                     <input id="quantity_product" type="number" step="1" min="1" max="" name="quantity" value="1" title="Qty" class="input-text qty text" size="4" pattern="" inputmode="">
  9.                     <input type="button" value="+" class="plus">
  10.                 </div>
  11.             </div>
  12.             <!-- Champ date des réservations -->
  13.             <div class="form-group mt-3 mb-4">
  14.                 <div class="form-input">
  15.                 {# Récupérer les périodes d'indisponibilité du produit #}
  16.                 {% for unavailableDate in product.productAgendas %}
  17.                     <input type="hidden" class="startDayNotAvailable" value={{unavailableDate.startDayNotAvailable|date('Y-m-d')}}>
  18.                     <input type="hidden" class="endDayNotAvailable" value={{unavailableDate.endDayNotAvailable|date('Y-m-d')}}>
  19.                     <input type="hidden" class="raisonNotAvailable" value={{unavailableDate.raisonNotAvailable}}>
  20.                 {% endfor %}
  21.                     <input id="reservation_start" name="reservation_start" autocomplete="off" type="text" style="border: 0px solid white; border-bottom: 1px solid #aaa;" placeholder="Date de prestation" class="form-control" required>
  22.                 </div>
  23.             </div>
  24.             <div class="form-group mb-2">
  25.                 <div class="form-input">
  26.                     <input id="reservation_start_hidden" name="reservation_start_hidden" autocomplete="off" type="hidden" style="border: 0px solid white; border-bottom: 1px solid #aaa;" placeholder="Date de début" class="form-control" required>
  27.                 </div>
  28.             </div>
  29.             {% set isClothing = null %}
  30.             {% for subcategory in product.subCategories %}
  31.                 {% if subcategory.isClothing %}
  32.                     {% set isClothing = true %}
  33.                 {% endif %}
  34.             {% endfor %}
  35.             {% if isClothing and product.sizes is not empty %}
  36.                 <div class="form-group">
  37.                     <label for="quantity_product">Tailles disponibles</label><br>
  38.                     <select class="form-control wide" id="exampleFormControlSelect1" name="size">
  39.                         {% for size in product.sizes %}
  40.                             <option>{{ size }}</option>
  41.                         {% endfor %}
  42.                     </select>
  43.                 </div>
  44.             {% endif %}
  45.             {% set isClothingRing = null %}
  46.             {% for subcategory in product.subCategories %}
  47.                 {% if subcategory.isClothingRing %}
  48.                     {% set isClothingRing = true %}
  49.                 {% endif %}
  50.             {% endfor %}
  51.             {% if isClothingRing and product.sizeRing is not empty %}
  52.                 <div class="form-group">
  53.                     <label for="sizeRing">Tailles disponibles</label><br>
  54.                     <select class="form-control wide" id="sizeRing" name="size_ring">
  55.                         {% for size in product.sizeRing %}
  56.                             <option>{{ size }}</option>
  57.                         {% endfor %}
  58.                     </select>
  59.                 </div>
  60.             {% endif %}
  61.             {% set isColor = null %}
  62.             {% for subcategory in product.subCategories %}
  63.                 {% if subcategory.isColor %}
  64.                     {% set isColor = true %}
  65.                 {% endif %}
  66.             {% endfor %}
  67.             {% if isColor and product.colors is not empty %}
  68.                 <div class="form-group">
  69.                     <label for="quantity_product">Couleurs disponibles</label><br>
  70.                     <select class="form-control wide" id="exampleFormControlSelect1" name="color">
  71.                         {% for color in product.colors %}
  72.                             <option>{{ color }}</option>
  73.                         {% endfor %}
  74.                     </select>
  75.                 </div>
  76.             {% endif %}
  77.             {% set isNbGuest = null %}
  78.             {% for subcategory in product.subCategories %}
  79.                 {% if subcategory.isNbGuest %}
  80.                     {% set isNbGuest = true %}
  81.                 {% endif %}
  82.             {% endfor %}
  83.             {% if isNbGuest %}
  84.                 <div class="form-group" id="nb_guest_old">
  85.                     <label for="nb_guest">Nombre de personnes
  86.                         {% if product.nbGuest and product.nbGuest != null %}
  87.                             <small>({{ product.nbGuest }} pers max)</small>
  88.                         {% endif %}
  89.                     </label><br>
  90.                     <input type="text" name="nb_guest" class="form-control" placeholder="Nombre de personnes" required>
  91.                 </div>
  92.             {% endif %}
  93.             {% if product.tarifDegressifs is not null and product.tarifDegressifs is not empty %}
  94.                 {% for tarifDegressif in product.tarifDegressifs %}
  95.                     <input type="hidden" class="nbrPers" value="{{ tarifDegressif.nbrPers }}">
  96.                     <input type="hidden" class="tarifReduction" value="{{ tarifDegressif.reduction }}">
  97.                 {% endfor %}
  98.             
  99.                 <div class="row justify-content-center mt-5 mb-4">
  100.                     <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalTarif"
  101.                         onclick="voirtouteTarif('{{product.id}}','{{ app.request.getSchemeAndHttpHost() }}')">
  102.                         Voir les tarifs degressif
  103.                     </button>
  104.                 </div>
  105.             {% endif %}
  106.             <div class="row justify-content-center">
  107.                 <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalOptionGP" onclick="voirtoutOption('{{product.id}}','{{ app.request.getSchemeAndHttpHost() }}')">Options disponibles</button>
  108.             </div>
  109.             <div class="d-none">
  110.             {% if product.productOptions %}
  111.                 <span class="font-weight-bold">Options disponibles :</span>
  112.                 <div class="row pl-3 pr-3">
  113.                     {% for option in product.productOptions %}
  114.                         {% if option.image1 %}
  115.                             <div class="d-flex col-md-12">
  116.                                 <div class="col-md-6">
  117.                                     <img onclick=afficheImgOption("{{ option.id }}btn1") id="{{ option.id }}btn1" src="{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ option.image1) }}" style="cursor: pointer;">
  118.                                 </div>
  119.                                 {% if option.image2 %}
  120.                                 <div class="col-md-6">
  121.                                     <img onclick=afficheImgOption("{{ option.id }}btn2") id="{{ option.id }}btn2" src="{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ option.image2) }}"  style="cursor: pointer;">
  122.                                 </div>
  123.                                 {% endif %}
  124.                             </div>
  125.                         {% endif %}
  126.                         <div class="col-md-12 custom-control custom-checkbox">
  127.                             <input type="checkbox" data-price="{{ option.price }}" name="options[{{ option.id }}]" value="{{ option.price }}" class="option-product custom-control-input chekboxclass" id="option{{ loop.index }}">
  128.                             <label class="custom-control-label" for="option{{ loop.index }}">
  129.                                 <strong>{{ option.price|number_format(2, ',') }}
  130.                                     €</strong>
  131.                                 -
  132.                                 {{ option.name }}</label>
  133.                         </div>
  134.                         <hr>
  135.                     {% endfor %}
  136.                 </div>
  137.             {% endif %}
  138.             </div>
  139.             
  140.             <div class="row col-md-12 pt-4 d-none justify-content-between">
  141.                 <h4 class="mb-0">Total :
  142.                 </h4>
  143.                 <div>
  144.                     <span id="totalPricere" style="font-size:1.5em" class="prece-total-reserv">{{ product.price|number_format(2, '.', '') }}</span>
  145.                     €</div>
  146.             </div>
  147.             <div id="message_form"></div>
  148.             
  149.             <div class="mt-3 form-group">
  150.             
  151.                 {% if product.quantity > 0 or product.company.type == 'service' %}
  152.                     {% if app.user %}
  153.                         {% if btnForm == 0 %}
  154.                             {% if product.isActivated %}
  155.                                 <div class="form-group text-center">
  156.                                     {% if product.company.abonnements.count() > 0 and product.company.abonnements.last.isActive == true %}
  157.                                         <button type="submit" class="btn btn-rounded btn-primary mt-3" id="btn_add" style="height:auto;">Faire une demande de réservation</button>
  158.                                     {% elseif product.company.commissionActive == true %}
  159.                                         <button type="submit" class="btn btn-rounded btn-primary mt-3" id="btn_add" style="height:auto;">Faire une demande de réservation</button>
  160.                                     {% else %}
  161.                                         <div class="alert alert-info text-center mt-3" style="margin-bottom: 0;">
  162.                                             <i class="fas fa-info-circle"></i><br>
  163.                                             La fonctionnalité paiement en ligne du prestataire n'est pas encore accessible. 
  164.                                             Vous pouvez réserver le produit et vous recevrez un email quand le paiement sera disponible
  165.                                             <br>
  166.                                             <input type="hidden" name="reservation" value="reserver">
  167.                                             <button type="submit" class="btn btn-rounded btn-primary mt-3" id="btn_add" style="height:auto;">Réserver</button>
  168.                                         </div>
  169.                                     {% endif %}
  170.                                 </div>
  171.                             {% endif %}
  172.                         {% elseif btnForm == 1 %}
  173.                             <button type="submit" class="btn btn-rounded btn-danger mt-3" id="btn_add">Supprimer du panier</button>
  174.                         {% endif %}
  175.                     {% else %}
  176.                         <div class="alert alert-info text-center">
  177.                             <i class="fa fa-info-circle"></i><br>
  178.                             Veuillez vous connecter afin de faire une demande de location
  179.                             {% set subCategory = product.subCategories.toArray()[0] %}
  180.                                 {% set slug = "" %}
  181.                                 {% if product.typeActivity is not null %}
  182.                                     {% set slug = product.typeActivity.slug %}
  183.                                 {% elseif product.typeHebergements is not null %}
  184.                                     {% set slug = product.typeHebergements.slugTypeHebergm %}
  185.                                 {% else %}
  186.                                     {% set slug = subCategory.categories.toArray[0].slug %}
  187.                                 {% endif %}
  188.                                 
  189.                                 <a id="reserverNotConnected" href="{{ path('app_login', { redirect: path('front_product_single', {
  190.                                                                 'slug': slug,
  191.                                                                 'subCategorySlug': subCategory.subCategorySlug,
  192.                                                                 'product_id': product.id,
  193.                                                                 'productSlug': product.productSlug}) }) }}" 
  194.                                    class="btn btn-rounded btn-primary mt-3" style="height:auto;">
  195.                                    Réserver
  196.                                 </a>
  197.                         </div>
  198.                     {% endif %}
  199.                 {% else %}
  200.                     Ce produit n'est plus disponible pour le moment
  201.                 {% endif %}
  202.             </div>
  203.         {% else %}
  204.             <p>Produit pas encore disponible à l’achat</p>
  205.         {% endif %}
  206.     {% else %}
  207.         <p>Connectez-vous en tant que client pour réserver cette service</p>
  208.     {% endif %}
  209. </form>