Merge pull request #23475 from lamrani002/kanbanContractList
NEW kanbanMode for list of contracts
This commit is contained in:
commit
156c94dc46
@ -2789,6 +2789,38 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
return ($error ? 1: 0);
|
return ($error ? 1: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 .= '<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() : $this->ref).'</span>';
|
||||||
|
if (property_exists($this, 'societe')) {
|
||||||
|
$return .= '<br><span class="info-box-label ">'.$this->societe.'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'date_contrat')) {
|
||||||
|
$return .= '<br><span class="opacitymedium">'.$langs->trans("DateContract").' : </span><span class="info-box-label">'.dol_print_date($this->date_contrat).'</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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ $show_files = GETPOST('show_files', 'int');
|
|||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search
|
||||||
|
$mode = GETPOST('mode', 'alpha');
|
||||||
|
|
||||||
$search_name = GETPOST('search_name', 'alpha');
|
$search_name = GETPOST('search_name', 'alpha');
|
||||||
$search_email = GETPOST('search_email', 'alpha');
|
$search_email = GETPOST('search_email', 'alpha');
|
||||||
@ -510,6 +511,9 @@ if ($socid > 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);
|
||||||
}
|
}
|
||||||
@ -606,7 +610,10 @@ $url = DOL_URL_ROOT.'/contrat/card.php?action=create';
|
|||||||
if (!empty($socid)) {
|
if (!empty($socid)) {
|
||||||
$url .= '&socid='.((int) $socid);
|
$url .= '&socid='.((int) $socid);
|
||||||
}
|
}
|
||||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->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('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
if ($optioncss != '') {
|
if ($optioncss != '') {
|
||||||
@ -618,6 +625,7 @@ 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.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($langs->trans("Contracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
@ -909,8 +917,22 @@ while ($i < min($num, $limit)) {
|
|||||||
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
|
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
|
||||||
$socstatic->country = $cacheCountryIDCode[$obj->country_id]['label'];
|
$socstatic->country = $cacheCountryIDCode[$obj->country_id]['label'];
|
||||||
}
|
}
|
||||||
|
//mode kanban
|
||||||
|
if ($mode == 'kanban') {
|
||||||
|
if ($i == 0) {
|
||||||
|
print '<tr><td colspan="12">';
|
||||||
|
print '<div class="box-flex-container">';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output Kanban
|
||||||
|
$contracttmp->societe = $socstatic->getNomUrl();
|
||||||
|
$contracttmp->date_contrat = $obj->date_contrat;
|
||||||
|
print $contracttmp->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')) {
|
||||||
@ -1115,6 +1137,7 @@ while ($i < min($num, $limit)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user