<?php foreach($kontak as $kontak) :   endforeach; ?>
<?php foreach($admin_login as $user) :   endforeach; ?> 
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark"> 
            		 <?php echo $title1.' '.$nama_kantor ?> 
            		  

            </h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active"><?php echo $title1; ?></li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
	    
          
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
      	  <div class="card">
              <div class="card-header">
                 

              </div>
              <!-- /.card-header -->
              <div class="card-body">
              	<table id="example1" class="table table-bordered table-striped">
              		<thead>
              			<tr>
              				<th>No</th>
              				<th>Kode Barang</th>
              				<th>Nama Barang</th>
              				<th>Harga Jual</th>
              				<th>Stok </th>
              				<th>Rak </th>
                      <?php 
                      $username = $this->session->userdata("username");  
                      $this->db->where('username',$username);
                      $query = $this->db->get('tb_admin');
                      $row = $query->row();
                     
                      $level = $row->level;

                       ?>
                      <?php  
                        if($level =='manager'){
                      ?>  
                      <th>Aksi</th>

                      <?php } ?>
              				
              		 
              				
              			</tr>
              		</thead>
              		<tbody>
              			<?php $no=1; foreach($barang as $rows) :   

              				$id_barang= $rows->id_barang;
              				$this->db->where('id',$id_barang);
              				$query = $this->db->get('tb_barang');
              				$row = $query->row();
              				$barcode_ecer = $row->barcode_ecer;
              				$nama_barang = $row->nama_barang;
											$id_rak = $row->id_rak;
              				$harga_jual_ecer = $row->harga_jual_ecer;

              				//rak
              				$sql_menuu = "SELECT * FROM tb_rak WHERE  id_rak = '$id_rak' ";
			              				$main_menuu = $this->db->query($sql_menuu)->result();
			              				foreach ($main_menuu as $mainkk) {
			              			 		$nama_rak= $mainkk->nama_rak;
			              			 	}

												?>


              				<tr>
												<td><?php echo $no; ?></td>
              					<td><?php echo $barcode_ecer; ?></td>
              					<td><?php echo $nama_barang; ?></td>
              					<td><?php echo nominal($harga_jual_ecer); ?></td>

              					<td><?php echo $rows->stok_aplikasi; ?></td>
              					<td><?php echo $nama_rak; ?></td>
              				   <?php  
                            if($level =='manager'){
                          ?>  
                          <td> <a href=""  type="button" data-toggle="modal" data-target="#modal-edit<?php echo $rows->id_stok; ?>"><i class="fa fa-edit"></i></a></td>
  <!-- Edit -->
                         
                            <div class="modal fade" id="modal-edit<?php echo $rows->id_stok; ?>">
                              <div class="modal-dialog">
                                <div class="modal-content">
                                  <div class="modal-header">
                                    <h4 class="modal-title">Edit Data</h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                      <span aria-hidden="true">&times;</span>
                                    </button>
                                  </div>
                                  <div class="modal-body">
                                      <form class="form-horizontal" action="<?php echo base_url('kantor/code_ubah_stok'); ?>" method="POST" enctype="multipart/form-data" />   
                                    <!-- id kirim -->
                                    <input type="hidden" name="id_stok" value="<?php echo $rows->id_stok; ?>">
                                    <div class="form-group">
                                      <label for="exampleInputEmail1">Stok Aplikasi</label>
                                      <input type="text" class="form-control" value="<?php echo $rows->stok_aplikasi; ?>" id="exampleInputEmail1" name="stok_aplikasi" placeholder="">
                                    </div>
                                    

                                  </div>
                                  <div class="modal-footer justify-content-between">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                    <button type="submit" class="btn btn-primary">Simpan</button>
                                     </form>
                                  </div>
                                </div>
                                <!-- /.modal-content -->
                              </div>
                              <!-- /.modal-dialog -->
                            </div>
                         
                        

                          <?php } ?>
              					   
 
              				</tr>
              			<?php $no++; endforeach; ?>

              		</tbody>

              	</table>
              </div>
              <!-- /.card-body -->
            </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
 