Add basic stats to new dashboard
This commit is contained in:
parent
86e8abde65
commit
98acfd6929
@ -514,47 +514,55 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
|||||||
'project' =>
|
'project' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Projects',
|
'groupName' => 'Projects',
|
||||||
|
'globalStatsKey' => 'projects',
|
||||||
'stats' => array('project', 'project_task'),
|
'stats' => array('project', 'project_task'),
|
||||||
),
|
),
|
||||||
'propal' =>
|
'propal' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Proposals',
|
'groupName' => 'Proposals',
|
||||||
|
'globalStatsKey' => 'proposals',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('propal_opened', 'propal_signed'),
|
array('propal_opened', 'propal_signed'),
|
||||||
),
|
),
|
||||||
'commande' =>
|
'commande' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Orders',
|
'groupName' => 'Orders',
|
||||||
|
'globalStatsKey' => 'orders',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('commande'),
|
array('commande'),
|
||||||
),
|
),
|
||||||
'facture' =>
|
'facture' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Invoices',
|
'groupName' => 'Invoices',
|
||||||
|
'globalStatsKey' => 'invoices',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('facture'),
|
array('facture'),
|
||||||
),
|
),
|
||||||
'contrat' =>
|
'contrat' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Contracts',
|
'groupName' => 'Contracts',
|
||||||
|
'globalStatsKey' => 'Contracts',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('contrat_inactive', 'contrat_active'),
|
array('contrat_inactive', 'contrat_active'),
|
||||||
),
|
),
|
||||||
'supplier_proposal' =>
|
'supplier_proposal' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'SupplierProposals',
|
'groupName' => 'SupplierProposals',
|
||||||
|
'globalStatsKey' => 'askprice',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('supplier_proposal_opened', 'supplier_proposal_signed'),
|
array('supplier_proposal_opened', 'supplier_proposal_signed'),
|
||||||
),
|
),
|
||||||
'order_supplier' =>
|
'order_supplier' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'SuppliersOrders',
|
'groupName' => 'SuppliersOrders',
|
||||||
|
'globalStatsKey' => 'supplier_orders',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('order_supplier'),
|
array('order_supplier'),
|
||||||
),
|
),
|
||||||
'invoice_supplier' =>
|
'invoice_supplier' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'BillsSuppliers',
|
'groupName' => 'BillsSuppliers',
|
||||||
|
'globalStatsKey' => 'supplier_invoices',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('invoice_supplier'),
|
array('invoice_supplier'),
|
||||||
),
|
),
|
||||||
@ -567,18 +575,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
|||||||
'Adherent' =>
|
'Adherent' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Members',
|
'groupName' => 'Members',
|
||||||
|
'globalStatsKey' => 'members',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('Adherent'),
|
array('Adherent'),
|
||||||
),
|
),
|
||||||
'ExpenseReport' =>
|
'ExpenseReport' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'ExpenseReport',
|
'groupName' => 'ExpenseReport',
|
||||||
|
'globalStatsKey' => 'expensereports',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('ExpenseReport'),
|
array('ExpenseReport'),
|
||||||
),
|
),
|
||||||
'Holiday' =>
|
'Holiday' =>
|
||||||
array(
|
array(
|
||||||
'groupName' => 'Holidays',
|
'groupName' => 'Holidays',
|
||||||
|
'globalStatsKey' => 'holidays',
|
||||||
'stats' =>
|
'stats' =>
|
||||||
array('Holiday'),
|
array('Holiday'),
|
||||||
),
|
),
|
||||||
@ -672,12 +683,46 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
|||||||
if (!empty($boards)) {
|
if (!empty($boards)) {
|
||||||
$groupName = $langs->trans($groupElement['groupName']);
|
$groupName = $langs->trans($groupElement['groupName']);
|
||||||
$groupKeyLowerCase = strtolower($groupKey);
|
$groupKeyLowerCase = strtolower($groupKey);
|
||||||
|
$nbTotalForGroup = 0;
|
||||||
|
|
||||||
|
// global stats
|
||||||
|
$globalStatsKey = false;
|
||||||
|
if (!empty($groupElement['globalStatsKey']) && empty($groupElement['globalStats'])){ // can be filled by hook
|
||||||
|
$globalStatsKey = $groupElement['globalStatsKey'];
|
||||||
|
$groupElement['globalStats'] = array();
|
||||||
|
|
||||||
|
if(in_array($globalStatsKey, $keys))
|
||||||
|
{
|
||||||
|
// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
|
||||||
|
$keyIndex = array_search($globalStatsKey, $keys);
|
||||||
|
|
||||||
|
$classe=$classes[$keyIndex];
|
||||||
|
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe]))
|
||||||
|
{
|
||||||
|
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey]?$boardloaded[$classe]->nb[$globalStatsKey]:0;
|
||||||
|
$nbTotal = doubleval($groupElement['globalStats']['total']);
|
||||||
|
if($nbTotal>=10000){ $nbTotal = round($nbTotal/1000 , 2) .'k'; }
|
||||||
|
$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
|
||||||
|
$groupElement['globalStats']['total'] = $nbTotal;
|
||||||
|
$groupElement['globalStats']['link'] = $links[$keyIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$openedDashBoard .= '<div class="box-flex-item">' . "\n";
|
$openedDashBoard .= '<div class="box-flex-item">' . "\n";
|
||||||
$openedDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . '">' . "\n";
|
$openedDashBoard .= ' <div class="info-box ' . $openedDashBoardSize . '">' . "\n";
|
||||||
$openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-' . $groupKeyLowerCase . '"><i class="fa fa-dol-' . $groupKeyLowerCase . '"></i></span>' . "\n";
|
$openedDashBoard.= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n";
|
||||||
|
$openedDashBoard.= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
|
||||||
|
|
||||||
|
if(!empty($groupElement['globalStats'])){
|
||||||
|
$openedDashBoard.= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$openedDashBoard.= ' </span>'."\n";
|
||||||
$openedDashBoard .= ' <div class="info-box-content">' . "\n";
|
$openedDashBoard .= ' <div class="info-box-content">' . "\n";
|
||||||
$openedDashBoard .= ' <span class="info-box-title" title="' . dol_escape_htmltag($groupName) . '">' . $groupName . '</span>' . "\n";
|
|
||||||
|
$openedDashBoard .= ' <span class="info-box-title" title="'.strip_tags($groupName).'">'.$groupName.'</span>' . "\n";
|
||||||
|
|
||||||
foreach ($boards as $board) {
|
foreach ($boards as $board) {
|
||||||
if (!empty($board->labelShort)) {
|
if (!empty($board->labelShort)) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
|||||||
*/
|
*/
|
||||||
.info-box {
|
.info-box {
|
||||||
display: block;
|
display: block;
|
||||||
|
position: relative;
|
||||||
min-height: 90px;
|
min-height: 90px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -54,6 +55,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
|||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
border-bottom-left-radius: 2px;
|
border-bottom-left-radius: 2px;
|
||||||
display: block;
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
float: left;
|
float: left;
|
||||||
height: 90px;
|
height: 90px;
|
||||||
width: 90px;
|
width: 90px;
|
||||||
@ -71,6 +73,32 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
|||||||
.info-box-icon > img {
|
.info-box-icon > img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
.info-box-icon-text{
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 90px;
|
||||||
|
bottom: 0px;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: rgba(0,0,0,0.1);
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 15px;
|
||||||
|
padding: 0px 3px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||||
|
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||||
|
}
|
||||||
|
.info-box-sm .info-box-icon-text{
|
||||||
|
overflow: hidden;
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
.info-box:hover .info-box-icon-text{
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.info-box-content {
|
.info-box-content {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
margin-left: 90px;
|
margin-left: 90px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user