index.blade.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. @extends('layouts.admin')
  2. @section('title')
  3. Squadre
  4. @stop
  5. @section('content')
  6. <div class="row">
  7. <div class="col-xs-12">
  8. <div class="col-md-3">
  9. <div class="form-group">
  10. <label for="season_id">Stagione:</label>
  11. <select name="season_id" class="form-control">
  12. <option value=""></option>
  13. @foreach($seasons as $key => $value)
  14. <option value="{{ $key }}" {{ (isset($_GET["season_id"]) && $_GET["season_id"] == $key) ? 'selected' : '' }}>{{ $value }}</option>
  15. @endforeach
  16. </select>
  17. </div>
  18. </div>
  19. <div class="col-md-3">
  20. <div class="form-group">
  21. <label for="type">Tipologia:</label>
  22. <select name="type" class="form-control">
  23. <option value=""></option>
  24. <option value="nation" {{ (isset($_GET["type"]) && $_GET["type"] == 'nation') ? 'selected' : '' }}>Nazionale</option>
  25. <option value="region" {{ (isset($_GET["type"]) && $_GET["type"] == 'region') ? 'selected' : '' }}>Regionale</option>
  26. </select>
  27. </div>
  28. </div>
  29. <div class="col-md-3">
  30. <div class="form-group">
  31. <label for="category_id">Categoria:</label>
  32. <select name="category_id" class="form-control">
  33. <option value=""></option>
  34. @foreach($categories as $key => $value)
  35. <option value="{{ $key }}" {{ (isset($_GET["category_id"]) && $_GET["category_id"] == $key) ? 'selected' : '' }}>{{ $value }}</option>
  36. @endforeach
  37. </select>
  38. </div>
  39. </div>
  40. <div class="col-md-3">
  41. <div class="form-group">
  42. <label for="group_id">Girone:</label>
  43. <select name="group_id" class="form-control">
  44. <option value=""></option>
  45. @foreach($groups as $key => $value)
  46. <option value="{{ $key }}" {{ (isset($_GET["group_id"]) && $_GET["group_id"] == $key) ? 'selected' : '' }}>{{ $value }}</option>
  47. @endforeach
  48. </select>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="row">
  54. <div class="col-xs-12">
  55. <div class="box">
  56. <div class="box-body table-responsive no-padding">
  57. <table class="table table-striped table-hover">
  58. <tr>
  59. <th>Nome</th>
  60. <th>Punti penalità</th>
  61. <th>Esclusa</th>
  62. <th>Ritirata</th>
  63. <th>Stagione</th>
  64. <th width="50"></th>
  65. <th width="50"></th>
  66. </tr>
  67. @foreach($teams as $team)
  68. <tr>
  69. <td>{{$team->name}}</td>
  70. <td>{{$team->penality}}</td>
  71. <td>{{$team->excluded ? 'Si' : ''}}</td>
  72. <td>{{$team->day > 0 ? $team->day . " " . $team->type : ''}}</td>
  73. <td>{{$team->season->name}}</td>
  74. <td>
  75. <a href="{{ route('teams.edit', array($team->id)) }}" type="button" class="btn btn-w-m btn-primary">Modifica</a>
  76. </td>
  77. <td>
  78. @if(false)
  79. <form class="form-inline" method="POST" action="{{ route('teams.destroy', $team->id) }}">
  80. @csrf
  81. @method('DELETE')
  82. <button style="display:none" type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  83. </form>
  84. @endif
  85. </td>
  86. </tr>
  87. @endforeach
  88. </table>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="col-xs-2">
  93. <!--<a href="{{ route('teams.create') }}" class="btn btn-success">Aggiungi</a>-->
  94. </div>
  95. </div>
  96. @stop
  97. @section('extra_js')
  98. <script>
  99. $( document ).ready(function() {
  100. $('select[name="type"]').change(function() {
  101. var type = $('select[name="type"] option:selected').val();
  102. var season_id = $('select[name="season_id"] option:selected').val();
  103. document.location.href = '/admin/teams?type=' + type + "&season_id=" + season_id;
  104. });
  105. $('select[name="category_id"]').change(function() {
  106. var type = $('select[name="type"] option:selected').val();
  107. var category_id = $('select[name="category_id"] option:selected').val();
  108. var season_id = $('select[name="season_id"] option:selected').val();
  109. document.location.href = '/admin/teams?type=' + type + '&category_id=' + category_id + "&season_id=" + season_id;
  110. });
  111. $('select[name="group_id"]').change(function() {
  112. var season_id = $('select[name="season_id"] option:selected').val();
  113. var type = $('select[name="type"] option:selected').val();
  114. var category_id = $('select[name="category_id"] option:selected').val();
  115. var group_id = $('select[name="group_id"] option:selected').val();
  116. document.location.href = '/admin/teams?type=' + type + '&category_id=' + category_id + '&group_id=' + group_id + "&season_id=" + season_id;
  117. });
  118. $('select[name="season_id"]').change(function() {
  119. var season_id = $('select[name="season_id"] option:selected').val();
  120. var type = $('select[name="type"] option:selected').val();
  121. var category_id = $('select[name="category_id"] option:selected').val();
  122. var group_id = $('select[name="group_id"] option:selected').val();
  123. document.location.href = '/admin/teams?type=' + type + '&category_id=' + category_id + '&group_id=' + group_id + "&season_id=" + season_id;
  124. });
  125. });
  126. </script>
  127. @stop