index.blade.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. @extends('layouts.admin')
  2. @section('title')
  3. Gestione categorie e gironi
  4. @stop
  5. @section('content')
  6. <div class="row">
  7. <div class="col-xs-8">
  8. <a href="{{ route('categories.create') }}" class="btn btn-success">Aggiungi</a><br><br>
  9. </div>
  10. <div class="col-xs-12">
  11. <div class="box">
  12. <div class="box-body table-responsive no-padding">
  13. <table class="table table-striped table-hover">
  14. <tr>
  15. <th>Nome</th>
  16. <th class="hidden-xs">Tipo</th>
  17. <th class="hidden-xs">Raggruppamento</th>
  18. <th width="50"></th>
  19. <th width="50"></th>
  20. <th width="50"></th>
  21. </tr>
  22. <tbody>
  23. @foreach($categories as $category)
  24. <tr class="category_row" data-id="{{$category->id}}" >
  25. <td>{{$category->name}}</td>
  26. <td class="hidden-xs">{{$category->type == 'nation' ? 'Nazionale' : 'Regionale'}}</td>
  27. <td>{{$category->grp}}</td>
  28. <td>
  29. <a href="{{ route('categories.groups.index', array($category->id)) }}" type="button" class="btn btn-w-m btn-primary">Gironi</a>
  30. </td>
  31. <td>
  32. <a href="{{ route('categories.edit', array($category->id)) }}" type="button" class="btn btn-w-m btn-primary"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
  33. </td>
  34. <td>
  35. {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('categories.destroy', $category->id))) !!}
  36. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')"><i class="fa fa-trash" aria-hidden="true"></i></button>
  37. {!! Form::close() !!}
  38. </td>
  39. </tr>
  40. @endforeach
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="col-xs-8">
  47. <a href="{{ route('categories.create') }}" class="btn btn-success">Aggiungi</a>
  48. </div>
  49. </div>
  50. @stop
  51. @section('extra_js')
  52. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  53. <script>
  54. $(function () {
  55. /*
  56. $('tbody').sortable({
  57. cursor: "move",
  58. stop: function( ) {
  59. var ids = '';
  60. $(".category_row").each(function()
  61. {
  62. var id = $(this).attr("data-id");
  63. ids += (ids != '' ? ',' : '') + id;
  64. });
  65. $.ajax('/admin/categories/sort/' + ids,
  66. {
  67. success: function (data, status, xhr) {// success callback function
  68. $('p').append(data);
  69. }
  70. });
  71. }
  72. });
  73. */
  74. });
  75. </script>
  76. @stop