kanban for list of suppliers invoices

This commit is contained in:
Lamrani Abdel 2023-01-10 13:29:46 +01:00
parent aea48e87de
commit 130e9d8df2
2 changed files with 452 additions and 395 deletions

View File

@ -3225,6 +3225,43 @@ class FactureFournisseur extends CommonInvoice
return $isUsed; return $isUsed;
} }
/**
* 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, 'socid')) {
$return .= ' | <span class="info-box-label">'.$this->socid.'</span>';
}
if (property_exists($this, 'date_echeance') && property_exists($this, 'date')) {
if (!empty($this->date_echeance)) {
$return .= '<br><span class="info-box-label">'.dol_print_date($this->date_echeance).'</span>';
} else {
$return .= '<br><span class="info-box-label">'.dol_print_date($this->date).'</span>';
}
}
if (property_exists($this, 'total_ht')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("AmountHT").'</span> : <span class="info-box-label amount">'.price($this->total_ht).'</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

@ -766,6 +766,9 @@ if ($socid) {
} }
$param = '&socid='.$socid; $param = '&socid='.$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);
} }
@ -918,7 +921,10 @@ $url = DOL_URL_ROOT.'/fourn/facture/card.php?action=create';
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.urlencode($socid); $url .= '&socid='.urlencode($socid);
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)); $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->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer));
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@ -1430,7 +1436,21 @@ if ($num > 0) {
$remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed(); $remaintopay = -$facturestatic->getSumFromThisCreditNotesNotUsed();
} }
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$facturestatic->socid = $thirdparty->getNomUrl(1, 'supplier', 3);
$facturestatic->total_ht = $obj->total_ht;
$facturestatic->date = $obj->datef;
print $facturestatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@ -1832,7 +1852,7 @@ if ($num > 0) {
} }
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }