@extends('adminlte::page') 

@section('content_header')
	<h1>Lista Attività</h1>
@endsection

@section('css')
<link rel="stylesheet" href="/css/calendaricon.css">
@endsection

@section('content')

<div class="container">
	<!-- Content here -->
	<div class="row">
		<div class="col-xs-12 ">
			<button class="btn btn-primary open_modal_new "><i
				class="fa fa-pencil-square-o fw"></i>Nuova Attività</button>
		</div>
	</div>
@foreach($tasks as $task)
	<div class ="row">	
		<div class="card-comment">
			<div class ="row p-2">
				<div class="col-xs p-2">
					<time datetime="{{ date_format(date_create($task->termine_il),'Y-m-d') }}" class="icon">
						<em>{{ __('app.'.date_format(date_create($task->termine_il),'l')) }}</em>
						<strong>{{ __('app.'.date_format(date_create($task->termine_il),'F'))}}</strong>
						<span>{{date_format(date_create($task->termine_il),'d') }}</span>
					</time>
				</div>
				<div class="col-xs p-2">
					<img class="img-circle img-sm" src="{{ Gravatar::get(App\Models\User::getUserById($task->assegnato_a)->email )}}" alt="User Image">
				</div>
				<div class="col">
					<div class="row">
						<div class="comment-text">
							<span class="username">
								<b>{{ $task->titolo}}</b><br>
							</span>
							{{ $task->descrizione }}<br>
						</div>
					</div>
					<div class="row text-muted">
						Creato il: {{ date_format(date_create($task->creato_il),'d/m/Y')}} da {{App\Models\User::getUserById($task->assegnato_a)->name }}
					</div>
				</div>
			</div>	
		</div>
	</div>
	@endforeach			
	</div>

		
				
</div>
	<!-- HIDDEN -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog draggable" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">Nuova Attività</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<div class="col-md-10">
							<!-- FORM INSERIMENTO NUOVA ATTIVITA -->
							<form action="" method="POST" id="form">
								@csrf 
								<label for="titolo" class="form-label">Titolo:</label>
								<input type="text" class="form-control" id="titolo"
									name="titolo" size="50">

						</div>
					</div>
					<div class="row">
						<div class="col-md-10">
							<label for="descrizione" class="form-label">Descrizione:</label>
							<textarea class="form-control" name="descrizione" id="descrizione"></textarea>
						</div>
					</div>
					<div class="row">
						<div class="col-md-5">
							<label for="assegnato_a" class="form-label">Assegna a:</label>
							<!-- SELECT USER -->
							<select name="assegnato_a" id="assegnato_a" class="form-control">

							</select>
						</div>	
						<div class="col-md-5">
							<!-- Data termine datetimepicker -->
							<label for="termine_il" class="form-label">Termine:</label>
							<input type="date" name="termine_il" class="form-control" value="{{ date('Y-m-d') }}" id="termine_il">
						</div>
							
					</div>
					
				</div>
				<div class="modal-footer">
					<input type="hidden" name="creato_da" value="{{ Auth::user()->id }}">
					<input type="hidden" name="stato" value="Aperto">
					<input type="hidden" name="creato_il" value="{{ date('Y-m-d') }}">
					<input type="hidden" name="chiuso_il" value="{{ date('Y-m-d') }}">
					<button type="submit" class="btn btn-primary">Submit</button>
					</form>
					<!-- FINE FORM INSERIMENTO NUOVA CATEGORIA -->
				</div>
			</div>
		</div>
	</div>


@endsection
@section('js')
	<script src="/js/app/task.js"></script>
@endsection

<!--

-->