From 757bd43cd2afbb230ef9cead6df089cb75189999 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 27 Aug 2024 10:39:33 +0200 Subject: [PATCH] Widget : button zoom, cosmetic --- html/css/style-classic7.css | 16 +++++++- html/js/gestion.js | 2 +- html/js/noalyss_script.js | 13 +++++++ include/lib/html_input.class.php | 6 +-- .../status_operation_event-main_display.php | 1 + include/widget/agenda/agenda.php | 2 +- include/widget/bookmark/bookmark.php | 4 +- include/widget/event/event-display.php | 3 +- include/widget/event/event.php | 4 +- include/widget/invoice/invoice.php | 38 +++++++++++++------ include/widget/last_event/last_event.php | 3 +- include/widget/mini_report/mini_report.php | 4 +- include/widget/todo_list/install.php | 2 +- include/widget/widget.php | 31 ++++++++++++++- 14 files changed, 103 insertions(+), 26 deletions(-) diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index b93171e37..46094c139 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -3575,4 +3575,18 @@ span.widget-name { margin-left: 10px; margin-top: 10px; position:absolute; - } \ No newline at end of file + } + + /** + 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; +} diff --git a/html/js/gestion.js b/html/js/gestion.js index 0364b477b..d12f81693 100644 --- a/html/js/gestion.js +++ b/html/js/gestion.js @@ -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); } diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 7c3933c85..9f57061fb 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -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'); + } + +} \ No newline at end of file diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 4a5174bc4..1cea9dd0d 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -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='
'; @@ -912,7 +912,7 @@ class HtmlInput $r.='
'; - $r.=h2($p_name, ' class="title" '); + $r.=h2($p_name, ' class="title" ',$raw); return $r; } diff --git a/include/template/status_operation_event-main_display.php b/include/template/status_operation_event-main_display.php index c1018eb82..78c0aa3b8 100644 --- a/include/template/status_operation_event-main_display.php +++ b/include/template/status_operation_event-main_display.php @@ -37,6 +37,7 @@ $customer_now=$Ledger->get_customer_now(); $customer_late=$Ledger->get_customer_late(); $gDossier_id=Dossier::id(); + ?> diff --git a/include/widget/agenda/agenda.php b/include/widget/agenda/agenda.php index 530811993..db8fb7de7 100644 --- a/include/widget/agenda/agenda.php +++ b/include/widget/agenda/agenda.php @@ -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:'📅'); echo $cal->display('short',0); $this->close_div(); } diff --git a/include/widget/bookmark/bookmark.php b/include/widget/bookmark/bookmark.php index da9175f47..d2ebedf87 100644 --- a/include/widget/bookmark/bookmark.php +++ b/include/widget/bookmark/bookmark.php @@ -29,7 +29,9 @@ class Bookmark extends Widget { global $g_user; $this->open_div(); - echo '

',_("Favoris"),'✨','

'; + + + $this->title(_("Favoris") . '✨'); $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)" diff --git a/include/widget/event/event-display.php b/include/widget/event/event-display.php index e3e991188..26ab8d2f2 100644 --- a/include/widget/event/event-display.php +++ b/include/widget/event/event-display.php @@ -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; diff --git a/include/widget/event/event.php b/include/widget/event/event.php index 0ec907878..d5638d8cf 100644 --- a/include/widget/event/event.php +++ b/include/widget/event/event.php @@ -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(); } -} \ No newline at end of file +} diff --git a/include/widget/invoice/invoice.php b/include/widget/invoice/invoice.php index 116615308..f710f9693 100644 --- a/include/widget/invoice/invoice.php +++ b/include/widget/invoice/invoice.php @@ -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 ''.$aTiers[$aParam['tiers']] . " " . $aLimit[$aParam["time_limit"]].''; } @@ -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'; diff --git a/include/widget/last_event/last_event.php b/include/widget/last_event/last_event.php index 02af98855..a244337a0 100644 --- a/include/widget/last_event/last_event.php +++ b/include/widget/last_event/last_event.php @@ -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); diff --git a/include/widget/mini_report/mini_report.php b/include/widget/mini_report/mini_report.php index d703ccfe9..307483d3a 100644 --- a/include/widget/mini_report/mini_report.php +++ b/include/widget/mini_report/mini_report.php @@ -55,8 +55,10 @@ class Mini_Report extends Widget } $this->open_div(); if ($report != 0) { + $report_id=$this->get_div_domid(); ?> - get_name(), 'report_div', 'none', '', 'n'); ?> + title($rapport->get_name()) ;?> + get_exercice(); if ($exercice == 0) { diff --git a/include/widget/todo_list/install.php b/include/widget/todo_list/install.php index 4417f468e..567d409fb 100644 --- a/include/widget/todo_list/install.php +++ b/include/widget/todo_list/install.php @@ -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'); "); diff --git a/include/widget/widget.php b/include/widget/widget.php index 14a6ba43d..b21f26127 100644 --- a/include/widget/widget.php +++ b/include/widget/widget.php @@ -155,7 +155,15 @@ where use_login=$1 order by uw.uw_order * @return void */ function open_div() { - printf( '
',$this->widget_code,$this->user_widget_id); + printf( '
',$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 '
'; @@ -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='
'; + $r.=''.$this->button_zoom().""; + $r.='
'; + $r.=sprintf('

%s

',$title); + echo $r; + } } \ No newline at end of file