kanban mode for pyment salaries list

This commit is contained in:
Lamrani Abdel 2023-01-11 17:39:46 +01:00
parent aea48e87de
commit 87d2e86aba
2 changed files with 176 additions and 106 deletions

View File

@ -707,4 +707,39 @@ class PaymentSalary extends CommonObject
return $result; return $result;
} }
/**
* 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, $db;
$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_bank')) {
$return .= ' | <span class="info-box-label">'.$this->fk_bank.'</span>';
}
if (property_exists($this, 'fk_user_author')) {
$return .= '<br><span class="info-box-status">'.$this->fk_user_author.'</span>';
}
if (property_exists($this, 'fk_typepayment')) {
$return .= '<br><span class="opacitymedium">'.$langs->trans("PaymentMode").'</span> : <span class="info-box-label">'.$this->fk_typepayment.'</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>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -45,6 +45,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'alpha'); // mode view for result
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -316,6 +318,9 @@ llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
$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);
} }
@ -385,11 +390,16 @@ print '<input type="hidden" name="action" value="list">';
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.'">';
$url = DOL_URL_ROOT.'/salaries/card.php?action=create'; $url = DOL_URL_ROOT.'/salaries/card.php?action=create';
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('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -532,8 +542,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Store properties in $object // Store properties in $object
$object->setVarsFromFetchObj($obj); $object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
$userstatic->id = $obj->uid; $userstatic->id = $obj->uid;
$userstatic->lastname = $obj->lastname; $userstatic->lastname = $obj->lastname;
@ -549,7 +558,33 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$paymentsalstatic->id = $obj->rowid; $paymentsalstatic->id = $obj->rowid;
$paymentsalstatic->ref = $obj->rowid; $paymentsalstatic->ref = $obj->rowid;
$paymentsalstatic->amount = $obj->amount;
$paymentsalstatic->fk_typepayment = $obj->payment_code;
$paymentsalstatic->datec = $obj->dateep;
$paymentsalstatic->datep = $obj->datep;
$accountlinestatic->id = $obj->fk_bank;
$accountlinestatic->ref = $obj->fk_bank;
$paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1);
$paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1);
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
// Output Kanban
print $paymentsalstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
// Show here line of result
print '<tr class="oddeven">';
// Ref // Ref
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n"; print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
if (!$i) { if (!$i) {
@ -678,7 +713,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }