	<div class="row clearfix">
	  	<div class="col-lg-12">

			<?= $this->session->flashdata('message'); ?>
	<div class="row">
		<div class="col-sm-12">
	  		<div class="card border-bottom-success shadow mb-4">
	            <div class="card-header py-3">
	              <h6 class="m-0 font-weight-bold text-success"></h6>
	    <a href="" class="btn btn-sm btn-success shadow-sm" data-toggle="modal" data-target="#addDataMenu" >
	        <i class="fas fa-fw fa-plus fa-sm text-white-50"></i>
	        <span class="text">Tambah Menu</span>
	    </a>
	            </div>
				<div class="card-body">
					<div class="table-responsive">
				  		<table class="table table-user-management table-striped table-bordered table-sm" id="tabel-data">
						  <thead>
						    <tr>
						      <th scope="col">#</th>
						      <th scope="col">Nama Menu</th>
						      <th scope="col">Action</th>
						    </tr>
						  </thead>
						  <tbody>
						  	<?php 
						  	$i = 1;
						  	foreach($menu as $row) : ?>
						  		<tr>
						  			<td><?= $i++; ?></td>
						  			<td><?= $row['nama'] ?></td>
						  			<td>
						  				<a href="<?= base_url('menu/submenu/'.$row['id_menu']); ?>" class="badge badge-success ubahMenu">
							      			<span class="icon text-white-50">
											  	<i class="fas fa-fw fa-folder"></i>
											</span>
											<span class="text">Detail Menu</span>
										</a>

						  				<a href="" class="badge badge-primary ubahMenu" data-toggle="modal" data-target="#ubahMenu"
						  					data-id_menu="<?= $row['id_menu'] ?>"
						  					data-nama="<?= $row['nama'] ?>">
							      			<span class="icon text-white-50">
											  	<i class="fas fa-fw fa-edit"></i>
											</span>
											<span class="text">Edit</span>
										</a>

						  				<a href="" class="badge badge-danger hapusMenu" data-toggle="modal" data-target="#hapusMenu"
						  					data-id_menu="<?= $row['id_menu'] ?>">
							      			<span class="icon text-white-50">
											  	<i class="fas fa-fw fa-trash"></i>
											</span>
											<span class="text">Hapus</span>
										</a>
						  			</td>
						  		</tr>
						  	<?php endforeach; ?>
						  </tbody>
						</table>
					</div>
				</div>
			</div>
	  	</div>
	</div>



<!-- Modal -->
<div class="modal fade" id="addDataMenu" tabindex="-1" role="dialog" aria-labelledby="addDataMenuLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="addDataMenuLabel">Tambah Menu</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form action="<?= base_url('menu/tambah'); ?>" method="post">
	      <div class="modal-body">
	        
                <div class="form-group row">
                  <label for="nama" class="col-sm-2 col-form-label">Menu</label>
                    <div class="col-sm-10">
                    <input type="text" class="form-control" id="nama" name="nama" value="" required>
                  </div>
                </div>

	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
	        <button type="submit" class="btn btn-success">Tambah</button>
	      </div>
      </form>
    </div>
  </div>
</div>

<!-- Modal -->
<div class="modal fade" id="ubahMenu" tabindex="-1" role="dialog" aria-labelledby="ubahMenuLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="ubahMenuLabel">Ubah Menu</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form action="<?= base_url('menu/ubah'); ?>" method="post">
	      <div class="modal-body">
	        
                <div class="form-group row">
                  <label for="name" class="col-sm-2 col-form-label">Menu</label>
                    <div class="col-sm-10">
                    <input type="hidden" class="form-control" id="id_menu_edit" name="id_menu" required>
                    <input type="text" class="form-control" id="nama_edit" name="nama" required>
                  </div>
                </div>

	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
	        <button type="submit" class="btn btn-success">Ubah</button>
	      </div>
      </form>
    </div>
  </div>
</div>

<!-- Modal -->
<div class="modal fade" id="hapusMenu" tabindex="-1" role="dialog" aria-labelledby="hapusMenuLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="hapusMenuLabel">Hapus Jabatan</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form action="<?= base_url('menu/hapus'); ?>" method="post">
	      <div class="modal-body">
	        	<input type="hidden" class="form-control" id="id_menu_hapus" name="id_menu" required>
                <h4>Konfirmasi Hapus!</h4>
                <p>Apakah ingin menghapus data?</p>

	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
	        <button type="submit" class="btn btn-danger">Ya</button>
	      </div>
      </form>
    </div>
  </div>
</div>


<script src="<?= base_url(); ?>assets/vendor/jquery/jquery.min.js"></script>
<script>
	$('.ubahMenu').on('click',function(){
	    var id = $(this).data('id_menu');
	    var nm = $(this).data('nama');

	    $('#id_menu_edit').val(id);
	    $('#nama_edit').val(nm);
    });

	$('.hapusMenu').on('click',function(){
	    var id = $(this).data('id_menu');

	    $('#id_menu_hapus').val(id);
    });
	
</script>