Merge pull request #23517 from lamrani002/kanbanLoan
NEW kanban mode for list of loan
This commit is contained in:
commit
07a2456307
@ -721,4 +721,39 @@ class Loan extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = '<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 .= '</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, 'capital')) {
|
||||||
|
$return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->capital).'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'datestart')) {
|
||||||
|
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateStart").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datestart), 'day').'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'dateend')) {
|
||||||
|
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->dateend), 'day').'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method_exists($this, 'LibStatut')) {
|
||||||
|
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'</div>';
|
||||||
|
}
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,6 +66,7 @@ $search_amount = GETPOST('search_amount', 'alpha');
|
|||||||
|
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
$mode = GETPOST('mode', 'alpha'); // mode view result
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -171,6 +172,9 @@ if ($resql) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@ -194,7 +198,10 @@ if ($resql) {
|
|||||||
if (!empty($socid)) {
|
if (!empty($socid)) {
|
||||||
$url .= '&socid='.$socid;
|
$url .= '&socid='.$socid;
|
||||||
}
|
}
|
||||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write);
|
$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('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
if ($optioncss != '') {
|
if ($optioncss != '') {
|
||||||
@ -206,6 +213,8 @@ if ($resql) {
|
|||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
@ -256,31 +265,49 @@ if ($resql) {
|
|||||||
$loan_static->label = $obj->label;
|
$loan_static->label = $obj->label;
|
||||||
$loan_static->paid = $obj->paid;
|
$loan_static->paid = $obj->paid;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
// Ref
|
if ($mode == 'kanban') {
|
||||||
print '<td>'.$loan_static->getNomUrl(1).'</td>';
|
if ($i == 0) {
|
||||||
|
print '<tr><td colspan="12">';
|
||||||
|
print '<div class="box-flex-container">';
|
||||||
|
}
|
||||||
|
// Output Kanban
|
||||||
|
$loan_static->datestart= $obj->datestart;
|
||||||
|
$loan_static->dateend = $obj->dateend;
|
||||||
|
$loan_static->capital = $obj->capital;
|
||||||
|
$loan_static->totalpaid = $obj->paid;
|
||||||
|
|
||||||
// Label
|
print $loan_static->getKanbanView('');
|
||||||
print '<td>'.dol_trunc($obj->label, 42).'</td>';
|
if ($i == (min($num, $limit) - 1)) {
|
||||||
|
print '</div>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Capital
|
// Ref
|
||||||
print '<td class="right maxwidth100"><span class="amount">'.price($obj->capital).'</span></td>';
|
print '<td>'.$loan_static->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
// Date start
|
// Label
|
||||||
print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
|
print '<td>'.dol_trunc($obj->label, 42).'</td>';
|
||||||
|
|
||||||
// Date end
|
// Capital
|
||||||
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
|
print '<td class="right maxwidth100"><span class="amount">'.price($obj->capital).'</span></td>';
|
||||||
|
|
||||||
print '<td class="right nowrap">';
|
// Date start
|
||||||
print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid);
|
print '<td class="center width100">'.dol_print_date($db->jdate($obj->datestart), 'day').'</td>';
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td></td>';
|
// Date end
|
||||||
|
print '<td class="center width100">'.dol_print_date($db->jdate($obj->dateend), 'day').'</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print '<td class="right nowrap">';
|
||||||
|
print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td></td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user