<div class="card-block">
	<div class="stok-keluar-info-box">
	  <i class="fa fa-info-circle"></i>
	  <div>
	    <b>Info:</b> Jika ada Order <b>Gagal Cetak</b>, <b>Paper Jam</b>, dll, input di sini agar data stok sesuai.
	  </div>
	</div>
	<table class="table table-striped table-mailcard" >
		<thead>
			<tr>
				<th class="w-1 text-center">No</th>
				<th class="w-10 pl-1">Nama bahan</th>
				<th class="w-8 text-right">Stok Keluar</th>
				<th class="w-8 text-right">Aksi</th>
			</tr>
		</thead>
		<tbody>
			<?php if(!empty($result)){
				$no = 1;
				$total = 0;
				foreach ($result as $row){
					$jml_masuk = stok_masuk($row->id);
					$jml_keluar = stok_keluar($row->id);
					$total = $jml_masuk - $jml_keluar;
					
					$disabled = '';
					if($jml_keluar <=0 ){
						$disabled = 'disabled';
					}
					
					echo "<tr><td class='text-center'>$no</td>
					<td class='pl-1'>".$row->title."</td>
					<td class='text-right'>".$jml_keluar."</td>
					<td class='text-right'>
					<div class='btn-group btn-group-sm' role='group'>
					<button type='button' class='btn btn-info btn-sm detail_bahan' data-id='".$row->id."' data-title='".$row->title."' ".$disabled."><i class='fa fa-search'></i> Detail</button>
					<button type='button' class='btn btn-secondary btn-sm flat print_stok_keluar' data-toggle='tooltip' data-id='".$row->id."' data-original-title='Print PDF'><i class='fa fa-file-pdf-o fa-1x'></i> Print</button>
					</div>
					</td>
					</tr>";
					$no++;
				} }else{ ?>
				<tr>
					<td colspan="4">Data belum ada</td>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<div class="stok-keluar-mobile-list">
		<?php if(!empty($result)){
			$no = 1;
			foreach ($result as $row){
				$jml_masuk = stok_masuk($row->id);
				$jml_keluar = stok_keluar($row->id);
				$total = $jml_masuk - $jml_keluar;
				$disabled = '';
				if($jml_keluar <=0 ){
					$disabled = 'disabled';
				}
		?>
		<div class="stok-keluar-mobile-card">
			<div class="stok-keluar-mobile-top">
				<div class="stok-keluar-mobile-number"><?php echo $no; ?></div>
				<div class="stok-keluar-mobile-title"><?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?></div>
				<div class="stok-keluar-mobile-stock">
					<div>Stok Keluar</div>
					<strong><?php echo $jml_keluar; ?></strong>
				</div>
			</div>
			<div class="stok-keluar-mobile-actions">
				<button type="button" class="stok-keluar-mobile-btn stok-keluar-mobile-btn-detail detail_bahan" data-id="<?php echo $row->id; ?>" data-title="<?php echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $disabled; ?>><i class="fa fa-search"></i> Detail</button>
				<button type="button" class="stok-keluar-mobile-btn stok-keluar-mobile-btn-print print_stok_keluar" data-toggle="tooltip" data-id="<?php echo $row->id; ?>" data-original-title="Print PDF"><i class="fa fa-print"></i> Print</button>
			</div>
		</div>
		<?php $no++; } ?>
		<div class="stok-keluar-mobile-summary">
			<i class="fa fa-users"></i>
			<span>Menampilkan: <?php echo count($result); ?></span>
		</div>
		<?php } else { ?>
		<div class="stok-keluar-mobile-empty">Data belum ada</div>
		<?php } ?>
	</div>
	<nav aria-label="Page navigation" class="mt-2 stok-keluar-pagination">
		<?php 
			echo $this->ajax_pagination->create_links(); 
		?>
	</nav>
</div><!-- /.card-body -->
