index.blade.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. <a href="{{ route('calendars.archive', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-warning">Archivia</a>
  36. </td>
  37. <td>
  38. {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('calendars.destroy', $calendar->id))) !!}
  39. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  40. {!! Form::close() !!}
  41. </td>
  42. </tr>
  43. @endforeach
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="col-xs-2">
  50. <a href="{{ route('calendars.create') }}" class="btn btn-success">Aggiungi</a>
  51. </div>
  52. </div>
  53. @stop
  54. @section('extra_js')
  55. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  56. <script>
  57. $(function () {
  58. $('tbody').sortable({
  59. cursor: "move",
  60. stop: function( ) {
  61. var ids = '';
  62. $(".calendar_row").each(function()
  63. {
  64. var id = $(this).attr("data-id");
  65. ids += (ids != '' ? ',' : '') + id;
  66. });
  67. $.ajax('/admin/calendars/sort/' + ids,
  68. {
  69. success: function (data, status, xhr) {// success callback function
  70. $('p').append(data);
  71. }
  72. });
  73. }
  74. });
  75. });
  76. </script>
  77. @stop