Update 2024-02-08: datatable show-detail fixed, change icon. Close-all function except sidebar modal.

This commit is contained in:
2024-02-08 10:39:47 +07:00
parent 1eb4b369d3
commit 2de34d2c86
5 changed files with 74 additions and 29 deletions
+11
View File
@@ -376,6 +376,16 @@ table * .awr-400 { max-width: 400px; }
table * .hid { visibility: hidden !important; display: none !important; } table * .hid { visibility: hidden !important; display: none !important; }
table * .nb { border: 0 !important; } table * .nb { border: 0 !important; }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before, table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
font-family: coreui-icons-linear;
content: "\ead6";
color: #55a4be;
}
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control::before, table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control::before {
margin-right: .25em;
font-family: coreui-icons-linear;
content: "\ead4";
}
ul.dtr-details li.hidden { visibility: hidden !important; display: none !important; } ul.dtr-details li.hidden { visibility: hidden !important; display: none !important; }
/******************************** Select2 ********************************/ /******************************** Select2 ********************************/
@@ -388,6 +398,7 @@ ul.dtr-details li.hidden { visibility: hidden !important; display: none !importa
color: var(--bs-black, #000) !important; color: var(--bs-black, #000) !important;
text-transform: uppercase; text-transform: uppercase;
font-weight: bolder !important; font-weight: bolder !important;
font-size: 1.1rem;
} }
/******************************** Autocomplete ********************************/ /******************************** Autocomplete ********************************/
+38 -7
View File
@@ -43,11 +43,19 @@ var FoniaJS = {
_hasil = $.base64.decode(skey); _hasil = $.base64.decode(skey);
_adata = _hasil.split(";"); _adata = _hasil.split(";");
this.User.ID = _adata[0]; this.User.ID = _adata[0];
this.User.UID = _adata[1]; this.User.UID = parseInt(_adata[1]);
this.User.GID = _adata[2]; this.User.GID = parseInt(_adata[2]);
this.User.Level = _adata[3]; this.User.Level = parseInt(_adata[3]);
} }
}, },
user_level: function(l) {//oke
if (this.User.Level <= (l ?? 9)) return true;
return false;
},
user_level_not: function(l) {//oke
if (this.User.Level !== (l ?? 9)) return true;
return false;
},
callMenu: function(p, q) {//oke callMenu: function(p, q) {//oke
var apar = ["p=" + p]; var apar = ["p=" + p];
if (q != null) apar.push("q=" + q); if (q != null) apar.push("q=" + q);
@@ -479,6 +487,7 @@ var FoniaJS = {
showWindow: function(id_wind, s_judul, s_isi, i_width, s_toolb, f_onload, b_scroll) {//oke showWindow: function(id_wind, s_judul, s_isi, i_width, s_toolb, f_onload, b_scroll) {//oke
var t_width = '', t_toolb = '', t_scroll = (typeof b_scroll == 'boolean' && b_scroll == false) ? '' : 'modal-dialog-scrollable'; var t_width = '', t_toolb = '', t_scroll = (typeof b_scroll == 'boolean' && b_scroll == false) ? '' : 'modal-dialog-scrollable';
var f_oncall = (typeof f_onload == "function") ? f_onload : function(){}; var f_oncall = (typeof f_onload == "function") ? f_onload : function(){};
if (typeof i_width == 'string') { t_width = 'modal-'+i_width; } else
if (i_width <= 300) { t_width = 'modal-sm'; } else if (i_width <= 300) { t_width = 'modal-sm'; } else
if (i_width <= 400) { t_width = 'modal-400'; } else if (i_width <= 400) { t_width = 'modal-400'; } else
if (i_width <= 500) { t_width = 'modal-500'; } else if (i_width <= 500) { t_width = 'modal-500'; } else
@@ -512,7 +521,7 @@ var FoniaJS = {
closeAllWindows: function() {//oke closeAllWindows: function() {//oke
$(".modal").each(function() { $(".modal").each(function() {
if ($(this).hasClass('show')) $(this).modal('toggle'); if ($(this).hasClass('show')) $(this).modal('toggle');
if ($(this).get('id')!=='sidebarMain') $(this).modal('dispose').remove(); if ($(this).attr('id')!=='sidebarMain') $(this).modal('dispose').remove();
}); });
$(".fon-autotext", ".fon-autopos").each(function() { $(".fon-autotext", ".fon-autopos").each(function() {
$(this).remove(); $(this).remove();
@@ -522,8 +531,7 @@ var FoniaJS = {
} }
}, },
setFocus: function(obj) { setFocus: function(obj) {
$(obj).select(); $(obj).select().focus();
$(obj).focus();
}, },
lPad: function(n, width, z) { lPad: function(n, width, z) {
z = z || "0"; z = z || "0";
@@ -766,7 +774,7 @@ Request.JSONF = function(options){//oke
var sClass = ''; var sClass = '';
if (ini.config.css) sClass += ' '+ini.config.css; if (ini.config.css) sClass += ' '+ini.config.css;
if (ini.config.func_select) sClass += ' table-select'; if (ini.config.func_select) sClass += ' table-select';
var strTab = '<table id="'+ini.id+'Tabel" class="table table-striped table-bordered table-hover'+sClass+' datatable">'; var strTab = '<table id="'+ini.id+'Tabel" class="table table-striped table-bordered table-hover'+sClass+'">';
var strBody = '<tbody>'; var strBody = '<tbody>';
$.each(ini.content, function(key, val){ $.each(ini.content, function(key, val){
@@ -972,6 +980,29 @@ Request.JSONF = function(options){//oke
} }
}); });
} }
//if (ini.config.live){
$('#'+ini.id+'Tabel tbody').on('click', 'td.dtr-control', function(){
var tr = $(this).closest('tr');
var row = otabel.row(tr);
if (row.child.isShown()){
row.child.hide();
tr.removeClass('dt-hasChild parent');
}else{
var ind = 0;
var tampil = '<ul class="list-unstyled">';
api.columns().every(function() {
var kol = this.header();
if (kol.className.indexOf('dtr-hidden') != -1){
tampil += '<li class="py-1"><span class="d-inline-block" style="min-width:100px;">' + kol.textContent + '</span><span class="text-break">' + row.data()[ind] + '</span></li>';
}
ind++;
})
tampil += '</ul>';
row.child(tampil).show();
tr.addClass('dt-hasChild parent');
}
});
//}
} }
var otabel = $('#'+ini.id+'Tabel').DataTable(opsi); var otabel = $('#'+ini.id+'Tabel').DataTable(opsi);
}; };
+7 -7
View File
@@ -6,9 +6,9 @@
Desc. : v3 - HTML5 Page Generator (jQuery & Bootstrap) Desc. : v3 - HTML5 Page Generator (jQuery & Bootstrap)
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : January 10th, 2008. Created Date : January 10th, 2008.
Last Modified : October 17th, 2022. Last Modified : January 21st, 2024.
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2024, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -33,9 +33,9 @@ final class App {
$this->apps = $_SESSION['__WEB_APP']; $this->apps = $_SESSION['__WEB_APP'];
if (isset($_SESSION['__WEB_USER'])) { if (isset($_SESSION['__WEB_USER'])) {
$this->auser = $_SESSION['__WEB_USER'];
$this->apps['TEMPLATE'] = "index.php"; $this->apps['TEMPLATE'] = "index.php";
$this->auser['user_info'] = tgl_sql2str($this->auser['Last_Date'], true) ." // ". $this->auser['Last_IP'].'<input type="hidden" id="Desktop_User_ID" value="'.intval($this->auser['UserID']).'"><input type="hidden" id="Desktop_User_Level" value="'.intval($this->auser['Level']).'"><input type="hidden" id="Desktop_User_UID" value="'.$this->auser['Username'].'">'; $this->auser = $_SESSION['__WEB_USER'];
//$this->auser['user_info'] = tgl_sql2str($this->auser['Last_Date'], true) ." // ". $this->auser['Last_IP'].'<input type="hidden" id="Desktop_User_ID" value="'.intval($this->auser['UserID']).'"><input type="hidden" id="Desktop_User_Level" value="'.intval($this->auser['Level']).'"><input type="hidden" id="Desktop_User_UID" value="'.$this->auser['Username'].'">';
$this->auser['user_img'] = "profile.png"; $this->auser['user_img'] = "profile.png";
if (file_exists($this->apps['REAL_PATH']."assets/images/profiles/".$this->auser['UserID'].".png")) { if (file_exists($this->apps['REAL_PATH']."assets/images/profiles/".$this->auser['UserID'].".png")) {
$this->auser['user_img'] = $this->auser['UserID'].".png"; $this->auser['user_img'] = $this->auser['UserID'].".png";
@@ -78,7 +78,7 @@ final class App {
if (user_logged()) $headers .= '<script type="text/javascript" src="'.$this->cache->Apps().'"></script>'."\n"; if (user_logged()) $headers .= '<script type="text/javascript" src="'.$this->cache->Apps().'"></script>'."\n";
$_secret = $this->apps['APP_CODE'] .";". $this->apps['APP_SID'] .";". $_SERVER['HTTP_HOST'] .";". $this->apps['WEB_PATH'] .";". "http://".$_SERVER['HTTP_HOST'].$this->apps['WEB_PATH'] .";". ($this->apps['AUTH_LEVEL']?$this->apps['AUTH_LEVEL']:0) .";". $this->version; $_secret = $this->apps['APP_CODE'] .";". $this->apps['APP_SID'] .";". $_SERVER['HTTP_HOST'] .";". $this->apps['WEB_PATH'] .";". "http://".$_SERVER['HTTP_HOST'].$this->apps['WEB_PATH'] .";". ($this->apps['AUTH_LEVEL']?$this->apps['AUTH_LEVEL']:0) .";". $this->version;
$_suser = (user_logged()) ? $this->auser['Username'] .";". $this->auser['UserID'] .";". $this->auser['Grup_MenuID'] .";". $this->auser['Level'] : ""; $_suser = (user_logged()) ? $this->auser['Username'] .";". $this->auser['UserID'] .";". $this->auser['Grup_MenuID'] .";". $this->auser['Level'] : "nobody;999;999;9";
$tnaviside = $tnavihead = ""; $tnaviside = $tnavihead = "";
$headers .= '<script type="text/javascript" language="javascript">'."\n"; $headers .= '<script type="text/javascript" language="javascript">'."\n";
$headers .= 'FoniaJS.setConfig("'.base64_encode($_secret).'", "'.base64_encode($_suser).'");'; $headers .= 'FoniaJS.setConfig("'.base64_encode($_secret).'", "'.base64_encode($_suser).'");';
@@ -99,8 +99,8 @@ final class App {
} }
// perubahan variabel dari data konfigurasi // perubahan variabel dari data konfigurasi
$asrc = array("[_CREATOR_NAME_]", "[_CREATOR_WEBSITE_]", "[_CREATOR_YEAR_]", "[_APP_NAME_VER_]", "[_APP_NAMES_VER_]", "[_APP_NAME_]", "[_APP_NAMES_]", "[_APP_NAMES_UP_]", "[_APP_VER_]", "[_APP_UPDATED_]", "[_REG_ID_]", "[_REG_NAME_]", "[_REG_NAME_UP_]", "[_REG_ADDRESS_]", "[_REG_CITY_]", "[_REG_CITY_UP_]", "[_REG_PHONE_]", "[_REG_FAX_]", "[_REG_EMAIL_]", "[_REG_POSTCODE_]", "[_REG_WEBSITE_]", "[_REG_YEAR_]", "[_USER_LASTLOG_]", "[_USER_IMG_]", "[_WEB_PATH_]", "[_NAVI_SIDEBAR_]", "[_NAVI_HEADER_]"); $asrc = array("[_CREATOR_NAME_]", "[_CREATOR_WEBSITE_]", "[_CREATOR_YEAR_]", "[_APP_NAME_VER_]", "[_APP_NAMES_VER_]", "[_APP_NAME_]", "[_APP_NAMES_]", "[_APP_NAMES_UP_]", "[_APP_VER_]", "[_APP_UPDATED_]", "[_REG_ID_]", "[_REG_NAME_]", "[_REG_NAME_UP_]", "[_REG_ADDRESS_]", "[_REG_CITY_]", "[_REG_CITY_UP_]", "[_REG_PHONE_]", "[_REG_FAX_]", "[_REG_EMAIL_]", "[_REG_POSTCODE_]", "[_REG_WEBSITE_]", "[_REG_YEAR_]", "[_USER_IMG_]", "[_WEB_PATH_]", "[_NAVI_SIDEBAR_]", "[_NAVI_HEADER_]");
$adst = array($this->apps['CREATOR_NAME'], $this->apps['CREATOR_WEBSITE'], $this->apps['CREATOR_YEAR'], $this->apps['APP_NAME']." v".$this->apps['APP_VER'], $this->apps['APP_NAMES']." v".$this->apps['APP_VER'], $this->apps['APP_NAME'], $this->apps['APP_NAMES'], strtoupper($this->apps['APP_NAMES']??""), $this->apps['APP_VER'], $this->apps['APP_UPDATED'], $this->reg->reg_id(), $this->apps['REG_NAME'], strtoupper($this->apps['REG_NAME']??""), $this->apps['REG_ADDRESS'], $this->apps['REG_CITY'], strtoupper($this->apps['REG_CITY']??""), $this->apps['REG_PHONE'], $this->apps['REG_FAX'], $this->apps['REG_EMAIL'], $this->apps['REG_POSTCODE'], $this->apps['REG_WEBSITE'], $this->apps['REG_YEAR'], $this->auser['user_info'] ?? "[none]", "profiles/".$this->auser['user_img'], $this->apps['WEB_PATH'], $tnaviside, $tnavihead); $adst = array($this->apps['CREATOR_NAME'], $this->apps['CREATOR_WEBSITE'], $this->apps['CREATOR_YEAR'], $this->apps['APP_NAME']." v".$this->apps['APP_VER'], $this->apps['APP_NAMES']." v".$this->apps['APP_VER'], $this->apps['APP_NAME'], $this->apps['APP_NAMES'], strtoupper($this->apps['APP_NAMES']??""), $this->apps['APP_VER'], $this->apps['APP_UPDATED'], $this->reg->reg_id(), $this->apps['REG_NAME'], strtoupper($this->apps['REG_NAME']??""), $this->apps['REG_ADDRESS'], $this->apps['REG_CITY'], strtoupper($this->apps['REG_CITY']??""), $this->apps['REG_PHONE'], $this->apps['REG_FAX'], $this->apps['REG_EMAIL'], $this->apps['REG_POSTCODE'], $this->apps['REG_WEBSITE'], $this->apps['REG_YEAR'], "profiles/".$this->auser['user_img'], $this->apps['WEB_PATH'], $tnaviside, $tnavihead);
$buffer = str_replace($asrc, $adst, $buffer); $buffer = str_replace($asrc, $adst, $buffer);
if (isset($this->auser) && is_array($this->auser)) { if (isset($this->auser) && is_array($this->auser)) {
+9 -2
View File
@@ -6,9 +6,9 @@
Desc. : v4 - Fungsi Custom Auth Desc. : v4 - Fungsi Custom Auth
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : January 27th, 2008. Created Date : January 27th, 2008.
Last Modified : May 6th, 2021. Last Modified : January 21st, 2024.
(c) 2008 - 2021, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2024, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -21,6 +21,13 @@ if (!function_exists('user_level')) {
} }
} }
if (!function_exists('user_level_not')) {
function user_level_not($level = 9) {
if ($_SESSION['__WEB_USER']['Level'] !== $level) return true;
return false;
}
}
if (!function_exists('user_logged')) { if (!function_exists('user_logged')) {
function user_logged() { function user_logged() {
if (isset($_SESSION['__WEB_USER'])) return true; if (isset($_SESSION['__WEB_USER'])) return true;
+9 -13
View File
@@ -6,9 +6,9 @@
Desc. : v3 - Button Generator (jQuery & Bootstrap) Desc. : v3 - Button Generator (jQuery & Bootstrap)
Created By : Siau Pheng (siaupheng@3fonia.com). Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : February 27th, 2008. Created Date : February 27th, 2008.
Last Modified : April 4th, 2022. Last Modified : January 22nd, 2024.
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2024, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/ *******************************************************************/
@@ -17,18 +17,16 @@ declare(strict_types=1);
namespace siaupheng\fonia3\Web; namespace siaupheng\fonia3\Web;
class Button { class Button {
private $__abutton = array(); private $__abutton =[];
private $__bsepa = false;
public function __construct() {} public function __construct() {}
private function add($type="info", $id="", $label="", $bmiss=false) { private function add($type="info", $id="", $label="", $bmiss=false) {
if ($id=="") $id = "random".rand(1000, 10000); if ($id=="") $id = "random".rand(1000, 10000);
$this->__abutton[] = array('type'=>$type, 'id'=>$id, 'label'=>$label, 'bmiss'=>$bmiss); $this->__abutton[] = ['type'=>$type, 'id'=>$id, 'label'=>$label, 'bmiss'=>$bmiss];
} }
public function separator() { public function separator() {
$this->__abutton[] = array('type'=>"separator"); $this->__abutton[] = ['type'=>"separator"];
$this->__bsepa = true;
} }
public function primary($id="", $label="", $bmiss=false) { public function primary($id="", $label="", $bmiss=false) {
$this->add("primary", $id, $label, $bmiss); $this->add("primary", $id, $label, $bmiss);
@@ -51,17 +49,15 @@ class Button {
public function Button($size=2) { public function Button($size=2) {
if (0==count($this->__abutton)) return ""; if (0==count($this->__abutton)) return "";
$items = count($this->__abutton) - ($this->__bsepa==true ? 1 : 0); $_out = '<div class="row mb-1"><div class="col-12 col-sm-6 my-0 mx-sm-0 text-center text-sm-start">'; $_ma = ' me-sm-2';
$sepa_size = (12 == $items*$size) ? 0 : 12 - ($items*$size);
$_out = '<div class="row mb-2">';
foreach ($this->__abutton as $item) { foreach ($this->__abutton as $item) {
if ("separator" == $item['type']) { if ("separator" == $item['type']) {
if (0 < $sepa_size) $_out .= '<div class="d-none d-lg-block col-lg-'.$sepa_size.'">&nbsp;</div>'; $_out .= '</div><div class="col-12 col-sm-6 my-0 mx-sm-0 text-center text-sm-end">'; $_ma = ' ms-sm-2';
} else { } else {
$_out .= '<div class="col-md-'.floor($size*2).' col-lg-'.$size.' mb-sm-0"><button type="button" class="btn btn-block btn-'.$item['type'].' shadow-none" id="'.$item['id'].'"'.(true==$item['bmiss']?' data-bs-dismiss="modal"':'').'>'.$item['label'].'</button></div>'; $_out .= '<button type="button" class="btn btn-'.$item['type'].' mb-2 mb-sm-0'.$_ma.' col-10 col-sm-auto shadow-none" id="'.$item['id'].'"'.(true==$item['bmiss']?' data-bs-dismiss="modal"':'').'>'.$item['label'].'</button>';
} }
} }
$_out .= '</div>'; $_out .= '</div></div>';
return $_out; return $_out;
} }
} }