Widget : button zoom, cosmetic

This commit is contained in:
sparkyx 2024-08-27 10:39:33 +02:00
parent fc68535f11
commit 757bd43cd2
14 changed files with 103 additions and 26 deletions

View file

@ -3575,4 +3575,18 @@ span.widget-name {
margin-left: 10px;
margin-top: 10px;
position:absolute;
}
}
/**
widget full size
*/
div.widget-full_size {
z-index: 5;
position: fixed;
top: 5px;
width: 96%;
height: 96%;
overflow: auto;
max-height: 100%;
margin: 2px;
}

View file

@ -282,7 +282,7 @@ function action_show(p_dossier)
parameters : {gDossier:p_dossier,'op':'action_show'},
onSuccess : function(p_xml, p_text) {
remove_waiting_box();
add_div({id: 'action_list_div', style:"top:1%;width:90%;left:5%" , cssclass: 'inner_box'});
add_div({id: 'action_list_div', style:"position:fixed;top:1%;width:90%;left:5%" , cssclass: 'inner_box'});
$('action_list_div').innerHTML=p_xml.responseText;
var table_followup=document.getElementById('event_followup');
if ( table_followup) { sorttable.makeSortable(table_followup); }

View file

@ -4620,3 +4620,16 @@ Widget.prototype.remove_ident = function ()
elt[0].remove()
}
}
/**
* Put the widget in full size
* @param widget_domid {string} dom id of the widget to toggle the size
*/
Widget.prototype.toggle_full_size=function (widget_domid) {
if ( $(widget_domid).hasClassName('widget-full_size')) {
$(widget_domid).removeClassName('widget-full_size');
} else {
$(widget_domid).addClassName('widget-full_size');
}
}

View file

@ -861,7 +861,7 @@ class HtmlInput
}
/**
* Title for boxes, you can customize the symbol thanks symbol with
* @brief Title for boxes, you can customize the symbol thanks symbol with
* the mode "custom"
* @param string $p_name Title
* @param string $div element id, except for mode none or custom
@ -872,7 +872,7 @@ class HtmlInput
* @return type
*/
static function title_box($p_name, $p_div, $p_mod="close", $p_js="",
$p_draggable="n",$p_enlarge='n')
$p_draggable="n",$p_enlarge='n',$raw="")
{
$p_div=strip_tags($p_div);
$r='<div class="bxbutton">';
@ -912,7 +912,7 @@ class HtmlInput
$r.='</div>';
$r.=h2($p_name, ' class="title" ');
$r.=h2($p_name, ' class="title" ',$raw);
return $r;
}

View file

@ -37,6 +37,7 @@ $customer_now=$Ledger->get_customer_now();
$customer_late=$Ledger->get_customer_late();
$gDossier_id=Dossier::id();
?>
<?php echo HtmlInput::title_box(_("Résumé"),"situation_div",'none','','n')?>
<table class='result'>

View file

@ -45,7 +45,7 @@ class Agenda extends Widget
\Dossier::id(),'per','calendar_zoom_div','cal');
$this->open_div();
echo \HtmlInput::title_box(_('Calendrier'),'cal_div','zoom',"calendar_zoom($obj)",'n');
echo \HtmlInput::title_box(_('Calendrier'),'cal_div','zoom',"calendar_zoom($obj)",'n',raw:'&#x1F4C5;');
echo $cal->display('short',0);
$this->close_div();
}

View file

@ -29,7 +29,9 @@ class Bookmark extends Widget
{
global $g_user;
$this->open_div();
echo '<h2 class="title">',_("Favoris"),'&#x2728;','</h2>';
$this->title(_("Favoris") . '&#x2728;');
$bookmark_sql="select distinct b_id,b_action,b_order,me_code,me_description, javascript"
. " from bookmark "
. "join v_menu_description_favori on (code=b_action or b_action=me_code)"

View file

@ -21,7 +21,8 @@
* \file
* \brief display events for 10 days
*/
echo h2(_("A faire"),'class="title"');
//echo \HtmlInput::title_box(_("A faire"), uniqid(), 'custom', $this->button_zoom(), 'n');
$this->title(_("Ev. pour 14 jours") );
if ( empty ($array)) {
echo _("Aucun événement en retard ou prévu");
return;

View file

@ -32,7 +32,7 @@ namespace Noalyss\Widget;
class Event extends Widget
{
/**
* @brief get the action where the remind day is within 10 days
* @brief get the action where the remind day is within 14 days
* @return array
*/
function get_next10()
@ -68,4 +68,4 @@ class Event extends Widget
$this->close_div();
}
}
}

View file

@ -19,24 +19,36 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu 18/08/24
/*!
* \file
* \brief display the next invoice to to be paid or late for customer or supplier
* \brief display the next invoice to be paid or late for customer or supplier
*/
namespace Noalyss\Widget;
/*!
* \class
* \brief display the next invoice to to be paid or late for customer or supplier
* \brief display the next invoice to be paid or late for customer or supplier
*/
class Invoice extends Widget
{
static function getConstantTiers() : array
{
return ['S' => _("Fournisseurs"), "C" => _("Clients")];;
}
static function getConstantLimit() :array {
return ['P' => _("Prochaines factures"), "R" => "facture en retard",'T'=>_("Aujourd'hui")];
}
function input_parameter()
{
$tiers = new \ISelect('tiers');
$tiers->value[] = array('value' => 'S', 'label' => _("Fournisseurs"));
$tiers->value[] = array('value' => 'C', 'label' => _("Clients"));
$aTiers=Invoice::getConstantTiers();
$tiers->value=[];
foreach ($aTiers as $key=>$value) {
$tiers->value[]=['value'=>$key,'label'=>$value];
}
$time_limit = new \ISelect('time_limit');
$time_limit->value[] = array('value' => 'P', 'label' => _("Prochaines factures"));
$time_limit->value[] = array('value' => 'R', 'label' => _("Factures en retard"));
$time_limit->value[] = array('value' => 'T', 'label' => _("Factures pour aujourd'hui"));
$aLimit=Invoice::getConstantLimit();
$time_limit->value=[];
foreach ($aLimit as $key=>$value) {
$time_limit->value[]=['value'=>$key,'label'=>$value];
}
$input = _("Factures ") . $tiers->input() . " " . _("échéance") . " " . $time_limit->input();
$this->make_form($input);
@ -46,8 +58,8 @@ class Invoice extends Widget
function display_parameter()
{
$aParam = $this->get_parameter();
$aTiers = ['S' => _("Fournisseurs"), "C" => _("Clients")];
$aLimit = ['P' => _("Prochaines"), "R" => "Retard",'T'=>_("Aujourd'hui")];
$aTiers =Invoice::getConstantTiers();
$aLimit = Invoice::getConstantLimit();
echo '<span class="widget_param">'.$aTiers[$aParam['tiers']] . " " . $aLimit[$aParam["time_limit"]].'</span>';
}
@ -55,10 +67,12 @@ class Invoice extends Widget
{
$this->open_div();
$aParam = $this->get_parameter();
$aTiers = ['S' => _("Fournisseurs"), "C" => _("Clients")];
$aLimit = ['P' => _("Prochaines factures"), "R" => "facture en retard",'T'=>_("Aujourd'hui")];
$aTiers = Invoice::getConstantTiers();
$aLimit = Invoice::getConstantLimit();
$title = $aTiers[$aParam['tiers']] . " " . $aLimit[$aParam["time_limit"]];
echo h2($title, 'class="title"');
$this->title($title);
$acc_ledger = new \Acc_Ledger($this->db, 0);
$ledger_type = 'ACH';

View file

@ -40,7 +40,8 @@ class Last_Event extends Widget
{
global $cn;
$this->open_div();
echo HtmlInput::title_box(_('Suivi'),"last_operation_management_div",'zoom','action_show('.dossier::id().')','n');
$this->title(_("Dernières actions du suivi"));
$gestion=new \Follow_Up($cn);
$array=$gestion->get_last(MAX_ACTION_SHOW);
$len_array=count($array);

View file

@ -55,8 +55,10 @@ class Mini_Report extends Widget
}
$this->open_div();
if ($report != 0) {
$report_id=$this->get_div_domid();
?>
<?php echo HtmlInput::title_box($rapport->get_name(), 'report_div', 'none', '', 'n'); ?>
<?php echo $this->title($rapport->get_name()) ;?>
<?php
$exercice = $g_user->get_exercice();
if ($exercice == 0) {

View file

@ -25,5 +25,5 @@ global $cn;
$cn->exec_sql("
INSERT INTO widget_dashboard (wd_code,wd_description,wd_parameter,wd_name) VALUES
('todo_list','Liste de choses à faire , de petites notes',0,'Pense-Bête');
('todo_list','Liste de choses à faire , de petites notes, qu''il est possible de partager',0,'Pense-Bête');
");

View file

@ -155,7 +155,15 @@ where use_login=$1 order by uw.uw_order
* @return void
*/
function open_div() {
printf( '<div id="%s_%s" class="box widget-box">',$this->widget_code,$this->user_widget_id);
printf( '<div id="%s" class="box widget-box">',$this->get_div_domid());
}
/**
* @brief compute the DIV ID
* @return string
*/
function get_div_domid() :string {
return sprintf( "%s_%s",$this->widget_code,$this->user_widget_id);
}
function close_div() {
echo '</div>';
@ -341,4 +349,25 @@ EOF;
parse_str($param,$aParam);
return $aParam;
}
/**
* @brief compute the button ZOOM to put in the title
* @return \html
*/
function button_zoom() {
$bt = \Icon_Action::zoom(uniqid(), sprintf("widget.toggle_full_size('%s')",$this->get_div_domid()));
return $bt;
}
/**
* @brief display the title and the icon for zooming
* @param $title string title of the widget
*/
function title( $title) {
$r='<div class="bxbutton">';
$r.='<span id="span_'.uniqid().'" style="float:right;margin-right:5px">'.$this->button_zoom()."</span>";
$r.='</div>';
$r.=sprintf('<h2 class="title">%s</h2>',$title);
echo $r;
}
}