first commit
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Sistem Kedisiplinan <?= $dinas ?> - <?= $header ?></title>
|
||||
<title>Sistem Bantuan Sosial Tunai Dinas Sosial, Pariwisata dan Kebudayaan Pinrang - <?= $header ?></title>
|
||||
|
||||
<!-- Main Styles -->
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/styles/style.min.css">
|
||||
@ -24,19 +24,6 @@
|
||||
<!-- Sweet Alert -->
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/sweetalert/sweetalert.css">
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/toastr/toastr.min.css">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="<?= base_url() ?>assets//images/favico/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="<?= base_url() ?>assets//images/favico/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="<?= base_url() ?>assets//images/favico/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="<?= base_url() ?>assets//images/favico/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="<?= base_url() ?>assets//images/favico/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="<?= base_url() ?>assets//images/favico/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="<?= base_url() ?>assets//images/favico/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="<?= base_url() ?>assets//images/favico/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="<?= base_url() ?>assets//images/favico/apple-icon-180x180.png">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="<?= base_url() ?>assets/images/favico/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="<?= base_url() ?>assets/images/favico/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="<?= base_url() ?>assets/images/favico/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="<?= base_url() ?>assets/images/favico/<?= base_url() ?>assets/images/favico/favicon-16x16.png">
|
||||
|
||||
<style type="text/css">
|
||||
.swal-modal .swal-text {
|
||||
@ -44,27 +31,21 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
if ($header == "Halaman Karyawan" || $header == "Halaman Jam Kerja" || $header == "Halaman Utama" || $header == "Halaman Pengaturan Libur" || $header == "Halaman Pengaturan Perjalanan Dinas" || $header == "Halaman Laporan") { ?>
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<style>
|
||||
.avatar {
|
||||
vertical-align: middle;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($header == "Halaman Pengaturan Libur" || $header == "Halaman Pengaturan Perjalanan Dinas") { ?>
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/plugin/select2/css/select2.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<!-- <style>
|
||||
.avatar {
|
||||
vertical-align: middle;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/plugin/select2/css/select2.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" /> -->
|
||||
|
||||
|
||||
</head>
|
||||
@ -11,48 +11,32 @@
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title" id="header_peta">Peta Absensi</h4>
|
||||
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="form-group">
|
||||
<div id="map" style="width: 100%; height: 500px"></div>
|
||||
</div>
|
||||
<!-- /#flot-chart-1.flot-chart -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title" id="header_absensi">Absensi Karyawan</h4>
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">List Penduduk</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<!-- create button for 'Tambah Penduduk' -->
|
||||
<button type="button" class="btn btn-primary btn-xs" onclick="tambah_penduduk()">
|
||||
<i class="fa fa-plus"></i> Tambah Penduduk
|
||||
</button>
|
||||
<br /> <br />
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_karyawan" class="table table-striped table-bordered display" style="width:100%">
|
||||
<table id="table_list_penduduk" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIP</th>
|
||||
<th>NIK</th>
|
||||
<th>Nama</th>
|
||||
<th>Status</th>
|
||||
<th>Last Updated</th>
|
||||
<th>Umur</th>
|
||||
<th>No HP</th>
|
||||
<th>Jenis Kelamin</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($list_karyawan as $key => $value) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?=$value->nik?></td>
|
||||
<td><?=$value->nama?></td>
|
||||
<td id="status_<?=$value->nik?>"> <?=$value->status_kerja?> </td>
|
||||
<td id="lu_<?=$value->nik?>"> - </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -71,177 +55,285 @@
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<!-- create modal for 'Tambah Penduduk' -->
|
||||
<div class="modal fade" id="modal_add_penduduk" tabindex="-1" role="dialog" aria-labelledby="modal_add_penduduk" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modal_add_penduduk"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="form_add_penduduk" onsubmit="return tambah_edit_penduduk(event)">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="status">
|
||||
<label for="nik">NIK</label>
|
||||
<input type="text" class="form-control" id="nik" name="nik" placeholder="Masukkan NIK" onkeypress="return isNumberKey(event)" minlength="16" maxlength="16" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Nama</label>
|
||||
<input type="text" class="form-control" id="nama" name="nama" placeholder="Masukkan Nama" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="umur">Tanggal Lahir</label>
|
||||
<input type="date" class="form-control" id="tgl_lahir" name="tgl_lahir" placeholder="Masukkan Tanggal Lahir" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jenis_kelamin">Jenis Kelamin</label>
|
||||
<select class="form-control" id="jenis_kelamin" name="jenis_kelamin" required>
|
||||
<option value="">Pilih Jenis Kelamin</option>
|
||||
<option value="Laki-laki">Laki-laki</option>
|
||||
<option value="Perempuan">Perempuan</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="alamat">Alamat</label>
|
||||
<textarea class="form-control" id="alamat" name="alamat" placeholder="Masukkan Alamat" style="resize :none;" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="no_hp">No HP</label>
|
||||
<input type="text" class="form-control" id="no_hp" name="no_hp" placeholder="Masukkan No HP" onkeypress="return isNumberKey(event)" minlength="9" maxlength="13" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-xs" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary btn-xs" id="btn_add_penduduk">Simpan</button>
|
||||
<button type="submit" class="btn btn-primary btn-xs" id="btn_update_penduduk">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD7B9RynI4hQM_Y4BG9GYxsTLWwYkGASRo&libraries=geometry,drawing,places&v=weekly®ion=ID&language=id"></script>
|
||||
|
||||
<script>
|
||||
$('#table_list_karyawan').DataTable({
|
||||
var data_lama;
|
||||
|
||||
})
|
||||
var id_dinas = <?= $id_dinas ?>;
|
||||
$("#header_peta").html(`Peta Absensi <i>(${getTodayDate()})</i>`)
|
||||
$("#header_absensi").html(`Absensi Karyawan <i>(${getTodayDate()})</i>`)
|
||||
function datatables() {
|
||||
table = $('#table_list_penduduk').DataTable({
|
||||
// "searching": false,
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, -1],
|
||||
[5, 10, 15, "All"]
|
||||
],
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
// "order": [[ 4, 'desc' ]],
|
||||
|
||||
let markersOverlay = [];
|
||||
"ajax": {
|
||||
"url": server_url + "admin/",
|
||||
"type": "POST",
|
||||
data: {
|
||||
proses: 'table_penduduk'
|
||||
},
|
||||
|
||||
function addInfoWindow(marker, message) {
|
||||
},
|
||||
|
||||
var infoWindow = new google.maps.InfoWindow({
|
||||
content: message
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'click', function() {
|
||||
infoWindow.open(map, marker);
|
||||
"columnDefs": [{
|
||||
"targets": [5],
|
||||
"orderable": false,
|
||||
}, ],
|
||||
});
|
||||
}
|
||||
async function initMap() {
|
||||
map = new google.maps.Map(document.getElementById("map"), {
|
||||
zoom: 17.5,
|
||||
center: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
mapTypeId: 'hybrid',
|
||||
streetViewControl: false,
|
||||
});
|
||||
datatables()
|
||||
|
||||
const cityCircle = new google.maps.Circle({
|
||||
strokeColor: "#FF0000",
|
||||
strokeOpacity: 0.3,
|
||||
strokeWeight: 0.3,
|
||||
fillColor: "#FF0000",
|
||||
fillOpacity: 0.3,
|
||||
map,
|
||||
center: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
radius: <?= $radius ?>,
|
||||
});
|
||||
|
||||
const marker = new google.maps.Marker({
|
||||
position: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
map: map,
|
||||
title: 'Center',
|
||||
icon: 'https://maps.google.com/mapfiles/ms/icons/green-dot.png',
|
||||
});
|
||||
|
||||
markersOverlay[0] = marker;
|
||||
|
||||
let dinas_html = `<div class="card-content">
|
||||
<div class="form-group>
|
||||
<label for="nik"><?= $dinas ?></label>
|
||||
</div>
|
||||
</div>`
|
||||
|
||||
addInfoWindow(marker, dinas_html);
|
||||
|
||||
setInterval(
|
||||
async function() {
|
||||
clearOverlays()
|
||||
markers = []
|
||||
markers = [{
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
|
||||
}]
|
||||
let all_data;
|
||||
try {
|
||||
const the_data = await $.ajax({
|
||||
url: server_url_api + "get_today_absensi?id_dinas=" + id_dinas,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
// block_ui("Mengambil Data Karyawan");
|
||||
},
|
||||
});
|
||||
// console.log(the_data);
|
||||
all_data = the_data.data;
|
||||
|
||||
for (let i = 0; i < all_data.length; i++) {
|
||||
markers.push(all_data[i])
|
||||
// console.log(all_data)
|
||||
}
|
||||
|
||||
let arr = []
|
||||
for (let i = 0; i < markers.length; i++) {
|
||||
console.log(markers[i]['lat'])
|
||||
let latlng = new google.maps.LatLng(markers[i]['lat'], markers[i]['lng']);
|
||||
arr.push(latlng);
|
||||
let color = i > 0 ? 'blue' : 'green'
|
||||
|
||||
const marker = new google.maps.Marker({
|
||||
position: {
|
||||
lat: markers[i]['lat'],
|
||||
lng: markers[i]['lng']
|
||||
},
|
||||
map: map,
|
||||
title: 'Center',
|
||||
icon: `https://maps.google.com/mapfiles/ms/icons/${color}-dot.png`,
|
||||
});
|
||||
|
||||
markersOverlay[i] = marker;
|
||||
if (i > 0) {
|
||||
let html = `<div class="card-content">
|
||||
<div class="form-group>
|
||||
<label for="nik">NIK</label>
|
||||
<input type="text" class="form-control" value="${markers[i]['nik']}" disabled>
|
||||
</div>
|
||||
<div class="form-group>
|
||||
<label for="nik">Nama</label>
|
||||
<input type="text" class="form-control" value="${markers[i]['nama']}" disabled>
|
||||
</div>
|
||||
<div class="form-group>
|
||||
<label for="nik">Last Updated</label>
|
||||
<input type="text" class="form-control" value="${markers[i]['last_updated']}" disabled>
|
||||
</div>
|
||||
<div class="form-group>
|
||||
<label for="nik">Status</label>
|
||||
<input type="text" class="form-control" value="${markers[i]['status']}" disabled>
|
||||
</div>
|
||||
</div>`
|
||||
$("#lu_"+markers[i]['nik']).html(markers[i]['last_updated']);
|
||||
$("#status_"+markers[i]['nik']).html(markers[i]['status']);
|
||||
addInfoWindow(marker, html);
|
||||
} else {
|
||||
addInfoWindow(marker, dinas_html);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var bounds = new google.maps.LatLngBounds();
|
||||
|
||||
if (markers.length > 1) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
bounds.extend(arr[i]);
|
||||
}
|
||||
map.fitBounds(bounds);
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}, 5000)
|
||||
function tambah_penduduk() {
|
||||
// enable nik
|
||||
$('#nik').prop('disabled', false);
|
||||
// hide button update
|
||||
$('#btn_update_penduduk').hide();
|
||||
// show button simpan
|
||||
$('#btn_add_penduduk').show();
|
||||
// clear all input in modal
|
||||
// status tambah
|
||||
$('#status').val('tambah');
|
||||
$('#form_add_penduduk').trigger('reset')
|
||||
$('#modal_add_penduduk').modal('show')
|
||||
$('#modal_add_penduduk').find('.modal-title').text('Tambah Penduduk')
|
||||
|
||||
}
|
||||
google.maps.event.addDomListener(window, 'load', initMap);
|
||||
|
||||
function clearOverlays() {
|
||||
if (markersOverlay) {
|
||||
for (i in markersOverlay) {
|
||||
markersOverlay[i].setMap(null);
|
||||
async function edit_penduduk(nik) {
|
||||
// disable nik
|
||||
$('#nik').attr('disabled', true)
|
||||
// show button update
|
||||
$('#btn_update_penduduk').show();
|
||||
// hide button simpan
|
||||
$('#btn_add_penduduk').hide();
|
||||
// clear all input in modal
|
||||
// status edit
|
||||
$('#status').val('edit');
|
||||
$('#form_add_penduduk').trigger('reset')
|
||||
$('#modal_add_penduduk').modal('show')
|
||||
$('#modal_add_penduduk').find('.modal-title').text('Edit Penduduk')
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "penduduk?nik=" + nik,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Penduduk");
|
||||
},
|
||||
});
|
||||
|
||||
data = data.data
|
||||
data_lama = data
|
||||
console.log(data)
|
||||
$('#nik').val(data.nik)
|
||||
$('#nama').val(data.nama)
|
||||
$('#tgl_lahir').val(data.tgl_lahir)
|
||||
$('#jenis_kelamin').val(data.jenis_kelamin)
|
||||
$('#alamat').val(data.alamat)
|
||||
$('#no_hp').val(data.no_hp)
|
||||
await $.unblockUI();
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// tambah_edit_penduduk
|
||||
function tambah_edit_penduduk(e) {
|
||||
e.preventDefault();
|
||||
const status = $('#status').val();
|
||||
const nik = $('#nik').val();
|
||||
const nama = $('#nama').val();
|
||||
const tgl_lahir = $('#tgl_lahir').val();
|
||||
const jenis_kelamin = $('#jenis_kelamin').val();
|
||||
const alamat = $('#alamat').val();
|
||||
const no_hp = $('#no_hp').val();
|
||||
|
||||
console.log(status, nik, nama, tgl_lahir, jenis_kelamin, alamat, no_hp);
|
||||
|
||||
if (status == 'edit') {
|
||||
const data = {
|
||||
nik: nik,
|
||||
nama: nama,
|
||||
tgl_lahir: tgl_lahir,
|
||||
jenis_kelamin: jenis_kelamin,
|
||||
alamat: alamat,
|
||||
no_hp: no_hp,
|
||||
}
|
||||
if (JSON.stringify(data) === JSON.stringify(data_lama)) {
|
||||
return toastr.warning("Data tidak ada yang berubah");
|
||||
}
|
||||
}
|
||||
|
||||
// show swal before submit
|
||||
swal({
|
||||
title: "Apakah anda yakin?",
|
||||
text: "Data akan "+ ( status == 'tambah' ? 'ditambahkan' : 'diubah' ) +"!",
|
||||
icon: "info",
|
||||
buttons: true,
|
||||
dangerMode: false,
|
||||
}).then((willDelete) => {
|
||||
if (willDelete) {
|
||||
$.ajax({
|
||||
type: status == 'tambah' ? 'post' : 'put',
|
||||
url: server_url_api + "penduduk",
|
||||
data: {
|
||||
nik: nik,
|
||||
nama: nama,
|
||||
tgl_lahir: tgl_lahir,
|
||||
jenis_kelamin: jenis_kelamin,
|
||||
alamat: alamat,
|
||||
no_hp: no_hp
|
||||
},
|
||||
dataType: "JSON",
|
||||
beforeSend: function(res) {
|
||||
block_ui("Menyimpan Data Penduduk");
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// close modal
|
||||
$('#modal_add_penduduk').modal('hide')
|
||||
$('#table_list_penduduk').dataTable().fnDestroy();
|
||||
datatables();
|
||||
toastr.success(response.message)
|
||||
$.unblockUI();
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
$.unblockUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function hapus_penduduk(id) {
|
||||
swal({
|
||||
title: "Apakah anda yakin?",
|
||||
text: "Data akan dihapus!",
|
||||
icon: "warning",
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
}).then((willDelete) => {
|
||||
if (willDelete) {
|
||||
$.ajax({
|
||||
type: 'delete',
|
||||
url: server_url_api + "penduduk/",
|
||||
data : {
|
||||
nik : id
|
||||
},
|
||||
dataType: "JSON",
|
||||
beforeSend: function(res) {
|
||||
block_ui("Menghapus Data Penduduk");
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response)
|
||||
$('#table_list_penduduk').dataTable().fnDestroy();
|
||||
datatables();
|
||||
toastr.success(response.message)
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
$.unblockUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,298 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">List Hari Jam Kerja</h4>
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_hari" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hari</th>
|
||||
<th>Jam Masuk</th>
|
||||
<th>Jam Istirehat</th>
|
||||
<th>Jam Masuk Kembali</th>
|
||||
<th>Jam Pulang</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="text-align: center;">
|
||||
<tr id="senin">
|
||||
<td class="harinya">Senin</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('senin')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="selasa">
|
||||
<td class="harinya">Selasa</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('selasa')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="rabu">
|
||||
<td class="harinya">Rabu</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('rabu')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="kamis">
|
||||
<td class="harinya">Kamis</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('kamis')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="jumat">
|
||||
<td class="harinya">Jumat</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('jumat')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="sabtu">
|
||||
<td class="harinya">Sabtu</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('sabtu')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
<tr id="ahad">
|
||||
<td class="harinya">Ahad</td>
|
||||
<td class="jam_masuk">-</td>
|
||||
<td class="jam_istirehat">-</td>
|
||||
<td class="jam_masuk_kembali">-</td>
|
||||
<td class="jam_pulang">-</td>
|
||||
<td><button type='button' onclick="edit_hari_kerja('ahad')" title='Edit Detail Karyawan' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico fa fa-edit'></i></button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<!-- /#flot-chart-1.flot-chart -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_jam_kerja" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1" data-keyboard="false" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<form class="modal-content" onsubmit="return edit_jam_kerja(event)">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-1"></h4>
|
||||
<!-- <p style="font-size: 10px;"><i>(Geserkan marker ke titik kordinat dinas)</i></p> -->
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="nik">Jam Masuk</label>
|
||||
<input type="hidden" id="hari">
|
||||
<input type="time" class="form-control" id="jam_masuk" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">Jam Istirehat</label>
|
||||
<input type="time" class="form-control" id="jam_istirehat" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">Jam Masuk Kembali</label>
|
||||
<input type="time" class="form-control" id="jam_masuk_kembali" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">Jam Pulang</label>
|
||||
<input type="time" class="form-control" id="jam_pulang" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-xs waves-effect waves-light">Simpan Perubahan</button>
|
||||
<button type="button" class="btn btn-danger btn-xs waves-effect waves-light" data-dismiss="modal">Batalkan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
|
||||
<!-- <script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script> -->
|
||||
|
||||
<script>
|
||||
var id_dinas = <?= $id_dinas ?>;
|
||||
var all_data = [];
|
||||
|
||||
async function get_all_data() {
|
||||
let data;
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "jam_kerja?id_dinas=" + id_dinas,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Jam Kerja");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
all_data = data
|
||||
data.forEach((item, index) => {
|
||||
$("#table_list_hari #" + item['hari'] + " .jam_masuk").html(tConvert(item['jam_masuk']))
|
||||
$("#table_list_hari #" + item['hari'] + " .jam_istirehat").html(tConvert(item['jam_istirehat']))
|
||||
$("#table_list_hari #" + item['hari'] + " .jam_masuk_kembali").html(tConvert(item['jam_masuk_kembali']))
|
||||
$("#table_list_hari #" + item['hari'] + " .jam_pulang").html(tConvert(item['jam_pulang']))
|
||||
})
|
||||
// data_karyawan = data;
|
||||
await $.unblockUI();
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
get_all_data();
|
||||
|
||||
function edit_hari_kerja(hari) {
|
||||
// console.log(all_data)
|
||||
$("#hari").val(null)
|
||||
$("#jam_masuk").val(null)
|
||||
$("#jam_istirehat").val(null)
|
||||
$("#jam_masuk_kembali").val(null)
|
||||
$("#jam_pulang").val(null)
|
||||
all_data.forEach((item, index) => {
|
||||
if (item['hari'] == hari) {
|
||||
const jam_masuk = $("#jam_masuk").val(item['jam_masuk'])
|
||||
const jam_istirehat = $("#jam_istirehat").val(item['jam_istirehat'])
|
||||
const jam_masuk_kembali = $("#jam_masuk_kembali").val(item['jam_masuk_kembali'])
|
||||
const jam_pulang = $("#jam_pulang").val(item['jam_pulang'])
|
||||
}
|
||||
|
||||
})
|
||||
$(".modal .modal-title").html(`Jam Kerja Hari ${uppercaseWord(hari)}`)
|
||||
$("#hari").val(hari)
|
||||
$('#modal_jam_kerja').modal('show');
|
||||
console.log(hari)
|
||||
}
|
||||
|
||||
function edit_jam_kerja(e) {
|
||||
e.preventDefault()
|
||||
const hari = $("#hari").val()
|
||||
const jam_masuk = $("#jam_masuk").val()
|
||||
const jam_istirehat = $("#jam_istirehat").val()
|
||||
const jam_masuk_kembali = $("#jam_masuk_kembali").val()
|
||||
const jam_pulang = $("#jam_pulang").val()
|
||||
|
||||
if (jam_masuk >= jam_istirehat && jam_masuk >= jam_masuk_kembali && jam_masuk >= jam_pulang) return toastr.error("Jam Karja Harus Berurutan Dari Jam Masuk Sampai Jam Pulang Dan Tidak Bisa Sama");
|
||||
if (jam_istirehat >= jam_masuk_kembali && jam_istirehat >= jam_pulang) return toastr.error("Jam Karja Harus Berurutan Dari Jam Masuk Sampai Jam Pulang Dan Tidak Bisa Sama");
|
||||
if (jam_masuk_kembali >= jam_pulang) return toastr.error("Jam Karja Harus Berurutan Dari Jam Masuk Sampai Jam Pulang Dan Tidak Bisa Sama");
|
||||
|
||||
let cari_data = null;
|
||||
for (const data of all_data) {
|
||||
if (data['hari'] == hari) {
|
||||
cari_data = data;
|
||||
}
|
||||
}
|
||||
|
||||
if (cari_data != null) {
|
||||
if (cari_data['jam_masuk'] == jam_masuk && cari_data['jam_istirehat'] == jam_istirehat && cari_data['jam_masuk_kembali'] == jam_masuk_kembali && cari_data['jam_pulang'] == jam_pulang) return toastr.error("Tiada Perubahan Data Yang Dilakukan");
|
||||
}
|
||||
|
||||
swal({
|
||||
text: `Edit Jam Kerja\nHari ${hari} ?`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
if (yes) {
|
||||
// console.log("tambah karyawan",nik,nama,jabatan,alamat)
|
||||
$.ajax({
|
||||
url: server_url_api + "jam_kerja",
|
||||
type: 'post',
|
||||
data: {
|
||||
id_dinas: id_dinas,
|
||||
hari: hari,
|
||||
jam_masuk: jam_masuk,
|
||||
jam_istirehat: jam_istirehat,
|
||||
jam_masuk_kembali: jam_masuk_kembali,
|
||||
jam_pulang: jam_pulang,
|
||||
},
|
||||
beforeSend: function(res) {
|
||||
$('#modal_jam_kerja').modal('hide');
|
||||
block_ui("Menyimpan Perunahan Jam Kerja");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
console.log(response)
|
||||
get_all_data()
|
||||
// $('#table_list_karyawan').dataTable().fnDestroy();
|
||||
// datatables()
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// console.log("sini edit jam kerja");
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,451 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">List Karyawan </h4>
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_karyawan" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>NIP</th>
|
||||
<th>Nama</th>
|
||||
<th>No Telpon</th>
|
||||
<th>Jabatan</th>
|
||||
<th>Pangkat</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="form-group text-center">
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light" onclick="buka_modal_tambah()">Tambah Karyawan</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- /#flot-chart-1.flot-chart -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_karyawan" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1" data-keyboard="false" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<form class="modal-content" onsubmit="return tambah_edit(event)">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-1"></h4>
|
||||
<!-- <p style="font-size: 10px;"><i>(Geserkan marker ke titik kordinat dinas)</i></p> -->
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group text-center" id="div_img" style="display: none;">
|
||||
<img src="" class="avatar" id="img_container" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">Foto</label>
|
||||
<input type="file" class="form-control" id="foto" required="true">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">NIP Karyawan</label>
|
||||
<input type="hidden" id="status_form">
|
||||
<input type="text" class="form-control" id="nik" placeholder="Masukkan NIK Karyawan" minlength="16" maxlength="16" onkeypress="return isNumberKey(event)" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Nama</label>
|
||||
<input type="text" class="form-control" id="nama" placeholder="Masukkan Nama Karyawan" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">No Telepon</label>
|
||||
<input type="text" class="form-control" id="no_telpon" placeholder="Masukkan No Telepon Karyawan" minlength="11" maxlength="13" onkeypress="return isNumberKey(event)" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jabatan">Jabatan</label>
|
||||
<input type="text" class="form-control" id="jabatan" placeholder="Masukkan Jabatan Karyawan" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pangkat">Pangkat</label>
|
||||
<select name="pangkat" id="pangkat" class="form-control" required>
|
||||
<option value="" disabled selected>-Pilih Pangkat</option>
|
||||
<option value="Tiada">Tiada</option>
|
||||
<option value="I A">I A</option>
|
||||
<option value="I B">I B</option>
|
||||
<option value="I C">I C</option>
|
||||
<option value="I D">I D</option>
|
||||
<option value="II A">II A</option>
|
||||
<option value="II B">II B</option>
|
||||
<option value="II C">II C</option>
|
||||
<option value="II D">II D</option>
|
||||
<option value="III A">III A</option>
|
||||
<option value="III B">III B</option>
|
||||
<option value="III C">III C</option>
|
||||
<option value="III D">III D</option>
|
||||
<option value="IV A">IV A</option>
|
||||
<option value="IV B">IV B</option>
|
||||
<option value="IV C">IV C</option>
|
||||
<option value="IV D">IV D</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="status">Status</label>
|
||||
<select name="status" id="status" class="form-control" required>
|
||||
<option value="" disabled selected>-Pilih Status</option>
|
||||
<option value="PNS" >PNS</option>
|
||||
<option value="Kontrak" >Kontrak</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tanggal_lahir">Tanggal Lahir</label>
|
||||
<input type="date" class="form-control" id="tanggal_lahir" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="alamat">Alamat</label>
|
||||
<textarea name="alamat" id="alamat" cols="30" rows="10" class="form-control" style="resize: none;" placeholder="Masukkan Alamat" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" id="button_simpan_edit" class="btn btn-primary btn-xs waves-effect waves-light"></button>
|
||||
<button type="button" class="btn btn-danger btn-xs waves-effect waves-light" data-dismiss="modal">Batalkan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
<script async>
|
||||
var id_dinas = <?= $id_dinas ?>;
|
||||
|
||||
var data_karyawan;
|
||||
|
||||
var table;
|
||||
|
||||
function datatables() {
|
||||
table = $('#table_list_karyawan').DataTable({
|
||||
// "searching": false,
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, -1],
|
||||
[5, 10, 15, "All"]
|
||||
],
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
// "order": [[ 4, 'desc' ]],
|
||||
|
||||
"ajax": {
|
||||
"url": server_url + "admin/karyawan",
|
||||
"type": "POST",
|
||||
data: {
|
||||
proses: 'table_karyawan'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
"columnDefs": [{
|
||||
"targets": [0],
|
||||
"orderable": false,
|
||||
}, ],
|
||||
});
|
||||
}
|
||||
datatables()
|
||||
|
||||
document.getElementById("foto").onchange = function() {
|
||||
let foto_produk = document.getElementById('foto').files[0];
|
||||
check_file(foto_produk)
|
||||
}
|
||||
|
||||
function buka_modal_tambah() { // buka modal untuk tambah karyawan
|
||||
$(".modal-title").html("Form Tambah Karyawan")
|
||||
$("#status_form").val("tambah")
|
||||
$("#button_simpan_edit").html("Tambah Karyawan")
|
||||
$("#nik").val(null)
|
||||
$("#foto").val(null)
|
||||
$("#nama").val(null)
|
||||
$("#no_telpon").val(null)
|
||||
$("#jabatan").val(null)
|
||||
$("#alamat").html(null)
|
||||
$("#tanggal_lahir").val(null)
|
||||
$("#nik").attr("disabled", false)
|
||||
$("#foto").attr('required', true)
|
||||
$("#div_img").attr('style', "display : none")
|
||||
selectElement('pangkat', '');
|
||||
selectElement('status', '');
|
||||
$('#modal_karyawan').modal('show');
|
||||
}
|
||||
|
||||
async function karyawan_edit(nik) {
|
||||
// console.log(nik);
|
||||
$(".modal-title").html("Form Edit Karyawan")
|
||||
$("#status_form").val("edit")
|
||||
$("#button_simpan_edit").html("Edit Karyawan")
|
||||
$("#foto").attr('required', false)
|
||||
$("#foto").val(null)
|
||||
$("#div_img").removeAttr("style")
|
||||
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "karyawan?nik=" + nik + "&id_dinas=" + id_dinas,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Karyawan");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
data_karyawan = data;
|
||||
await $.unblockUI();
|
||||
$("#nik").val(data.nik)
|
||||
$("#nama").val(data.nama)
|
||||
$("#no_telpon").val(data.no_telpon)
|
||||
$("#jabatan").val(data.jabatan)
|
||||
$("#tanggal_lahir").val(data.tanggal_lahir)
|
||||
$("#alamat").html(data.alamat)
|
||||
$("#nik").attr("disabled", true)
|
||||
$("#img_container").attr("src", server_url + data.image)
|
||||
selectElement('pangkat', data.pangkat);
|
||||
selectElement('status', data.status);
|
||||
$('#modal_karyawan').modal('show');
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function tambah_edit(e) {
|
||||
e.preventDefault();
|
||||
const status_form = $("#status_form").val()
|
||||
|
||||
const foto = document.getElementById('foto').files[0]
|
||||
const nik = $("#nik").val()
|
||||
const nama = $("#nama").val()
|
||||
const no_telpon = $("#no_telpon").val()
|
||||
const jabatan = $("#jabatan").val()
|
||||
const alamat = $("#alamat").val()
|
||||
const pangkat = $("#pangkat").val()
|
||||
const status = $("#status").val()
|
||||
const tanggal_lahir = $("#tanggal_lahir").val()
|
||||
|
||||
// console.log(pangkat,status,tanggal_lahir)
|
||||
let data = new FormData()
|
||||
data.append('nik', nik)
|
||||
data.append('proses', status)
|
||||
data.append('foto', foto == undefined ? 'tiada' : foto)
|
||||
data.append('nama', nama)
|
||||
data.append('no_telpon', no_telpon)
|
||||
data.append('jabatan', jabatan)
|
||||
data.append('alamat', alamat)
|
||||
data.append('id_dinas', id_dinas)
|
||||
data.append('status_form', status_form)
|
||||
data.append('pangkat', pangkat)
|
||||
data.append('status', status)
|
||||
data.append('tanggal_lahir', tanggal_lahir)
|
||||
if (status_form == "tambah") {
|
||||
|
||||
swal({
|
||||
text: `Tambah Karyawan Dengan\nNIK : ${nik},\nNama : ${nama}`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
if (yes) {
|
||||
// console.log("tambah karyawan", nik, nama, jabatan, alamat)
|
||||
$.ajax({
|
||||
url: server_url_api + "karyawan",
|
||||
type: 'post',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data,
|
||||
beforeSend: function(res) {
|
||||
$('#modal_karyawan').modal('hide');
|
||||
block_ui("Menambah Karyawan");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
console.log(response)
|
||||
$('#table_list_karyawan').dataTable().fnDestroy();
|
||||
datatables()
|
||||
toastr.success(response.message);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (status_form == 'edit') {
|
||||
// console.log(nik,nama,no_telpon,jabatan,alamat)
|
||||
// if (nik == data_karyawan.nik && nama == data_karyawan.nama && no_telpon == data_karyawan.no_telpon && jabatan == data_karyawan.jabatan && alamat == data_karyawan.alamat) return toastr.warning("Tiada Perubahan Data Karyawan");
|
||||
|
||||
// console.log("sini berlaku edit")
|
||||
|
||||
swal({
|
||||
text: `Edit Data Karyawan ?`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
if (yes) {
|
||||
// console.log("tambah karyawan",nik,nama,jabatan,alamat)
|
||||
$.ajax({
|
||||
url: server_url_api + "karyawan",
|
||||
type: 'post',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data,
|
||||
beforeSend: function(res) {
|
||||
$('#modal_karyawan').modal('hide');
|
||||
block_ui("Edit Data Karyawan");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
$('#table_list_karyawan').dataTable().fnDestroy();
|
||||
datatables()
|
||||
// console.log(response)
|
||||
toastr.success(response.message);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// console.log("sini tambah atau edit", status)
|
||||
}
|
||||
|
||||
function hapus_karyawan(nik) {
|
||||
// console.log(nik)
|
||||
swal({
|
||||
text: `Hapus Data Karyawan Dengan\nNIK : ${nik}\n?`,
|
||||
icon: "warning",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
if (yes) {
|
||||
// console.log("hapus karyawan")
|
||||
$.ajax({
|
||||
url: server_url_api + "karyawan",
|
||||
type: 'delete',
|
||||
data: {
|
||||
id_dinas: id_dinas,
|
||||
nik: nik,
|
||||
},
|
||||
beforeSend: function(res) {
|
||||
$('#modal_karyawan').modal('hide');
|
||||
block_ui("Hapus Karyawan");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
$('#table_list_karyawan').dataTable().fnDestroy();
|
||||
datatables()
|
||||
console.log(response)
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,221 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-8">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Filter Laporan </h4>
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
|
||||
<!-- /#flot-chart-1.flot-chart -->
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
<div class="col-xs-2"></div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Laporan Absensi Bulan <?= $month ?>, Tahun <?= $year ?></h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto;" class="form-group">
|
||||
<table id="example" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama / NIP</th>
|
||||
<th>Jabatan</th>
|
||||
<th>Tanggal</th>
|
||||
<th>Status</th>
|
||||
<th>Jam Masuk</th>
|
||||
<th>Jam Istirehat</th>
|
||||
<th>Jam Masuk Kembali</th>
|
||||
<th>Jam Pulang</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i = $first_date; $i <= $last_date; $i++) {
|
||||
|
||||
foreach ($list_karyawan as $key => $value) {
|
||||
$tanggal = strlen($i) == 1 ? "0" . $i : $i;
|
||||
// echo
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('model');
|
||||
$check_absensi = $CI->model->tampil_data_where('tb_absensi_karyawan', ['nik' => $value->nik, "tanggal" => $year . "-" . $month . "-" . $tanggal])->result();
|
||||
|
||||
$status = '-';
|
||||
$jam_masuk = "-";
|
||||
$jam_istirehat = "-";
|
||||
$jam_masuk_kembali = "-";
|
||||
$jam_pulang = "-";
|
||||
|
||||
if (count($check_absensi) > 0) {
|
||||
$status = 'Masuk Kerja';
|
||||
$jam_masuk = $check_absensi[0]->jam_masuk;
|
||||
$jam_istirehat = $check_absensi[0]->jam_istirehat ?? '-';
|
||||
$jam_masuk_kembali = $check_absensi[0]->jam_masuk_kembali ?? '-';
|
||||
$jam_pulang = $check_absensi[0]->jam_pulang ?? '-';
|
||||
}
|
||||
|
||||
$check_libur = $CI->model->tampil_data_where('tb_informasi_libur', ['nik' => $value->nik, "tanggal" => $year . "-" . $month . "-" . $tanggal])->result();
|
||||
|
||||
if (count($check_libur) > 0) {
|
||||
$status = "Libur";
|
||||
$idnya = $check_libur[0]->id_libur;
|
||||
}
|
||||
|
||||
$check_perjalanan_dinas = $CI->model->tampil_data_where('tb_informasi_perjalanan_dinas', ['nik' => $value->nik, "tanggal" => $year . "-" . $month . "-" . $tanggal])->result();
|
||||
|
||||
if (count($check_perjalanan_dinas) > 0) {
|
||||
$status = "Perjalanan Dinas";
|
||||
$idnya = $check_perjalanan_dinas[0]->id_perjalanan_dinas;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $value->nama ?> / <?= $value->nik ?> </td>
|
||||
<td><?= $value->jabatan ?></td>
|
||||
<td><?= $tanggal ?>-<?= $month ?>-<?= $year ?></td>
|
||||
<td><?= $status ?></td>
|
||||
<td><?= $jam_masuk ?></td>
|
||||
<td><?= $jam_istirehat ?></td>
|
||||
<td><?= $jam_masuk_kembali ?></td>
|
||||
<td><?= $jam_pulang ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($status == 'Libur' || $status == "Perjalanan Dinas") {
|
||||
?>
|
||||
<center><button type='button' onclick='check_info("<?= $status ?>" ,<?= $idnya ?>)' title='Check Informasi <?= $status ?>' class='btn btn-primary btn-circle btn-sm waves-effect waves-light'><i class='ico zmdi zmdi-info-outline'></i></button></center>
|
||||
<?php
|
||||
} else {
|
||||
echo "-";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<div id="iframeDisplay"></div>
|
||||
<button type="button" id="button_cetak" class="btn btn-primary btn-xs waves-effect waves-light" onclick="displayIframe()">Cetak Laporan</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_pdf" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1" data-keyboard="false">
|
||||
<div class="modal-dialog modal-lg" role="document" >
|
||||
<div class="modal-content">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var groupColumn = 2;
|
||||
var table = $('#example').DataTable({
|
||||
columnDefs: [{
|
||||
visible: false,
|
||||
targets: groupColumn
|
||||
}],
|
||||
order: [
|
||||
[groupColumn, 'asc']
|
||||
],
|
||||
displayLength: 25,
|
||||
drawCallback: function(settings) {
|
||||
var api = this.api();
|
||||
var rows = api.rows({
|
||||
page: 'current'
|
||||
}).nodes();
|
||||
var last = null;
|
||||
|
||||
api
|
||||
.column(groupColumn, {
|
||||
page: 'current'
|
||||
})
|
||||
.data()
|
||||
.each(function(group, i) {
|
||||
if (last !== group) {
|
||||
$(rows)
|
||||
.eq(i)
|
||||
.before('<tr class="group text-center"><td colspan="8">' + group + '</td></tr>');
|
||||
|
||||
last = group;
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// Order by the grouping
|
||||
$('#example tbody').on('click', 'tr.group', function() {
|
||||
var currentOrder = table.order()[0];
|
||||
if (currentOrder[0] === groupColumn && currentOrder[1] === 'asc') {
|
||||
table.order([groupColumn, 'desc']).draw();
|
||||
} else {
|
||||
table.order([groupColumn, 'asc']).draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
async function check_info(stat, id) {
|
||||
console.log(stat, id)
|
||||
}
|
||||
|
||||
function displayIframe() {
|
||||
document.getElementById("iframeDisplay").innerHTML = "<iframe src=\"../HtmlPage1.html\" height=\"200\" width=\"300\" ></iframe>";
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,354 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Form Libur </h4>
|
||||
<form class="card-content" onsubmit="return tambah_libur(event)">
|
||||
<div class="form-group">
|
||||
<label for="tanggal_libur">Range Tanggal</label>
|
||||
<input type="text" name="tanggal_libur" class="form-control" value="" reqruied />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tanggal_libur">List Karyawan</label>
|
||||
<div class="row small-spacing" style="overflow-x: auto;">
|
||||
<div class="col-xs-9">
|
||||
<select multiple id="select_list_karyawan" class="form-control" onchange="check_dulu()" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<li class="checkbox">
|
||||
<input type="checkbox" id="chk-2"><label for="chk-2">Semua</label>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tanggal_libur">Keterangan</label>
|
||||
<textarea name="" id="ket" cols="30" rows="10" class="form-control" style="resize: none" placeholder="Keterangan Libur" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button type="submit" class="btn btn-primary btn-xs waves-effect waves-light">
|
||||
Tambah Libur
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">List Libur</h4>
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_libur" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Range Tanggal</th>
|
||||
<th>List Karyawan</th>
|
||||
<th>Created At</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_informasi_libur" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<form class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-1"> Informasi Libur</h4>
|
||||
<!-- <p style="font-size: 10px;"><i>(Geserkan marker ke titik kordinat dinas)</i></p> -->
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="nik">Range Tanggal</label>
|
||||
<input type="text" class="form-control" id="range_tanggal" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">List Karayawn</label>
|
||||
<textarea name="list_karyawan" class="form-control" id="list_karyawan" cols="30" rows="10" style="resize: none;" disabled></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Keterangan</label>
|
||||
<textarea name="keterangan" class="form-control" id="keterangan" cols="30" rows="10" style="resize: none;" disabled></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Created At</label>
|
||||
<input type="text" class="form-control" id="created_at" disabled>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
<!-- Select2 -->
|
||||
<script src="<?= base_url() ?>assets/plugin/select2/js/select2.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
var table;
|
||||
|
||||
function datatables() {
|
||||
table = $('#table_list_libur').DataTable({
|
||||
// "searching": false,
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, -1],
|
||||
[5, 10, 15, "All"]
|
||||
],
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
// "order": [[ 4, 'desc' ]],
|
||||
|
||||
"ajax": {
|
||||
"url": server_url + "admin/libur",
|
||||
"type": "POST",
|
||||
data: {
|
||||
proses: 'table_libur'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
"columnDefs": [{
|
||||
"targets": [2, 4],
|
||||
"orderable": false,
|
||||
}, ],
|
||||
});
|
||||
}
|
||||
datatables()
|
||||
|
||||
async function check_info(id_libur) {
|
||||
// console.log(id_libur)
|
||||
let data
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "libur?id_libur=" + id_libur + "&id_dinas=" + id_dinas,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Informasi Libur");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
console.log(data);
|
||||
|
||||
await $.unblockUI();
|
||||
$("#range_tanggal").val(data.range_tanggal)
|
||||
$("#keterangan").val(data.ket)
|
||||
$("#list_karyawan").val(data.list_karyawan)
|
||||
$("#created_at").val(data.created_at)
|
||||
$('#modal_informasi_libur').modal('show');
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
|
||||
|
||||
}
|
||||
// $('#modal_informasi_libur').modal('show');
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var id_dinas = <?= $id_dinas ?>;
|
||||
let today = new Date().toLocaleDateString()
|
||||
let start_tanggal, end_tanggal
|
||||
|
||||
// console.log(today)
|
||||
$(function() {
|
||||
$('input[name="tanggal_libur"]').daterangepicker({
|
||||
opens: 'left',
|
||||
minDate: today
|
||||
}, function(start, end, label) {
|
||||
// console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
|
||||
start_tanggal = start.format('YYYY-MM-DD')
|
||||
end_tanggal = end.format('YYYY-MM-DD')
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
let data_karyawan_count = 0;
|
||||
|
||||
async function check_data_karyawan() {
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "karyawanAll",
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Karyawan");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
// await $.unblockUI();
|
||||
const select_list_karyawan = document.getElementById("select_list_karyawan")
|
||||
data_karyawan_count = data.length;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let option = document.createElement("option");
|
||||
option.value = data[i]['nik'];
|
||||
option.text = data[i]['nama'] + " - " + data[i]['nik'];
|
||||
select_list_karyawan.appendChild(option)
|
||||
}
|
||||
// console.log(data);
|
||||
await $.unblockUI();
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
// const message = error.responseJSON.message
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
check_data_karyawan()
|
||||
|
||||
$("#select_list_karyawan").select2({
|
||||
placeholder: " -Pilih Karyawan",
|
||||
allowClear: true
|
||||
});
|
||||
$("#chk-2").click(function() {
|
||||
if ($("#chk-2").is(':checked')) {
|
||||
console.log("ini checked")
|
||||
$("#select_list_karyawan > option").prop("selected", "selected");
|
||||
$("#select_list_karyawan").trigger("change");
|
||||
} else {
|
||||
console.log("ini dischecked")
|
||||
$("#select_list_karyawan").val('').change();
|
||||
}
|
||||
});
|
||||
|
||||
function check_dulu() {
|
||||
// console.log("sini check dulu");
|
||||
const count = $("#select_list_karyawan option:selected").length;
|
||||
if (count == data_karyawan_count) {
|
||||
document.getElementById("chk-2").checked = true
|
||||
} else {
|
||||
document.getElementById("chk-2").checked = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function tambah_libur(e) {
|
||||
e.preventDefault();
|
||||
// console.log("sini tambah libur")
|
||||
// console.log(start_tanggal,end_tanggal)
|
||||
const list_karyawan = $("#select_list_karyawan").val();
|
||||
const ket = $("#ket").val();
|
||||
// console.log(ket);
|
||||
let data = new FormData()
|
||||
data.append('id_dinas', id_dinas)
|
||||
data.append('list_karyawan', JSON.stringify(list_karyawan))
|
||||
data.append('start_tanggal', start_tanggal)
|
||||
data.append('end_tanggal', end_tanggal)
|
||||
data.append('ket', ket)
|
||||
|
||||
swal({
|
||||
text: `Informasi Libur Akan Ditambah ?`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
$.ajax({
|
||||
url: server_url_api + "libur",
|
||||
type: 'post',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data,
|
||||
beforeSend: function(res) {
|
||||
// $('#modal_karyawan').modal('hide');
|
||||
block_ui("Menambah Libur");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
console.log(response)
|
||||
// $('#table_list_libur').dataTable().fnDestroy();
|
||||
// datatables()
|
||||
$("#select_list_karyawan").val('').change();
|
||||
$("#ket").val("")
|
||||
$('#table_list_libur').dataTable().fnDestroy();
|
||||
datatables()
|
||||
toastr.success(response.message);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 && statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,368 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-3 col-md-2"></div>
|
||||
<div class="col-xs-12 col-lg-6 col-md-8">
|
||||
<form class="box-content" onsubmit="return simpan_radius(event)">
|
||||
<h4 class="box-title">Pengaturan Radius</h4>
|
||||
<div class="input-group margin-bottom-20">
|
||||
<input type="text" id="radius" class="form-control" placeholder="Masukkan Radius (meter)" required minlength="1" maxlength="3" value="<?= $radius ?>" onkeypress="return isNumberKey(event)">
|
||||
<span class="input-group-addon b-0 text-grey">meter</span>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button type="submit" class="btn btn-primary btn-xs waves-effect waves-light">Simpan Radius</button>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
<div class="col-lg-3 col-md-2"></div>
|
||||
</div>
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content">
|
||||
<h4 class="box-title">Pengaturan Titik Lokasi Dinas</h4>
|
||||
|
||||
<!-- /.dropdown js__dropdown -->
|
||||
<div class="form-group">
|
||||
<div id="map" style="width: 100%; height: 500px"></div>
|
||||
</div>
|
||||
<!-- /#flot-chart-1.flot-chart -->
|
||||
<div class="form-group">
|
||||
<input type="text" placeholder="Masukkan Alamat Untuk Mengubah Kordinat" id="alamat" class="form-control">
|
||||
<!-- <center><button type="button" class="btn btn-primary btn-xs waves-effect waves-light" onclick="buka_modal_pengaturan()">Atur Titik Kordinat</button></center> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- /.row -->
|
||||
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_pengaturan_kordinat" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1" data-keyboard="false" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" onclick="rewind_button()" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-1">Pengaturan Titik Kordinat Dinas</h4>
|
||||
<p style="font-size: 10px;"><i>(Geserkan marker ke titik kordinat dinas)</i></p>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<!-- <input type="text" placeholder="Masukkan Alamat" id="alamat"> -->
|
||||
<!-- <input type="text" placeholder="Masukkan Alamat" id="alamat" class="form-control"> -->
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div id="map2" style="width: 100%; height: 500px"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" style="display:none" class="button_simpan_marker btn btn-success btn-xs waves-effect waves-light" onclick="simpan_marker()">Simpan Marker</button>
|
||||
<button type="button" style="display:none" class="button_simpan_marker btn btn-danger btn-xs waves-effect waves-light" onclick="rewind_button()" data-dismiss="modal">Batalkan</button>
|
||||
<button type="button" id="button_tambah_marker" class="btn btn-primary btn-xs waves-effect waves-light" onclick="get_center()">Letak
|
||||
Marker</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD7B9RynI4hQM_Y4BG9GYxsTLWwYkGASRo&libraries=geometry,drawing,places&v=weekly®ion=ID&language=id">
|
||||
</script>
|
||||
<!-- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD7B9RynI4hQM_Y4BG9GYxsTLWwYkGASRo&&language=id®ion=ID&callback=initAutocomplete&libraries=places&v=weekly&sensor=false" defer></script> -->
|
||||
<script>
|
||||
let map;
|
||||
async function initMap() {
|
||||
map = new google.maps.Map(document.getElementById("map"), {
|
||||
zoom: 19.5,
|
||||
center: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
mapTypeId: 'hybrid',
|
||||
streetViewControl: false,
|
||||
});
|
||||
|
||||
const marker = new google.maps.Marker({
|
||||
position: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
map: map,
|
||||
title: 'Center',
|
||||
icon: 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png',
|
||||
});
|
||||
|
||||
const cityCircle = new google.maps.Circle({
|
||||
strokeColor: "#FF0000",
|
||||
strokeOpacity: 0.3,
|
||||
strokeWeight: 0.3,
|
||||
fillColor: "#FF0000",
|
||||
fillOpacity: 0.3,
|
||||
map,
|
||||
center: {
|
||||
lat: <?= $lat ?>,
|
||||
lng: <?= $lng ?>
|
||||
},
|
||||
radius: <?= $radius ?>,
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, 'load', initMap);
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// function buka_modal_pengaturan() {
|
||||
// $('#modal_pengaturan_kordinat').modal('show');
|
||||
// }
|
||||
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
var marker;
|
||||
var lat, lng;
|
||||
|
||||
function geocodePosition(pos) {
|
||||
geocoder.geocode({
|
||||
latLng: pos
|
||||
});
|
||||
}
|
||||
|
||||
function updateMarkerPosition(latLng) {
|
||||
// document.getElementById('info').value = [
|
||||
console.log(latLng.lat(), latLng.lng())
|
||||
lat = latLng.lat()
|
||||
lng = latLng.lng()
|
||||
console.log(lat, lng)
|
||||
|
||||
}
|
||||
|
||||
|
||||
let map2;
|
||||
|
||||
function initAutocomplete() {
|
||||
map2 = new google.maps.Map(document.getElementById("map2"), {
|
||||
center: {
|
||||
lat: -3.916417,
|
||||
lng: 119.7329218
|
||||
},
|
||||
zoom: 16,
|
||||
mapTypeId: "hybrid"
|
||||
}); // Create the search box and link it to the UI element.
|
||||
|
||||
|
||||
const input = document.getElementById("alamat");
|
||||
const searchBox = new google.maps.places.SearchBox(input);
|
||||
|
||||
// map.controls[google.maps.ControlPosition.TOP_LEFT].push(input); // Bias the SearchBox results towards current map's viewport.
|
||||
|
||||
map2.addListener("bounds_changed", () => {
|
||||
searchBox.setBounds(map2.getBounds());
|
||||
});
|
||||
// more details for that place.
|
||||
|
||||
searchBox.addListener("places_changed", () => {
|
||||
if (typeof marker !== 'undefined') {
|
||||
// console.log('ada');
|
||||
marker.setMap(null);
|
||||
}
|
||||
|
||||
const places = searchBox.getPlaces();
|
||||
console.log(places)
|
||||
// $("#sini_modal").modal();
|
||||
if (places.length == 0) {
|
||||
return;
|
||||
} // Clear out the old markers.
|
||||
|
||||
|
||||
const bounds = new google.maps.LatLngBounds();
|
||||
// console.log(bounds);
|
||||
|
||||
places.forEach(place => {
|
||||
// console.log(place)
|
||||
if (!place.geometry) {
|
||||
console.log("Returned place contains no geometry");
|
||||
return;
|
||||
}
|
||||
|
||||
if (place.geometry.viewport) {
|
||||
var centernya = map2.setCenter(place.geometry.location);
|
||||
map2.fitBounds(place.geometry.viewport);
|
||||
map2.setZoom(14);
|
||||
} else {
|
||||
var centernya = map2.setCenter(place.geometry.viewport);
|
||||
map2.setCenter(place.geometry.location);
|
||||
map2.setZoom(14);
|
||||
}
|
||||
// console.log(updateMarkerPosition(place.geometry.location));
|
||||
$("#alamat").val("");
|
||||
$('#modal_pengaturan_kordinat').modal('show');
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, 'load', initAutocomplete);
|
||||
|
||||
function get_center() {
|
||||
// set marker to null to remove marker
|
||||
const rndInt = Math.floor(Math.random() * 6) + 1
|
||||
|
||||
let center = map2.getCenter();
|
||||
lat = center.lat()
|
||||
lng = center.lng()
|
||||
|
||||
// console.log(lat, lng)
|
||||
// add marker to map2
|
||||
marker = new google.maps.Marker({
|
||||
uniqueId: rndInt,
|
||||
position: {
|
||||
lat: center.lat(),
|
||||
lng: center.lng()
|
||||
},
|
||||
map: map2,
|
||||
title: 'Center',
|
||||
icon: 'https://maps.google.com/mapfiles/ms/icons/green-dot.png',
|
||||
draggable: true,
|
||||
});
|
||||
|
||||
// add listener to marker
|
||||
google.maps.event.addListener(marker, 'dragend', function(event) {
|
||||
updateMarkerPosition(event.latLng);
|
||||
});
|
||||
|
||||
$(".button_simpan_marker").removeAttr("style");
|
||||
$("#button_tambah_marker").attr("style", "display:none");
|
||||
|
||||
}
|
||||
|
||||
function simpan_marker() {
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: server_url_api + "pengaturan_lokasi",
|
||||
type: 'put',
|
||||
data: {
|
||||
id: <?= $id_dinas ?>,
|
||||
lat: lat,
|
||||
lng: lng
|
||||
},
|
||||
beforeSend: function(res) {
|
||||
$('#modal_pengaturan_kordinat').modal('hide');
|
||||
block_ui("Mengubah Titik Kordinat Dinas");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
window.location.reload();
|
||||
// console.log(response)
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function rewind_button() {
|
||||
$(".button_simpan_marker").attr("style", "display:none");
|
||||
$("#button_tambah_marker").removeAttr("style");
|
||||
lat = null;
|
||||
lng = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function simpan_radius(e) {
|
||||
e.preventDefault();
|
||||
const radius = $("#radius").val();
|
||||
|
||||
if (radius == <?= $radius ?>) return toastr.warning("Tiada Perubahan Radius");
|
||||
|
||||
swal({
|
||||
text: `Ubah radius dari <?= $radius ?> meter menjadi \n ${radius} meter`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
if (yes) {
|
||||
$.ajax({
|
||||
url: server_url_api + "pengaturan_radius",
|
||||
type: 'put',
|
||||
data: {
|
||||
id: <?= $id_dinas ?>,
|
||||
radius: radius,
|
||||
},
|
||||
beforeSend: function(res) {
|
||||
|
||||
block_ui("Mengubah Radius");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
window.location.reload();
|
||||
// console.log(response)
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,349 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Form Perjalanan Dinas </h4>
|
||||
<form class="card-content" onsubmit="return tambah_perjalanan_dinas(event)">
|
||||
<div class="form-group">
|
||||
<label for="tanggal_perjalanan_dinas">Range Tanggal</label>
|
||||
<input type="text" name="tanggal_perjalanan_dinas" class="form-control" value="" reqruied />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tanggal_perjalanan_dinas">List Karyawan</label>
|
||||
<div class="row small-spacing" style="overflow-x: auto;">
|
||||
<div class="col-xs-9">
|
||||
<select multiple id="select_list_karyawan" class="form-control" onchange="check_dulu()" required>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<li class="checkbox">
|
||||
<input type="checkbox" id="chk-2"><label for="chk-2">Semua</label>
|
||||
</li>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tanggal_perjalanan_dinas">Keterangan</label>
|
||||
<textarea name="" id="ket" cols="30" rows="10" class="form-control" style="resize: none" placeholder="Keterangan Perjalanan Dinas" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button type="submit" class="btn btn-primary btn-xs waves-effect waves-light">
|
||||
Tambah Perjalanan Dinas
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">List Libur</h4>
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_perjalanan_dinas" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Range Tanggal</th>
|
||||
<th>List Karyawan</th>
|
||||
<th>Created At</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modal_informasi_perjalanan_dinas" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-1">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<form class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel-1"> Informasi Perjalanan Dinas</h4>
|
||||
<!-- <p style="font-size: 10px;"><i>(Geserkan marker ke titik kordinat dinas)</i></p> -->
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="nik">Range Tanggal</label>
|
||||
<input type="text" class="form-control" id="range_tanggal" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nik">List Karayawn</label>
|
||||
<textarea name="list_karyawan" class="form-control" id="list_karyawan" cols="30" rows="10" style="resize: none;" disabled></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Keterangan</label>
|
||||
<textarea name="keterangan" class="form-control" id="keterangan" cols="30" rows="10" style="resize: none;" disabled></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Created At</label>
|
||||
<input type="text" class="form-control" id="created_at" disabled>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
<!-- Select2 -->
|
||||
<script src="<?= base_url() ?>assets/plugin/select2/js/select2.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
var table;
|
||||
|
||||
function datatables() {
|
||||
table = $('#table_list_perjalanan_dinas').DataTable({
|
||||
// "searching": false,
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, -1],
|
||||
[5, 10, 15, "All"]
|
||||
],
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
// "order": [[ 4, 'desc' ]],
|
||||
|
||||
"ajax": {
|
||||
"url": server_url + "admin/perjalanan_dinas",
|
||||
"type": "POST",
|
||||
data: {
|
||||
proses: 'table_dinas'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
"columnDefs": [{
|
||||
"targets": [2, 4],
|
||||
"orderable": false,
|
||||
}, ],
|
||||
});
|
||||
}
|
||||
datatables()
|
||||
|
||||
async function check_info(id_perjalanan_dinas) {
|
||||
// console.log(id_perjalanan_dinas)
|
||||
let data
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "perjalanan_dinas?id_perjalanan_dinas=" + id_perjalanan_dinas + "&id_dinas=" + id_dinas,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Informasi Perjalanan Dinas");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
console.log(data);
|
||||
|
||||
await $.unblockUI();
|
||||
$("#range_tanggal").val(data.range_tanggal)
|
||||
$("#keterangan").val(data.ket)
|
||||
$("#list_karyawan").val(data.list_karyawan)
|
||||
$("#created_at").val(data.created_at)
|
||||
$('#modal_informasi_perjalanan_dinas').modal('show');
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
|
||||
|
||||
}
|
||||
// $('#modal_informasi_perjalanan_dinas').modal('show');
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var id_dinas = <?= $id_dinas ?>;
|
||||
let today = new Date().toLocaleDateString()
|
||||
let start_tanggal, end_tanggal
|
||||
|
||||
// console.log(today)
|
||||
$(function() {
|
||||
$('input[name="tanggal_perjalanan_dinas"]').daterangepicker({
|
||||
opens: 'left',
|
||||
minDate: today
|
||||
}, function(start, end, label) {
|
||||
// console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
|
||||
start_tanggal = start.format('YYYY-MM-DD')
|
||||
end_tanggal = end.format('YYYY-MM-DD')
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
let data_karyawan_count = 0;
|
||||
|
||||
async function check_data_karyawan() {
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "karyawanAll",
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Karyawan");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
// await $.unblockUI();
|
||||
const select_list_karyawan = document.getElementById("select_list_karyawan")
|
||||
data_karyawan_count = data.length;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let option = document.createElement("option");
|
||||
option.value = data[i]['nik'];
|
||||
option.text = data[i]['nama'] + " - " + data[i]['nik'];
|
||||
select_list_karyawan.appendChild(option)
|
||||
}
|
||||
// console.log(data);
|
||||
await $.unblockUI();
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
// const message = error.responseJSON.message
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
check_data_karyawan()
|
||||
|
||||
$("#select_list_karyawan").select2({
|
||||
placeholder: " -Pilih Karyawan",
|
||||
allowClear: true
|
||||
});
|
||||
$("#chk-2").click(function() {
|
||||
if ($("#chk-2").is(':checked')) {
|
||||
console.log("ini checked")
|
||||
$("#select_list_karyawan > option").prop("selected", "selected");
|
||||
$("#select_list_karyawan").trigger("change");
|
||||
} else {
|
||||
console.log("ini dischecked")
|
||||
$("#select_list_karyawan").val('').change();
|
||||
}
|
||||
});
|
||||
|
||||
function check_dulu() {
|
||||
// console.log("sini check dulu");
|
||||
const count = $("#select_list_karyawan option:selected").length;
|
||||
if (count == data_karyawan_count) {
|
||||
document.getElementById("chk-2").checked = true
|
||||
} else {
|
||||
document.getElementById("chk-2").checked = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function tambah_perjalanan_dinas(e) {
|
||||
e.preventDefault();
|
||||
// console.log("sini tambah libur")
|
||||
// console.log(start_tanggal,end_tanggal)
|
||||
const list_karyawan = $("#select_list_karyawan").val();
|
||||
const ket = $("#ket").val();
|
||||
// console.log(ket);
|
||||
let data = new FormData()
|
||||
data.append('id_dinas', id_dinas)
|
||||
data.append('list_karyawan', JSON.stringify(list_karyawan))
|
||||
data.append('start_tanggal', start_tanggal)
|
||||
data.append('end_tanggal', end_tanggal)
|
||||
data.append('ket', ket)
|
||||
swal({
|
||||
text: `Informasi Perjalanan Dinas Akan Ditambah ?`,
|
||||
icon: "info",
|
||||
buttons: {
|
||||
cancel: true,
|
||||
confirm: true,
|
||||
},
|
||||
// dangerMode: true,
|
||||
}).then((yes) => {
|
||||
$.ajax({
|
||||
url: server_url_api + "perjalanan_dinas",
|
||||
type: 'post',
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data,
|
||||
beforeSend: function(res) {
|
||||
// $('#modal_karyawan').modal('hide');
|
||||
block_ui("Menambah Perjalanan Dinas");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
// window.location.reload();
|
||||
console.log(response)
|
||||
// $('#table_list_karyawan').dataTable().fnDestroy();
|
||||
// datatables()
|
||||
toastr.success(response.message);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.unblockUI();
|
||||
// console.log(errorThrown)
|
||||
// console.log(textStatus)
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 && statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
469
application/views/admin/menu/topsis.php
Normal file
469
application/views/admin/menu/topsis.php
Normal file
@ -0,0 +1,469 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">List Penduduk</h4>
|
||||
|
||||
<div class="card-content">
|
||||
|
||||
<!-- create button for 'Tambah Penduduk' -->
|
||||
<button type="button" class="btn btn-primary btn-xs" onclick="proses_bantuan()">
|
||||
<i class="fa fa-book"></i> Proses Bantuan Sosial
|
||||
</button>
|
||||
<br><br>
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_list_penduduk" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIK</th>
|
||||
<th>Nama</th>
|
||||
<th>Status Bantuan</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Matriks Keputusan</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_matriks_keputusan" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIK</th>
|
||||
<th>Kriteria Umur</th>
|
||||
<th>Kriteria Pekerjaan</th>
|
||||
<th>Kriteria Penghasilan</th>
|
||||
<th>Kriteria Jumlah Tanggungan</th>
|
||||
<th>Kriteria Status Rumah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Matriks Normalisasi</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_matriks_normalisasi" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIK</th>
|
||||
<th>Kriteria Umur</th>
|
||||
<th>Kriteria Pekerjaan</th>
|
||||
<th>Kriteria Penghasilan</th>
|
||||
<th>Kriteria Jumlah Tanggungan</th>
|
||||
<th>Kriteria Status Rumah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Normalisasi Terbobot</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_normalisasi_terbobot" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIK</th>
|
||||
<th>Kriteria Umur</th>
|
||||
<th>Kriteria Pekerjaan</th>
|
||||
<th>Kriteria Penghasilan</th>
|
||||
<th>Kriteria Jumlah Tanggungan</th>
|
||||
<th>Kriteria Status Rumah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Ideal Positif</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_ideal_positif" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Kriteria Umur</th>
|
||||
<th>Kriteria Pekerjaan</th>
|
||||
<th>Kriteria Penghasilan</th>
|
||||
<th>Kriteria Jumlah Tanggungan</th>
|
||||
<th>Kriteria Status Rumah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Ideal Negatif</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_ideal_negatif" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Kriteria Umur</th>
|
||||
<th>Kriteria Pekerjaan</th>
|
||||
<th>Kriteria Penghasilan</th>
|
||||
<th>Kriteria Jumlah Tanggungan</th>
|
||||
<th>Kriteria Status Rumah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing tampilkan" style="display: none;">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">preverensi</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<div style="overflow-x: auto">
|
||||
<table id="table_preverensi" class="table table-striped table-bordered display" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>NIK</th>
|
||||
<th>Preverensi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<!-- create modal for 'Tambah Penduduk' -->
|
||||
<div class="modal fade" id="modal_add_penduduk" tabindex="-1" role="dialog" aria-labelledby="modal_add_penduduk" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modal_add_penduduk"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form id="form_add_penduduk" onsubmit="return tambah_edit_penduduk(event)">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" id="status">
|
||||
<label for="nik">NIK</label>
|
||||
<input type="text" class="form-control" id="nik" name="nik" placeholder="Masukkan NIK" onkeypress="return isNumberKey(event)" minlength="16" maxlength="16" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama">Nama</label>
|
||||
<input type="text" class="form-control" id="nama" name="nama" placeholder="Masukkan Nama" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="umur">Tanggal Lahir</label>
|
||||
<input type="date" class="form-control" id="tgl_lahir" name="tgl_lahir" placeholder="Masukkan Tanggal Lahir" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jenis_kelamin">Jenis Kelamin</label>
|
||||
<select class="form-control" id="jenis_kelamin" name="jenis_kelamin" required>
|
||||
<option value="">Pilih Jenis Kelamin</option>
|
||||
<option value="Laki-laki">Laki-laki</option>
|
||||
<option value="Perempuan">Perempuan</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="alamat">Alamat</label>
|
||||
<textarea class="form-control" id="alamat" name="alamat" placeholder="Masukkan Alamat" style="resize :none;" required></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="no_hp">No HP</label>
|
||||
<input type="text" class="form-control" id="no_hp" name="no_hp" placeholder="Masukkan No HP" onkeypress="return isNumberKey(event)" minlength="9" maxlength="13" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-xs" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary btn-xs" id="btn_add_penduduk">Simpan</button>
|
||||
<button type="submit" class="btn btn-primary btn-xs" id="btn_update_penduduk">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
var data_lama;
|
||||
|
||||
function datatables() {
|
||||
table = $('#table_list_penduduk').DataTable({
|
||||
// "searching": false,
|
||||
"lengthMenu": [
|
||||
[5, 10, 15, -1],
|
||||
[5, 10, 15, "All"]
|
||||
],
|
||||
"pageLength": 10,
|
||||
"ordering": true,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
// "order": [[ 4, 'desc' ]],
|
||||
|
||||
"ajax": {
|
||||
"url": server_url + "admin/topsis",
|
||||
"type": "POST",
|
||||
data: {
|
||||
proses: 'table_penduduk'
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
"columnDefs": [{
|
||||
"targets": [2, 3],
|
||||
"orderable": false,
|
||||
}, ],
|
||||
});
|
||||
}
|
||||
datatables()
|
||||
|
||||
function status_bantuan(nik) {
|
||||
// console.log(nik)
|
||||
window.location.href = server_url + "admin/topsis/" + nik
|
||||
}
|
||||
|
||||
function proses_bantuan() {
|
||||
// console.log("sini proses bantuan")
|
||||
ajax_proses = $.ajax({
|
||||
url: server_url_api + "bantuan",
|
||||
type: "get",
|
||||
|
||||
dataType: "JSON",
|
||||
beforeSend: function() {
|
||||
block_ui("Menyimpan Data Penduduk");
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
// show class tampilkan
|
||||
$('.tampilkan').removeAttr('style')
|
||||
|
||||
const matriks_keputusan = data.matriks_keputusan
|
||||
const matriks_normalisasi = data.matriks_normalisasi
|
||||
const normalisasi_terbobot = data.normalisasi_terbobot
|
||||
const preverensi = data.preverensi
|
||||
// insert data matriks_keputusan to table table_matriks_keputusan body
|
||||
let html_matriks_keputusan = ''
|
||||
let html_matriks_normalisasi = ''
|
||||
let html_normalisasi_terbobot = ''
|
||||
let html_preverensi = ''
|
||||
|
||||
for (let i = 0; i < matriks_keputusan.length; i++) {
|
||||
html_matriks_keputusan += '<tr>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].nik + '</td>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].kriteria_umur + '</td>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].kriteria_pekerjaan + '</td>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].kriteria_penghasilan + '</td>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].kriteria_jumlah_tanggungan + '</td>'
|
||||
html_matriks_keputusan += '<td>' + matriks_keputusan[i].kriteria_jenis_rumah + '</td>'
|
||||
html_matriks_keputusan += '</tr>'
|
||||
|
||||
html_matriks_normalisasi += '<tr>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].nik + '</td>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].kriteria_umur + '</td>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].kriteria_pekerjaan + '</td>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].kriteria_penghasilan + '</td>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].kriteria_jumlah_tanggungan + '</td>'
|
||||
html_matriks_normalisasi += '<td>' + matriks_normalisasi[i].kriteria_jenis_rumah + '</td>'
|
||||
html_matriks_normalisasi += '</tr>'
|
||||
|
||||
html_normalisasi_terbobot += '<tr>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].nik + '</td>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].kriteria_umur + '</td>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].kriteria_pekerjaan + '</td>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].kriteria_penghasilan + '</td>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].kriteria_jumlah_tanggungan + '</td>'
|
||||
html_normalisasi_terbobot += '<td>' + normalisasi_terbobot[i].kriteria_jenis_rumah + '</td>'
|
||||
html_normalisasi_terbobot += '</tr>'
|
||||
|
||||
html_preverensi += '<tr>'
|
||||
html_preverensi += '<td>' + preverensi[i].nik + '</td>'
|
||||
html_preverensi += '<td>' + preverensi[i].preverensi + '</td>'
|
||||
html_preverensi += '</tr>'
|
||||
|
||||
}
|
||||
|
||||
$('#table_matriks_keputusan tbody').html(html_matriks_keputusan)
|
||||
$('#table_matriks_normalisasi tbody').html(html_matriks_normalisasi)
|
||||
$('#table_normalisasi_terbobot tbody').html(html_normalisasi_terbobot)
|
||||
$('#table_preverensi tbody').html(html_preverensi)
|
||||
|
||||
// datatable matriks_keputusan
|
||||
$('#table_matriks_keputusan').DataTable();
|
||||
$('#table_matriks_normalisasi').DataTable();
|
||||
$('#table_normalisasi_terbobot').DataTable();
|
||||
$('#table_preverensi').DataTable();
|
||||
|
||||
const ideal_positif = data.ideal_positif
|
||||
|
||||
let html_ideal_positif = ''
|
||||
html_ideal_positif += '<tr>'
|
||||
html_ideal_positif += '<td>' + ideal_positif.kriteria_umur + '</td>'
|
||||
html_ideal_positif += '<td>' + ideal_positif.kriteria_pekerjaan + '</td>'
|
||||
html_ideal_positif += '<td>' + ideal_positif.kriteria_penghasilan + '</td>'
|
||||
html_ideal_positif += '<td>' + ideal_positif.kriteria_jumlah_tanggungan + '</td>'
|
||||
html_ideal_positif += '<td>' + ideal_positif.kriteria_jenis_rumah + '</td>'
|
||||
html_ideal_positif += '</tr>'
|
||||
$('#table_ideal_positif tbody').html(html_ideal_positif)
|
||||
$('#table_ideal_positif').DataTable();
|
||||
|
||||
const ideal_negatif = data.ideal_negatif
|
||||
|
||||
let html_ideal_negatif = ''
|
||||
html_ideal_negatif += '<tr>'
|
||||
html_ideal_negatif += '<td>' + ideal_negatif.kriteria_umur + '</td>'
|
||||
html_ideal_negatif += '<td>' + ideal_negatif.kriteria_pekerjaan + '</td>'
|
||||
html_ideal_negatif += '<td>' + ideal_negatif.kriteria_penghasilan + '</td>'
|
||||
html_ideal_negatif += '<td>' + ideal_negatif.kriteria_jumlah_tanggungan + '</td>'
|
||||
html_ideal_negatif += '<td>' + ideal_negatif.kriteria_jenis_rumah + '</td>'
|
||||
html_ideal_negatif += '</tr>'
|
||||
$('#table_ideal_negatif tbody').html(html_ideal_negatif)
|
||||
$('#table_ideal_negatif').DataTable();
|
||||
|
||||
$('#table_list_penduduk').dataTable().fnDestroy();
|
||||
datatables();
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
// if (statusCode != 500 || statusCode != 0) {
|
||||
// toastr.error(responseJSON.message);
|
||||
// } else {
|
||||
// toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
// }
|
||||
// $.unblockUI();
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
239
application/views/admin/menu/topsis_detail.php
Normal file
239
application/views/admin/menu/topsis_detail.php
Normal file
@ -0,0 +1,239 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
|
||||
<?php $this->load->view("admin/header"); ?>
|
||||
|
||||
<body>
|
||||
|
||||
<?php $this->load->view("admin/side_topbar"); ?>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Detail Kriteria Penduduk</h4>
|
||||
|
||||
<div class="card-content">
|
||||
<!-- create input below like umur, pekerjaan, penghasilan , jumlah tanggungan dan jenis rumah -->
|
||||
<form class="form-horizontal" onsubmit="return cek_status_bantuan_sosial(event)">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">NIK</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="nik" name="nik" value="<?= $nik ?>" placeholder="NIK" disabled>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Nama</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="nama" name="nama" value="<?= $nama ?>" placeholder="Nama" disabled>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Umur</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" id="umur" name="umur" value="<?= $umur ?>" placeholder="Umur" disabled>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pekerjaan" class="col-sm-2 control-label">Pekerjaan</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="pekerjaan" name="pekerjaan" required>
|
||||
<option value='' selected disabled>-Pilih Pekerjaan</option>
|
||||
<option value="1">PNS</option>
|
||||
<option value="2">Wiraswasta</option>
|
||||
<option value="3">Petani</option>
|
||||
<option value="4">Buruh</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="penghasilan" class="col-sm-2 control-label">Penghasilan</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="penghasilan" name="penghasilan" required>
|
||||
<option value='' selected disabled>-Pilih Penghasilan</option>
|
||||
<option value="4">Kurang dari Rp. 3.000.000</option>
|
||||
<option value="3">Rp. 3.000.000 - Rp. 5.000.000</option>
|
||||
<option value="2">Rp. 5.000.000 - Rp. 8.000.000</option>
|
||||
<option value="1">Lebih dari Rp. 8.000.000</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jumlah_tanggungan" class="col-sm-2 control-label">Jumlah Tanggungan</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="jumlah_tanggungan" name="jumlah_tanggungan" required>
|
||||
<option value='' selected disabled>-Pilih Tanggungan</option>
|
||||
<option value="1">Tiada</option>
|
||||
<option value="2">Kurang dari 3</option>
|
||||
<option value="3">3 - 5</option>
|
||||
<option value="4">Lebih dari 5</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jenis_rumah" class="col-sm-2 control-label">Jenis Rumah</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" id="jenis_rumah" name="jenis_rumah" required>
|
||||
<option value='' selected disabled>-Pilih Jenis Rumah</option>
|
||||
<option value="1">Rumah Sendiri</option>
|
||||
<option value="3">Rumah Sewa</option>
|
||||
<option value="4">Rumah Kontrak</option>
|
||||
<option value="2">Rumah Keluarga</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-2"></div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button type="submit" class="btn btn-primary btn-xs waves-effect waves-light" id="btn_simpan">Masukkan Detail Kriteria</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row small-spacing">
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
<div class="col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title" id="header_absensi">Status Bantuan</h4>
|
||||
|
||||
<div class="card-content">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-content -->
|
||||
</div>
|
||||
<!-- /.col-xs-12 -->
|
||||
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/footer') ?>
|
||||
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('admin/scripts') ?>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="<?= base_url() ?>assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
var data_lama;
|
||||
|
||||
|
||||
async function cek_data(){
|
||||
const nik = $('#nik').val();
|
||||
let data
|
||||
try {
|
||||
data = await $.ajax({
|
||||
url: server_url_api + "topsis?nik=" + nik,
|
||||
type: 'get',
|
||||
async: false,
|
||||
beforeSend: function(res) {
|
||||
block_ui("Mengambil Data Kriteria");
|
||||
},
|
||||
});
|
||||
data = data.data
|
||||
data_lama = data
|
||||
console.log(data)
|
||||
if(data != null){
|
||||
$("#pekerjaan").val(data.bobot_pekerjaan)
|
||||
$("#penghasilan").val(data.bobot_penghasilan)
|
||||
$("#jumlah_tanggungan").val(data.bobot_jumlah_tanggungan)
|
||||
$("#jenis_rumah").val(data.bobot_jenis_rumah)
|
||||
$("#btn_simpan").html("Update Detail Kriteria")
|
||||
}
|
||||
await $.unblockUI();
|
||||
} catch (error) {
|
||||
await $.unblockUI();
|
||||
const statusCode = error.status;
|
||||
console.log(error)
|
||||
console.log(statusCode)
|
||||
if (statusCode == 0 || statusCode == 500) return toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
|
||||
const message = error.responseJSON.message
|
||||
toastr.error(message);
|
||||
}
|
||||
}
|
||||
cek_data()
|
||||
|
||||
function cek_status_bantuan_sosial(e) {
|
||||
e.preventDefault();
|
||||
const nik = $('#nik').val();
|
||||
const umur = $('#umur').val();
|
||||
const bobot_pekerjaan = $('#pekerjaan').val();
|
||||
const bobot_penghasilan = $('#penghasilan').val();
|
||||
const bobot_jumlah_tanggungan = $('#jumlah_tanggungan').val();
|
||||
const bobot_jenis_rumah = $('#jenis_rumah').val();
|
||||
var bobot_umur
|
||||
if (umur < 25) {
|
||||
bobot_umur = 1
|
||||
} else if (umur >= 25 && umur <= 35) {
|
||||
bobot_umur = 2
|
||||
} else if (umur >= 36 && umur <= 45) {
|
||||
bobot_umur = 3
|
||||
} else if (umur >= 46) {
|
||||
bobot_umur = 4
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: server_url_api + "topsis",
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
nik: nik,
|
||||
bobot_umur: bobot_umur,
|
||||
bobot_pekerjaan: bobot_pekerjaan,
|
||||
bobot_penghasilan: bobot_penghasilan,
|
||||
bobot_jumlah_tanggungan: bobot_jumlah_tanggungan,
|
||||
bobot_jenis_rumah: bobot_jenis_rumah
|
||||
},
|
||||
beforeSend: function(res) {
|
||||
// block_ui("Loading Status Bantuan Menggunakan Metode Topsis");
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
$.unblockUI();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
const statusCode = XMLHttpRequest.status;
|
||||
const responseJSON = XMLHttpRequest.responseJSON;
|
||||
console.log(statusCode);
|
||||
console.log(responseJSON)
|
||||
if (statusCode != 500 || statusCode != 0) {
|
||||
toastr.error(responseJSON.message);
|
||||
} else {
|
||||
toastr.error("Jaringan atau server bermasalah, sila refresh kembali halaman");
|
||||
}
|
||||
$.unblockUI();
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
<!-- Dibuat oleh Kicap Karan. https://www.kicap-karan.com -->
|
||||
|
||||
</html>
|
||||
@ -1,11 +1,11 @@
|
||||
<div class="main-menu">
|
||||
<header class="header">
|
||||
<a href="<?= base_url("admin") ?>" class="logo"></i><?= $level ?></a>
|
||||
<a href="<?= base_url("admin") ?>" class="logo"></i>Admin</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="<?= base_url() ?>assets/images/avatar-sm-5.jpg" alt=""><span class="status online"></span></a>
|
||||
<h5 class="name"><a href="3"><?= $nama ?></a></h5>
|
||||
<h5 class="position"><?= $level ?></h5>
|
||||
<h5 class="name"><a href="3">Administratif</a></h5>
|
||||
<h5 class="position">Admin</h5>
|
||||
<!-- /.name -->
|
||||
|
||||
</div>
|
||||
@ -21,23 +21,8 @@
|
||||
<li <?php if($header == "Halaman Utama"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin") ?>"><i class="menu-icon mdi mdi-view-dashboard"></i><span>Halaman Utama</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Jam Kerja"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/jam_kerja") ?>"><i class="menu-icon fa fa-clock-o"></i><span>Halaman Jam Kerja</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Pengaturan Libur"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/libur") ?>"><i class="menu-icon fa fa-calendar"></i><span>Pengaturan Libur</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Pengaturan Perjalanan Dinas"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/perjalanan_dinas") ?>"><i class="menu-icon fa fa-calendar"></i><span>Perjalanan Dinas</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Pengaturan Lokasi Dinas"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/pengaturan") ?>"><i class="menu-icon mdi mdi-desktop-mac"></i><span>Pengaturan Lokasi Dinas</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Karyawan"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/karyawan") ?>"><i class="menu-icon zmdi zmdi-accounts-alt"></i><span>Halaman Karyawan</span></a>
|
||||
</li>
|
||||
<li <?php if($header == "Halaman Laporan"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/laporan") ?>"><i class="menu-icon zmdi zmdi-comment-list"></i><span>Halaman Laporan</span></a>
|
||||
<li <?php if($header == "Halaman Topsis"){echo 'class="current"';} ?>>
|
||||
<a class="waves-effect" href="<?= base_url("admin/topsis") ?>"><i class="menu-icon fa fa-clock-o"></i><span>Halaman Topsis</span></a>
|
||||
</li>
|
||||
<li >
|
||||
<a class="waves-effect" href="<?= base_url("admin/logout") ?>"><i class="menu-icon mdi mdi-logout"></i><span>Logout</span></a>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Sistem Kedisiplinan Dinas Pariwisata Dan Kebudayaan Kabupaten Mamuju Tengah - Halaman Login</title>
|
||||
<title>Sistem Bantuan Sosial Tunai Dinas Sosial, Pariwisata dan Kebudayaan Pinrang - Halaman Login</title>
|
||||
<link rel="stylesheet" href="<?= base_url() ?>assets/styles/style.min.css">
|
||||
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="<?= base_url() ?>assets<?= base_url() ?>assets/images/favico/apple-icon-57x57.png">
|
||||
@ -44,9 +44,9 @@
|
||||
<div id="single-wrapper">
|
||||
<form action="#" class="frm-single" onsubmit="return login(event)">
|
||||
<div class="inside">
|
||||
<div class="title">Sistem Kedisiplinan</div>
|
||||
<div class="title">Sistem Bantuan Sosial Tunai </div>
|
||||
<!-- /.title -->
|
||||
<div class="frm-title">Dinas Pariwisata Dan Kebudayaan Kabupaten Mamuju Tengah </div>
|
||||
<div class="frm-title">Dinas Sosial, Pariwisata dan Kebudayaan Kabupaten Pinrang </div>
|
||||
<!-- /.frm-title -->
|
||||
<div class="frm-input"><input type="text" placeholder="Username" class="frm-inp" id="username" required><i class="fa fa-user frm-ico"></i></div>
|
||||
<!-- /.frm-input -->
|
||||
@ -107,19 +107,19 @@
|
||||
block_ui("Sedang Login");
|
||||
},
|
||||
success: function(response) {
|
||||
$.unblockUI();
|
||||
swal({
|
||||
title: "Success",
|
||||
text: "Anda Berhasil Login",
|
||||
icon: "success",
|
||||
buttons: {
|
||||
cancel: false,
|
||||
confirm: false,
|
||||
},
|
||||
timer: 2000
|
||||
// dangerMode: true,
|
||||
})
|
||||
delay(1500)
|
||||
// $.unblockUI();
|
||||
// swal({
|
||||
// title: "Success",
|
||||
// text: "Anda Berhasil Login",
|
||||
// icon: "success",
|
||||
// buttons: {
|
||||
// cancel: false,
|
||||
// confirm: false,
|
||||
// },
|
||||
// timer: 2000
|
||||
// // dangerMode: true,
|
||||
// })
|
||||
// delay(1500)
|
||||
window.location.replace(server_url + "admin")
|
||||
// console.log(response)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user