add_tmdb.html.twig 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {% extends 'videotheque/base.html.twig' %}
  2. {% block title %}
  3. {% if titre is defined %}{{ parent() }} - {{ titre }}{% else %}{{ parent() }}{% endif %}
  4. {% endblock %}
  5. {% block titre %}
  6. {% if titre is defined %}{{ titre }}{% else %}{{ parent() }}{% endif %}
  7. {% endblock %}
  8. {% block body %}
  9. {#{{ form(form) }}#}
  10. <form class="mb-3" action="{{ path('videotheque_ajouter_tmdb') }}">
  11. <div class="input-group">
  12. <input class="form-control" name="query" type="text" placeholder="{{ "search_in_tmdb" | trans}}" aria-label="Recherche" {% if recherche != "" %}value="{{ recherche }}"{% endif %}>
  13. <button class="btn btn-primary" type="submit">{{ "Rechercher" | trans }}</button>
  14. </div>
  15. </form>
  16. <div class="">
  17. {% if nbFilms > 0 %}
  18. <span class="fw-light small">{{ nbFilms }} résultat{{ nbFilms > 1 ? 's' }}</span>
  19. <nav aria-label="...">
  20. <ul class="pagination">
  21. <li class="page-item {{ page == 1 ? 'disabled'}}">
  22. <a class="page-link" href="{{ path('videotheque_ajouter_tmdb', {'query': recherche, 'page': page - 1} ) }}">{{ "Previous" | trans }}</a>
  23. </li>
  24. {% for p in 1..nbPages %}
  25. <li class="page-item {{ page == p ? 'active'}}" {{ page == p ? 'aria-current="page"'}}>
  26. <a class="page-link" href="{{ path('videotheque_ajouter_tmdb', {'query': recherche, 'page': p } ) }}">{{ p }}</a>
  27. </li>
  28. {% endfor %}
  29. <li class="page-item {{ page == nbPages ? 'disabled'}}">
  30. <a class="page-link" href="{{ path('videotheque_ajouter_tmdb', {'query': recherche, 'page': page + 1} ) }}">{{ "Next" | trans }}</a>
  31. </li>
  32. </ul>
  33. </nav>
  34. {% endif %}
  35. </div>
  36. <table class="table table-borderless table-sm align-middle">
  37. <thead>
  38. <tr class="border-bottom">
  39. <th>&nbsp;</th>
  40. <th>Titre</th>
  41. <th>Date de sortie</th>
  42. <th>Genre</th>
  43. <th>Realisateur</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. {% if nbFilms == 0 %}
  48. <tr>
  49. <td colspan="5" class="text-center">Pas de résultat</td>
  50. <tr>
  51. {% endif %}
  52. {% for idtmdb, film in films %}
  53. {% if film['filmBdd'] is defined %}
  54. <tr>
  55. <td colspan="5">
  56. <div class="alert alert-warning mb-0" role="alert">
  57. Ce film est peut-être déjà en base :
  58. {% for filmBdd in film['filmBdd'] %}
  59. &nbsp;<a href="{{ path('videotheque_voirfilm', {'id': filmBdd.id} ) }}">Aller sur la fiche</a>
  60. {% endfor %}
  61. </div>
  62. </td>
  63. </tr>
  64. {% endif %}
  65. <tr class="{{ film['data'].information ? '' : 'border-bottom' }}">
  66. <td>
  67. <a type="button" class="btn btn-{{ film['filmBdd'] is defined ? 'warning' : 'primary' }}" href="{{ path('videotheque_ajouter', {'idtmdb': idtmdb }) }}">
  68. Créér{{ film['filmBdd'] is defined ? ' quand même' : '' }}
  69. </a>
  70. </td>
  71. <td>{{ film['data'].titre }}</td>
  72. <td>{% if film['data'].dateSortie %}{{ film['data'].dateSortie | date ('d/m/Y')}}{% endif %}</td>
  73. <td>{% for genre in film['data'].genres %}<span class="badge bg-info me-1">{{ genre.name }}</span>{% endfor %}</td>
  74. <td>{% for realisateur in film['data'].realisateurs %}<span class="badge bg-info me-1">{{ realisateur.nomComplet }}</span>{% endfor %}</td>
  75. </tr>
  76. {% if film['data'].information %}
  77. <tr data-controller="collapser" class="border-bottom">
  78. <td colspan="5">
  79. <div class="d-flex">
  80. <a class="ms-auto" href="#collapseResume-{{ idtmdb }}" role="button" data-bs-target="#collapseResume-{{ idtmdb }}" data-bs-toggle="collapse" aria-expanded="false" aria-controls="collapseResume-{{ idtmdb }}">
  81. Résumé
  82. <i class="fa fa-chevron-right fa-xs" data-collapser-target="button"></i>
  83. </a>
  84. </div>
  85. <div id="collapseResume-{{ idtmdb }}" class="collapse" data-collapser-target="collapse">
  86. {{ film['data'].information }}
  87. </div>
  88. </td>
  89. </tr>
  90. {% endif %}
  91. {% endfor %}
  92. </tbody>
  93. </table>
  94. {% endblock %}