index.blade.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. @extends('layouts.admin')
  2. @section('title')
  3. Calendari
  4. @stop
  5. @section('content')
  6. <p>Trascina le righe per ordinare gli elementi</p>
  7. <div class="row">
  8. <div class="col-xs-12">
  9. <div class="box">
  10. <div class="box-body table-responsive no-padding">
  11. <table class="table table-striped table-hover">
  12. <tr>
  13. <th>Tipologia</th>
  14. <th>Categoria</th>
  15. <th>Girone</th>
  16. <th>Stagione</th>
  17. <th width="50"></th>
  18. <th width="50"></th>
  19. <th width="50"></th>
  20. </tr>
  21. <tbody>
  22. @foreach($calendars as $calendar)
  23. <tr class="calendar_row" data-id="{{$calendar->id}}" style="cursor:move">
  24. <td>{{$calendar->type == 'nation' ? 'Nazionale' : 'Regionale'}}</td>
  25. <td>{{isset($calendar->category) ? $calendar->category->name : ''}}</td>
  26. <td>{{isset($calendar->group) ? $calendar->group->name : ''}}</td>
  27. <td>{{isset($calendar->season) ? $calendar->season->name : ''}}</td>
  28. <td>
  29. <a href="{{ route('calendars.games', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-primary">Risultati</a>
  30. </td>
  31. <td>
  32. <a href="{{ route('calendars.edit', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-primary">Importa calendario</a>
  33. </td>
  34. <td>
  35. @if($calendar->archived)
  36. <a href="{{ route('calendars.restore', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-success">Ripristina</a>
  37. @else
  38. <a href="{{ route('calendars.archive', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-warning">Archivia</a>
  39. @endif
  40. </td>
  41. <td>
  42. {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('calendars.destroy', $calendar->id))) !!}
  43. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  44. {!! Form::close() !!}
  45. </td>
  46. </tr>
  47. @endforeach
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="col-xs-2">
  54. <a href="{{ route('calendars.create') }}" class="btn btn-success">Aggiungi</a>
  55. </div>
  56. </div>
  57. @stop
  58. @section('extra_js')
  59. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  60. <script>
  61. $(function () {
  62. $('tbody').sortable({
  63. cursor: "move",
  64. stop: function( ) {
  65. var ids = '';
  66. $(".calendar_row").each(function()
  67. {
  68. var id = $(this).attr("data-id");
  69. ids += (ids != '' ? ',' : '') + id;
  70. });
  71. $.ajax('/admin/calendars/sort/' + ids,
  72. {
  73. success: function (data, status, xhr) {// success callback function
  74. $('p').append(data);
  75. }
  76. });
  77. }
  78. });
  79. });
  80. </script>
  81. @stop