index.blade.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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->id)) }}" type="button" class="btn btn-w-m btn-primary">Modifica</a>
  45. </td>
  46. <td>
  47. {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('pages.advs.destroy', array($page, $adv)))) !!}
  48. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  49. {!! Form::close() !!}
  50. </td>
  51. </tr>
  52. @endforeach
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. @endforeach
  61. <div class="col-xs-2" style="margin-top:50px">
  62. <a href="{{ route('pages.index') }}" class="btn btn-info">Elenco pagine</a>
  63. </div>
  64. @stop
  65. @section('extra_js')
  66. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  67. <script>
  68. $(function () {
  69. $('tbody').sortable({
  70. cursor: "move",
  71. stop: function( ) {
  72. var ids = '';
  73. $(".adv_row").each(function()
  74. {
  75. var id = $(this).attr("data-id");
  76. ids += (ids != '' ? ',' : '') + id;
  77. });
  78. $.ajax('/admin/adv/sort/' + ids,
  79. {
  80. success: function (data, status, xhr) {// success callback function
  81. $('p').append(data);
  82. }
  83. });
  84. }
  85. });
  86. });
  87. </script>
  88. @stop