index.blade.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('sections.destroy', $section->id))) !!}
  45. <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>
  46. {!! Form::close() !!}
  47. </td>
  48. </tr>
  49. @endforeach
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="col-xs-8">
  56. <a href="{{ route('sections.create') }}" class="btn btn-success">Aggiungi</a>
  57. </div>
  58. </div>
  59. @stop
  60. @section('extra_js')
  61. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  62. <script>
  63. $(function () {
  64. $('tbody').sortable({
  65. cursor: "move",
  66. scroll: true,
  67. stop: function( ) {
  68. var ids = '';
  69. $(".section_row").each(function()
  70. {
  71. var id = $(this).attr("data-id");
  72. ids += (ids != '' ? ',' : '') + id;
  73. });
  74. $.ajax('/admin/sections/sort/' + ids,
  75. {
  76. success: function (data, status, xhr) {// success callback function
  77. $('p').append(data);
  78. }
  79. });
  80. }
  81. });
  82. });
  83. </script>
  84. @stop