kanban mode for list charge social

This commit is contained in:
Lamrani Abdel 2023-01-10 16:17:16 +01:00
parent aea48e87de
commit 8238d1df97
2 changed files with 200 additions and 140 deletions

View File

@ -749,4 +749,38 @@ class ChargeSociales extends CommonObject
$this->type = 1; $this->type = 1;
$this->type_label = 'Type of social contribution'; $this->type_label = 'Type of social contribution';
} }
/**
* 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, 'fk_project') && !empty($this->fk_project)) {
$return .= ' | <span class="info-box-label">'.$this->fk_project.'</span>';
}
if (property_exists($this, 'date_ech')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span>:<span class="info-box-label">'.dol_print_date($this->date_ech).'</span>';
}
if (property_exists($this, 'amount')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
}
if (method_exists($this, 'LibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -47,6 +47,8 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist';
$mode = GETPOST('mode', 'alpha');
$search_ref = GETPOST('search_ref', 'int'); $search_ref = GETPOST('search_ref', 'int');
$search_label = GETPOST('search_label', 'alpha'); $search_label = GETPOST('search_label', 'alpha');
@ -294,6 +296,9 @@ $num = $db->num_rows($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);
} }
@ -367,6 +372,8 @@ if ($search_date_limit_endyear) {
} }
$newcardbutton = ''; $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 ($user->rights->tax->charges->creer) { if ($user->rights->tax->charges->creer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
} }
@ -382,6 +389,8 @@ 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="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="mode" value="'.$mode.'">';
$center = ''; $center = '';
@ -576,13 +585,30 @@ while ($i < min($num, $limit)) {
$chargesociale_static->ref = $obj->rowid; $chargesociale_static->ref = $obj->rowid;
$chargesociale_static->label = $obj->label; $chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label; $chargesociale_static->type_label = $obj->type_label;
$chargesociale_static->amount = $obj->amount;
$chargesociale_static->paye = $obj->paye;
$chargesociale_static->date_ech = $obj->date_ech;
if (isModEnabled('project')) { if (isModEnabled('project')) {
$projectstatic->id = $obj->project_id; $projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref; $projectstatic->ref = $obj->project_ref;
$projectstatic->title = $obj->project_label; $projectstatic->title = $obj->project_label;
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
$chargesociale_static->fk_project = $projectstatic->getNomUrl();
print $chargesociale_static->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Line number // Line number
@ -731,7 +757,7 @@ while ($i < min($num, $limit)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }