templates/frontend/static/student_parent.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     {{ 'student_and_parent'|trans }}
  4. {% endblock %}
  5. {% block css %}
  6.     <style>
  7.         .ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){
  8.             border-color: transparent!important;
  9.         }
  10.         .ck.ck-editor__main>.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{
  11.             border: transparent!important;
  12.         }
  13.        /* #watermark {
  14.             height: 400px;
  15.             width: 100%;
  16.             padding-top: 30px;
  17.             overflow: hidden;
  18.             background-color: {% if first_color != ''%}{{first_color}}{% else %}#7f3e98{% endif %}30;
  19.         }*/
  20.         .team3 {
  21.             font-size: 16px;
  22.         }
  23.         .team3 h1,
  24.         .team3 h2,
  25.         .team3 h3,
  26.         .team3 h4,
  27.         .team3 h5,
  28.         .team3 h6 {
  29.             color: #3e4555;
  30.         }
  31.         .team3 .font-weight-medium {
  32.             font-weight: 500;
  33.         }
  34.         .team3 .bg-light {
  35.             background-color: #f4f8fa !important;
  36.         }
  37.         .team3 .subtitle {
  38.             color: #8d97ad;
  39.             line-height: 24px;
  40.             font-size: 13px;
  41.         }
  42.         .team3 ul {
  43.             margin-top: 30px;
  44.         }
  45.         .team3 h5 {
  46.             line-height: 22px;
  47.             font-size: 18px;
  48.         }
  49.         .team3 ul li a {
  50.             color: #8d97ad;
  51.             padding-right: 15px;
  52.             -webkit-transition: 0.1s ease-in;
  53.             -o-transition: 0.1s ease-in;
  54.             transition: 0.1s ease-in;
  55.         }
  56.         .team3 ul li a:hover {
  57.             -webkit-transform: translate3d(0px, -5px, 0px);
  58.             transform: translate3d(0px, -5px, 0px);
  59.             color: #316ce8;
  60.         }
  61.         .team3 .title {
  62.             margin: 30px 0 0 0;
  63.         }
  64.         .team3 .subtitle {
  65.             margin: 0 0 0px 0;
  66.             font-size: 13px;
  67.         }
  68.     </style>
  69.     <style>
  70.         /* TIMELINE
  71.         –––––––––––––––––––––––––––––––––––––––––––––––––– */
  72.         .timeline {
  73.             white-space: nowrap;
  74.             overflow-x: hidden;
  75.         }
  76.         .timeline ol {
  77.             font-size: 0;
  78.             width: 100vw;
  79.             padding: 250px 0;
  80.             transition: all 1s;
  81.         }
  82.         .timeline ol li {
  83.             position: relative;
  84.             display: inline-block;
  85.             list-style-type: none;
  86.             width: 160px;
  87.             height: 3px;
  88.             background: {% if first_color != ''%}{{first_color}}{% else %}#7f3e98{% endif %}!important;
  89.         }
  90.         .timeline ol li:last-child {
  91.             width: 250px;
  92.         }
  93.         .timeline ol li:not(:first-child) {
  94.             margin-left: 14px;
  95.         }
  96.         .timeline ol li div {
  97.             position: absolute;
  98.             left: calc(100% + 7px);
  99.             width: 250px;
  100.             padding: 15px;
  101.             font-size: 1rem;
  102.             white-space: normal;
  103.             color: black;
  104.             background: white;
  105.         }
  106.         .timeline ol li div::before {
  107.             content: '';
  108.             position: absolute;
  109.             top: 100%;
  110.             left: 0;
  111.             width: 0;
  112.             height: 0;
  113.             border-style: solid;
  114.         }
  115.         .timeline ol li:nth-child(odd) div {
  116.             top: -16px;
  117.             transform: translateY(-100%);
  118.         }
  119.         .timeline ol li:nth-child(odd) div::before {
  120.             top: 100%;
  121.             border-width: 8px 8px 0 0;
  122.             border-color: white transparent transparent transparent;
  123.         }
  124.         .timeline ol li:nth-child(even) div {
  125.             top: calc(100% + 16px);
  126.         }
  127.         .timeline ol li:nth-child(even) div::before {
  128.             top: -8px;
  129.             border-width: 8px 0 0 8px;
  130.             border-color: transparent transparent transparent white;
  131.         }
  132.         .timeline time {
  133.             display: block;
  134.             font-weight: bold;
  135.             margin-bottom: 8px;
  136.         }
  137.         /* TIMELINE ARROWS
  138.         –––––––––––––––––––––––––––––––––––––––––––––––––– */
  139.         .timeline .arrows {
  140.             display: flex;
  141.             justify-content: center;
  142.             margin-bottom: 20px;
  143.         }
  144.         .timeline .arrows .arrow__prev {
  145.             margin-right: 20px;
  146.         }
  147.         .timeline .disabled {
  148.             opacity: .5;
  149.         }
  150.         .timeline .arrows img {
  151.             width: 45px;
  152.             height: 45px;
  153.         }
  154.         /* GENERAL MEDIA QUERIES
  155.         –––––––––––––––––––––––––––––––––––––––––––––––––– */
  156.         @media screen and (max-width: 599px) {
  157.             .timeline ol,
  158.             .timeline ol li {
  159.                 width: auto;
  160.             }
  161.             .timeline ol {
  162.                 padding: 0;
  163.                 transform: none !important;
  164.             }
  165.             .timeline ol li {
  166.                 display: block;
  167.                 height: auto;
  168.                 background: transparent;
  169.             }
  170.             .timeline ol li:first-child {
  171.                 margin-top: 25px;
  172.             }
  173.             .timeline ol li:not(:first-child) {
  174.                 margin-left: auto;
  175.             }
  176.             .timeline ol li div {
  177.                 width: 94%;
  178.                 height: auto !important;
  179.                 margin: 0 auto 25px;
  180.             }
  181.             .timeline ol li div {
  182.                 position: static;
  183.             }
  184.             .timeline ol li:nth-child(odd) div {
  185.                 transform: none;
  186.             }
  187.             .timeline ol li:nth-child(odd) div::before,
  188.             .timeline ol li:nth-child(even) div::before {
  189.                 left: 50%;
  190.                 top: 100%;
  191.                 transform: translateX(-50%);
  192.                 border: none;
  193.                 border-left: 1px solid white;
  194.                 height: 25px;
  195.             }
  196.             .timeline ol li:last-child,
  197.             .timeline ol li:nth-last-child(2) div::before,
  198.             .timeline ol li:not(:last-child)::after,
  199.             .timeline .arrows {
  200.                 display: none;
  201.             }
  202.         }
  203.         .section {
  204.             padding: 50px 0;
  205.         }
  206.         .section .container {
  207.             width: 90%;
  208.             max-width: 1200px;
  209.             margin: 0 auto;
  210.             text-align: center;
  211.         }
  212.         .section h1 {
  213.             font-size: 2.5rem;
  214.         }
  215.         .section h2 {
  216.             font-size: 1.3rem;
  217.         }
  218.         figure img{
  219.             min-width: 320px!important;
  220.             max-width: 500px;
  221.         }
  222.         @media only screen and (max-width: 425px){
  223.             figure img{
  224.                 min-width: 350px!important;
  225.                 max-width: 100%!important;
  226.             }
  227.         }
  228.         .card-body{
  229.             padding-left: 0rem !important;
  230.             padding-right: 0rem !important;
  231.         }
  232.     </style>
  233. {% endblock %}
  234. {% block body %}
  235.     <div class=" d-flex flex-column flex-row-fluid">
  236.         <div class="card-body  pt-10">
  237.             <div class="row  ">
  238.                 {% if page_pedagogy is not null %}
  239.                     <div class="container scrool-div" id="{{ page_pedagogy.slug }}">
  240.                         <h2 class="bold text-center text-primary mb-5">{{ page_pedagogy.name }}</h2>
  241.                         <div class="separator"></div>
  242.                             <div class=" mt-4 row   mb-8">
  243.                                 {% set colors = ['#f65151','#ca51f6','#518ef6','#dec27e','#de997e','#F0FFF0','#FFA07A','#228B22','#00FFFF','#FF69B4','#CD853F'] %}
  244.                                 <div class="accordion" id="accordionExample">
  245.                                     <div class="accordion-item">
  246.                                         <h2 class="accordion-header" id="headingOne">
  247.                                             <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
  248.                                                 <h3 class="title text-primary">{{ 'class_list'|trans }}</h3>
  249.                                             </button>
  250.                                         </h2>
  251.                                         <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
  252.                                             <div class="accordion-body row" style="overflow-y: scroll; height: 300px">
  253.                                                 {% for c  in classes %}
  254.                                                     <div class=" col-md-4 col-lg-4 col-sm-12 col-xs-12 ">
  255.                                                         <div class="card m-4" style="border-style: solid;background-color: {{ colors[random(1,10)] }}">
  256.                                                             <div class="card-header" style="border-bottom: none;padding: 10px">
  257.                                                                 <h3 class="card-title">{{ c.name }}</h3>
  258.                                                                 <div class="card-toolbar">
  259.                                                                     <button type="button" class="btn btn-sm btn-light btn-show-class" data-id="{{ c.id }}" data-name="{{ c.name }}">
  260.                                                                         <span class="fa fa-book"></span>
  261.                                                                     </button>
  262.                                                                 </div>
  263.                                                             </div>
  264.                                                         </div>
  265.                                                     </div>
  266.                                                 {% endfor %}
  267.                                             </div>
  268.                                         </div>
  269.                                     </div>
  270.                                 </div>
  271.                             </div>
  272.                         <div class="row">
  273.                             <div class="accordion" id="accordionExample2">
  274.                                 <div class="accordion-item">
  275.                                     <h2 class="accordion-header" id="headingOne1">
  276.                                         <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne1" aria-expanded="true" aria-controls="collapseOne1">
  277.                                             <h3 class="title text-primary">{{ 'school_department'|trans }}</h3>
  278.                                         </button>
  279.                                     </h2>
  280.                                     <div id="collapseOne1" class="accordion-collapse collapse show" aria-labelledby="headingOne1" data-bs-parent="#accordionExample1">
  281.                                         <div class="accordion-body row" style="overflow-y: scroll; height: 300px">
  282.                                             {% for c  in departments %}
  283.                                                 <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 p-4">
  284.                                                     <div class="card" style="border-style: solid;background-color: {{ colors[random(1,10)] }}">
  285.                                                         <div class="card-header" style="border-bottom: none;padding: 10px">
  286.                                                             <h3 class="card-title">{{ c.name }}</h3>
  287.                                                             <div class="card-toolbar">
  288.                                                                 <button type="button" class="btn btn-sm btn-light btn-show-team" data-id="{{ c.id }}" data-name="{{ c.name }}">
  289.                                                                     <span class="fa fa-user-friends"></span>
  290.                                                                 </button>
  291.                                                             </div>
  292.                                                         </div>
  293.                                                     </div>
  294.                                                 </div>
  295.                                             {% endfor %}
  296.                                         </div>
  297.                                     </div>
  298.                                 </div>
  299.                             </div>
  300.                         </div>
  301.                     </div>
  302.                 {% endif %}
  303.             </div>
  304.             <div class="row "  style="margin-top: 80px;">
  305.                 {% if page_calendar is not null %}
  306.                     <div class="container scrool-div" id="{{ page_calendar.slug }}">
  307.                         <h2 class="bold text-center text-primary mb-5 mt-5">{{ page_calendar.name }}</h2>
  308.                         <div class="row" style="">
  309.                             <section class="timeline">
  310.                                 <ol>
  311.                                     {% for e in events %}
  312.                                         <li>
  313.                                             <div style="max-height: 160px!important;">
  314.                                                 <a href="javascript:void(0)" class="btn-show fs-7" data-id="{{ e.id }}">
  315.                                                     <em class="fs-7"  style="font-weight: bold;">{{ e.date_event2 | date('F') |trans }}</em><br/>
  316.                                                     <time class="fs-8" style="{% if e.past == '0' %} color: {% if first_color != ''%}{{first_color}}{% else %}#7f3e98{% endif %}; {% endif %}">{{ e.date_event2 }}</time>  {{ e.description|striptags|u.truncate(80, '...')|raw  }}</a>
  317.                                             </div>
  318.                                         </li>
  319.                                     {% endfor %}
  320.                                     <li></li>
  321.                                 </ol>
  322.                                 <div class="arrows">
  323.                                     <button class="arrow arrow__prev disabled btn btn-primary" disabled>
  324.                                         <span class="bi bi-caret-left fs-1"></span>
  325.                                     </button>
  326.                                     <button class="arrow arrow__next btn btn-primary">
  327.                                         <span class="bi bi-caret-right  fs-1"></span>
  328.                                     </button>
  329.                                 </div>
  330.                             </section>
  331.                         </div>
  332.                     </div>
  333.                 {% endif %}
  334.             </div>
  335.             <div class="row  " style="margin-top: 80px;">
  336.                 {% if page_admission is not null %}
  337.                     <div class="container scrool-div" id="{{ page_admission.slug }}">
  338.                         <h2 class="bold text-center text-primary mb-5 mt-5">{{ page_admission.name }}</h2>
  339.                         <div class="row mt-4">
  340.                             <div class="card shadow-sm">
  341.                                 <div class="card-header">
  342.                                     <h3 class="card-title"><span class="text-muted" style="margin-right: 10px;">{{ school_global.name  }}</span>   <span class="text-primary">{{ 'admission_requirements'|trans }}</span></h3>
  343.                                 </div>
  344.                                 <div class="card-body" id="watermark">
  345.                                     <ul style="list-style: none">
  346.                                         {% for c in admission_infos %}
  347.                                             <li class="ck ck-content ck-editor__editable ck-rounded-corners ck-editor__editable_inline ck-read-only ck-blurred">
  348.                                                 {{ c.description|raw }}
  349.                                             </li>
  350.                                         {% endfor %}
  351.                                     </ul>
  352.                                 </div>
  353.                                 <div class="card-footer pt-20">
  354.                                     {% for r in admission_pages %}
  355.                                         <div class="ck ck-content ck-editor__editable ck-rounded-corners ck-editor__editable_inline ck-read-only ck-blurred" lang="en" dir="ltr" role="textbox" aria-label="Rich Text Editor, main" contenteditable="false">
  356.                                             {{ r.schoolFeeDescription|raw }}
  357.                                         </div>
  358.                                         <div class="ck ck-content ck-editor__editable ck-rounded-corners ck-editor__editable_inline ck-read-only ck-blurred" lang="en" dir="ltr" role="textbox" aria-label="Rich Text Editor, main" contenteditable="false">
  359.                                             {{ r.schoolFeeOther|raw }}
  360.                                         </div>
  361.                                     {% endfor %}
  362.                                 </div>
  363.                             </div>
  364.                         </div>
  365.                     </div>
  366.                 {% endif %}
  367.             </div>
  368.         </div>
  369.     </div>
  370.     <div class="modal fade" data-bs-focus="false" tabindex="-1" id="kt_modal_show">
  371.         <div class="modal-dialog">
  372.             <div class="modal-content">
  373.                 <div class="modal-header">
  374.                     <h5 class="modal-title" id="modal_show_title">
  375.                         <span class="fa fa-spin fa-satellite"></span>
  376.                     </h5>
  377.                     <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
  378.                         <span class="fa fa-window-close"></span>
  379.                     </div>
  380.                     <!--end::Close-->
  381.                 </div>
  382.                 <div class="modal-body">
  383.                     <div class=" d-flex flex-column flex-row-fluid " id="modal_show_img">
  384.                     </div>
  385.                     <div class=" d-flex flex-column flex-row-fluid" id="modal_show_content">
  386.                     </div>
  387.                 </div>
  388.                 <div class="modal-footer">
  389.                     <button type="button" class="btn btn-light" data-bs-dismiss="modal">{{ 'close'|trans }}</button>
  390.                 </div>
  391.             </div>
  392.         </div>
  393.     </div>
  394.     <div class="modal fade" data-bs-focus="false" tabindex="-1" id="kt_modal_class_and_course">
  395.         <div class="modal-dialog modal-fullscreen">
  396.             <div class="modal-content">
  397.                 <div class="modal-header">
  398.                     <h5 class="modal-title" id="class_name">
  399.                     </h5>
  400.                     <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
  401.                         <span class="fa fa-window-close"></span>
  402.                     </div>
  403.                 </div>
  404.                 <div class="modal-body">
  405.                     <h2>{{ 'course_list'|trans }}</h2>
  406.                     <div class="mb-10 mt-10 row" id="course_list">
  407.                     </div>
  408.                 </div>
  409.                 <div class="modal-footer">
  410.                     <button type="button" class="btn btn-light" data-bs-dismiss="modal">{{ 'close'|trans }}</button>
  411.                 </div>
  412.             </div>
  413.         </div>
  414.     </div>
  415.     <div class="modal fade" data-bs-focus="false" tabindex="-1" id="kt_modal_team">
  416.         <div class="modal-dialog modal-fullscreen">
  417.             <div class="modal-content">
  418.                 <div class="modal-header">
  419.                     <h5 class="modal-title" id="department_name">
  420.                     </h5>
  421.                     <div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
  422.                         <span class="fa fa-window-close"></span>
  423.                     </div>
  424.                 </div>
  425.                 <div class="modal-body">
  426.                     <h2>{{ 'staff_member'|trans }}</h2>
  427.                     <div class="mb-10 mt-10 row" id="member_list">
  428.                     </div>
  429.                 </div>
  430.                 <div class="modal-footer">
  431.                     <button type="button" class="btn btn-light" data-bs-dismiss="modal">{{ 'close'|trans }}</button>
  432.                 </div>
  433.             </div>
  434.         </div>
  435.     </div>
  436. {% endblock %}
  437.  {% block js %}
  438.      <script src="{{ asset('assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js') }}"></script>
  439.      <script src="{{ asset('assets/js/hammer.min.js') }}"></script>
  440.      <script id="classCourse" type="text/html">
  441.          <div class="col-md-4 col-lg-4 mb-5 border-dashed p-2" style="[[back_color]]">
  442.              <div class="form-check form-check-custom form-check-solid">
  443.                  <label class="form-check-label bold">
  444.                      [[course_name]]
  445.                  </label>
  446.              </div>
  447.              <div class="input-group mb-5 mt-5">
  448.                  <span class="input-group-text">{{ 'week_hour'|trans }}</span>
  449.                  <span class="input-group-text">[[week_hour]]</span>
  450.              </div>
  451.              <div class="input-group mb-5 mt-5">
  452.                  <span class="input-group-text">{{ 'year_hour'|trans }}</span>
  453.                  <span class="input-group-text">[[year_hour]]</span>
  454.              </div>
  455.              <div class="input-group mb-5 mt-5">
  456.                  <span class="input-group-text">{{ 'coefficient'|trans }}</span>
  457.                  <span class="input-group-text">[[coefficient]]</span>
  458.              </div>
  459.          </div>
  460.      </script>
  461.      <script id="teamMemberHtml" type="text/html">
  462.          <div class="col-lg-3 mb-4 team3">
  463.              <div class="row">
  464.                  <div class="col-md-12">
  465.                      <img style="width: 270px;height: 250px" src="[[image]]" alt="wrapkit" class="img-fluid" />
  466.                  </div>
  467.                  <div class="col-md-12">
  468.                      <div class="pt-2">
  469.                          <h3 class="mt-4 font-weight-medium mb-0">[[name]]</h3>
  470.                          <h4 class="subtitle">[[position]]</h4>
  471.                          <h4 class="subtitle">[[department]]</h4>
  472.                          <a href = "mailto: [[email1]]" class="subtitle"> [[email2]]</a>
  473.                          <a href = "tel: [[phone1]]" class="subtitle"> [[phone2]]</a>
  474.                      </div>
  475.                  </div>
  476.              </div>
  477.          </div>
  478.      </script>
  479.      <script>
  480.          $(document).ready(function (){
  481.          })
  482.      </script>
  483.      <script>
  484.          let colors = ['#f65151','#ca51f6','#518ef6','#dec27e','#de997e','#F0FFF0','#FFA07A','#228B22','#00FFFF','#FF69B4','#CD853F'];
  485.          function getRandomInt(max) {
  486.              return Math.floor(Math.random() * max);
  487.          }
  488.          $(document).ready(function (){
  489.              //let modalShow = bootstrap.Modal.getOrCreateInstance(document.getElementById('kt_modal_show'));
  490.              let modalManageCourse = bootstrap.Modal.getOrCreateInstance(document.getElementById('kt_modal_class_and_course'));
  491.              let modalManageTeam = bootstrap.Modal.getOrCreateInstance(document.getElementById('kt_modal_team'));
  492.              $('.btn-show-class').on('click', function () {
  493.                  let url = "{{ path('get_class_course_list',{'id':'00000'}) }}";
  494.                  url = url.replace('00000',this.getAttribute('data-id'));
  495.                  let name = this.getAttribute('data-name');
  496.                  $('#class_name').html(name);
  497.                  $('#item_class').val(this.getAttribute('data-id'));
  498.                  $.ajax({
  499.                      url: url,
  500.                      type: 'GET',
  501.                      dataType: 'json',
  502.                      success: function(res){
  503.                          $('#course_list').html('');
  504.                          let templateRep = document.getElementById("classCourse");
  505.                          let templateRepHtml = templateRep.innerHTML;
  506.                          res.data.forEach(function (item){
  507.                              let listHtml = "";
  508.                              listHtml += templateRepHtml.replace("[[course_name]]",item.class_course.name)
  509.                                  .replace("[[back_color]]","background-color:"+colors[getRandomInt(10)])
  510.                                  .replace("[[week_hour]]",item.week_hour)
  511.                                  .replace("[[year_hour]]",item.year_hour)
  512.                                  .replace("[[coefficient]]",item.coefficient)
  513.                              ;
  514.                              $('#course_list').append(listHtml);
  515.                          });
  516.                          modalManageCourse.show();
  517.                      },
  518.                      error :function (error) {
  519.                          Swal.fire({
  520.                              text: "{{ 'object_not_found'|trans }}",
  521.                              icon: "error",
  522.                              buttonsStyling: false,
  523.                              confirmButtonText: "{{ 'close'|trans }}",
  524.                              customClass: {
  525.                                  confirmButton: "btn btn-primary"
  526.                              }
  527.                          });
  528.                      }
  529.                  });
  530.              });
  531.              $('.btn-show-team').on('click', function () {
  532.                  let url = "{{ path('app_get_team_member_by_department',{'id':'00000'}) }}";
  533.                  url = url.replace('00000',this.getAttribute('data-id'));
  534.                  let name = this.getAttribute('data-name');
  535.                  $('#department_name').html(name);
  536.                  $.ajax({
  537.                      url: url,
  538.                      type: 'GET',
  539.                      dataType: 'json',
  540.                      success: function(res){
  541.                          $('#member_list').html('');
  542.                          let templateRep1 = document.getElementById("teamMemberHtml");
  543.                          let templateRepHtml1 = templateRep1.innerHTML;
  544.                          res.data.forEach(function (item){
  545.                              let listHtml = "";
  546.                              let imgUrl = "{{ asset('assets/media/avatars/user.png') }}";
  547.                              if(item.image.length>0){
  548.                                  imgUrl = "{{ asset('uploads/') }}"+item.image;
  549.                              }
  550.                              listHtml = templateRepHtml1.replace("[[name]]",item.name)
  551.                                  .replace("[[position]]",item.position.name)
  552.                                  .replace("[[email2]]",item.email)
  553.                                  .replace("[[email1]]",item.email)
  554.                                  .replace("[[phone1]]",item.phone)
  555.                                  .replace("[[phone2]]",item.phone)
  556.                                  .replace("[[image]]",imgUrl)
  557.                                  .replace("[[department]]",item.department.name)
  558.                              ;
  559.                              console.log(listHtml);
  560.                              $('#member_list').append(listHtml);
  561.                          });
  562.                          modalManageTeam.show();
  563.                      },
  564.                      error :function (error) {
  565.                          Swal.fire({
  566.                              text: "{{ 'object_not_found'|trans }}",
  567.                              icon: "error",
  568.                              buttonsStyling: false,
  569.                              confirmButtonText: "{{ 'close'|trans }}",
  570.                              customClass: {
  571.                                  confirmButton: "btn btn-primary"
  572.                              }
  573.                          });
  574.                      }
  575.                  });
  576.              });
  577.          })
  578.      </script>
  579.      <script>
  580.          let modalShow = bootstrap.Modal.getOrCreateInstance(document.getElementById('kt_modal_show'));
  581.          $('.btn-show').on('click', function () {
  582.              let url = "{{ path('get_one_entity',{'entity':'event','id':'00000'}) }}";
  583.              url = url.replace('00000',this.getAttribute('data-id'));
  584.              $.ajax({
  585.                  url: url,
  586.                  type: 'GET',
  587.                  dataType: 'json',
  588.                  success: function(res){
  589.                      $('#modal_show_title').html(res.data.date_event.replace('T',' '));
  590.                      $('#modal_show_content').html(res.data.description);
  591.                      if(res.data.image !== ""){
  592.                          let img='<img class="img-responsive img" style="max-width: 400px;max-height: 300px" src="'+"{{ asset('uploads/') }}"+res.data.image +'"'+' />';
  593.                          $('#modal_show_img').html(img);
  594.                      }
  595.                      else{
  596.                          $('#modal_show_img').html('');
  597.                      }
  598.                      modalShow.show();
  599.                  },
  600.                  error :function (error) {
  601.                      Swal.fire({
  602.                          text: "{{ 'object_not_found'|trans }}",
  603.                          icon: "error",
  604.                          buttonsStyling: false,
  605.                          confirmButtonText: "{{ 'close'|trans }}",
  606.                          customClass: {
  607.                              confirmButton: "btn btn-primary"
  608.                          }
  609.                      });
  610.                  }
  611.              });
  612.          });
  613.          $(document).ready(function (){
  614.              // VARIABLES
  615.              const timeline = document.querySelector(".timeline ol"),
  616.                  elH = document.querySelectorAll(".timeline li > div"),
  617.                  arrows = document.querySelectorAll(".timeline .arrows .arrow"),
  618.                  arrowPrev = document.querySelector(".timeline .arrows .arrow__prev"),
  619.                  arrowNext = document.querySelector(".timeline .arrows .arrow__next"),
  620.                  firstItem = document.querySelector(".timeline li:first-child"),
  621.                  lastItem = document.querySelector(".timeline li:last-child"),
  622.                  xScrolling = 280,
  623.                  disabledClass = "disabled";
  624.              // START
  625.              window.addEventListener("load", init);
  626.              function init() {
  627.                  setEqualHeights(elH);
  628.                  animateTl(xScrolling, arrows, timeline);
  629.                  setSwipeFn(timeline, arrowPrev, arrowNext);
  630.                  setKeyboardFn(arrowPrev, arrowNext);
  631.              }
  632.              // SET EQUAL HEIGHTS
  633.              function setEqualHeights(el) {
  634.                  let counter = 0;
  635.                  for (let i = 0; i < el.length; i++) {
  636.                      const singleHeight = el[i].offsetHeight;
  637.                      if (counter < singleHeight) {
  638.                          counter = singleHeight;
  639.                      }
  640.                  }
  641.                  for (let i = 0; i < el.length; i++) {
  642.                      //el[i].style.height = `${counter}px`;
  643.                  }
  644.              }
  645.              // CHECK IF AN ELEMENT IS IN VIEWPORT
  646.              // http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
  647.              function isElementInViewport(el) {
  648.                  const rect = el.getBoundingClientRect();
  649.                  return (
  650.                      rect.top >= 0 &&
  651.                      rect.left >= 0 &&
  652.                      rect.bottom <=
  653.                      (window.innerHeight || document.documentElement.clientHeight) &&
  654.                      rect.right <= (window.innerWidth || document.documentElement.clientWidth)
  655.                  );
  656.              }
  657.              // SET STATE OF PREV/NEXT ARROWS
  658.              function setBtnState(el, flag = true) {
  659.                  if (flag) {
  660.                      el.classList.add(disabledClass);
  661.                  } else {
  662.                      if (el.classList.contains(disabledClass)) {
  663.                          el.classList.remove(disabledClass);
  664.                      }
  665.                      el.disabled = false;
  666.                  }
  667.              }
  668.              // ANIMATE TIMELINE
  669.              function animateTl(scrolling, el, tl) {
  670.                  let counter = 0;
  671.                  for (let i = 0; i < el.length; i++) {
  672.                      el[i].addEventListener("click", function () {
  673.                          if (!arrowPrev.disabled) {
  674.                              arrowPrev.disabled = true;
  675.                          }
  676.                          if (!arrowNext.disabled) {
  677.                              arrowNext.disabled = true;
  678.                          }
  679.                          const sign = this.classList.contains("arrow__prev") ? "" : "-";
  680.                          if (counter === 0) {
  681.                              tl.style.transform = `translateX(-${scrolling}px)`;
  682.                          } else {
  683.                              const tlStyle = getComputedStyle(tl);
  684.                              // add more browser prefixes if needed here
  685.                              const tlTransform =
  686.                                  tlStyle.getPropertyValue("-webkit-transform") ||
  687.                                  tlStyle.getPropertyValue("transform");
  688.                              const values =
  689.                                  parseInt(tlTransform.split(",")[4]) +
  690.                                  parseInt(`${sign}${scrolling}`);
  691.                              tl.style.transform = `translateX(${values}px)`;
  692.                          }
  693.                          setTimeout(() => {
  694.                              isElementInViewport(firstItem)
  695.                                  ? setBtnState(arrowPrev)
  696.                                  : setBtnState(arrowPrev, false);
  697.                              isElementInViewport(lastItem)
  698.                                  ? setBtnState(arrowNext)
  699.                                  : setBtnState(arrowNext, false);
  700.                          }, 1100);
  701.                          counter++;
  702.                      });
  703.                  }
  704.              }
  705.              // ADD SWIPE SUPPORT FOR TOUCH DEVICES
  706.              function setSwipeFn(tl, prev, next) {
  707.                  const hammer = new Hammer(tl);
  708.                  hammer.on("swipeleft", () => next.click());
  709.                  hammer.on("swiperight", () => prev.click());
  710.              }
  711.              // ADD BASIC KEYBOARD FUNCTIONALITY
  712.              function setKeyboardFn(prev, next) {
  713.                  document.addEventListener("keydown", (e) => {
  714.                      if (e.which === 37 || e.which === 39) {
  715.                          const timelineOfTop = timeline.offsetTop;
  716.                          const y = window.pageYOffset;
  717.                          if (timelineOfTop !== y) {
  718.                              window.scrollTo(0, timelineOfTop);
  719.                          }
  720.                          if (e.which === 37) {
  721.                              prev.click();
  722.                          } else if (e.which === 39) {
  723.                              next.click();
  724.                          }
  725.                      }
  726.                  });
  727.              }
  728.          })
  729.      </script>
  730.  {% endblock %}