kanban mode for list of client invoice

This commit is contained in:
Lamrani Abdel 2023-01-10 12:43:55 +01:00
parent aea48e87de
commit c52247e6ac
2 changed files with 655 additions and 601 deletions

View File

@ -5732,6 +5732,37 @@ class Facture extends CommonInvoice
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
/**
* 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 = '')
{
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'socid')) {
$return .= '<br><span class="info-box-label">'.$this->socid.'</span>';
}
if (property_exists($this, 'fk_user_author')) {
$return .= '<br><span class="info-box-label">'.$this->fk_user_author.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }
/** /**

View File

@ -75,6 +75,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicelist';
$mode = GETPOST('mode', 'alpha');
if ($contextpage == 'poslist') { if ($contextpage == 'poslist') {
$optioncss = 'print'; $optioncss = 'print';
@ -974,6 +975,9 @@ if ($resql) {
} }
$param = '&socid='.urlencode($socid); $param = '&socid='.urlencode($socid);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -1185,6 +1189,9 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$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'));
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer")); $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer"));
} }
@ -1204,6 +1211,7 @@ if ($resql) {
print '<input type="hidden" name="search_status" value="'.$search_status.'">'; print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -1894,6 +1902,21 @@ if ($resql) {
$total_margin += $marginInfo['total_margin']; $total_margin += $marginInfo['total_margin'];
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$facturestatic->socid = $companystatic->getNomUrl(1, 'company', 15);
$userstatic->fetch($obj->fk_user_author);
$facturestatic->fk_user_author = $userstatic->getNomUrl(1);
print $facturestatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven"'; print '<tr class="oddeven"';
if ($contextpage == 'poslist') { if ($contextpage == 'poslist') {
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();'; print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();';
@ -2532,7 +2555,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }