templates/announce_detail/announce_detail.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{companyName}} | {% trans %}Announce{% endtrans %}{% endblock %}
  3. {% block stylesheets %}
  4.     {{ parent() }}
  5.     <link href="{{ asset('css/home.func.css') }}" rel="stylesheet" />
  6.     <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
  7.     <style>
  8.         #messageBody::-webkit-scrollbar {
  9.             width: 10px;
  10.         }
  11.         /* Track */
  12.         #messageBody::-webkit-scrollbar-track {
  13.             box-shadow: inset 0 0 5px grey;
  14.             border-radius: 5px;
  15.         }
  16.         /* Handle */
  17.         #messageBody::-webkit-scrollbar-thumb {
  18.             background: rgba(3, 128, 13, 0.27);
  19.             border-radius: 5px;
  20.         }
  21.         /* Handle on hover */
  22.         #messageBody ::-webkit-scrollbar-thumb:hover {
  23.             background: rgba(3, 128, 13, 0.97);
  24.         }
  25.             .modal { width:75% !important ; height: 75% !important ; }
  26.         .truncate-overflow {
  27.             display: -webkit-box;
  28.             -webkit-line-clamp: 4;
  29.             -webkit-box-orient: vertical;
  30.             overflow: hidden;
  31.             font-size: 14px;
  32.         }
  33.         .truncate-overflow:hover {
  34.             cursor: pointer;
  35.         }
  36.         div.ex3 {
  37.             background-color: #ffffff;
  38.             height: 250px;
  39.             width: 100%;
  40.             overflow-y: auto;
  41.         }
  42.         div.ex4 {
  43.             background-color: #ffffff;
  44.             height: 300px;
  45.             border-radius: 30px;
  46.             width: 100%;
  47.             overflow-y: auto;
  48.         }
  49.     </style>
  50.     <style>
  51.         .container-caroussel {
  52.             position: relative;
  53.             width: 50%;
  54.         }
  55.         .image-caroussel {
  56.             display: block;
  57.             width: 100%;
  58.             height: auto;
  59.         }
  60.         .btn-a-body {
  61.             --b: 3px;     /* the border thickness*/
  62.             --g: 5px;    /* the gap */
  63.             --c: rgba(3, 128, 13, 0.97); /* the color */
  64.             background: -webkit-linear-gradient(45deg, rgba(3, 128, 13, 0.97), #16945b);
  65.             padding: 10px; border-radius: 20px;
  66.             width: max-content;
  67.             aspect-ratio: 0.5;
  68.             color:white;
  69.             cursor: pointer;
  70.             transition: .3s;
  71.         }
  72.         .btn-a-body:hover {
  73.             outline: var(--b) solid var(--c);
  74.             outline-offset: var(--g);
  75.             background: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.87), rgba(255, 255, 255, 0.85));
  76.             color: rgba(3, 128, 13, 0.96);
  77.         }
  78.         .overlay-caroussel {
  79.             position: absolute;
  80.             bottom: 0;
  81.             left: 0;
  82.             right: 0;
  83.             background-color: #008CBA;
  84.             overflow: hidden;
  85.             width: 100%;
  86.             height: 0;
  87.             transition: .5s ease;
  88.         }
  89.         .container-caroussel:hover .overlay {
  90.             height: 100%;
  91.         }
  92.         .text-caroussel {
  93.             color: white;
  94.             font-size: 20px;
  95.             position: absolute;
  96.             top: 50%;
  97.             left: 50%;
  98.             -webkit-transform: translate(-50%, -50%);
  99.             -ms-transform: translate(-50%, -50%);
  100.             transform: translate(-50%, -50%);
  101.             text-align: center;
  102.         }
  103.     </style>
  104. {% endblock %}
  105. {% block body %}
  106.     {{ parent() }}
  107. <div class="row" id="content">
  108.     {% if current_announce!="all" and current_announce is not null%}
  109.     <div class="col s12" style="margin-top: 100px">
  110.             <div class="col s12   " style="">
  111.                 <h6 style="margin-top: -1px; font-size: 18px; padding-right: 15px" class="right right-align">{{ announces|length }} dernières annonces</h6>
  112.                 <div class="col s12 right right-align" style="margin-top: 2%; margin-bottom: 30px">
  113.                     <a href="#!" class="card  btn-a-body  "  style="margin-bottom: 30px; margin-top: -20px ;width: 100%     ">
  114.                         Déposez une announce
  115.                         <i style="font-size: 15px; margin-left: 15px; margin-right:  5px" class="   fas fa-bell"></i>
  116.                     </a>
  117.                 </div>
  118.                 {% if current_announce!="all"  %}
  119.                     <div class="col s10 offset-s1" >
  120.                    {% if local == "fr" %}
  121.                        <h4 style="margin-top: -25px"> {{ current_announce.titleFr }}</h4>
  122.                      {% else %}
  123.                          <h4 style="margin-top: -25px"> {{ current_announce.titleEn }}</h4>
  124.                      {% endif %}
  125.                      <ul class="autoplayPack">
  126.                          {% if   current_announce.cover is not null  %}
  127.                              <li>
  128.                                  <img class="     responsive-img "   src="{{ onlinePath }}/media/{{ current_announce.cover }}"  style="height: 300px"  alt="">
  129.                              </li>
  130.                          {% endif %}
  131.                          {% if  current_announce.picture is not null %}
  132.                              <li>
  133.                                  <img class="    responsive-img "  src="{{ onlinePath }}/media/{{ current_announce.picture }}"  style="height: 300px" alt="">
  134.                              </li>
  135.                          {% endif %}
  136.                      </ul>
  137.                  </div>
  138.                     <div class="col s12 m10 offset-m1  " style="padding: 20px">
  139.                         <a href="#!" id="btnChat" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  140.                             Echanger Avec le Proprio
  141.                             <i class="fas fa-pen" style="margin-left: 15px; margin-right:  5px"></i>
  142.                         </a>
  143.                         <a href="#!" id="btnContact" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  144.                             Contacter
  145.                             {% if current_announce.createdBy.company is  null %}
  146.                                 {{ current_announce.createdBy }}
  147.                             {% else %}
  148.                             {{ current_announce.createdBy.company.companyName }}
  149.                             {% endif %}
  150.                             <i class="fas fa-phone" style="margin-left: 15px; margin-right:  5px"></i>
  151.                         </a>
  152.                         <a href="#!" id="btnShare" class=" hide-on-small-and-down hide-on-small-only    card btn-a-body" style="">
  153.                             Partager
  154.                             <i class="fas fa-share-alt" style="margin-left: 15px; margin-right:  5px"></i>
  155.                         </a>
  156.                     </div>
  157.                     <div class="col s12 m10 offset-m1 card">
  158.                        <p class="" style="text-align: justify; padding: 20px">
  159.                            {{ current_announce.description }}
  160.                        </p>
  161.                           <ul style="font-size: 20px">
  162.                             <li>  <i class="fas fa-location-arrow" style="margin-right: 10px"></i> <b><u>Ville:</u></b> {{ current_announce.address.town }}</li>
  163.                             <li>  <i class="fas fa-search-location" style="margin-right: 10px"></i>  <b><u>Quartier:</u></b> {{ current_announce.address.location }}</li>
  164.                             <li> <i class="fas fa-map" style="margin-right: 10px"></i> <b><u>Superficie</u></b>: {{ current_announce.area }}m²</li>
  165.                             <li>   <i class="fas fa-cookie" style="margin-right: 10px"></i> <b><u>Pièces: </u></b>{{ current_announce.numberOfPiece }}</li>
  166.                         </ul>
  167.                         <h5 class="right right-align black-text" style="margin-top: -10px; padding-right: 0px; font-size: 23px">
  168.                             {{ current_announce.amount|number_format(2, '.', ',')  }}
  169.                             <i class="fas fa-cart-plus"></i>
  170.                         </h5>
  171.                        <div class="col s12 right right-align" style="padding-bottom: 20px; margin-right: -10px; padding-top: 10px">
  172.                            <a href="#!" id="btnBook" onclick="makeAnOffre({{ current_announce.amount }})" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  173.                                Faire une Proposition
  174.                                <i class="fas fa-cart-arrow-down" style="margin-left: 15px; margin-right:  5px"></i>
  175.                                <img id="btnBookLoading" src="{{ asset('img/loading.webp') }}" class="hide" style="max-height: 20px; position: absolute; float: right; right: 0; padding-right: 10px" alt="">
  176.                            </a>
  177.                        </div>
  178.                     </div>
  179.               {% else %}
  180.                   <div class="col s12">
  181.                       {% for announce in announces %}
  182.                               <div class="col s12  m10 offset-m1 " style="padding: 5px">
  183.                                   <div class="col s12 card">
  184.                                       <div class="col s7 ">
  185.                                           <h5>
  186.                                               {{ announce.titleEn }}
  187.                                           </h5>
  188.                                           <p class="truncate-overflow">{{ announce.description }}</p>
  189.                                       </div>
  190.                                       <div class="col s5">
  191.                                           <img class="  card  image-n-margin  responsive-img halfway-fab hoverable"   src="{{ onlinePath }}/media/{{ announce.cover }}" style=" padding-top: 20px; border-radius: 20px; width: 200px; height: 200px" alt="">
  192.                                       </div>
  193.                                       <div class="col s12 " style="margin-top: 20px; margin-bottom: 20px">
  194.                                           <a href="{{ path('app_announce_detail',{'announce':announce.id}) }}" id="btnLocation" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  195.                                               En Savoir plus..
  196.                                               <i class="fas fa-eye" style="margin-left: 15px; margin-right:  5px"></i>
  197.                                           </a>
  198.                                           <h5 class="right right-align black-text" style="margin-top: -10px; padding-right: 0px; font-size: 23px">
  199.                                               {{ announce.amount|number_format(2, '.', ',')  }}
  200.                                               <i class="fas fa-cart-plus"></i>
  201.                                           </h5>
  202.                                       </div>
  203.                                   </div>
  204.                               </div>
  205.                       {%endfor %}
  206.                   </div>
  207.                 {% endif %}
  208.             </div>
  209.         <div class="col s12  ">
  210.             <div class="col s12 m10 offset-m1 card "  style="overflow:scroll; height:100px;" id="messageBody"  >
  211.             </div>
  212.             <div class="col s12 m10 offset-m1 card " style="border-radius: 30px" >
  213.                 <div class="col s12 m8 l9">
  214.                     <div class="input-field col s12">
  215.                         <textarea id="messageToSend" class="materialize-textarea"></textarea>
  216.                         <label for="messageToSend">Votre Message</label>
  217.                     </div>
  218.                 </div>
  219.                 <div class="col s12 m4 l3" style="margin-top: 30px">
  220.                     <a onclick="postMessage() " href="#!" id="btnSendMessage" class="btn-a-body card" style="margin-top: 20px ">Envoyer
  221.                         <i class="fas fa-paper-plane  "  style="margin-left: 15px; margin-right:  5px"></i></a>
  222.                 </div>
  223.             </div>
  224.             {% if announces|length >1 %}
  225.             <div class="col s12" style="margin-top: 90px">
  226.                 <h5>Autres Offres</h5>
  227.                 <h6>Promotions, deals and special offers for you</h6>
  228.             </div>
  229.                 <div class="col s12 autoplayBestProd">
  230.                     {% for announce in announces %}
  231.                         {% if current_announce != announce %}
  232.                             <div class="col s12  " style="margin: 20px">
  233.                                 <div class="col s12 card">
  234.                                     <div class="col s7 ">
  235.                                         <h5>
  236.                                             {{ announce.titleEn }}
  237.                                         </h5>
  238.                                         <p class="truncate-overflow">{{ announce.description }}</p>
  239.                                     </div>
  240.                                     <div class="col s5">
  241.                                         <img class="  card  image-n-margin  responsive-img halfway-fab hoverable"   src="{{ onlinePath }}/media/{{ announce.cover }}" style=" padding-top: 20px; border-radius: 20px; width: 200px; height: 200px" alt="">
  242.                                     </div>
  243.                                     <div class="col s12 " style="margin-top: 20px; margin-bottom: 20px">
  244.                                         <a href="{{ path('app_announce_detail',{'announce':announce.id}) }}" id="btnLocation" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  245.                                             En Savoir plus..
  246.                                             <i class="fas fa-eye" style="margin-left: 15px; margin-right:  5px"></i>
  247.                                         </a>
  248.                                         <h5 class="right right-align black-text" style="margin-top: -10px; padding-right: 0px; font-size: 23px">
  249.                                             {{ announce.amount|number_format(2, '.', ',')  }}
  250.                                             <i class="fas fa-cart-plus"></i>
  251.                                         </h5>
  252.                                     </div>
  253.                                 </div>
  254.                             </div>
  255.                         {%endif %}
  256.                     {%endfor %}
  257.                 </div>
  258.             {%endif %}
  259.         </div>
  260.     </div>
  261.     {% elseif current_announce =="all" %}
  262.         <div class="row"  style="margin-top: 150px" >
  263.             <div class="col s12">
  264.                 <div class="col s12 m3   l3 card z-depth-1" style="border-radius: 40px; margin-top: 30px ">
  265.                     <div class="col s12" style="margin-top: 20px">
  266.                         <i class="fas fa-link" style=" font-size: 15px; position: absolute; margin-left: -20px;margin-top: 15px; float: right; z-index: 100 "></i>
  267.                         <select name="locationType" id="locationType">
  268.                             <option value="location">Location</option>
  269.                             <option value="vente">Vente</option>
  270.                         </select>
  271.                     </div>
  272.                     <div class="col s12">
  273.                         <i class="fas fa-building" style=" font-size: 15px; position: absolute; margin-left: -20px;margin-top: 15px; float: right; z-index: 100 "></i>
  274.                         <select name="buildType" id="buildType">
  275.                             {% for building in buildingTypes %}
  276.                                 <option value="{{ building.id }}">{{ building.type }}</option>
  277.                             {%endfor %}
  278.                         </select>
  279.                     </div>
  280.                     <div class="col s12" style="margin-bottom: 20px" >
  281.                         <i class="fas fa-location-arrow" style=" font-size: 15px; position: absolute; margin-left: -20px;margin-top: 15px; float: right; z-index: 100 "></i>
  282.                         <select class="js-example-basic-single" name="destinationTown" id="destinationTown" style="width: 100%;   ">
  283.                             {% for town in towns %}
  284.                                 <option value="{{ town.id }}">{{ town.townName }}</option>
  285.                             {%endfor %}
  286.                         </select>
  287.                     </div>
  288.                     <div class="col s12  " style="margin-top: 20px; margin-bottom: 30px">
  289.                         <a href="#!" class="card  btn-a-body " style="margin-bottom: 30px ;  ">
  290.                             Appliquer le Filtre <i style="font-size: 15px; margin-left: 15px; margin-right:  5px" class="   fas fa-search"></i></a>
  291.                     </div>
  292.                 </div>
  293.                 <div class="col s12 l9 m9  " style="overflow:scroll; height:700px;">
  294.                     <div class="col s10 offset-s1  ">
  295.                         <h5>Dernières annonces</h5>
  296.                         <h6>Promotions, deals and special offers for you</h6>
  297.                         {% for announce in announces %}
  298.                             {% if current_announce != announce %}
  299.                                 <div class="col s12  " style="margin: 20px">
  300.                                     <div class="col s12 card">
  301.                                         <div class="col s7 ">
  302.                                             <h5>
  303.                                                 {{ announce.titleEn }}
  304.                                             </h5>
  305.                                             <p class="truncate-overflow">{{ announce.description }}</p>
  306.                                         </div>
  307.                                         <div class="col s5">
  308.                                             <img class="  card  image-n-margin  responsive-img halfway-fab hoverable"   src="{{ onlinePath }}/media/{{ announce.cover }}" style=" padding-top: 20px; border-radius: 20px; width: 200px; height: 200px" alt="">
  309.                                         </div>
  310.                                         <div class="col s12 " style="margin-top: 20px; margin-bottom: 20px">
  311.                                             <a href="{{ path('app_announce_detail',{'announce':announce.id}) }}" id="btnLocation" class=" hide-on-small-and-down hide-on-small-only   card btn-a-body" style="">
  312.                                                 En Savoir plus..
  313.                                                 <i class="fas fa-eye" style="margin-left: 15px; margin-right:  5px"></i>
  314.                                             </a>
  315.                                             <h5 class="right right-align black-text" style="margin-top: -10px; padding-right: 0px; font-size: 23px">
  316.                                                 {{ announce.amount|number_format(2, '.', ',')  }}
  317.                                                 <i class="fas fa-cart-plus"></i>
  318.                                             </h5>
  319.                                         </div>
  320.                                     </div>
  321.                                 </div>
  322.                             {%endif %}
  323.                         {%endfor %}
  324.                     </div>
  325.                 </div>
  326.             </div>
  327.         </div>
  328.     {% else %}
  329.     {% endif %}
  330. </div>
  331.     <div id="modal1" class="modal ">
  332.         <div class="modal-content">
  333.             <div class="row">
  334.                 <form  data-aos="zoom-out-down"  data-aos-duration="2000"   onsubmit="return false;"
  335.                        class="col m8 offset-m2 l6 offset-l3  s12   " id="login_form_customer" style="margin-top: 2px; border-radius: 20px; margin-bottom: 30px"   >
  336.                     <div class="col s12 center center-block">
  337.                         <img src="{{ asset('img/login.png') }}" style="max-height: 70px; margin-bottom: 20px" alt="" class="center center block">
  338.                     </div>
  339.                     <div class="col   s12   m10 offset-m1    input-field center center-block center-align">
  340.                         <i class="fas fa-user-circle prefix" style="color:#e5bd02;font-size: 18px  ">  </i>
  341.                         <input placeholder="john@gmail.com"  required="required" type="email" id="emailInput" name="email" class="validate"   />
  342.                         <label for="emailInput" data-error="wrong" data-success="ok">Nom d'utilisateur </label>
  343.                         <span id="username_log_check" class="helper-text" data-error="wrong" data-success="ok"></span>
  344.                     </div>
  345.                     <div class="col   s12   m10 offset-m1    input-field center center-block center-align" style="margin-top: 5px">
  346.                         <i class="fas fa-key prefix" style="color:#e5bd02;font-size: 18px  ">  </i>
  347.                         <input   required="required" type="password" id="passwordInput" name="password" class="validate"  />
  348.                         <label for="passwordInput" data-error="wrong" data-success="ok">Mot de Passe </label>
  349.                         <span id="password_log_check" class="helper-text" data-error="wrong" data-success="ok"></span>
  350.                     </div>
  351.                     <div class="col s12" >
  352.                         <p style="margin-top: -1px; margin-bottom: 20px; margin-left: 50px">
  353.                             <input type="checkbox" name="_remember_me" id="_remember_me" />
  354.                             <label for="_remember_me">Remember Me</label>
  355.                         </p>
  356.                     </div>
  357.                     <button
  358.                             id="btnSubmitLog"  class="btn waves-effect indigo-text text-darken-4  waves-light col s10 offset-s1  m8 offset-m2 button" style=" height: 45px ; margin-bottom: 30px" type="submit"  ><span>Connexion</span>
  359.                         <i class="fas fa-power-off right"> </i>
  360.                     </button>
  361.                     <div class="col s12 " style="margin-left:-20px; margin-bottom: 20px; margin-top: -20px">
  362.                         <p class="right-align">Or   <a href="{{ path('app_register',
  363.                                 {'destination': path('app_announce_detail',
  364.                                     {'announce':current_announce }) })
  365.                             }}">Sign Up</a>
  366.                             <a href="{{ path("app_forgot_password_request") }}" class="" style="margin-left: 30px">Reset Password</a>
  367.                         </p>
  368.                     </div>
  369.                 </form>
  370.             </div>
  371.         </div>
  372.         <div class="modal-footer modal-fixed-footer fixed">
  373.             <div class="row">
  374.                 <div class="col s12 divider"></div>
  375.             </div>
  376.             <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a>
  377.         </div>
  378.     </div>
  379. {% endblock %}
  380. {% block javascripts %}
  381.     {{ parent() }}
  382.     <script src="{{ asset('js/home.func.js') }}"></script>
  383.     <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
  384.     <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
  385.     <script type="text/javascript">
  386.         var apiBaseUrl="{{ host }}"
  387.         var loginUrl="{{ path('authentication_token') }}";
  388.         $('#login_form_customer').submit(function(){
  389.             login()
  390.         });
  391.         var Toast = Swal.mixin({
  392.             toast: true,
  393.             position: 'top-end',
  394.             showConfirmButton: false,
  395.             timer: 14000,
  396.             timerProgressBar: true,
  397.             didOpen: (toast) => {
  398.                 toast.addEventListener('mouseenter', Swal.stopTimer)
  399.                 toast.addEventListener('mouseleave', Swal.resumeTimer)
  400.             }
  401.         });
  402.         function login() {
  403.             var passwordInput= $("#passwordInput").val();
  404.             var emailInput= $("#emailInput").val();
  405.             $.ajax({
  406.                 method: "POST",
  407.                 tryCount  : 0,
  408.                 retryLimit  : 4,
  409.                 url: loginUrl,
  410.                 "headers": {
  411.                     "Content-Type": "application/json"
  412.                 },
  413.                 data: JSON.stringify({
  414.                     "email": emailInput,
  415.                     "password": passwordInput
  416.                 }),
  417.                 beforeSend:function () {
  418.                     $("#btnSubmitLog").addClass("disabled").html("login in progress...");
  419.                 },
  420.                 success: function(data){
  421.                     $("#btnSubmitLog").removeClass("disabled").html("Connexion")
  422.                     setCookie("{{ companyName }}_user_token",data.token,1);
  423.                     setCookie("{{ companyName }}_user_userpass",passwordInput,1);
  424.                     setCookie("{{ companyName }}_user_username",emailInput,1);
  425.                     $('#modal1').modal('close');
  426.                     Toast.fire({
  427.                         icon: 'success',
  428.                         title: "Welcome Back"
  429.                     });
  430.                 },
  431.                 error:function (xhr, textStatus, errorThrown) {
  432.                     $("#btnSubmitLog").removeClass("disabled").html("Try Again")
  433.                     Toast.fire({
  434.                         icon: 'warning',
  435.                         title: "Invalid Username or Password"
  436.                     });
  437.                     $("#passwordInput").addClass('invalid');
  438.                     $("#emailInput").addClass('invalid');
  439.                 }
  440.             });
  441.         }
  442.         $(document).ready(function() {
  443.             $('.js-example-basic-single').select2();
  444.             $('#locationType').material_select();
  445.             $('#buildType').material_select();
  446.             $('.datepicker').pickadate({
  447.                 selectMonths: true, // Creates a dropdown to control month
  448.                 selectYears: 15, // Creates a dropdown of 15 years to control year,
  449.                 today: 'Today',
  450.                 clear: 'Clear',
  451.                 close: 'Ok',
  452.                 closeOnSelect: false, // Close upon selecting a date,
  453.                 container: undefined, // ex. 'body' will append picker to body
  454.             });
  455.             $('.modal').modal({
  456.                     dismissible: true, // Modal can be dismissed by clicking outside of the modal
  457.                     opacity: .4, // Opacity of modal background
  458.                     inDuration: 300, // Transition in duration
  459.                     outDuration: 200, // Transition out duration
  460.                     startingTop: '4%', // Starting top style attribute
  461.                     endingTop: '15%', // Ending top style attribute
  462.                     ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available.
  463.                     },
  464.                     complete: function() {
  465.                     } // Callback for Modal close
  466.                 }
  467.             );
  468.             $('.autoplayTestimony').slick({
  469.                 slidesToShow: 3,
  470.                 slidesToScroll: 1,
  471.                 autoplay: true,
  472.                 autoplaySpeed: 2000,
  473.                 responsive: [
  474.                     {
  475.                         breakpoint: 2024,
  476.                         settings: {
  477.                             slidesToShow: 4,
  478.                             slidesToScroll: 4,
  479.                             infinite: true,
  480.                             dots: true
  481.                         }
  482.                     },
  483.                     {
  484.                         breakpoint: 1424,
  485.                         settings: {
  486.                             slidesToShow: 3,
  487.                             slidesToScroll: 3,
  488.                             infinite: true,
  489.                             dots: true
  490.                         }
  491.                     },
  492.                     {
  493.                         breakpoint: 900,
  494.                         settings: {
  495.                             slidesToShow: 2,
  496.                             slidesToScroll: 2
  497.                         }
  498.                     },
  499.                     {
  500.                         breakpoint: 480,
  501.                         settings: {
  502.                             slidesToShow: 1,
  503.                             slidesToScroll: 1
  504.                         }
  505.                     }
  506.                 ]
  507.             })
  508.             $('.autoplayPack').slick({
  509.                 slidesToShow: 1,
  510.                 slidesToScroll: 1,
  511.                 autoplay: true,
  512.                 autoplaySpeed: 2000,
  513.                 responsive: [
  514.                     {
  515.                         breakpoint: 1024,
  516.                         settings: {
  517.                             slidesToShow: 1,
  518.                             slidesToScroll: 1,
  519.                             infinite: true,
  520.                             dots: true
  521.                         }
  522.                     },
  523.                     {
  524.                         breakpoint: 600,
  525.                         settings: {
  526.                             slidesToShow: 1,
  527.                             slidesToScroll: 1
  528.                         }
  529.                     },
  530.                     {
  531.                         breakpoint: 480,
  532.                         settings: {
  533.                             slidesToShow: 1,
  534.                             slidesToScroll: 1
  535.                         }
  536.                     }
  537.                 ]
  538.             });
  539.             $('.autoplayBestProd').slick({
  540.                 slidesToShow: 2,
  541.                 slidesToScroll: 2,
  542.                 autoplay: true,
  543.                 autoplaySpeed: 22000,
  544.                 responsive: [
  545.                     {
  546.                         breakpoint: 1024,
  547.                         settings: {
  548.                             slidesToShow: 2,
  549.                             slidesToScroll: 2,
  550.                             infinite: true,
  551.                             dots: true
  552.                         }
  553.                     },
  554.                     {
  555.                         breakpoint: 600,
  556.                         settings: {
  557.                             slidesToShow: 1,
  558.                             slidesToScroll: 1
  559.                         }
  560.                     },
  561.                     {
  562.                         breakpoint: 480,
  563.                         settings: {
  564.                             slidesToShow: 1,
  565.                             slidesToScroll: 1
  566.                         }
  567.                     }
  568.                 ]
  569.             });
  570.         });
  571.         {% if current_announce!="all" and current_announce is not null%}
  572.         function makeAnOffre(amount) {
  573.            var tokenUser= getCookie("{{ companyName }}_user_token");
  574.            if(tokenUser===""){
  575.                $('#modal1').modal('open',{
  576.                    dismissible: true, // Modal can be dismissed by clicking outside of the modal
  577.                    opacity: .8, // Opacity of modal background
  578.                    inDuration: 300, // Transition in duration
  579.                    outDuration: 200, // Transition out duration
  580.                    startingTop: '2%', // Starting top style attribute
  581.                    endingTop: '15%', // Ending top style attribute
  582.                    width: '60%',
  583.                    ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available.
  584.                    },
  585.                    complete: function() {
  586.                    } // Callback for Modal close
  587.                });
  588.            }else{
  589.                Swal.mixin({
  590.                    imageUrl: '{{ asset('img/icon_money.png') }}',
  591.                    imageHeight: 60,
  592.                    imageAlt: 'Faites une proposition.',
  593.                    allowOutsideClick: false,
  594.                    allowEscapeKey: false,
  595.                    reverseButtons: true,
  596.                    confirmButtonText:
  597.                        '{% trans %}Suivant{% endtrans %} <i class="fa fa-arrow-right"></i>',
  598.                    showCancelButton: true,
  599.                    progressSteps: ['1'],
  600.                    cancelButtonText:
  601.                        '<i class="fa fa-trash"></i> Annuler',
  602.                    cancelButtonAriaLabel: '{% trans %}Annuler{% endtrans %}'
  603.                }).
  604.                queue([
  605.                    {
  606.                        title: 'Faites une proposition.',
  607.                        text: '',
  608.                        inputValue: amount,
  609.                        inputPlaceholder: '01',
  610.                        input: 'number',
  611.                        inputValidator: (result) => {
  612.                            if(result===""){
  613.                                return "empty field";
  614.                            }
  615.                            if(parseInt(result)<1){
  616.                                return 'invalid number';
  617.                            }
  618.                        }
  619.                    },
  620.                ]).then((result) => {
  621.                    if (result.value) {
  622.                        $.ajax({
  623.                            method: "POST",
  624.                            tryCount  : 0,
  625.                            retryLimit  : 4,
  626.                            url: "{{ path('app_make_offer') }}",
  627.                            "headers": {
  628.                                "Content-Type": "application/json"
  629.                            },
  630.                            data: JSON.stringify({
  631.                                "announce":"{{ current_announce.id }}",
  632.                                "offer":result.value[0],
  633.                                "_user_token":getCookie("{{ companyName }}_user_token"),
  634.                            }),
  635.                            beforeSend:function () {
  636.                                $("#btnBook").addClass("disabled");
  637.                                $("#btnBookLoading").removeClass("hide");
  638.                            },
  639.                            success: function(data){
  640.                                console.log(data);
  641.                                $("#btnBook").removeClass("disabled");
  642.                                $("#btnBookLoading").addClass("hide");
  643.                                if(data.resultCode===202 || data.resultCode===200){
  644.                                    Swal.fire({
  645.                                        title: data.message,
  646.                                        icon: 'success',
  647.                                        showClass: {
  648.                                            popup: 'animate__animated animate__fadeInDown'
  649.                                        },
  650.                                        hideClass: {
  651.                                            popup: 'animate__animated animate__fadeOutUp'
  652.                                        }
  653.                                    })
  654.                                }else {
  655.                                    Swal.fire({
  656.                                        title: data.message,
  657.                                        icon: 'success',
  658.                                        showClass: {
  659.                                            popup: 'animate__animated animate__fadeInDown'
  660.                                        },
  661.                                        hideClass: {
  662.                                            popup: 'animate__animated animate__fadeOutUp'
  663.                                        }
  664.                                    })
  665.                                }
  666.                            },
  667.                            error:function (xhr, textStatus, errorThrown) {
  668.                                console.log(xhr);
  669.                                var data=JSON.parse(xhr.responseJSON);
  670.                                Swal.fire({
  671.                                    title: data.message,
  672.                                    icon: 'error',
  673.                                    text: "You can be redirected to the previous page",
  674.                                    showClass: {
  675.                                        popup: 'animate__animated animate__fadeInDown'
  676.                                    },
  677.                                    hideClass: {
  678.                                        popup: 'animate__animated animate__fadeOutUp'
  679.                                    }
  680.                                })
  681.                                $("#btnBook").removeClass("disabled");
  682.                                $("#btnBookLoading").addClass("hide");
  683.                            }
  684.                        });
  685.                    }
  686.                });
  687.            }
  688.         }
  689.         var tokenUser= getCookie("{{ companyName }}_user_token");
  690.         if(tokenUser!=""){
  691.             getMessage();
  692.         }
  693.         function getMessage() {
  694.             $.ajax({
  695.                 method: "POST",
  696.                 tryCount  : 0,
  697.                 retryLimit  : 4,
  698.                 url: "{{ path('app_get_announce_message') }}",
  699.                 "headers": {
  700.                     "Content-Type": "application/json"
  701.                 },
  702.                 data: JSON.stringify({
  703.                     "announce":"{{ current_announce.id }}",
  704.                     "_user_token":getCookie("{{ companyName }}_user_token"),
  705.                 }),
  706.                 beforeSend:function () {
  707.                     $("#messageBody").html("").css("height","100px");
  708.                 },
  709.                 success: function(data){
  710.                     console.log(data);
  711.                     var i=0;
  712.                     if(data.result!=null){
  713.                         if(data.result.length>4){
  714.                             $("#messageBody")  .css("height","600px");
  715.                         }else{
  716.                             $("#messageBody").css("height","300px");
  717.                         }
  718.                          for(i=0; i< data.result.length; i++){
  719.                              if (data.result[i].sendBy===data.userId){
  720.                                  if(data.result[i].vue){
  721.                                      $("#messageBody").append(
  722.                                          `<br>  <br>
  723.                                 <div  class="col s12 right-aligned right l7   card z-depth-2" style="right:0;    padding: 20px; background-color: rgba(192,220,126,0); border-bottom-left-radius: 30px;  border-top-right-radius: 30px; ">
  724.                                 <img class="circle" style="width:40px; height:40px" src="{{ asset('img/login.png') }}"  alt=""> <p  style="margin-top:-10px">`
  725.                                          + data.result[i].message + `</p>
  726.                                          <p class="right-aligned right" style="margin-top:-10px"> ` + data.result[i].createdAt + ` <i class="fas fa-check-double  " style="font-size:10px; color:blue"> </i> </p></div>
  727.                                  `
  728.                                      );
  729.                                  }else{
  730.                                      $("#messageBody").append(
  731.                                          `<br>  <br>
  732.                                 <div  class="col s12 right-aligned l7  right    card z-depth-2" style="right:0;   padding: 20px; background-color: rgba(192,220,126,0); border-bottom-left-radius: 30px;  border-top-right-radius: 30px; ">
  733.                                 <img class="circle" style="width:40px; height:40px" src="{{ asset('img/login.png') }}"  alt=""><p  style="margin-top:-10px">` + data.result[i].message + `</p>
  734.                                     <p class="right-aligned right" style="margin-top:-10px"> ` + data.result[i].createdAt + ` <i class="fas fa-check-double   " style="font-size:10px; color:gray"> </i></p> </div>
  735.                                  `
  736.                                      );
  737.                                  }
  738.                              }else{
  739.                                  if(data.result[i].vue){
  740.                                  $("#messageBody").append(
  741.                                      `
  742.                                 <br>
  743.                                 <br>
  744.                                 <div class="col s12 l7 left left 1 card z-depth-2" style=" left: 0;   padding: 20px; background-color: rgba(0,172,193,0.21);  border-top-right-radius: 30px;  border-bottom-left-radius: 30px">
  745.                                 <img class="circle" style="width:40px; height:40px" src="{{ asset('img/login.png') }}"  alt=""><p  style="margin-top:-10px"> ` + data.result[i].message + `</p>
  746.                                 <p class="right-aligned " style="margin-top:-10px">` + data.result[i].createdAt + `  <i class="fas fa-check-double  " style="font-size:10px; color:blue"> </i></p> </div>
  747.                                  `
  748.                                  );
  749.                                  }else{
  750.                                      $("#messageBody").append(
  751.                                          `
  752.                                 <br>
  753.                                 <br>
  754.                                 <div class="col s12 left l7  card z-depth-2" style=" left: 0;   padding: 20px; background-color: rgba(0,172,193,0.21);  border-top-right-radius: 30px;  border-bottom-left-radius: 30px">
  755.                                 <img class="circle" style="width:40px; height:40px" src="{{ asset('img/login.png') }}"  alt=""><p  style="margin-top:-10px">` + data.result[i].message + `</p>
  756.                                     <p class="right-aligned right " style="margin-top:-10px">` + data.result[i].createdAt + `  <i class="fas fa-check-double   " style="font-size:10px; color:gray"> </i></p></div>
  757.                                  `
  758.                                      );
  759.                                  }
  760.                              }
  761.                          }
  762.                     }
  763.                 },
  764.                 error:function (xhr, textStatus, errorThrown) {
  765.                     console.log(xhr);
  766.                 }
  767.             });
  768.         }
  769.         function postMessage() {
  770.             var tokenUser= getCookie("{{ companyName }}_user_token");
  771.             if(tokenUser===""){
  772.                 $('#modal1').modal('open',{
  773.                     dismissible: true, // Modal can be dismissed by clicking outside of the modal
  774.                     opacity: .8, // Opacity of modal background
  775.                     inDuration: 300, // Transition in duration
  776.                     outDuration: 200, // Transition out duration
  777.                     startingTop: '2%', // Starting top style attribute
  778.                     endingTop: '15%', // Ending top style attribute
  779.                     width: '60%',
  780.                     ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available.
  781.                     },
  782.                     complete: function() {
  783.                     } // Callback for Modal close
  784.                 });
  785.             }else {
  786.                 $.ajax({
  787.                     method: "POST",
  788.                     tryCount: 0,
  789.                     retryLimit: 4,
  790.                     url: "{{ path('app_post_announce_message') }}",
  791.                     "headers": {
  792.                         "Content-Type": "application/json"
  793.                     },
  794.                     data: JSON.stringify({
  795.                         "announce": "{{ current_announce.id }}",
  796.                         "messageType": "text",
  797.                         "message": $("#messageToSend").val(),
  798.                         "_user_token": getCookie("{{ companyName }}_user_token"),
  799.                     }),
  800.                     beforeSend: function () {
  801.                         $("#btnSendMessage").addClass("disabled")
  802.                     },
  803.                     success: function (data) {
  804.                         $("#btnSendMessage").removeClass("disabled");
  805.                         $("#messageToSend").val("");
  806.                         console.log(data);
  807.                         var i = 0;
  808.                          getMessage();
  809.                         Toast.fire({
  810.                             icon: 'success',
  811.                             title: "Successfully sent"
  812.                         });
  813.                     },
  814.                     error: function (xhr, textStatus, errorThrown) {
  815.                         $("#btnSendMessage").removeClass("disabled");
  816.                         console.log(xhr);
  817.                     }
  818.                 });
  819.             }
  820.         }
  821.         {% endif %}
  822.     </script>
  823. {% endblock %}