From 7124a59110b4c9c3fd60a449d3c367281461b2eb Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 12 Jan 2023 18:28:57 +0100 Subject: [PATCH] kanban mode for list of prelevement orders --- .../class/bonprelevement.class.php | 34 +++++++++++++ htdocs/compta/prelevement/orders_list.php | 49 ++++++++++++++----- 2 files changed, 70 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 959630a5538..e8e511f8c87 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2397,4 +2397,38 @@ class BonPrelevement extends CommonObject */ return 0; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + + if (property_exists($this, 'date_echeance')) { + $return .= '
'.$langs->trans("Date").' : '.dol_print_date($this->db->jdate($this->date_echeance), 'day').''; + } + if (property_exists($this, 'total')) { + $return .= '
'.$langs->trans("Amount").' : '.price($this->total).''; + } + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 01ef33eea9d..bead580ab31 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -54,6 +54,8 @@ if (!$sortfield) { } $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); + // Get supervariables $statut = GETPOST('statut', 'int'); @@ -147,6 +149,9 @@ if ($result) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -161,6 +166,8 @@ if ($result) { $selectedfields = ''; $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($usercancreate) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type='.urlencode($type)); } @@ -176,6 +183,8 @@ if ($result) { print ''; print ''; print ''; + print ''; + if ($type != '') { print ''; } @@ -220,27 +229,41 @@ if ($result) { $directdebitorder->id = $obj->rowid; $directdebitorder->ref = $obj->ref; - $directdebitorder->datec = $obj->datec; - $directdebitorder->amount = $obj->amount; + $directdebitorder->date_echeance = $obj->datec; + $directdebitorder->total = $obj->amount; $directdebitorder->statut = $obj->statut; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban - print ''; - print $directdebitorder->getNomUrl(1); - print "\n"; + print $directdebitorder->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; + print ''; + print $directdebitorder->getNomUrl(1); + print "\n"; - print ''.price($obj->amount)."\n"; + print ''.dol_print_date($db->jdate($obj->datec), 'day')."\n"; - print ''; - print $bon->LibStatut($obj->statut, 5); - print ''; + print ''.price($obj->amount)."\n"; - print ''."\n"; + print ''; + print $bon->LibStatut($obj->statut, 5); + print ''; - print "\n"; + print ''."\n"; + + print "\n"; + } $i++; } } else {