@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' => 'ProjectsController@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('cache_on_delivery')) ? 'has-error' : '' }}">
			{{ Form::label( 'cache_on_delivery', 'Наценка на заказ за наложенный платеж:', array('class' => 'control-label') ) }}
			{{ Form::text('cache_on_delivery', null, array('class' => 'form-control', 'placeholder' => 'Наценка на заказ за наложенный платеж', 'autofocus')) }}
			{{ ($errors->has('cache_on_delivery') ? $errors->first('cache_on_delivery') : '') }}
		</div>

		<div class="form-group {{ ($errors->has('cost_post_delivery')) ? 'has-error' : '' }}">
			{{ Form::label( 'cost_post_delivery', 'Стоимость доставки почтой:', array('class' => 'control-label') ) }}
			{{ Form::text('cost_post_delivery', null, array('class' => 'form-control', 'placeholder' => 'Наценка на заказ за наложенный платеж', 'autofocus')) }}
			{{ ($errors->has('cost_post_delivery') ? $errors->first('cost_post_delivery') : '') }}
		</div>

		{{ Form::label('Тип проекта') }}
		<div class="form-group">
			<label class="radio-inline">
				{{ Form::radio('type', Project::TYPE_SHOP, 1) }} Интернет магазин
			</label>
			<br/>
			<label class="radio-inline">
				{{ Form::radio('type', Project::TYPE_HR) }} Отдел кадров
			</label>
		</div>

		<div class="form-group">
			<label class="checkbox-inline">
				{{ Form::checkbox('usecrm', 1) }} использовать CRM систему
			</label>
			<br/>
      <div class="form-group">
        <label class="checkbox-inline">
          {{ Form::checkbox('usebudget', 1) }} вести бюджет
        </label>
        <br/>
        Дата закрытия месяца в бюджете (операции закрываются не вкл. это число):
        <br/>
        <label class="radio-inline">
          {{ Form::radio('budget_close_day', 1, 1) }} 1
        </label>
        <label class="radio-inline">
          {{ Form::radio('budget_close_day', 6) }} 6
        </label>
      </div>
			<label class="checkbox-inline">
				{{ Form::checkbox('usecheckcalls', 1) }} контролировать звонки
			</label>
			<br/>
			<label class="checkbox-inline">
				{{ Form::checkbox('usepayroll', 1) }} расчитывать зарплату
			</label>
		</div>

		{{ Form::label('Участники проекта') }}
		<div class="form-group">
			@foreach ($users as $user)
			<label class="checkbox-inline">
				{{ Form::checkbox('projectUsers['.$user->id.']', 1) }} {{ $user->first_name }} {{ $user->last_name }}
			</label>
			<br/>
			@endforeach
		</div>

		{{--
		@foreach ($fines as $fine)
		<div class="form-group">
			{{ Form::label('Штраф за ' . $fine->name) }}
			{{ Form::text('projectFines['.$fine->id.']', isset($projectFines[$fine->id])?$projectFines[$fine->id]['value']:0, array('class' => 'form-control')) }}
		</div>
		@endforeach
		--}}

		{{ Form::submit('Создать проект', array('class' => 'btn btn-primary')) }}
		{{ Form::button('Отмена', array('class' => 'btn btn-default', 'onclick'=>'location="'.URL::to('projects').'"')) }}

    {{ Form::close() }}
	</div>
</div>

@stop