<?php $__env->startSection("content"); ?>
<div>
	<ol class="breadcrumb">
	  <li><a href="<?php echo e(URL::route('user.home')); ?>"><?php echo trans('messages.home'); ?></a></li>
	  <li class="active">Purchase Requests</li>
	</ol>
</div>
<?php if(Session::has('message')): ?>
	<div class="alert alert-info"><?php echo trans(Session::get('message')); ?></div>
<?php endif; ?>
<div class="panel panel-default">
	<div class="panel-heading ">
		<span class="glyphicon glyphicon-list"></span>
		Purchase Requests
		<div class="panel-btn">
			<a class="btn btn-sm btn-info" href="<?php echo URL::route('order.create'); ?>" >
				<span class="glyphicon glyphicon-plus-sign"></span>
				New Purchase Request
			</a>
		</div>
	</div>

	<div class="panel-body">

		<table class="table table-striped table-hover table-condensed search-table">
			<thead>
				<tr>
					<th>Item</th>
					<th>Fund Manager</th>
					<th>Fund Source</th>
					<!-- <th>Supplier</th> -->
					<th>Date on which items are required</th>
					<th>Status</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
			<?php foreach($orders as $order): ?>
				<tr>
					<td><?php echo $order->commodity->name; ?></td>
					<td><?php echo $order->fundManager->name; ?></td>
					<td><?php echo $fund_sources[$order->fund_sources]; ?></td>
					<!-- <td><?php echo $order->supplier->name; ?></td> -->
					<td><?php echo $order->due_date; ?></td>
					<td>
					<!-- status -->
					<?php if($order->isApproved()): ?>
						<span class='label label-success'>Approved</span>
					<?php elseif($order->isRejected()): ?>
						<span class='label label-danger'>Rejected</span>
					<?php else: ?>
						<span class='label label-info'>Pending</span>
					<?php endif; ?>
					</td>
					<td>
					<?php if(!$order->isRejected()): ?>
					<!-- delete this commodity (uses the delete method found at GET /inventory/{id}/delete -->
					<!--
                    <a class="btn btn-sm btn-info"
                        href="<?php echo URL::route('order.show', $order->id); ?>"
                        title="View Order Details">
                        <span class="glyphicon glyphicon-eye-open"></span>
                        View
                    </a>
					<button class="btn btn-sm btn-danger delete-item-link"
						data-toggle="modal" data-target=".confirm-delete-modal"
						data-id="<?php echo URL::route('order.destroy', array($order->id)); ?>">
						<span class="glyphicon glyphicon-trash"></span>
						<?php echo trans('messages.delete'); ?>

					</button>
					-->
					<!-- edit this commodity (uses the edit method found at GET /inventory/{id}/edit -->
						<a class="btn btn-sm btn-info" href="<?php echo URL::route('order.edit', array($order->id)); ?>" >
							<span class="glyphicon glyphicon-edit"></span>
							<?php echo trans('messages.edit'); ?>

						</a>
						<?php if($order->isApproved()): ?>
						<a class="btn btn-sm btn-primary" href="<?php echo URL::route('order.lpi', array($order->id)); ?>"
							title="Print Order Document">
							<span class="glyphicon glyphicon-print"></span>
							LPI
						</a>
						<a class="btn btn-sm btn-primary" href="<?php echo URL::route('purchase.request', array($order->id)); ?>"
							title="Print Order Document">
							<span class="glyphicon glyphicon-print"></span>
							PR
						</a>
						<?php else: ?>
						<a class="btn btn-sm btn-danger" href="<?php echo URL::route('order.reject', array($order->id)); ?>"
							title="Reject Oder">
							<span class="glyphicon glyphicon-thumbs-down"></span>
							Reject
						</a>
						<a class="btn btn-sm btn-success" href="<?php echo URL::route('order.approve', array($order->id)); ?>"
							title="Approve Order">
							<span class="glyphicon glyphicon-thumbs-up"></span>
							Approve
						</a>
						<?php endif; ?>
					<?php endif; ?>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
			</table>
		<?php Session::put('SOURCE_URL', URL::full());?>
	</div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("layout", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>