diff --git a/application/controllers/Api_server.php b/application/controllers/Api_server.php
index 70b5b03..69c3bce 100644
--- a/application/controllers/Api_server.php
+++ b/application/controllers/Api_server.php
@@ -1,9 +1,9 @@
0){
$this->response(['message' => 'NIK '.$data['nik_karyawan'].' telah terdaftar dalam sistem sebelumnya'], 400);
}else{
+ $this->model->qrcode_karyawan($data['nik_karyawan']);
$this->model->insert('tb_karyawan',$data);
- $this->model->insert('tb_login',['username' => $data['nik_karyawan'],'password' => md5($data['nik_karyawan'])]);
+ // $this->model->insert('tb_login',['username' => $data['nik_karyawan'],'password' => md5($data['nik_karyawan']),'nik_karyawan' => $data['nik_karyawan']]);
$this->response(['message' => 'ok'], 200);
}
@@ -175,6 +176,19 @@ class Api_server extends RestController
if (count($cek_data) > 0) {
$cek_absensi = $this->model->tampil_data_where('tb_absensi',['bulan' => date('m'),'tahun' => date('Y')])->result();
if(count($cek_absensi) > 0){
+ $array_libur = ($cek_data[0]->detail != null) ? json_decode($cek_data[0]->detail,true) : null;
+ $libur = false;
+ $ket_libur = null;
+ if ($array_libur != null){
+ foreach ($array_libur as $key => $value) {
+ if ($value['tanggal'] == date('Y-m-d')) {
+ $libur = true;
+ $ket_libur = $value['ket'];
+ break;
+ }
+ }
+ }
+
$array_absensi = json_decode($cek_absensi[0]->detail,true);
$tanggal_ada = false;
$nik_ada = false;
@@ -199,7 +213,11 @@ class Api_server extends RestController
}
- if ($jam_keluar == true){
+ if ($libur == true) {
+ $this->response(['message' => $cek_data[0]->nama.' libur karena '. $ket_libur], 401);
+ }
+
+ elseif ($jam_keluar == true){
$this->response(['message' => $cek_data[0]->nama.' telah diabsensi masuk kerja dan pulang kerja pada hari ini'], 401);
}
elseif ($nik_ada == true) {
@@ -302,5 +320,20 @@ class Api_server extends RestController
$this->response($cek_data, 200);
}
+ function notifikasi_post(){
+ $no_telpon = $this->post('no_telpon');
+
+ $cek_data = $this->model->tampil_data_keseluruhan('tb_notifikasi')->result();
+
+ if (count($cek_data) == 0) {
+ $this->model->insert('tb_notifikasi',['no_telpon' => $no_telpon]);
+ }else{
+ $this->model->custom_query('UPDATE tb_notifikasi set no_telpon = '.$no_telpon);
+ }
+
+ $this->response(['message' => $no_telpon], 200);
+ }
+
+
}
diff --git a/application/controllers/Home.php b/application/controllers/Home.php
index 57fe787..b5fbe8a 100644
--- a/application/controllers/Home.php
+++ b/application/controllers/Home.php
@@ -41,7 +41,7 @@ class Home extends CI_Controller {
$row[] = $no;
$row[] = $field->nik_karyawan;
$row[] = $field->nama;
- $row[] = '
';
+ $row[] = ' ';
$data[] = $row;
}
@@ -274,6 +274,18 @@ class Home extends CI_Controller {
}
+ function notifikasi(){
+ $cek_data = $this->model->tampil_data_keseluruhan('tb_notifikasi')->result();
+
+ if (count($cek_data) > 0) {
+ $main['no_telpon'] = $cek_data[0]->no_telpon;
+ }else{
+ $main['no_telpon'] = '';
+ }
+
+ $main['header'] = 'Halaman No Notifikasi';
+ $this->load->view('home/menu/notifikasi', $main);
+ }
function cetak($tahun = null, $bulan = null){
if (is_numeric($bulan) && is_numeric($tahun)) {
@@ -413,6 +425,61 @@ class Home extends CI_Controller {
redirect('/home/laporan');
}
}
+
+ function print_id_karyawan($nik_karyawan = null)
+ {
+ // print_r($this->uri->segment(3));
+
+ if ($nik_karyawan != null) {
+ $cek_data = $this->model->tampil_data_where('tb_karyawan',array('nik_karyawan' => $nik_karyawan))->result();
+ if (count($cek_data) > 0) {
+ $this->model->qrcode_karyawan($nik_karyawan);
+ $pdf = new TCPDF('P','mm',array(80,60));
+ $pdf->setPrintHeader(false);
+ $pdf->AddPage();
+ // $pdf->Image(base_url('images/karyawan/'.$nik_karyawan.'.png'),5,7,30);
+
+ $html = '
+
+
+
+ |
+ .'images/karyawan/'.$nik_karyawan.'.png) |
+ |
+
+
+ |
+ '.$cek_data[0]->nama.' |
+ |
+
+
+ ';
+ $pdf->writeHTML($html, true, false, true, false, '');
+ $pdf->output();
+ }else{
+ redirect('/home');
+ }
+ }
+
+ }
function logout()
{
diff --git a/application/models/Model.php b/application/models/Model.php
index 781c1b3..e87a917 100644
--- a/application/models/Model.php
+++ b/application/models/Model.php
@@ -281,30 +281,30 @@ class Model extends CI_Model {
return $ini;
}
- // function qrcode_buku($kode){
- // include "phpqrcode/qrlib.php";
- // $kode = $kode;
+ function qrcode_karyawan($karyawan){
+ include "phpqrcode/qrlib.php";
- // // $PNG_TEMP_DIR = 'images/'.$kategori;
- // $PNG_WEB_DIR = 'images/buku/';
+ // $PNG_TEMP_DIR = 'images/'.$kategori;
+
+ $PNG_WEB_DIR = 'images/karyawan/';
- // if (!file_exists($PNG_WEB_DIR))
- // mkdir($PNG_WEB_DIR);
+ if (!file_exists($PNG_WEB_DIR))
+ mkdir($PNG_WEB_DIR);
- // $errorCorrectionLevel = 'H';
+ $errorCorrectionLevel = 'H';
- // $matrixPointSize = 10;
+ $matrixPointSize = 10;
- // $filename =$PNG_WEB_DIR.md5($kode).'.png';
- // QRcode::png($kode, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
+ $filename =$PNG_WEB_DIR.$karyawan.'.png';
+ QRcode::png($karyawan, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
- // if (file_exists($PNG_WEB_DIR.md5($kode).'.png') > 0) {
- // return "ada";
- // }else{
- // return "tiada";
- // }
- // }
+ if (file_exists($PNG_WEB_DIR.$karyawan.'.png') > 0) {
+ return "ada";
+ }else{
+ return "tiada";
+ }
+ }
function cek_last_ai($tables){
return $this->db->query("SELECT `AUTO_INCREMENT` as no
diff --git a/application/views/home/header.php b/application/views/home/header.php
index dc51aa9..e27485d 100644
--- a/application/views/home/header.php
+++ b/application/views/home/header.php
@@ -4,8 +4,8 @@
?>/assets/images/admin.png)
-
-
+
Admin
+
Admin
@@ -30,6 +30,9 @@
uri->segment(2) == "laporan"): ?>class="current">
Laporan Absensi
+ uri->segment(2) == "notifikasi"): ?>class="current">
+ No Telpon Notifikasi
+
diff --git a/application/views/home/menu/karyawan.php b/application/views/home/menu/karyawan.php
index 0de2690..c94928c 100644
--- a/application/views/home/menu/karyawan.php
+++ b/application/views/home/menu/karyawan.php
@@ -243,7 +243,7 @@
block_ui()
},
- success: function (response) {
+ success: function (response) {
$('#sini_form')[0].reset();
$('#table_list_karyawan').dataTable().fnDestroy();
datatables()
@@ -263,10 +263,8 @@
timer : 3000
// dangerMode: true,
})
-
-
-
+ qrcode_karyawan(nik_karyawan)
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
// console.log(errorThrown)
@@ -574,6 +572,18 @@
});
}
+
+ async function qrcode_karyawan(nik_karyawan){
+ let html = await ``
+
+ await $("#sini_modalnya .modal-body").html(html)
+
+ await $('#sini_modalnya').modal('show');
+ }