first commit
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/AboutController
|
||||
Description : Informasi Aplikasi
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 23th, 2011.
|
||||
Last Modified : August 13th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use Webapp\App\Register;
|
||||
use Webapp\App\Update;
|
||||
use Webapp\DB\CheckSQL;
|
||||
use Webapp\Web\Param;
|
||||
|
||||
class AboutController {
|
||||
|
||||
protected Engine $app;
|
||||
protected Session $session;
|
||||
protected Update $update;
|
||||
protected CheckSQL $check;
|
||||
|
||||
public function __construct(Engine $app, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->session = $session;
|
||||
$this->update = new Update($app);
|
||||
$this->check = new CheckSQL($app);
|
||||
$this->check->ignore_table("app_auth","app_backup","app_config","app_menu","app_operator");
|
||||
}
|
||||
|
||||
public function update_check() {
|
||||
$ainfo = $this->update->check();
|
||||
$ajson['is_update'] = $ainfo['cur_sha1'] === $ainfo['new_sha1'];
|
||||
$ajson['html'] = '
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-lg-4 col-form-label">Versi Aplikasi</div>
|
||||
<div class="col col-form-label"><span class="form-control">'.$ainfo['cur_version'].'</span></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-lg-4 col-form-label">Commit Sekarang</div>
|
||||
<div class="col col-form-label"><span class="form-control"><strong>'.$ainfo['cur_sha'].'</strong> '.$ainfo['cur_date'].'</span></div>
|
||||
</div>
|
||||
<div class="row"><div class="col"><hr class="my-1"></div></div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-lg-4 col-form-label">Commit Update</div>
|
||||
<div class="col col-form-label"><span class="form-control"><strong>'.$ainfo['new_sha'].'</strong> '.$ainfo['new_date'].'</span></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-lg-4 col-form-label">Informasi Update</div>
|
||||
<div class="col col-form-label"><span class="form-control">'.$ainfo['new_message'].'</span></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-lg-4 col-form-label">Status Server</div>
|
||||
<div class="col">
|
||||
<span class="form-control text-'.($ainfo['svr_status']===1?'success border-primary':'warning border-danger').'" id="spanStatus">'.$ainfo['svr_message'].'</span>
|
||||
</div>
|
||||
</div>';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function update_proses() {
|
||||
$ajson = $this->update->go();
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function db_check() {
|
||||
$ajson['html'] = '<ul id="db-list"><li>Proses ...</li></ul>';
|
||||
$ajson['db_count'] = $this->check->count_db();
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function db_proses() {
|
||||
$nomor = Param::Get('Nomor', 0);
|
||||
$ajson['html'] = $this->check->check_db_step($nomor);
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function opti_proses() {
|
||||
$nomor = Param::Get('Nomor', 0);
|
||||
$ajson['html'] = $this->check->optimize_db_step($nomor);
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$ajson = [];
|
||||
$apps = $this->session->get('WEB_APP');
|
||||
|
||||
$ajson['html'] = '<div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="about-tab" data-bs-toggle="tab" data-bs-target="#about" type="button" role="tab" aria-controls="about" aria-selected="true">Tentang Aplikasi</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="other-tab" data-bs-toggle="tab" data-bs-target="#other" type="button" role="tab" aria-controls="other" aria-selected="false">Informasi Pendukung</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="tool-tab" data-bs-toggle="tab" data-bs-target="#tool" type="button" role="tab" aria-controls="tool" aria-selected="false">Tools</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content border border-top-0 p-3">
|
||||
<div class="tab-pane fade active show" id="about" role="tabpanel" aria-labelledby="about-tab">
|
||||
<div class="text-center text-secondary">
|
||||
<span class="fs-5">'.$apps['REG_NAME'].'</span><br>'.$apps['REG_ADDRESS'].'<br>'.$apps['REG_CITY'].' '.$apps['REG_POSTCODE'].'</div><br>
|
||||
<table>
|
||||
<tr><td>Register ID</td><td class="c pe-1">:</td><td nowrap>'.Register::reg_id($this->session).'</td></tr>
|
||||
<tr><td>Register Code</td><td class="c">:</td><td>'.Register::reg_code($this->session).'</td></tr>
|
||||
</table>
|
||||
<hr class="my-2">
|
||||
<div class="text-center text-secondary">'.$apps['APP_NAMES'].' Ver. '.$apps['APP_VER'].'<br>Updated : '.$apps['APP_UPDATED'].'<br><br><span style="font-size:.9em;"><i class="bi-c-circle pe-1"></i>'.$apps['CREATOR_YEARS'].', '.$apps['CREATOR_NAME'].'<br>'.$apps['CREATOR_WEBSITE'].'.</span></div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="other" role="tabpanel" aria-labelledby="other-tab">
|
||||
<div class="row"><div class="col" id="divBuildInfo"></div></div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tool" role="tabpanel" aria-labelledby="tool-tab">
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-8">Proses Cek dan Otomatis Repair Database, jika terjadi masalah dengan database aplikasi.</div>
|
||||
<div class="col-md-4 d-grid gap-2 my-auto"><button type="button" class="btn btn-info col-12" id="butDBCek">Cek Database</button></div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-md-8">Proses Optimalisasi database, merampingkan kembali database aplikasi.</div>
|
||||
<div class="col-md-4 d-grid gap-2 my-auto"><button type="button" class="btn btn-warning col-12" id="butDBOpti">Opti Database</button></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8">Cek update aplikasi secara online.</div>
|
||||
<div class="col-md-4 d-grip gap-2 my-auto"><button type="button" class="btn btn-success col-12" id="butUpdateCek">Cek Update</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/ChpasswdController
|
||||
Description : Data Ubah Password
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 7th, 2008.
|
||||
Last Modified : August 9th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use Webapp\App\Auth;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
|
||||
class ChpasswdController {
|
||||
|
||||
protected Engine $app;
|
||||
|
||||
public function __construct(Engine $app, Session $session) {
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function simpan() {
|
||||
$ajson['status'] = false;
|
||||
|
||||
$l_pass = Param::Get("LPass");
|
||||
$b_pass1 = Param::Get("BPass1");
|
||||
|
||||
$auth = new Auth($this->app);
|
||||
if ($auth->user_check($this->app->user()->username(), $l_pass)) {
|
||||
$this->app->db()->update('app_operator', 'Password=MD5(?) WHERE UserID=?', [$b_pass1, $this->app->user()->id()]);
|
||||
$ajson['status'] = true;
|
||||
$ajson['message'] = "Sukses merubah password Anda!";
|
||||
} else {
|
||||
$ajson['message'] = "Password lama Anda salah!";
|
||||
}
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$form = new Form($this->app);
|
||||
$t_passl = $form->password("_", "LPass", '', true, true, "masukkan password lama", 20);
|
||||
$t_passb1 = $form->password("_", "BPass1", '', true, true, "masukkan password baru 1", 20);
|
||||
$t_passb2 = $form->password("_", "BPass2", '', true, true, "masukkan password baru 2", 20);
|
||||
$ajson['html'] = '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="LPass">Password Lama</label>
|
||||
<div class="col">'.$t_passl.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="BPass1">Password Baru 1</label>
|
||||
<div class="col">'.$t_passb1.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-6 col-lg-4 col-form-label" for="BPass2">Password Baru 2</label>
|
||||
<div class="col">'.$t_passb2.'</div>
|
||||
</div>';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/ConfigController
|
||||
Description : Konfigurasi Informasi Perusahaan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 25th, 2010.
|
||||
Last Modified : August 14th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\DB\SQL;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
|
||||
class ConfigController {
|
||||
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function config() {
|
||||
$mode = Param::Get('mode', 'view');
|
||||
|
||||
if ($mode === 'save') {
|
||||
$sql = new SQL($this->app);
|
||||
$sql->set_table("app_config");
|
||||
$sql->add_param("REG_ADDRESS");
|
||||
$sql->add_param("REG_CITY");
|
||||
$sql->add_param("REG_POSTCODE");
|
||||
$sql->add_param("REG_PHONE");
|
||||
//$sql->add_param("REG_FAX");
|
||||
$sql->add_param("REG_OWNER");
|
||||
$sql->add_param("REG_NPWP");
|
||||
//$sql->add_param("REG_WEBSITE");
|
||||
$sql->add_param("REG_EMAIL");
|
||||
$sql->add_param_userid();
|
||||
$sql->add_where("REG_ID");
|
||||
$sql->UpdateDB();
|
||||
}
|
||||
|
||||
$benable = ($mode === 'edit') ? true : false;
|
||||
$id_reg = Param::Get("REG_ID", $this->session->get('WEB_APP')['REG_ID']);
|
||||
$para = $this->db->fetchRow('SELECT * FROM app_config WHERE REG_ID=?', [$id_reg]);
|
||||
|
||||
$form = new Form($this->app);
|
||||
$form->textbox("Nama Perusahaan", "REG_NAME", $para['REG_NAME'], false, false, "text", "masukkan nama instansi");
|
||||
$form->textarea("Alamat Perusahaan", "REG_ADDRESS", $para['REG_ADDRESS'], $benable, false, 1, "masukkan alamat instansi");
|
||||
$form->textbox("Kabupaten / Kota", "REG_CITY", $para['REG_CITY'], $benable, false, "text", "masukkan nama kota");
|
||||
$form->textbox("Kode Pos", "REG_POSTCODE", $para['REG_POSTCODE'], $benable, false, "angka", "masukkan nomor kodepos");
|
||||
$form->textbox("No. Telpon", "REG_PHONE", $para['REG_PHONE'], $benable, false, "phone", "masukkan nomor telphone");
|
||||
//$form->textbox("No. Fax", "REG_FAX", $para['REG_FAX'], $benable, false, "phone", "masukkan nomor faximile");
|
||||
//$form->textbox("Website", "REG_WEBSITE", $para['REG_WEBSITE'], $benable, false, "text", "masukkan alamat website");
|
||||
$form->textbox("Email", "REG_EMAIL", $para['REG_EMAIL'], $benable, false, "email", "masukkan alamat email");
|
||||
$form->textbox("Nama Pemilik", "REG_OWNER", $para['REG_OWNER'], $benable, false, "text", "masukkan nama owner");
|
||||
$form->textbox("NPWP Pemilik", "REG_NPWP", $para['REG_NPWP'], $benable, false, "text", "masukkan npwp owner");
|
||||
$form->hidden("REG_ID", $para['REG_ID']);
|
||||
$form->hidden("mode", $mode);
|
||||
$ajson['html'] = $form->show(3);
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->app->json(['html' => '<div id="divMaster"></div>']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/MenugrupController
|
||||
Description : Grup Login Menu
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : August 8th, 2013.
|
||||
Last Modified : August 19th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\DB\SQL;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
use Webapp\Web\Table;
|
||||
|
||||
class MenugrupController {
|
||||
|
||||
private string $mode;
|
||||
private int $id_grup;
|
||||
private string $parent_code;
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->session = $session;
|
||||
$this->mode = (string) Param::Get('mode');
|
||||
$this->id_grup = (int) Param::Get("Grup_MenuID", 0);
|
||||
$this->parent_code = (string) $session->get('WEB_APP')['PARENT_CODE'];
|
||||
}
|
||||
|
||||
public function table_detail() {
|
||||
if (in_array($this->mode, ['add','edit','del'])) {
|
||||
$sql = new SQL($this->app);
|
||||
$sql->set_table("app_menu_grup");
|
||||
$sql->add_param("Nama_Grup");
|
||||
$sql->add_param("Ket");
|
||||
$sql->add_param("Aktif");
|
||||
$sql->add_param_stamp();
|
||||
$sql->add_param_userid();
|
||||
$sql->add_where("Grup_MenuID");
|
||||
|
||||
if ($this->mode === "add") {
|
||||
$sql->InsertDB();
|
||||
} else if ($this->mode === "edit") {
|
||||
$sql->UpdateDB();
|
||||
} else if ($this->mode === "del") {
|
||||
$sql->DeleteDB();
|
||||
}
|
||||
}
|
||||
|
||||
$tcari = Param::Get("Cari_Grup", "");
|
||||
$twhere = ''; $apar = [];
|
||||
if (!empty($tcari)) {
|
||||
$twhere = 'Nama_Grup LIKE ?';
|
||||
$apar[] = '%'.$tcari.'%';
|
||||
}
|
||||
|
||||
$obj = new Table($this->app);
|
||||
$obj->set_table('app_menu_grup', '*,IF(Grup_MenuID=1,0,1) IDel', $twhere, $apar);
|
||||
$obj->add_field("Grup_MenuID", "ID", "hid");
|
||||
$obj->add_field("Nama_Grup", "Nama Grup");
|
||||
$obj->add_field("Ket", "Keterangan");
|
||||
$obj->add_field("DateStamp", "Update Terakhir", "c", 'sqljam');
|
||||
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
|
||||
$obj->set_field_order("Nama_Grup", "A");
|
||||
$obj->add_row_btn("menu-button", "Menu", "MenuGrupJS.menu_show");
|
||||
$obj->add_row_btn("clipboard", "Ubah", "MenuGrupJS.detail_ubah");
|
||||
$obj->add_row_btn("trash", "Hapus", "MenuGrupJS.detail_hapus", "IDel", 1);
|
||||
$obj->set_func_btn("MenuGrupJS.detail_tambah", "+ Grup");
|
||||
$this->app->json([ $obj->json_table("divDetail") ]);
|
||||
}
|
||||
|
||||
public function detail_grup() {
|
||||
$agrup = [ 'Nama_Grup' => '', 'Ket' => '', 'Aktif' => 1, 'Grup_MenuID' => 0 ];
|
||||
if ($this->mode === 'edit') {
|
||||
$agrup = $this->db->fetchRow('SELECT * FROM app_menu_grup WHERE Grup_MenuID=?', [$this->id_grup]);
|
||||
}
|
||||
|
||||
$form = new Form($this->app);
|
||||
$form->textbox("Nama Grup Menu", "Nama_Grup", $agrup['Nama_Grup'], true, false, "text", "nama grup menu");
|
||||
$form->textarea("Keterangan Grup", "Ket", $agrup['Ket'], true, false, 1, "keterangan grup menu");
|
||||
$form->switch("Status Aktif", "Aktif", $agrup['Aktif'], true, false, ["1","0"]);
|
||||
$form->hidden("Grup_MenuID", $agrup['Grup_MenuID']);
|
||||
$form->hidden("mode", $this->mode);
|
||||
$ajson['html'] = $form->show(3);
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function detail_menu() {
|
||||
$agrup = $this->db->fetchRow('SELECT Grup_MenuID,Nama_Grup,CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_menu_grup WHERE Grup_MenuID=?', [$this->session->get('WEB_APP')['PARENT_CODE'], $this->id_grup]);
|
||||
$amenu = explode(",", $agrup['Menu']);
|
||||
|
||||
$amodul = $this->db->fetchAll("SELECT * FROM app_menu WHERE Level=0 AND Modul<>'IND' AND Aktif=1 ORDER BY Urut ASC");
|
||||
$hasil = '<div id="tabMenuList">';
|
||||
$ajson = ['html' => ''];
|
||||
if (count($amodul)>1) {
|
||||
$hasil .= '<ul class="nav nav-tabs" role="tablist">';
|
||||
for ($i=0; $i<count($amodul); $i++) {
|
||||
$hasil .= '<li class="nav-item" role="presentation"><button class="nav-link'.($i==0?' active':'').'" id="i'.$amodul[$i]['Modul'].'-tab" data-bs-toggle="tab" data-bs-target="#i'.$amodul[$i]['Modul'].'" type="button" role="tab" aria-controls="i'.$amodul[$i]['Modul'].'" aria-selected="'.($i==0?'true':'false').'">'.$amodul[$i]['Menu'].'</button></li>';
|
||||
}
|
||||
$hasil .= '<li class="nav-item ms-auto"><a class="nav-link disabled text-uppercase">'.$agrup['Nama_Grup'].'</a></li></ul>';
|
||||
$hasil .= '<div class="tab-content">';
|
||||
foreach ($amodul as $i => $modul) {
|
||||
$alist = $this->db->fetchAll("SELECT * FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$modul['Modul']]);
|
||||
$hasil .= '<div class="tab-pane fade'.($i==0?' show active':'').'" role="tabpanel" id="i'.$modul['Modul'].'" aria-labelledby="i'.$modul['Modul'].'-tab">';
|
||||
$hasil .= $this->modul_gen($alist, $amenu);
|
||||
$hasil .= '</div>';
|
||||
}
|
||||
$hasil .= '</div>';
|
||||
} else {
|
||||
$alist = $this->db->fetchAll("SELECT * FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$amodul[0]['Modul']]);
|
||||
$hasil .= $this->modul_gen($alist, $amenu);
|
||||
}
|
||||
$ajson['html'] .= $hasil.'</div>';
|
||||
$ajson['html'] .= '<input type="hidden" id="Grup_MenuID" value="'. $agrup['Grup_MenuID'] .'" />';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function save_menu() {
|
||||
$amenu = explode(",", (string) Param::Get("Menu"));
|
||||
$ahasil = [];
|
||||
$amodul = $this->db->fetchAll("SELECT * FROM app_menu WHERE Level=0 AND Modul<>'IND' AND Aktif=1 ORDER BY Urut ASC");
|
||||
foreach ($amodul as $modul) {
|
||||
$akode = $this->db->fetchColumn("SELECT Kode FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$modul['Modul']]);
|
||||
$asub = array_intersect($amenu, $akode);
|
||||
if (count($asub)>0) $ahasil = array_merge($ahasil, [$modul['Kode']], $asub);
|
||||
}
|
||||
$this->db->runQuery("UPDATE app_menu_grup SET Menu=ENCODE('".implode(",",$ahasil)."',?),DateStamp=NOW(),UserID=? WHERE Grup_MenuID=?", [$this->parent_code, $this->session->get('WEB_USER')['UserID'], $this->id_grup]);
|
||||
$this->app->json([ 'status' => true ]);
|
||||
}
|
||||
|
||||
private function modul_gen(array $alist = [], array $amenu = []): string {
|
||||
$hasil = '<table class="table table-striped table-bordered table-hover">';
|
||||
$hasil .= '<thead><tr><th>Nama Menu</th><th>Keterangan</th><th width="30"><input type="checkbox" class="form-check-input cek-modul mx-2" omodul="'.$alist[0]['Modul'].'" /></th></tr></thead><tbody>';
|
||||
foreach ($alist as $list) {
|
||||
$checked = (in_array($list['Kode'], $amenu)) ? "checked" : "";
|
||||
$hasil .= sprintf('<tr><td class="l">%s</td><td class="l">%s</td><td class="c" width="30"><input type="checkbox" class="form-check-input %s" value="%s" %s/></td></tr>', str_repeat("--", $list['Level']-1)."> ".$list['Menu'], $list['Judul'], $list['Modul'], $list['Kode'], $checked);
|
||||
}
|
||||
$hasil .= '</tbody></table>';
|
||||
return $hasil;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->app->json([
|
||||
'html' => '
|
||||
<div class="fade-in">
|
||||
<div class="card"><div class="card-header custom-style">Daftar Grup Menu</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Grup" name="Cari_User" 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"> </div></div></div>
|
||||
</div>'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/OperatorController
|
||||
Description : Data Pengguna
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : August 1st, 2008.
|
||||
Last Modified : August 27th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use App\Utils\Invesa;
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\DB\SQL;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
use Webapp\Web\Table;
|
||||
|
||||
class OperatorController {
|
||||
|
||||
private string $mode;
|
||||
private int $id_user;
|
||||
private int $filter;
|
||||
private string $parent_code;
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->session = $session;
|
||||
$this->mode = (string) Param::Get('mode');
|
||||
$this->id_user = (int) Param::Get("UserID");
|
||||
$this->filter = (int) Param::Get("Filter_Level");
|
||||
$this->parent_code = (string) $session->get('WEB_APP')['PARENT_CODE'];
|
||||
}
|
||||
|
||||
public function table_detail() {
|
||||
$cari = Param::Get("Cari_User");
|
||||
$twhere = ''; $apar = [];
|
||||
if ($this->filter === 99) {
|
||||
$twhere = "Level>=?";
|
||||
$apar[] = $this->session->get('WEB_USER')['Level'];
|
||||
} else {
|
||||
$twhere = "Level=?";
|
||||
$apar[] = $this->filter;
|
||||
}
|
||||
if (!empty($cari)) {
|
||||
$twhere .= ' AND CONCAT(Username,Nama) LIKE ?';
|
||||
$apar[] = '%'.$cari.'%';
|
||||
}
|
||||
$id = (int) $this->session->get('WEB_USER')['UserID'] ?? 0;
|
||||
$twhere .= ($id === 2) ? ' AND UserID>1' : ($id > 2 ? ' AND UserID>2' : '');
|
||||
|
||||
$obj = new Table($this->app);
|
||||
$obj->set_table("app_operator", "*", $twhere, $apar);
|
||||
$obj->add_field("UserID", "ID", "hid");
|
||||
$obj->add_field("Username", "Username");
|
||||
$obj->add_field("Nama", "Nama Pengguna", "awr");
|
||||
$obj->add_field("Posisi", "Posisi");
|
||||
$obj->add_field("Level", "Level", "l", $this->session->get('WEB_APP')['USER_LEVEL']);
|
||||
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
|
||||
$obj->set_field_order("Username", "A");
|
||||
$obj->add_row_btn("menu-button", "Menu", "OperatorJS.menu_show");
|
||||
$obj->add_row_btn("clipboard", "Ubah", "OperatorJS.detail_ubah");
|
||||
$obj->add_row_btn("trash", "Hapus", "OperatorJS.detail_hapus");
|
||||
$obj->set_func_btn("OperatorJS.detail_tambah", "+ Pengguna");
|
||||
$this->app->json([ $obj->json_table("divDetail") ]);
|
||||
}
|
||||
|
||||
public function detail_filter() {
|
||||
$form = new Form($this->app);
|
||||
$tfilter = $form->option("_", "Fi_Level", $this->filter, true, false, [99=>"SEMUA LEVEL PENGGUNA"] + $this->session->get('WEB_APP')['USER_LEVEL']);
|
||||
$ajson['html'] = '
|
||||
<div class="row mb-3"><div class="col text-center">Tampilan Berdasarkan :</div></div>
|
||||
<div class="row"><div class="col text-center">'.$tfilter.'</div></div>';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function detail_user() {
|
||||
$auser = [ 'UserID'=>0, 'Username'=>"", 'Nama'=>"", 'Posisi'=>"", 'Level' => 9, 'Aktif' => 1, 'Grup_MenuID' => 0 ];
|
||||
if ($this->mode === 'edit') {
|
||||
$auser = $this->db->fetchRow('SELECT * FROM app_operator WHERE UserID=?', [$this->id_user]);
|
||||
}
|
||||
|
||||
$form = new Form($this->app);
|
||||
$t_user = $form->textbox("_", "Username", $auser['Username'], true, true, "text", "username");
|
||||
$t_nama = $form->textbox("_", "Nama", $auser['Nama'], true, false, "text", "nama pengguna");
|
||||
$t_posi = $form->textbox("_", "Posisi", $auser['Posisi'], true, false, "text", "posisi pengguna");
|
||||
$t_level = $form->option_ulevel("_", "Level", $auser['Level'], true, false, "", "OperatorJS.oc_Level();");
|
||||
$t_pass = $form->password("_", "Password", "", true, true, "", 50, "biarkan kosong jika tidak ingin mengubah password.");
|
||||
$t_status = $form->switch("_", "Aktif", $auser['Aktif'], true, false, ["1","0"]);
|
||||
$t_grup = $form->option_db("_", "Grup_MenuID", $auser['Grup_MenuID'], true, false, "app_menu_grup", ["Grup_MenuID","Nama_Grup"], "Aktif=1", [0,"TANPA GRUP"]);
|
||||
$ajson['html'] = '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Username">Username</label>
|
||||
<div class="col">'.$t_user.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Nama">Nama Pengguna</label>
|
||||
<div class="col">'.$t_nama.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Posisi">Posisi Pengguna</label>
|
||||
<div class="col">'.$t_posi.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Level">Level Pengguna</label>
|
||||
<div class="col">'.$t_level.'</div>
|
||||
</div>
|
||||
<div class="row mb-1"><div class="col"><hr class="my-1"></div></div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Grup_MenuID">Grup Menu</label>
|
||||
<div class="col">'.$t_grup.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Password">Password</label>
|
||||
<div class="col-sm-8 col-lg-5"><div class="input-group">'.$t_pass.Invesa::Form_Info("biarkan kosong jika tidak ingin mengubah password.").'</div></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 col-form-label">'.$t_status.'</div>
|
||||
</div>
|
||||
<input type="hidden" id="UserID" value="'.$auser['UserID'].'" >
|
||||
<input type="hidden" id="UserLama" value="'.$auser['Username'].'" >
|
||||
<input type="hidden" id="mode" value="'.$this->mode.'" >';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function detail_menu() {
|
||||
$auser = $this->db->fetchRow("SELECT UserID,Nama,Grup_MenuID,CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_operator WHERE UserID=?", [$this->parent_code, $this->id_user]);
|
||||
$amenu = explode(",", $auser['Menu']);
|
||||
|
||||
$aglist = []; $ajson = ['html' => ''];
|
||||
$glist = $this->db->fetchField("SELECT CONVERT(DECODE(Menu,?) USING UTF8MB4) FROM app_menu_grup WHERE Grup_MenuID=?", [$this->parent_code, $auser['Grup_MenuID']]);
|
||||
if (!empty($glist)) $aglist = explode(",", $glist);
|
||||
|
||||
$amodul = $this->db->fetchAll("SELECT * FROM app_menu WHERE Level=0 AND Modul<>'IND' AND Aktif=1 ORDER BY Urut ASC");
|
||||
$hasil = '<div id="tabMenuList">';
|
||||
if (count($amodul)>1) {
|
||||
$hasil .= '<ul class="nav nav-tabs" role="tablist">';
|
||||
foreach ($amodul as $i => $modul) {
|
||||
$hasil .= '<li class="nav-item" role="presentation"><button class="nav-link'.($i==0?' active':'').'" id="i'.$modul['Modul'].'-tab" data-bs-toggle="tab" data-bs-target="#i'.$modul['Modul'].'" type="button" role="tab" aria-controls="i'.$modul['Modul'].'" aria-selected="'.($i==0?'true':'false').'">'.$modul['Menu'].'</button></li>';
|
||||
}
|
||||
$hasil .= '<li class="nav-item ms-auto"><a class="nav-link disabled text-uppercase">'.$auser['Nama'].'</a></li></ul>';
|
||||
$hasil .= '<div class="tab-content">';
|
||||
foreach ($amodul as $i => $modul) {
|
||||
$alist = $this->db->fetchAll("SELECT * FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$modul['Modul']]);
|
||||
$hasil .= '<div class="tab-pane fade'.($i==0?' show active':'').'" role="tabpanel" id="i'.$modul['Modul'].'" aria-labelledby="i'.$modul['Modul'].'-tab">';
|
||||
$hasil .= $this->modul_gen($alist, $amenu, $aglist);
|
||||
$hasil .= '</div>';
|
||||
}
|
||||
$hasil .= '</div>';
|
||||
} else {
|
||||
$alist = $this->db->fetchAll("SELECT * FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$amodul[0]['Modul']]);
|
||||
$hasil .= $this->modul_gen($alist, $amenu, $aglist);
|
||||
}
|
||||
$ajson['html'] .= $hasil.'</div>';
|
||||
$ajson['html'] .= '<input type="hidden" id="UserID" value="'. $auser['UserID'] .'" />';
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function save_user() {
|
||||
$sql = new SQL($this->app);
|
||||
$sql->set_table("app_operator");
|
||||
$sql->add_param("Grup_MenuID");
|
||||
$sql->add_param("Username");
|
||||
$sql->add_param("Nama");
|
||||
$sql->add_param("Posisi");
|
||||
$sql->add_param("Level");
|
||||
$sql->add_param("Aktif");
|
||||
$sql->add_param("SuperID", $this->session->get('WEB_USER')['UserID']);
|
||||
$sql->add_where("UserID");
|
||||
|
||||
if ($this->mode === "add") {
|
||||
$sql->InsertDB();
|
||||
} else if ($this->mode === "edit") {
|
||||
$sql->UpdateDB();
|
||||
} else if ($this->mode === "del") {
|
||||
$sql->DeleteDB();
|
||||
}
|
||||
// SIMPAN PASSWORD
|
||||
$pass = Param::Get("Password");
|
||||
if (($this->mode !== "del") and !empty($pass)) {
|
||||
$this->db->runQuery("UPDATE app_operator SET Password=MD5(?) WHERE Username=?", [$pass, Param::Get("Username")]);
|
||||
}
|
||||
$this->app->json([ 'status' => true ]);
|
||||
}
|
||||
|
||||
public function save_menu() {
|
||||
$amenu = explode(",", (string) Param::Get("Menu")); $ahasil = [];
|
||||
$amodul = $this->db->fetchAll("SELECT * FROM app_menu WHERE Level=0 AND Modul<>'IND' AND Aktif=1 ORDER BY Urut ASC");
|
||||
foreach ($amodul as $modul) {
|
||||
$akode = $this->db->fetchColumn("SELECT Kode FROM app_menu WHERE Modul=? AND Level>0 AND Aktif=1 ORDER BY Kode", [$modul['Modul']]);
|
||||
$asub = array_intersect($amenu, $akode);
|
||||
if (count($asub)>0) $ahasil = array_merge($ahasil, [$modul['Kode']], $asub);
|
||||
}
|
||||
$this->db->runQuery("UPDATE app_operator SET Menu=ENCODE('".implode(",",$ahasil)."',?),DateStamp=NOW(),SuperID=? WHERE UserID=?", [$this->parent_code, $this->session->get('WEB_USER')['UserID'], $this->id_user]);
|
||||
$this->app->json([ 'status' => true ]);
|
||||
}
|
||||
|
||||
public function check_user() {
|
||||
$ada = (int) $this->db->fetchField("SELECT COUNT(*) FROM app_operator WHERE Username=?", [Param::Get("Username")]) > 0;
|
||||
$this->app->json([ 'ada' => $ada ]);
|
||||
}
|
||||
|
||||
private function modul_gen(array $alist = [], array $amenu = [], array $aglist = []): string {
|
||||
$hasil = '<table class="table table-striped table-bordered table-hover">';
|
||||
$hasil .= '<thead><tr><th>Nama Menu</th><th>Keterangan</th><th width="30"><input type="checkbox" class="form-check-input cek-modul mx-2" omodul="'.$alist[0]['Modul'].'" /></th><th width="30"><input type="checkbox" class="form-check-input mx-2" disabled /></th></tr></thead><tbody>';
|
||||
foreach ($alist as $list) {
|
||||
$checked = (in_array($list['Kode'], $amenu)) ? "checked" : "";
|
||||
$gchecked = (in_array($list['Kode'], $aglist)) ? "checked" : "";
|
||||
$hasil .= sprintf('<tr><td class="l">%s</td><td class="l">%s</td><td class="c" width="30"><input type="checkbox" class="form-check-input %s" value="%s" %s/></td><td class="c" width="30"><input type="checkbox" class="form-check-input" disabled %s/></td></tr>', str_repeat("--", $list['Level']-1)."> ".$list['Menu'], $list['Judul'], $list['Modul'], $list['Kode'], $checked, $gchecked);
|
||||
}
|
||||
$hasil .= '</tbody></table>';
|
||||
return $hasil;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->app->json([
|
||||
'html' => '
|
||||
<div class="fade-in">
|
||||
<div class="card"><div class="card-header custom-style">Daftar Pengguna</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_User" name="Cari_User" 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 class="col-auto"><button class="btn btn-info shadow-none" type="button" id="butFilter">Filter</button><input type="hidden" id="Filter_Level" value="99"></div></div><div id="divDetail"> </div></div></div>
|
||||
</div>'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/PrinterController
|
||||
Description : Printer POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : August 4th, 2013.
|
||||
Last Modified : October 12th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\DB\SQL;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
use Webapp\Web\Table;
|
||||
use App\Utils\Invesa;
|
||||
|
||||
class PrinterController {
|
||||
|
||||
private string $mode;
|
||||
private string $id_reg;
|
||||
private string $curr_id_reg;
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db, Session $session) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->session = $session;
|
||||
$this->mode = Param::Get("mode", "");
|
||||
$this->curr_id_reg = (string) $session->get('WEB_APP')['REG_ID'];
|
||||
$this->id_reg = Param::Get("REG_ID", $this->curr_id_reg);
|
||||
}
|
||||
|
||||
public function form_printer() {
|
||||
if ( $this->mode === "save" ) {
|
||||
$sql = new SQL($this->app);
|
||||
$sql->set_table("inv_config");
|
||||
$sql->add_param("PRINT_AUTO");
|
||||
$sql->add_param("PRINT_OPENCD");
|
||||
$sql->add_param("PRINT_AUTOCUT");
|
||||
$sql->add_param("PRINT_ROW");
|
||||
$sql->add_param("TITLE_BEGIN");
|
||||
$sql->add_param("TITLE_END");
|
||||
$sql->add_where("REG_ID");
|
||||
$sql->UpdateDB();
|
||||
|
||||
if ($this->id_reg === $this->curr_id_reg) {
|
||||
$_sess = $this->session->get('APP_INV', []);
|
||||
$_sess['PRINT_AUTO'] = Param::Get("PRINT_AUTO", 1);
|
||||
$_sess['PRINT_OPENCD'] = Param::Get("PRINT_OPENCD", 1);
|
||||
$_sess['PRINT_AUTOCUT'] = Param::Get("PRINT_AUTOCUT", 1);
|
||||
$_sess['PRINT_ROW'] = Param::Get("PRINT_ROW", 0);
|
||||
$_sess['TITLE_BEGIN'] = Param::Get("TITLE_BEGIN", "");
|
||||
$_sess['TITLE_END'] = Param::Get("TITLE_END", "");
|
||||
$this->session->set('APP_INV', $_sess);
|
||||
}
|
||||
|
||||
$ajson['sukses'] = true;
|
||||
$this->mode = "view";
|
||||
}
|
||||
|
||||
$para = [];
|
||||
if ($this->id_reg > 0) {
|
||||
$para = $this->db->fetchRow("SELECT * FROM inv_config WHERE REG_ID=?", [$this->id_reg]);
|
||||
$para['Nama_Cab'] = $this->db->fetchField("SELECT Nama_Cab FROM para_cabang WHERE CabID=?", [$para['CABANGID']]) ?? '';
|
||||
}
|
||||
|
||||
$benable = ($this->mode === "edit") ? true : false;
|
||||
$form = new Form($this->app);
|
||||
$fautoprint = $form->checkbox("_", "PRINT_AUTO", $para['PRINT_AUTO'], $benable, false, [1,0]);
|
||||
$fopencd = $form->checkbox("_", "PRINT_OPENCD", $para['PRINT_OPENCD'], $benable, false, [1,0]);
|
||||
$fautocut = $form->checkbox("_", "PRINT_AUTOCUT", $para['PRINT_AUTOCUT'], $benable, false, [1,0]);
|
||||
$ftitlebegin = $form->textbox("_", "TITLE_BEGIN", $para['TITLE_BEGIN'], $benable, false, "text", "catatan atas struk");
|
||||
$ftitleend = $form->textbox("_", "TITLE_END", $para['TITLE_END'], $benable, false, "text", "catatan bawah struk");
|
||||
$fprintrow = $form->textbox("_", "PRINT_ROW", $para['PRINT_ROW'], $benable, false, "number");
|
||||
|
||||
$ajson['html'] = '
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<div class="input-group mb-1"><div class="input-group-text">'.$fautoprint.'</div><span class="input-group-text col">Otomatis Cetak Struk ?</span></div>
|
||||
<div class="input-group mb-1"><div class="input-group-text">'.$fopencd.'</div><span class="input-group-text col">Otomatis Buka Laci Kasir ?</span></div>
|
||||
<div class="input-group mb-1"><div class="input-group-text">'.$fautocut.'</div><span class="input-group-text col">Otomatis Potong Struk ?</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1"><hr class="my-1"></div>
|
||||
<div class="row mb-1">
|
||||
<div class="col"><div class="input-group"><span class="input-group-text" style="width:180px;">Header Struk</span>'.$ftitlebegin.Invesa::Form_Info("Gunakan [br] untuk header yang terdiri dari beberapa baris.").'</div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<div class="col"><div class="input-group"><span class="input-group-text" style="width:180px;">Footer Struk</span>'.$ftitleend.Invesa::Form_Info("Gunakan [br] untuk footer yang terdiri dari beberapa baris.").'</div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<div class="col-6"><div class="input-group"><span class="input-group-text" style="width:180px;">Baris Cetak Kosong</span>'.$fprintrow.Invesa::Form_Info("Jumlah baris kosong dibawah struk/nota sebelum potong.").'</div></div>
|
||||
</div>
|
||||
<input type="hidden" id="mode" value="'.$this->mode.'" >';
|
||||
$ajson['Nama_Cab'] = $para['Nama_Cab'];
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function brow_cabang() {
|
||||
$obj = new Table($this->app);
|
||||
$obj->set_table("(SELECT * FROM para_cabang WHERE Aktif=1) C LEFT JOIN inv_config G ON (G.CABANGID=C.CabID)", "C.*,G.REG_ID");
|
||||
$obj->add_field("REG_ID", "ID", "hid");
|
||||
$obj->add_field("Kode_Cab", "Kode", "c");
|
||||
$obj->add_field("Nama_Cab", "Nama Cabang", "awr");
|
||||
$obj->set_field_order("Kode_Cab", "A");
|
||||
$obj->set_func_select("PrinterJS.cab_select");
|
||||
$this->app->json([ $obj->json_table("divBrowCab") ]);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->app->json(['html' =>
|
||||
'<div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Nama_Cabang" type="text" disabled readonly><button id="butBrow" class="btn btn-info" type="button"><i class="bi-search"></i></button></div></div></div><div class="card"><div class="card-body"><div id="divPrinter"> </div><input type="hidden" id="REG_ID" value="'.$this->id_reg.'"></div></div>'
|
||||
]);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/System/SuperController
|
||||
Description : Supervisi Operator
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : September 11st, 2012.
|
||||
Last Modified : August 29th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\System;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\Web\Param;
|
||||
use Webapp\Web\Table;
|
||||
|
||||
class SuperController {
|
||||
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function approve() {
|
||||
$this->db->runQuery('UPDATE app_auth SET Auth=1,SuperID=? WHERE AuthID=?', [$this->app->user()->id(), Param::Get("AuthID",0)]);
|
||||
}
|
||||
|
||||
public function table_detail() {
|
||||
$obj = new Table($this->app);
|
||||
$obj->set_table('(SELECT AuthID,UserID,Kode,DATE_FORMAT(Tanggal,"%d-%m-%Y %H:%i:%s") Tanggal,REQ,Catatan FROM app_auth WHERE Auth=0) A LEFT JOIN app_operator O ON (A.UserID=O.UserID) LEFT JOIN app_menu M ON (A.Kode=M.Kode)', 'A.*,O.Nama Nama_User,M.Judul');
|
||||
$obj->add_field("AuthID", "ID", "hid");
|
||||
$obj->add_field("Nama_User", "User ID", "l");
|
||||
$obj->add_field("Tanggal", "Tanggal", "c");
|
||||
$obj->add_field("Judul", "Menu Aplikasi", "l");
|
||||
$obj->add_field("Catatan", "Informasi Transaksi", "awr");
|
||||
$obj->add_field("REQ", "Kode Request", "l");
|
||||
$obj->add_row_btn("unlock2", "Proses", "SuperJS.detail_select");
|
||||
$ajson[] = $obj->json_table("divSuper");
|
||||
$this->app->json($ajson);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->app->json([
|
||||
'html' => '
|
||||
<div class="fade-in">
|
||||
<div class="card"><div class="card-header custom-style">Supervisi Hak Akses</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Super" 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="divSuper"> </div></div></div>
|
||||
</div>'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user