index.blade.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 class="form-inline" method="POST" action="{{ route('categories.destroy', $category->id) }}">
  36. @csrf
  37. @method('DELETE')
  38. <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>
  39. </form>
  40. </td>
  41. </tr>
  42. @endforeach
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="col-xs-8">
  49. <a href="{{ route('categories.create') }}" class="btn btn-success">Aggiungi</a>
  50. </div>
  51. </div>
  52. @stop
  53. @section('extra_js')
  54. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  55. <script>
  56. $(function () {
  57. /*
  58. $('tbody').sortable({
  59. cursor: "move",
  60. stop: function( ) {
  61. var ids = '';
  62. $(".category_row").each(function()
  63. {
  64. var id = $(this).attr("data-id");
  65. ids += (ids != '' ? ',' : '') + id;
  66. });
  67. $.ajax('/admin/categories/sort/' + ids,
  68. {
  69. success: function (data, status, xhr) {// success callback function
  70. $('p').append(data);
  71. }
  72. });
  73. }
  74. });
  75. */
  76. });
  77. </script>
  78. @stop