
<div class="page-content">
	<div class="page-header position-relative">
		<h1>
			Inventory List <small> <i class="icon-double-angle-right"></i> With
				Calendar
			</small>

		</h1>

	</div>
	<!--/.page-header-->

	<div class="span7" id="8">
		<form class="form-horizontal" method="post" action="">
			
			<!-- /control-group -->
		</form>
	</div>
	<!-- /control-group -->


	<div class="row-fluid">
		<div class="span12" style="overflow: scroll;">
			<!--PAGE CONTENT BEGINS-->
			<table id="inventory-table"
				class="table table-striped table-bordered table-hover no-margin-bottom no-border-top">
				<thead>
					<tr>
						<th>S.No.</th>
						<th>Item Name</th>
						<th>Item Code</th>
						<th>Purchased Date</th>
						<th>Location</th>
						<th>Item Amount</th>
						<th>Installment</th>
						<th>Payment Amount</th>
						<th>Payment Date</th>
						<th></th>
					</tr>
				</thead>

				<tbody>
				<?php
				    if(is_array($get_inventory)){
				    	$i=1;
					foreach ( $get_inventory as $inventory ) {
				?>
					<tr>
						<td><?php echo $i;?></td>
						<td> <?php echo $inventory['item_name']; ?> </td>
						<td> <?php echo $inventory['item_code']; ?></td>
						<td><?php echo $inventory['purchase_date'];?></td>
						<td> <?php echo $inventory['location']; ?> </td>
						<td> <?php echo $inventory['item_amount']; ?> </td>
						<td> <?php if($inventory['installment']=='1') echo "Yes"; else echo "No"; ?> </td>
						<td>
						<?php
						if($inventory['installment']==='1'){
							 
						$installment_amount = unserialize($inventory['payment_amount']);
						$total_install_amount="";
						foreach($installment_amount as $amount){
							echo '<span class="label label-info tooltip-info" data-original-title="Installment Amount" data-rel="tooltip" data-placement="top" style="cursor:pointer;">'.$amount.'</span><br>';
						$total_install_amount = $total_install_amount+$amount;
						}
						}else{
							echo $inventory['payment_amount'];
						}
						if($inventory['item_amount']==$total_install_amount){
							echo '<span class="label label-success">Installment Completed</span>';
						}
						
						?>
						</td>
						<td>
						<?php
						if($inventory['installment']==='1'){ 
						$installment_date = unserialize($inventory['payment_date']);
						foreach($installment_date as $date){
							echo '<span class="label label-info tooltip-info" data-original-title="Installment Date" data-rel="tooltip" data-placement="top" style="cursor:pointer;">'.$date.'</span><br>';
						}
						}else{
							echo $inventory['payment_date'];
						}
						?>
						</td>
						<td class="td-actions">
						<a href="<?php echo $link->link('add_inventory',Admin,'?edit_id='.$inventory['id']);?>" class="green"><i class="icon-edit bigger-130 tooltip-success" data-original-title="Edit" data-rel="tooltip" data-placement="top"></i></a>
						<a href="<?php echo $link->link('view_inventory',Admin,'?delete_id='.$inventory['id']);?>" class="red"><i class="icon-trash bigger-130 tooltip-error" data-original-title="Delete" data-rel="tooltip" data-placement="top"></i></a>
						<?php if($inventory['installment']=='1' && $inventory['item_amount']!=$total_install_amount){?><i class="icon-plus bigger-130 tooltip-info" title="Add Installment" data-rel="popover" data-placement="left" data-content="<form method='post' action=''><input type='hidden' name='inventory_id' value='<?php echo $inventory['id'];?>'>
						<input type='text' name='add_installment' placeholder='payment amount'><br><br>
						<input type='text' id='datepicker' name='installment_date' placeholder='payment date(dd-mm-yyyy)'><br><br>
						<button type='submit' name='installment_submit' class='btn btn-info'>Save</button></form>"></i>
						<?php }?>
						</td>
					</tr>
				<?php $i++; } } ?>       
										</tbody>
			</table>

			<!--PAGE CONTENT ENDS-->
		</div>
		<!--/.span-->
	</div>
	<!--/.row-fluid-->
</div>
<!--/.page-content-->


</div>
<!--/.main-content-->
