2021-09-16 15:37:22 +07:00
<! doctype html >
< html lang = " en " >
< head >
<!-- Required meta tags -->
< meta charset = " utf-8 " >
< meta name = " viewport " content = " width=device-width, initial-scale=1, shrink-to-fit=no " >
<!-- Bootstrap CSS -->
< link rel = " stylesheet " href = " <?php echo base_url()?>assets/css/bootstrap.min.css " integrity = " sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm " crossorigin = " anonymous " >
< link rel = " stylesheet " href = " <?php echo base_url()?>assets/css/dataTables.bootstrap4.min.css " >
< link data - require = " sweet-alert@* " data - semver = " 0.4.2 " rel = " stylesheet " href = " <?php echo base_url()?>assets/css/sweetalert.min.css " />
< link data - require = " sweet-alert@* " data - semver = " 0.4.2 " rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css " />
< link rel = " icon " type = " image/png " href = " ../../assets/images/favicon.png " />
< title > Aplikasi UMKM </ title >
2021-09-16 22:54:20 +07:00
2021-09-16 15:37:22 +07:00
</ head >
< body >
< nav class = " navbar navbar-expand-lg navbar-dark bg-primary " >
< div class = " container " >
< a class = " navbar-brand " href = " # " >
< img src = " <?php echo base_url()?>assets/images/logo-white.png " width = " 100 " alt = " " >
</ a >
< button class = " navbar-toggler " type = " button " data - toggle = " collapse " data - target = " #navbarSupportedContent " aria - controls = " navbarSupportedContent " aria - expanded = " false " aria - label = " Toggle navigation " >
< span class = " navbar-toggler-icon " ></ span >
</ button >
< div class = " collapse navbar-collapse " id = " navbarSupportedContent " >
< ul class = " navbar-nav mr-auto " >
</ ul >
< form methode = " POST " action = " <?php echo base_url('index.php/')?>login/logout " class = " form-inline my-2 my-lg-0 " >
< button class = " btn btn-outline-warning btn-sm my-2 my-sm-0 " type = " submit " > Logout </ button >
</ form >
</ div >
</ div >
</ nav >
< div class = " container " >
< div class = " row " >
< div class = " col-md-3 " style = " cursor:pointer; " >
2021-09-16 22:54:20 +07:00
< div class = " card " >
2021-09-16 15:37:22 +07:00
< div class = " card-header text-center " >
< img src = " <?php echo base_url()?>assets/images/<?php echo $user_logged->foto_user ?> " width = " 125 " />< br >
< strong >< ? php echo $user_logged -> nama ?> </strong>
</ div >
< ul class = " list-group list-group-flush " >
< a href = " <?php echo base_url('index.php/')?>user/dashboard " style = " text-decoration:none; " >
< li class = " list-group-item border-bottom text-light active " > Daftar UMKM </ li >
</ a >
< a href = " <?php echo base_url('index.php/')?>user/setting " style = " text-decoration:none; " >
< li class = " list-group-item text-dark " > Setting </ li >
</ a >
</ ul >
</ div >
</ div >
2021-09-16 22:54:20 +07:00
< div class = " col col-12 col-md-9 col-lg-9 " >
2021-09-16 15:37:22 +07:00
< div class = " card " >
< h5 class = " card-header " > Daftar UMKM </ h5 >
< div class = " card-body " >
< div >
< ul class = " nav nav-tabs " >
< li class = " nav-item " >
< a href = " <?php echo base_url('index.php/')?>admin/umkm " class = " nav-link active " > Daftar UMKM </ a >
</ li >
</ ul >
2021-09-16 22:54:20 +07:00
< div class = " mt-3 " >
2021-09-16 15:37:22 +07:00
< ? php if ( isset ( $del_msg )){
if ( $del_msg == 'error' ){
?>
< div class = " alert alert-danger " role = " alert " > Tidak bisa menghapus < strong >< ? php echo $del_umkm ?> </strong>
, kerena terdapat data absensi yang terkait !</ div >
< ? php } elseif ( $del_msg == 'sucess' ){ ?>
< div class = " alert alert-success " role = " alert " > Data berhasil terhapus !</ div >
< ? php }} ?>
2021-09-16 22:54:20 +07:00
< table id = " tabeldata " class = " table table-striped table-bordered table-responsive-lg " >
2021-09-16 15:37:22 +07:00
< thead >
< tr >
< th > No </ th >
< th > Nama Umkm </ th >
< th > Kecamatan </ th >
< th > Kategori </ th >
< th > Opsi </ th >
</ tr >
</ thead >
< tbody >
< ? php
$no = 0 ;
foreach ( $data_umkm as $umkm ) {
$no ++ ;
?>
< tr >
< td >< ? php echo $no ?> </td>
< td >< ? php echo $umkm -> nama ?> </td>
< td >< ? php echo $umkm -> kecamatan ?> </td>
< ? php
$kategori = $this -> KategoriModel -> getKategoriById ( $umkm -> id_kategori );
?>
< td >< ? php echo $kategori -> kategori ?> </td>
< td >
< a href = " <?php echo base_url('index.php/')?>user/detailumkm?id_umkm=<?php echo $umkm->id_umkm ?> " class = " btn btn-block btn-info btn-sm " > Detail </ a >
< a href = " <?php echo base_url('index.php/')?>user/editumkm?id_umkm=<?php echo $umkm->id_umkm ?> " class = " btn btn-block btn-warning btn-sm " > Edit </ a >
</ td >
</ tr >
< ? php
}
?>
</ tbody >
</ table >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
</ div >
<!-- Optional JavaScript -->
<!-- jQuery first , then Popper . js , then Bootstrap JS -->
< script src = " <?php echo base_url()?>assets/js/jquery-3.2.1.slim.min.js " integrity = " sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN " crossorigin = " anonymous " ></ script >
< script src = " <?php echo base_url()?>assets/js/popper.min.js " integrity = " sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q " crossorigin = " anonymous " ></ script >
< script src = " <?php echo base_url()?>assets/js/bootstrap.min.js " integrity = " sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl " crossorigin = " anonymous " ></ script >
< script src = " <?php echo base_url()?>assets/js/jquery.dataTables.min.js " ></ script >
< script src = " <?php echo base_url()?>assets/js/dataTables.bootstrap4.min.js " ></ script >
< script src = " <?php echo base_url()?>assets/js/sweetalert.min.js " ></ script >
< script >
$ ( document ) . ready ( function () {
$ ( '#tabeldata' ) . DataTable ();
} );
</ script >
< script >
const element = document . querySelectorAll ( '#btn_hapus' )
element . forEach ( function ( el ){
el . addEventListener ( 'click' , function ( e ) {
e . preventDefault ();
var urlToRedirect = e . currentTarget . getAttribute ( 'href' ); //use currentTarget because the click may be on the nested i tag and not a tag causing the href to be empty
console . log ( urlToRedirect ); // verify if this is the right URL
swal ({
title : " Kamu yakin ? " ,
text : " Data yang dihapus tidak bisa dikembalikan. " ,
icon : " warning " ,
buttons : [
'Batal' ,
'Hapus'
],
dangerMode : true ,
}) . then ( function ( isConfirm ) {
if ( isConfirm ) {
swal ({
title : 'Berhasil' ,
text : 'Data berhasil terhapus' ,
icon : 'success'
}) . then ( function () {
window . location . href = urlToRedirect ;
});
} else {
swal ( " Batal " , " Data tidak terhapus.) " , " error " );
}
});
});
});
</ script >
</ body >
</ html >