
<?php $__env->startSection('title'); ?>
@parent
Добавление продукта для проекта <?php echo $project->name; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
	<div class="col-md-6 col-md-offset-3">
		<?php echo Form::open(array('action' => array('ProductsController@store', $project->id))); ?>
		<h2>Добавление продукта для проекта <?php echo $project->name; ?></h2>

		<div class="form-group <?php echo ($errors->has('mark')) ? 'has-error' : ''; ?>">
			<?php echo Form::label( 'mark', 'Марка:', array('class' => 'control-label') ); ?>
			<?php echo Form::select('mark', $marks, null, array('class' => 'form-control', 'autofocus')); ?>
			<?php echo ($errors->has('mark') ? $errors->first('mark') : ''); ?>
		</div>

		<div class="form-group <?php echo ($errors->has('name')) ? 'has-error' : ''; ?>">
			<?php echo Form::label( 'name', 'Название:', array('class' => 'control-label') ); ?>
			<?php echo Form::text('name', null, array('class' => 'form-control')); ?>
			<?php echo ($errors->has('name') ? $errors->first('name') : ''); ?>
		</div>

		<div class="row">
			<div class="col-md-6">
				<div class="form-group <?php echo ($errors->has('year_start')) ? 'has-error' : ''; ?>">
					<?php echo Form::label( 'year_start', 'С:', array('class' => 'control-label') ); ?>
					<?php echo Form::select('year_start', $yearsStart, null, array('class' => 'form-control')); ?>
					<?php echo ($errors->has('year_start') ? $errors->first('name') : ''); ?>
				</div>
			</div>
			<div class="col-md-6">
				<div class="form-group <?php echo ($errors->has('year_end')) ? 'has-error' : ''; ?>">
					<?php echo Form::label( 'year_end', 'По:', array('class' => 'control-label') ); ?>
					<?php echo Form::select('year_end', $yearsEnd, null, array('class' => 'form-control')); ?>
					<?php echo ($errors->has('year_end') ? $errors->first('name') : ''); ?>
				</div>
			</div>
	    <div class="col-md-6">
			  <label class="checkbox">
          <input type="checkbox" name="no-production"> Не отправлять в производство
        </label>
	    </div>
	  </div>

		<?php foreach (ProductType::all() as $productType): ?>
		<div class="well well-sm">
			<h4><?php echo $productType->name; ?></h4>
			<div class="row">
				<div class="col-md-6">
					<div class="form-group <?php echo ($errors->has('price['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'price['.$productType->id.']', 'Цена при 100% предоплате:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('price['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('price['.$productType->id.']') ? $errors->first('price') : ''); ?>
					</div>
				</div>
				<div class="col-md-6">
					<div class="form-group <?php echo ($errors->has('price_back['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'price_back['.$productType->id.']', 'Цена при наложенном платеже:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('price_back['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('price_back['.$productType->id.']') ? $errors->first('price_back') : ''); ?>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-6">
					<div class="form-group <?php echo ($errors->has('price_opt['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'price_opt['.$productType->id.']', 'Оптовая цена:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('price_opt['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('price_opt['.$productType->id.']') ? $errors->first('price_opt') : ''); ?>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-4">
					<div class="form-group <?php echo ($errors->has('plates['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'plates['.$productType->id.']', 'Пластины:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('plates['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('plates['.$productType->id.']') ? $errors->first('price') : ''); ?>
					</div>
				</div>
				<div class="col-md-4">
					<div class="form-group <?php echo ($errors->has('hooks['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'hooks['.$productType->id.']', 'Уголки:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('hooks['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('hooks['.$productType->id.']') ? $errors->first('price') : ''); ?>
					</div>
				</div>
				<div class="col-md-4">
					<div class="form-group <?php echo ($errors->has('splates['.$productType->id.']')) ? 'has-error' : ''; ?>">
						<?php echo Form::label( 'splates['.$productType->id.']', 'С-ки:', array('class' => 'control-label') ); ?>
						<?php echo Form::text('splates['.$productType->id.']', null, array('class' => 'form-control')); ?>
						<?php echo ($errors->has('splates['.$productType->id.']') ? $errors->first('price') : ''); ?>
					</div>
				</div>
			</div>
		</div>
		<?php endforeach; ?>

		<?php echo Form::submit('Добавить продукт', array('class' => 'btn btn-primary')); ?>
		<?php echo Form::button('Отмена', array('class' => 'btn btn-default', 'onclick'=>'location="'.URL::to('projects').'/'.$project->id.'/products"')); ?>

    <?php echo Form::close(); ?>
	</div>
</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.default', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>