@extends('layouts.default')

@section('title')
	@parent
	Создание новой задачи
@stop

@section('content')
	<div class="row">
		<div class="col-md-6 col-md-offset-3">
			{{ Form::open(array('action' => 'UsertasksController@store')) }}
			<h2>Создание новой задачи</h2>

			<div class="form-group {{ ($errors->has('name')) ? 'has-error' : '' }}">
				{{ Form::label( 'name', 'Название:', array('class' => 'control-label') ) }}
				{{ Form::text('name', null, array('class' => 'form-control', 'placeholder' => 'Название', 'autofocus')) }}
				{{ ($errors->has('name') ? $errors->first('name') : '') }}
			</div>

			<div class="form-group {{ ($errors->has('fine')) ? 'has-error' : '' }}">
				{{ Form::label( 'fine', 'Штраф за невыполнение:', array('class' => 'control-label') ) }}
				{{ Form::text('fine', null, array('class' => 'form-control', 'placeholder' => 'Штраф за невыполнение')) }}
				{{ ($errors->has('fine') ? $errors->first('fine') : '') }}
			</div>

			{{ Form::label('Исполнители') }}
			<div class="form-group">
				@foreach ($users as $user)
				<label class="checkbox-inline">
					{{ Form::checkbox('users['.$user->id.']', 1) }} {{ $user->first_name }} {{ $user->last_name }}
				</label>
				<br/>
				@endforeach
			</div>

			{{ Form::submit('Создать задачу', array('class' => 'btn btn-primary')) }}
			{{ Form::button('Отмена', array('class' => 'btn btn-default', 'onclick'=>'location="'.URL::to('usertasks').'"')) }}

			{{ Form::close() }}
		</div>
	</div>
@stop