umkm-app/application/views/admin/progresabsen.php

315 lines
22 KiB
PHP
Raw Normal View History

2021-09-15 21:00:06 +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 rel="icon" type="image/png" href="../../assets/images/favicon.png" />
<title>Aplikasi UMKM</title>
</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="../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;">
<div class="card">
2021-09-15 21:00:06 +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/')?>admin/dashboard" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data Pemilik UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/umkm" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Data UMKM</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/absensi" style="text-decoration:none;">
<li class="list-group-item bg-primary text-white border-bottom">Absensi</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/laporan" style="text-decoration:none;">
<li class="list-group-item text-dark border-bottom">Laporan</li>
</a>
<a href="<?php echo base_url('index.php/')?>admin/setting" style="text-decoration:none;">
<li class="list-group-item text-dark">Setting</li>
</a>
</ul>
</div>
</div>
<div class="col col-md-9 col-lg-9 col-sm-12 col-12">
2021-09-15 21:00:06 +07:00
<div class="card">
<h5 class="card-header">Absensi</h5>
<div class="card-body">
<div>
<ul class="nav nav-tabs">
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/absensi" class="nav-link">Absen Aktif</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/daftarabsen" class="nav-link">Data Absensi</a>
</li>
<li class="nav-item">
<a href="<?php echo base_url('index.php/')?>admin/progresabsen" class="nav-link active">Progres Absensi</a>
</li>
</ul>
<div class="mt-3">
<?php foreach($tahun_list as $tahun) {?>
<div class="mb-3">
<div class="card">
<?php
$jumlahlaporantahunan = $Laporanmodel->getLaporanCountByYear($tahun->tahun);
if($jumlahlaporantahunan<1){
$badge_text='Aktif';
$badge_color='success';
$header_color='';
$header_text='';
$bg_warning='warning';
} else {
$badge_text='Close';
$badge_color='dark';
$header_color='bg-secondary';
$header_text='text-light';
$bg_warning='dark';
}
?>
<div class="card-header <?php echo $header_color.' '.$header_text?>">
Tahun <?php echo $tahun->tahun?> <span class="badge badge-<?php echo $badge_color?>"><?php echo $badge_text?></span>
</div>
<div class="card-body">
<div class="row">
<div class="col col-2 col-md-1 col-lg-1 pt-1">
2021-09-15 21:00:06 +07:00
<?php
$jumlahabsen = $absenmodel->getAbsenCountByYear($tahun->tahun);
$prosentaseabsen = ($jumlahabsen/12)*100;
$selisihabsen = 12-$jumlahabsen;
$selisihprosentase = 100-$prosentaseabsen;
?>
<label><?php echo $jumlahabsen ?>/12</label>
</div>
<div class="col col-md-9 pt-2">
<div class="progress">
<div class="progress-bar progress-bar-striped bg-<?php echo $badge_color?>" role="progressbar" style="width: <?php echo $prosentaseabsen?>%" aria-valuenow="<?php echo $jumlahabsen?>" aria-valuemin="0" aria-valuemax="12"><?php echo number_format((float)$prosentaseabsen, 1, '.', ''); ?>%</div>
<div class="progress-bar progress-bar-striped bg-secondary" role="progressbar" style="width: <?php echo $selisihprosentase?>%" aria-valuenow="<?php echo $selisihabsen?>" aria-valuemin="0" aria-valuemax="12"></div>
</div>
</div>
<div class="col col-md-2 d-flex align-items-center text-center">
<btn class="btn btn-sm btn-inline btn-<?php echo $bg_warning?> mr-2" type="button" data-toggle="collapse" data-target="#detailabsen<?php echo $tahun->tahun?>" aria-expanded="false" aria-controls="detailabsen<?php echo $tahun->tahun?>">Detail</btn>
<?php if($jumlahlaporantahunan<1){?>
<button id="btn_close" class="btn btn-sm btn-inline btn-danger">Close</button>
<?php } else { ?>
<button class="btn btn-sm btn-inline btn-secondary" disabled>Close</button>
<?php } ?>
</div>
</div>
<div class="collapse" id="detailabsen<?php echo $tahun->tahun?>">
<div class="mt-3">
<div class="card card-body">
<div class="row">
<?php
$checked_januari='';
$checked_februari='';
$checked_maret='';
$checked_april='';
$checked_mei='';
$checked_juni='';
$checked_juli='';
$checked_agustus='';
$checked_september='';
$checked_oktober='';
$checked_november='';
$checked_desember='';
$daftarabsen = $absenmodel->getAbsensByTahun($tahun->tahun);
foreach($daftarabsen as $absen){
if($absen->bulan=='1'){
$checked_januari='checked';
} elseif($absen->bulan=='2'){
$checked_februari='checked';
} elseif($absen->bulan=='3'){
$checked_maret='checked';
} elseif($absen->bulan=='4'){
$checked_april='checked';
} elseif($absen->bulan=='5'){
$checked_mei='checked';
} elseif($absen->bulan=='6'){
$checked_juni='checked';
} elseif($absen->bulan=='7'){
$checked_juli='checked';
} elseif($absen->bulan=='8'){
$checked_agustus='checked';
} elseif($absen->bulan=='9'){
$checked_september='checked';
} elseif($absen->bulan=='10'){
$checked_oktober='checked';
} elseif($absen->bulan=='11'){
$checked_november='checked';
} elseif($absen->bulan=='12'){
$checked_desember='checked';
}
}
?>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_januari?>>
<label class="form-check-label" for="exampleCheck1">Januari</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_februari?>>
<label class="form-check-label" for="exampleCheck1">Februari</label>
</div>
</div>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_maret?>>
<label class="form-check-label" for="exampleCheck1">Maret</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_april?>>
<label class="form-check-label" for="exampleCheck1">April</label>
</div>
</div>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_mei?>>
<label class="form-check-label" for="exampleCheck1">Mei</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_juni?>>
<label class="form-check-label" for="exampleCheck1">Juni</label>
</div>
</div>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_juli?>>
<label class="form-check-label" for="exampleCheck1">Juli</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_agustus?>>
<label class="form-check-label" for="exampleCheck1">Agustus</label>
</div>
</div>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_september?>>
<label class="form-check-label" for="exampleCheck1">September</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_oktober?>>
<label class="form-check-label" for="exampleCheck1">Oktober</label>
</div>
</div>
<div class="col col-md-2">
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_november?>>
<label class="form-check-label" for="exampleCheck1">November</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input bg-success text-success" onclick="return false;" <?php echo $checked_desember?>>
<label class="form-check-label" for="exampleCheck1">Desember</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<!-- endforeach tahun -->
</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_close')
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: "Absen tahunan yang ditutup tidak bisa diaktifkan kembali.",
icon: "warning",
buttons: [
'Batal',
'Submit'
],
dangerMode: true,
}).then(function(isConfirm) {
if (isConfirm) {
swal({
title: 'Berhasil',
text: 'Absen tahunan berhasil ditutup.',
icon: 'success'
}).then(function() {
window.location.href = urlToRedirect;
});
} else {
swal("Batal", "Absen tahunan masih aktif.)", "error");
}
});
});
});
</script>
</body>
</html>