@extends('layouts.app')

@section('content')
<div class="container contingut">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <div class="panel panel-default">
                <div class="panel-heading"><h4>Afegir dies Festius</h4></div>
                <div class="panel-body">
                    <div class="form" role="form">
                        <div class="col-sm-7">
                            <label>Afegir periode de Festius</label>
                            <div class="input-daterange input-group" id="datepicker">
                                <span class="input-group-addon">De</span>
                                <input type="text" class="input-sm form-control" name="start" id="start"/>
                                <span class="input-group-addon">a</span>
                                <input type="text" class="input-sm form-control" name="end" id ="end"/>
                            </div>
                        </div>
                        <div class="col-sm-7">
                            <label>Descripcio</label>
                            <input type="text" class="input-sm form-control" name="descripcio" id="descripcio"/>
                        </div>
                        <div class="col-sm-12"><br/>
                            <button type="submit" class="btn btn-primary" id="sendRangDates"><i class="fa fa-btn fa-sign-in"></i>Enviar</button>
                        </div>
                    </div>
                </div>
                <div class="panel-heading">
                    @if($dates)
                        <table class="table table-striped" id="festius">
                            <thead>
                                <tr>
                                    <th>Motiu</th>
                                    <th>Del dia</th>
                                    <th>Fins al dia</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                            @foreach($dates as $key => $data)
                                <tr id="{{ $data->id }}">
                                    <td id="descripcio">{{ $data->descripcio}}</td>
                                    <td id="dataInici" class="data">{{ date("d-m-y",strtotime($data->data_inici))}}</td>
                                    <td id="dataFi" class="data">{{ date("d-m-y",strtotime($data->data_fi))}}</td>
                                    <td><button type="submit" class="btn btn-danger" id="eliminarData" value="{{ $data->id}}"><i class="fa fa-btn fa-sign-in"></i>Eliminar</button></td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Submenú contador lateral -->
@include('partials.menu')
@endsection
