index.blade.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. @extends('layouts.admin')
  2. @section('title')
  3. Gestione layout, news e banner
  4. @stop
  5. @section('content')
  6. <p>Trascina le righe per ordinare gli elementi</p>
  7. <div class="row">
  8. <div class="col-xs-8">
  9. <a href="{{ route('sections.create') }}" class="btn btn-success">Aggiungi</a><br><br>
  10. </div>
  11. <div class="col-xs-12">
  12. <div class="box">
  13. <div class="box-body table-responsive no-padding">
  14. <table class="table table-striped table-hover">
  15. <tr>
  16. <th>Nome</th>
  17. <th class="hidden-xs">Tipo</th>
  18. <th class="hidden-xs">Layout</th>
  19. <th width="50"></th>
  20. <th width="50"></th>
  21. <th width="50"></th>
  22. <th width="50"></th>
  23. <th width="50"></th>
  24. </tr>
  25. <tbody>
  26. @foreach($sections as $section)
  27. <tr class="section_row" data-id="{{$section->id}}" style="cursor:move">
  28. <td>{{$section->name}}</td>
  29. <td class="hidden-xs">{{$section->type == 'section' ? 'Nazionale' : 'Regionale'}}</td>
  30. <td class="hidden-xs"><img src="/images/{{$section->layout}}.png" style="width:150px"></td>
  31. <td>
  32. <a href="#" onclick="if (confirm('Sei sicuro di voler convertire questa sezione in un evento?')) document.location.href='{{ route('sections.to_event', array($section->id)) }}';" type="button" class="btn btn-w-m btn-primary">Trasforma in evento</a>
  33. </td>
  34. <td>
  35. <a href="{{ route('sections.advs.index', array($section->id)) }}" type="button" class="btn btn-w-m btn-primary">Pubblicità</a>
  36. </td>
  37. <td>
  38. <a href="{{ route('sections.layout', array($section->id)) }}" type="button" class="btn btn-w-m btn-primary">News</a>
  39. </td>
  40. <td>
  41. <a href="{{ route('sections.edit', array($section->id)) }}" type="button" class="btn btn-w-m btn-primary"><i class="fa fa-pencil" aria-hidden="true"></i></a>
  42. </td>
  43. <td>
  44. <form class="form-inline" method="POST" action="{{ route('sections.destroy', $section->id) }}">
  45. @csrf
  46. @method('DELETE')
  47. <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>
  48. </form>
  49. </td>
  50. </tr>
  51. @endforeach
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="col-xs-8">
  58. <a href="{{ route('sections.create') }}" class="btn btn-success">Aggiungi</a>
  59. </div>
  60. </div>
  61. @stop
  62. @section('extra_js')
  63. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  64. <script>
  65. $(function () {
  66. $('tbody').sortable({
  67. cursor: "move",
  68. scroll: true,
  69. stop: function( ) {
  70. var ids = '';
  71. $(".section_row").each(function()
  72. {
  73. var id = $(this).attr("data-id");
  74. ids += (ids != '' ? ',' : '') + id;
  75. });
  76. $.ajax('/admin/sections/sort/' + ids,
  77. {
  78. success: function (data, status, xhr) {// success callback function
  79. $('p').append(data);
  80. }
  81. });
  82. }
  83. });
  84. });
  85. </script>
  86. @stop