index.blade.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. @extends('layouts.admin')
  2. @section('title')
  3. Pubblicità Pagina {{$page->name}}
  4. @stop
  5. @section('content')
  6. @foreach($aDatas as $idx => $data)
  7. <div class="row">
  8. <div class="col-xs-2">
  9. <h2>{{$idx}}</h2>
  10. </div>
  11. <div class="col-xs-10 text-right">
  12. <br><a href="{{ route('pages.advs.create', $page) }}?position={{$idx}}" class="btn btn-success">Aggiungi</a>
  13. </div>
  14. </div>
  15. <div class="row">
  16. <div class="col-xs-2">
  17. <img src="/images/{{str_replace(" ", "", $idx)}}.png" style="max-width:180px">
  18. </div>
  19. <div class="col-xs-10">
  20. <div class="col-xs-12">
  21. <div class="box">
  22. <div class="box-body table-responsive no-padding">
  23. <table class="table table-striped table-hover">
  24. <tr>
  25. <th>Nome</th>
  26. <th>Google</th>
  27. <th>Immagine</th>
  28. <th>Online</th>
  29. <th width="50"></th>
  30. <th width="50"></th>
  31. </tr>
  32. <tbody>
  33. @foreach($data as $adv)
  34. <tr class="adv_row" data-id="{{$adv->id}}" style="cursor:move">
  35. <td>{{$adv->name}}</td>
  36. <td>{{$adv->google_code}}</td>
  37. <td>
  38. @if($adv->image != '')
  39. <img src="/files/adv/{{$adv->image}}" style="max-width:250px" />
  40. @endif
  41. </td>
  42. <td>{{$adv->online ? 'Si' : 'No'}}</td>
  43. <td>
  44. <a href="{{ route('pages.advs.edit', array($page, $adv)) }}" type="button" class="btn btn-w-m btn-primary">Modifica</a>
  45. </td>
  46. <td>
  47. <form class="form-inline" method="POST" action="{{ route('pages.advs.destroy', [$page, $adv]) }}">
  48. @csrf
  49. @method('DELETE')
  50. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  51. </form>
  52. </td>
  53. </tr>
  54. @endforeach
  55. </tbody>
  56. </table>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. @endforeach
  63. <div class="col-xs-2" style="margin-top:50px">
  64. <a href="{{ route('pages.index') }}" class="btn btn-info">Elenco pagine</a>
  65. </div>
  66. @stop
  67. @section('extra_js')
  68. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  69. <script>
  70. $(function () {
  71. $('tbody').sortable({
  72. cursor: "move",
  73. stop: function( ) {
  74. var ids = '';
  75. $(".adv_row").each(function() {
  76. var id = $(this).attr("data-id");
  77. ids += (ids != '' ? ',' : '') + id;
  78. });
  79. $.ajax('/admin/adv/sort/' + ids, {
  80. success: function (data, status, xhr) {
  81. $('p').append(data);
  82. }
  83. });
  84. }
  85. });
  86. });
  87. </script>
  88. @stop