Files
cmasa/app/Controller/Table/Ppob/OperatorController.php
T
2026-10-29 13:34:31 +07:00

99 lines
3.9 KiB
PHP

<?php
/*******************************************************************
PHP Class : /Controller/Table/Ppob/OperatorController
Description : Master Operator PPOB
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : September 1st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Ppob;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class OperatorController {
private string $mode_detail;
private int $id_ope;
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_ope = (int) Param::Get("OpeID", 0);
}
public function table_detail() {
$tcari = Param::Get("Cari_Ope");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'CONCAT(N_Ope,Prefix_Ope) LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("ppob_operator", "*", $tsql, $asql);
$obj->add_field("OpeID", "ID", "hid");
$obj->add_field("K_Ope", "Kode", "l");
$obj->add_field("N_Ope", "Nama Operator", "awr");
$obj->add_field("Status", "Status", "c", "checkbox");
$obj->set_field_order("K_Ope", "A");
$obj->add_row_btn("clipboard", "Detail", "PPOBOpeJS.detail_ubah");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function form_operator() {
$atabel = ['OpeID'=>0, 'K_Ope'=>"", 'N_Ope'=>"", 'Prefix_Ope'=>"", 'Status'=>1];
if ($this->id_ope > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM ppob_operator WHERE OpeID=?", [$this->id_ope]);
}
$form = new Form($this->app);
$tkode = $form->textbox("_", "K_Ope", $atabel['K_Ope'], false, false, "text");
$tnama = $form->textbox("_", "N_Ope", $atabel['N_Ope'], false, false, "text");
$tpref = $form->textbox("_", "Prefix_Ope", $atabel['Prefix_Ope'], false, false, "text");
$tstatus = $form->radio("_", "Status", $atabel['Status'], 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="K_Ope">Kode Operator</label>
<div class="col">'.$tkode.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="N_Ope">Nama Operator</label>
<div class="col">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Prefix_Ope">Prefix Operator</label>
<div class="col">'.$tpref.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Status">Status ?</label>
<div class="col d-flex gap-2">'.$tstatus.'</div>
</div>
<input type="hidden" id="OpeID" value="'.$atabel['OpeID'].'" >
<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 Operator PPOB</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Ope" 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>'
]);
}
}