| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- @extends('layouts.admin')
- @section('title')
- Calendari
- @stop
- @section('content')
- <p>Trascina le righe per ordinare gli elementi</p>
- <div class="row">
- <div class="col-xs-12">
- <div class="box">
- <div class="box-body table-responsive no-padding">
- <table class="table table-striped table-hover">
- <tr>
- <th>Tipologia</th>
- <th>Categoria</th>
- <th>Girone</th>
- <th>Stagione</th>
- <th width="50"></th>
- <th width="50"></th>
- <th width="50"></th>
- </tr>
- <tbody>
- @foreach($calendars as $calendar)
- <tr class="calendar_row" data-id="{{$calendar->id}}" style="cursor:move">
- <td>{{$calendar->type == 'nation' ? 'Nazionale' : 'Regionale'}}</td>
- <td>{{isset($calendar->category) ? $calendar->category->name : ''}}</td>
- <td>{{isset($calendar->group) ? $calendar->group->name : ''}}</td>
- <td>{{isset($calendar->season) ? $calendar->season->name : ''}}</td>
- <td>
- <a href="{{ route('calendars.games', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-primary">Risultati</a>
- </td>
- <td>
- <a href="{{ route('calendars.edit', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-primary">Importa calendario</a>
- </td>
- <td>
- @if($calendar->archived)
- <a href="{{ route('calendars.restore', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-success">Ripristina</a>
- @else
- <a href="{{ route('calendars.archive', array($calendar->id)) }}" type="button" class="btn btn-w-m btn-warning">Archivia</a>
- @endif
- </td>
- <td>
- <form class="form-inline" method="POST" action="{{ route('calendars.destroy', $calendar->id) }}">
- @csrf
- @method('DELETE')
- <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
- </form>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <div class="col-xs-2">
- <a href="{{ route('calendars.create') }}" class="btn btn-success">Aggiungi</a>
- </div>
- </div>
- @stop
- @section('extra_js')
- <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
- <script>
- $(function () {
- $('tbody').sortable({
- cursor: "move",
- stop: function( ) {
- var ids = '';
- $(".calendar_row").each(function()
- {
- var id = $(this).attr("data-id");
- ids += (ids != '' ? ',' : '') + id;
- });
- $.ajax('/admin/calendars/sort/' + ids,
- {
- success: function (data, status, xhr) {// success callback function
- $('p').append(data);
- }
- });
- }
- });
- });
- </script>
- @stop
|