templates/tennis_court_availability/indexSingleVenue.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %} {{ date|date('D d-M') }}: {{ tennis_venue.venue }}{% endblock %}
  3. {% block body %}
  4.     <style>
  5.         .table-data th {
  6.             height: 70px;
  7.             width: 120px;
  8.             padding: 0px 10px
  9.         }
  10.         .table-data td {
  11.             height: 150px;
  12.             width: 120px;
  13.             vertical-align: middle;
  14.         }
  15.         .table-hour th {
  16.             height: 66px;
  17.             padding: 0px 10px
  18.         }
  19.         .table-hour td {
  20.             height: 150px;
  21.             vertical-align: middle;
  22.         }
  23.     </style>
  24.     {% for message in app.flashes('failed') %}
  25.         <div class="alert alert-danger">
  26.             {{ message }}
  27.         </div>
  28.     {% endfor %}
  29.     <div class="top-up-dialog col-md-3 shadow p-2 text-center">
  30.         <p><strong>Your account balance is too low to book this court. Top-up?</strong></p>
  31.         <div class="d-flex justify-content-center">
  32.             <button class="btn btn-warning w-50 close-pop-up"> Ignore</button>
  33.             <a class="btn btn-primary ml-2 w-50" href="{{ path('payments_new', {type: 'In-coming cash'}) }}">TopUp</a>
  34.         </div>
  35.     </div>
  36.     <div class="bid-dialog col-md-3 shadow-lg text-dark rounded px-0 pb-2">
  37.         <div class="py-2 text-center text-light" style="background-color: #e7e7e7"><h4 style="color:#898989"><strong>Bid Your Price</strong></h4></div>
  38.         <div class="">
  39.             <form class="bid-form px-5 pt-3 py-2" method="post">
  40.                 <div class="form-group">
  41.                     <div class="label-bid"></div>
  42.                     <input type="number" class="bid-input form-control mt-1" name="bid">
  43.                 </div>
  44.                 <div class="form-group d-flex">
  45.                     <input type="submit" name="submit" class="w-50 submit-bid-button btn btn-success d-inline ml-1"
  46.                            value="Submit">
  47.                     <input type="submit" name="cancel-submit"
  48.                            class="w-50 close-bid-button btn btn-danger d-inline" value="Cancel">
  49.                 </div>
  50.             </form>
  51.         </div>
  52.     </div>
  53.     <h1 style="color: red;">{{ tennis_venue.venue }}: {{ date|date('D d-M-Y') }}</h1>
  54.     {% include 'tennis_court_availability/parts/venue_header_single_venue.html.twig' %}
  55.     {% if tennis_venue.courtSurface != "Mixed" %}
  56.         <span style="color: green"> Surface (All Courts):</span> {{ tennis_venue.courtSurface }}<br>
  57.     {% endif %}
  58.     {% if tennis_venue.floodlights != "Yes (not all)" %}
  59.         <span style="color: blue"> Floodlights (All Courts): </span>{{ tennis_venue.floodlights }}
  60.     {% endif %}
  61.     <hr>
  62.     <h3 style="color: blue;">{{ date|date('D d-M-Y') }}</h3>
  63.     <div class="row">
  64.         <div class="d-flex w-100">
  65.             <div>
  66.                 <table class="table table-hour">
  67.                     <thead>
  68.                     <tr>
  69.                         <th>Hour
  70.                             <a href={{ path('tennis_court_availability_scrape', {venue: tennis_venue.id, date: date|date('Y-m-d')}) }}>
  71.                                 <i style="font-size: 15px; color: red; background-color: yellow"
  72.                                    class="fas fa-download"></i></a>
  73.                         </th>
  74.                         {% if is_granted('ROLE_ACEIFY') and app.user.id != ActiveAceifyClient.findClient(app.user).id %}
  75.                             <th>
  76.                                 Email
  77.                             </th>
  78.                         {% endif %}
  79.                     </tr>
  80.                     </thead>
  81.                     <tbody>
  82.                     {% for hour in hours %}
  83.                         <tr>
  84.                             <td style="text-align: right" data-sort="{{ hour.sort }}"><b>{{ hour.hour }}</b></td>
  85.                             {% if is_granted('ROLE_ACEIFY') and app.user.id != ActiveAceifyClient.findClient(app.user).id %}
  86.                                 <td style="text-align: center">
  87.                                     {% set client_court_flag = 0 %}
  88.                                     {% for client_court_time in client_court_times %}
  89.                                         {% if client_court_time.date == date and client_court_time.hour == hour.sort %}
  90.                                             {% set client_court_flag =1 %}
  91.                                             <form method="post"
  92.                                                   action="{{ path('client_court_times_delete', {'id': client_court_time.id}) }}">
  93.                                                 <input type="hidden" name="_token"
  94.                                                        value="{{ csrf_token('delete' ~ client_court_time.id) }}">
  95.                                                 <button style="background-color: white;border:none"><i
  96.                                                             style="color: green" class="fa fa-calendar-check"></i>
  97.                                                 </button>
  98.                                             </form>
  99.                                         {% endif %}
  100.                                     {% endfor %}
  101.                                     {% if client_court_flag ==0 %}
  102.                                         <a href="{{ path('client_court_times_new', {date: date|date('Y-m-d'), hour: hour.sort}) }}">
  103.                                             <i style="color: grey" class="fa fa-circle"></i>
  104.                                         </a>
  105.                                     {% endif %}
  106.                                 </td>
  107.                             {% endif %}
  108.                         </tr>
  109.                     {% endfor %}
  110.                     </tbody>
  111.                 </table>
  112.             </div>
  113.             <div class="table-data-container">
  114.                 <table class="table table-responsive table-data">
  115.                     <thead>
  116.                     <tr>
  117.                         {% for i in range(1,number_of_courts) %}
  118.                             <th style="text-align: center">
  119.                                 <b><u>Court: {{ i }}</u></b><br>
  120.                                 {% if tennis_venue.courtSurface =="Mixed" %}
  121.                                     <span style="color: green"> {{ CourtSurfaceAndFloodlights.returnCourtSurfaceByVenueAndCourt(tennis_venue, i) }} Court; </span>
  122.                                 {% endif %}
  123.                                 {% if tennis_venue.floodlights =="Yes (not all)" %}
  124.                                     {% if CourtSurfaceAndFloodlights.returnFloodlightsByVenueAndCourt(tennis_venue, i) =="Yes" %}
  125.                                         <span style="color: blue">  Floodlights </span>
  126.                                     {% endif %}
  127.                                 {% endif %}
  128.                             </th>
  129.                         {% endfor %}
  130.                         {% include 'tennis_court_availability/parts/weather_headers.html.twig' %}
  131.                     </tr>
  132.                     </thead>
  133.                     <tbody>
  134.                     {% for hour in hours %}
  135.                         {% set past_or_future = "default" %}
  136.                         {% if date|date('Y-m-d') < today|date('Y-m-d') or hour.sort < todayHour and date|date('Y-m-d') == today|date('Y-m-d') %}
  137.                             <tr style="background-color: whitesmoke">
  138.                             {% set past_or_future = "Past" %}
  139.                         {% else %}
  140.                             {% if hour.sort == todayHour and date|date('Y-m-d') == today|date('Y-m-d') %}
  141.                                 {% set past_or_future = "Future" %}
  142.                                 <tr style="background-color: lightyellow">
  143.                             {% else %}
  144.                                 <tr>
  145.                                 {% set past_or_future = "Future" %}
  146.                             {% endif %}
  147.                         {% endif %}
  148.                         {% for i in range(1,number_of_courts) %}
  149.                             {% set availability = "-" %}
  150.                             {% set id = '' %}
  151.                             {% set court_cost='' %}
  152.                             <td style="text-align: center">
  153.                                 {% include 'template_parts/login_or_register_popup.html.twig' %}
  154.                                 {% set court = CourtAvailabilities.getCourtAvailabiliyByVenueDateHourCourt(tennis_venue, date, hour.sort, i) %}
  155.                                 {% if court is not null %}
  156.                                     {% include 'tennis_court_availability/parts/bookings_made_single_court.html.twig' %}
  157.                                     {#                                        Not yet released - Reserve #}
  158.                                     {% if court.available ==1 %}
  159.                                         {% include 'tennis_court_availability/parts/court_not_released_yet_single_court.html.twig' %}
  160.                                     {% endif %}
  161.                                     {#                                        Available #}
  162.                                     {% if court.available == 2 %}
  163.                                         {% include 'tennis_court_availability/parts/court_available_single_court.html.twig' %}
  164.                                     {% endif %}
  165.                                     {#                                        Booked #}
  166.                                     {% if court.available ==3 %}
  167.                                         {% include 'tennis_court_availability/parts/court_fully_booked_single_court.html.twig' %}
  168.                                     {% endif %}
  169.                                     {#                                        Closed #}
  170.                                     {% if court.available ==4 %}
  171.                                         {% include 'tennis_court_availability/parts/court_closed_single_court.html.twig' %}
  172.                                     {% endif %}
  173.                                 {% endif %}
  174.                             </td>
  175.                         {% endfor %}
  176.                         {% include 'tennis_court_availability/parts/weather.html.twig' %}
  177.                         </tr>
  178.                     {% endfor %}
  179.                     </tbody>
  180.                 </table>
  181.             </div>
  182.         </div>
  183.     </div>
  184.     <hr>
  185.     <br>
  186.     <br>
  187.     <br>
  188.     <br>
  189. {% endblock %}
  190. {% block datatable %}
  191.     <script>
  192.         $(document).ready(function () {
  193.             $('.table').DataTable({
  194.                 'pageLength': 50,
  195.                 "order": [[0, 'asc']],
  196.                 "paging": false,
  197.                 "searching": false,
  198.                 "bInfo": false,
  199.                 "responsive": false,
  200.                 "sort": false
  201.             });
  202.         });
  203.     </script>
  204.     <script>
  205.         {% if app.user %}
  206.         function checkAccountBalance(id) {
  207.             var bidPrice = $("#bid-input-reserve" + id).val();
  208.             var balance = {{ (Payments.TotalPaymentsMade(ActiveAceifyClient.findClient(app.user)) -
  209.             Payments.TotalBookingsCost(ActiveAceifyClient.findClient(app.user))) }};
  210.             if (balance < parseInt(bidPrice)) {
  211.                 $(".close").click();
  212.                 $(".top-up-dialog").css('display', 'block');
  213.                 return false;
  214.             } else {
  215.                 return true;
  216.             }
  217.         }
  218.         function checkAccountBalanceConfirm(price) {
  219.             {% if is_granted('ROLE_ACEIFY') %}
  220.             {% else %}
  221.             var balance = {{ (Payments.TotalPaymentsMade(ActiveAceifyClient.findClient(app.user)) -
  222.             Payments.TotalBookingsCost(ActiveAceifyClient.findClient(app.user))) }};
  223.             if (balance < price) {
  224.                 $(".close").click();
  225.                 $(".top-up-dialog").css('display', 'block');
  226.                 return false;
  227.             } else {
  228.                 return true;
  229.             }
  230.             {% endif %}
  231.             {% endif %}
  232.         }
  233.         $('.close-pop-up').click(function () {
  234.             $(".top-up-dialog").css('display', 'none');
  235.         });
  236.         var date = '';
  237.         var hour = '';
  238.         var venue = '';
  239. {#        {% endif %}#}
  240.         function bid(date, hour, venue) {
  241.             date = date;
  242.             hour = hour;
  243.             venue = venue;
  244.             $(".bid-dialog").css('display', 'block');
  245.             $(".label-bid").html("<p class='mb-0' style='font-size: 20.5px;color:#878787'><strong>Please enter your bid for the court on " + date + " at " + hour + "h at " + venue + "</strong></p>");
  246.             $(".submit-bid-button").click(function (e) {
  247.                 e.preventDefault();
  248.                 var bid = $('.bid-input').val();
  249.                 {# var href = "/tennis/bookings/advanceReservation/" + date + "/" + hour + "/" + venue + "/{{ app.user.id }}/" + bid + ""; #}
  250.                 $(".bid-dialog").css("display", "none");
  251.                 window.location.href = href;
  252.             });
  253.             $(".close-bid-button").click(function (e) {
  254.                 e.preventDefault();
  255.                 $(".bid-dialog").css("display", "none");
  256.             })
  257.             return false;
  258.         }
  259.     </script>
  260.     <script>
  261.         ///   $("table").removeClass('table-responsive');
  262.     </script>
  263. {% endblock datatable %}
  264. {% block additionaljs %}
  265.     <script>
  266.         $(document).ready(function () {
  267.             var height = $('.table-data thead tr th').height();
  268.             $('.table-hour thead tr th').height(height);
  269.         })
  270.     </script>
  271. {% endblock %}