first commit

This commit is contained in:
2026-10-29 13:34:31 +07:00
commit 45e4595c57
255 changed files with 35457 additions and 0 deletions
@@ -0,0 +1,126 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Gel/KaryawanController
Description : Master Standar Gaji
Created By : Siau Pheng ([email protected]).
Created Date : September 17th, 2014.
Last Modified : September 4th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Gel;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\DB\SQL;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class KaryawanController {
private string $mode_detail;
private int $id_karya;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db) {
$this->app = $app;
$this->db = $db;
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_karya = Param::Int("KaryaID", 0);
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("para_karyawan");
$sql->add_param("Nama_Karya");
$sql->add_param("Gaji_Harian");
$sql->add_param_date("Tgl_Masuk");
$sql->add_param_date("Tgl_Keluar");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("KaryaID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Karya");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'Nama_Karya LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("para_karyawan", "*", $tsql, $asql);
$obj->add_field("KaryaID", "ID", "hid");
$obj->add_field("Nama_Karya", "Nama Karyawan", "awr");
$obj->add_field("Gaji_Harian", "Gaji Harian", "r", "rupiah");
$obj->add_field("Tgl_Masuk", "Tgl. Masuk", "c", "sqltgl");
$obj->add_field("Tgl_Keluar", "Tgl. Keluar", "c", "sqltgl");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Nama_Karya", "A");
$obj->add_row_btn("clipboard", "Ubah", "KaryawanJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "KaryawanJS.detail_hapus");
$obj->set_func_btn("KaryawanJS.detail_tambah", "+ Karyawan");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function form_karya() {
$atabel = [ 'KaryaID'=>0, 'Nama_Karya'=>"", 'Gaji_Harian'=>0, 'Tgl_Masuk'=>tgl_ymd(), 'Tgl_Keluar'=>'0000-00-00', 'Aktif'=>1 ];
if ($this->id_karya > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM para_karyawan WHERE KaryaID=?", [$this->id_karya]);
}
$form = new Form($this->app);
$tnama = $form->textbox("_", "Nama_Karya", $atabel['Nama_Karya'], true, true, "text", "nama karyawan");
$tgaji = $form->textbox("_", "Gaji_Harian", $atabel['Gaji_Harian'], true, true, "double", "gaji harian");
$tmasuk = $form->datebox("_", "Tgl_Masuk", $atabel['Tgl_Masuk'], true, false);
$tkeluar = $form->datebox("_", "Tgl_Keluar", $atabel['Tgl_Keluar'], true, false);
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, true, ['1'=>"Aktif",'0'=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nama_Karya">Nama Karyawan</label>
<div class="col">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Gaji_Harian">Gaji Harian</label>
<div class="col-sm-6 col-lg-5">'.$tgaji.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Tgl_Masuk">Tanggal Masuk</label>
<div class="col-sm-6 col-lg-5">'.$tmasuk.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Tgl_Keluar">Tanggal Keluar</label>
<div class="col-sm-6 col-lg-5">'.$tkeluar.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<input type="hidden" id="KaryaID" value="'.$atabel['KaryaID'].'" >
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
$this->app->json($ajson);
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in"><div class="card"><div class="card-header custom-style">Daftar Karyawan</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Karya" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divDetail">&nbsp;</div></div></div></div>'
]);
}
}