NEW view mode for List of Orders

This commit is contained in:
Lamrani Abdel 2022-12-07 16:59:19 +01:00
parent cdcd54e6fe
commit 26e274beb9
3 changed files with 668 additions and 590 deletions

View File

@ -60,6 +60,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') : 'orderlist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
$mode = GETPOST('mode', 'alpha');
// Search Parameters // Search Parameters
$search_datecloture_start = GETPOST('search_datecloture_start', 'int'); $search_datecloture_start = GETPOST('search_datecloture_start', 'int');
@ -578,6 +579,9 @@ if (empty($reshook)) {
// Make a redirect to avoid to bill twice if we make a refresh or back // Make a redirect to avoid to bill twice if we make a refresh or back
$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);
} }
@ -1111,7 +1115,9 @@ if ($resql) {
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$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);
} }
@ -1285,7 +1291,10 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd); $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('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd);
// Lines of title fields // Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -1300,6 +1309,8 @@ if ($resql) {
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
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="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'order', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -1949,6 +1960,9 @@ if ($resql) {
$generic_commande->note_public = $obj->note_public; $generic_commande->note_public = $obj->note_public;
$generic_commande->note_private = $obj->note_private; $generic_commande->note_private = $obj->note_private;
$generic_commande->thirdparty = $companystatic;
$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;
@ -1961,6 +1975,19 @@ if ($resql) {
$total_margin += $marginInfo['total_margin']; $total_margin += $marginInfo['total_margin'];
} }
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
print $generic_commande->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@ -2610,6 +2637,7 @@ if ($resql) {
$total += $obj->total_ht; $total += $obj->total_ht;
$subtotal += $obj->total_ht; $subtotal += $obj->total_ht;
}
$i++; $i++;
} }

View File

@ -31,6 +31,40 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php';
abstract class CommonOrder extends CommonObject abstract class CommonOrder extends CommonObject
{ {
use CommonIncoterm; use CommonIncoterm;
/**
* 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, $conf;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<div class="info-box-order">';
$return .= img_picto('', 'order');
$return .= '</div>';
$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, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '<br><span class="info-box-ref opacitymedium">'.$this->thirdparty->getNomUrl(1).'</span>';
}
if (property_exists($this, 'total_ht')) {
$return .= '<br><span class="info-box-ref amount">'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('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

@ -101,6 +101,22 @@ if (!defined('ISLOADEDBYSTEELSHEET')) {
font-size: 25px; font-size: 25px;
line-height: 92px; line-height: 92px;
} }
.info-box-order {
border-top-left-radius: 2px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 2px;
display: block;
overflow: hidden;
float: left;
height: 115px;
width: 88px;
text-align: center;
font-size: 2.3em;
line-height: 115px;
margin-right: 10px;
background: var(--colorbacktitle1) !important;
}
.opened-dash-board-wrap .info-box .info-box-icon { .opened-dash-board-wrap .info-box .info-box-icon {
font-size: 2em; font-size: 2em;
} }