<?php if (isset($packing)): ?>
	<div class="row">
		<div class="col-md-6 col-md-offset-3">
			<div class="panel panel-default panel-production">
				<div class="panel-heading">
					<h3>Упаковка: в ожидании</h3>
				</div>
				<div class="panel-body">
					<table class="table table-striped table-hover">
						<thead>
							<th>Номер</th>
							<th>Заказ</th>
						</thead>
						<tbody>
							<?php foreach ($partners as $partner): ?>
							<tr>
								<td>
									<h4>№<?php echo $partner->id; ?><br>
									<?php echo $partner->getRawTransportTypeName(); ?>
									</h4>
								</td>
								<td class="project-name">
									<?php if ($partner->getCart()): ?>
										<?php foreach ($partner->getCart() as $item): ?>
											<?php foreach ($item as $item2): ?>
												<?php if($item2['quant'] > 0): ?>
													<h4><?php echo $item2['name']; ?> <?php echo $item2['quant']; ?> компл.</h4>
												<?php endif; ?>
											<?php endforeach; ?>
										<?php endforeach; ?>
									<?php endif; ?>
									<button class="btn btn-lg btn-primary btn-production-packed" data-action="<?php echo action('ProductionController@packed'); ?>" data-id="<?php echo $partner->id; ?>"><span class="glyphicon glyphicon-ok"></span> Упаковано</button>
									<br/><br/>
									<?php echo $partner->name; ?><br/>передан в производство <span class="date-to-humanize" data-date="<?php echo $partner->datetime_of_agree; ?>"><?php echo $partner->datetime_of_agree; ?></span><br/>
								</td>
							</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
<?php else: ?>
	<div class="row">
		<div class="col-md-6">
			<div class="panel panel-default panel-production">
				<div class="panel-heading">
					<h3>Производство: в ожидании</h3>
				</div>
				<div class="panel-body">
					<table class="table table-striped table-hover">
						<thead>
							<th>Номер</th>
							<th>Заказ</th>
						</thead>
						<tbody>
							<?php foreach ($productions1 as $production): ?>
							<tr>
								<td>
									<h4 class="cart">№<?php echo $production->order_id; ?><br><br>
									<?php echo $production->partner->getRawTransportTypeName(); ?></h4>
								</td>
								<td class="project-name">
									<div>
										<h4><?php echo $production->name; ?></h4>
										<p><?php echo $production->partner->comment_to_production; ?></p>
									</div>
									<button class="btn btn-lg btn-primary btn-production-process" data-action="<?php echo action('ProductionController@process'); ?>" data-id="<?php echo $production->id; ?>" data-order-id="<?php echo $production->order_id; ?>"><span class="glyphicon glyphicon-play"></span> Взять в работу</button>
									<button class="btn btn-lg btn-warning btn-production-sizing" data-action="<?php echo action('ProductionController@sizing'); ?>" data-print-url="<?php echo action('ProductionController@productionPrint', array($production->id)); ?>" data-id="<?php echo $production->id; ?>" data-order-id="<?php echo $production->order_id; ?>"><span class="glyphicon glyphicon-play"></span> Нет размера</button>
									<br/><br/>
									<?php if($production->partner->is_franchisees_order): ?> <span class="label label-danger" style="font-size:18px">для франчайзи</span> <?php endif; ?>
									<?php /*
									<?php echo $production->partner->name; ?><br/>передана в производство <span class="date-to-humanize" data-date="<?php echo $production->partner->datetime_of_agree; ?>"><?php echo $production->partner->datetime_of_agree; ?></span><br/>
									*/ ?>
								</td>
							</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="col-md-6">
			<div class="panel panel-default panel-production">
				<div class="panel-heading">
					<h3>Производство: в работе 
					  <button class="btn btn-lg btn-info btn-print-production-inwork" data-print-url="<?php echo action('ProductionController@productionPrintInWork'); ?>"><span class="glyphicon glyphicon-print"></span> Сегодняшние заказы</button>
					</h3>
					Печать возможна только до нажития "Готово".
				</div>
				<div class="panel-body">
					<table class="table table-striped table-hover">
						<thead>
							<th>Номер</th>
							<th>Заказ</th>
						</thead>
						<tbody>
							<?php foreach ($productions2 as $production): ?>
							<tr>
								<td>
									<h4 class="cart">№<?php echo $production->order_id; ?><br><br>
									<?php echo $production->partner->getRawTransportTypeName(); ?></h4></h4>
								</td>
								<td class="project-name">
									<h4><?php echo $production->name; ?></h4>
									<p><?php echo $production->partner->comment_to_production; ?></p>
									<button class="btn btn-lg btn-success btn-production-success" data-action="<?php echo action('ProductionController@success'); ?>" data-id="<?php echo $production->id; ?>" data-order-id="<?php echo $production->order_id; ?>"><span class="glyphicon glyphicon-ok"></span> Готово</button>
									<?php if($production->production_master_id == 0 || $production->production_master_id == '0'): ?>
										<button class="btn btn-lg btn-warning btn-production-nostorage" data-action="<?php echo action('ProductionController@noStorage'); ?>" data-print-url="<?php echo action('ProductionController@productionPrintSuccess', array($production->id)); ?>" data-id="<?php echo $production->id; ?>" data-order-id="<?php echo $production->order_id; ?>"><span class="glyphicon glyphicon-backward"></span> Нет на складе</button>
										<span class="label label-info">Взять со склада</span>
									<?php endif; ?>
									<button class="btn btn-lg btn-warning btn-production-sizing" data-action="<?php echo action('ProductionController@sizing'); ?>" data-print-url="<?php echo action('ProductionController@productionPrint', array($production->id)); ?>" data-id="<?php echo $production->id; ?>" data-order-id="<?php echo $production->order_id; ?>"><span class="glyphicon glyphicon-play"></span> Нет размера</button>
									<br/><br/>
									<?php if($production->partner->is_franchisees_order): ?> <span class="label label-danger" style="font-size:18px">для франчайзи</span> <?php endif; ?>
									<?php echo $production->partner->name; ?><br/>передана в производство <span class="date-to-humanize" data-date="<?php echo $production->partner->datetime_of_agree; ?>"><?php echo $production->partner->datetime_of_agree; ?></span><br/>
								</td>
							</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
<?php endif; ?>