@extends('adminlte::page')

@section('content_header')
<h1>Effettua un giroconto/prelievo</h1>
@endsection

@section('content')
<div class="row">
	<div class="col-lg-12">
    	<div class="panel panel-default">
            <div class="panel-heading">
                Giroconto
            </div>
			@if ($errors->any())
				<div class="alert alert-danger">
					<ul>
						@foreach ($errors->all() as $error)
							<li>{{ $error }}</li>
						@endforeach
					</ul>
				</div>
			@endif
            <div class="panel-body">
            	<div class="row">
                    <div class="col-lg-12">

                    <form method="POST" action="/admin/movimenti/giroconto">
                        @csrf
                        <div class="form-group">
                            <label for="mov_data">Data</label>
                            <input type="date" class="form-control" id="mov_data" name="mov_data" required>
                        </div>
                        <div class="form-group">
                            <label for="mov_fk_categoria">Categoria</label>
                            <select class="form-control" id="mov_fk_categoria" name="mov_fk_categoria" required>
                                <!-- Options should be populated dynamically -->
                                <option value="">Seleziona Categoria</option>
                                @foreach($categories as $category)
                                    <option value="{{ $category->id }}">{{ $category->cat_name }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="daConto">Da Conto</label>
                            <select class="form-control" id="daConto" name="daConto" required>
                                <!-- Options should be populated dynamically -->
                                <option value="">Seleziona Conto</option>
                                @foreach($contos as $conto)
                                    <option value="{{ $conto->id }}">{{ $conto->nomeConto }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="aConto">A Conto</label>
                            <select class="form-control" id="aConto" name="aConto" required>
                                <!-- Options should be populated dynamically -->
                                <option value="">Seleziona Conto</option>
                                @foreach($contos as $conto)
                                    <option value="{{ $conto->id }}">{{ $conto->nomeConto }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="mov_importo">Importo</label>
                            <input type="number" step="0.01" class="form-control" id="mov_importo" name="mov_importo" required>
                        </div>
                        <div class="form-group">
                            <label for="mov_descrizione">Descrizione</label>
                            <input type="text" class="form-control" id="mov_descrizione" name="mov_descrizione" required>
                        </div>
                        <input type="hidden" name="userid" value="{{ Auth::user()->id }}">
                        <button type="submit" class="btn btn-primary">Invia</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
    </div>
</div>

@endsection
