diff --git a/htdocs/index.php b/htdocs/index.php index f53d6eace2b..5a41a85a11d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -313,6 +313,7 @@ if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTAT // Loop and displays each line of table + $boardloaded=array(); foreach ($keys as $key=>$val) { if ($conditions[$key]) @@ -643,13 +644,15 @@ foreach($dashboardlines as $infoKey => $tmp) foreach($valid_dashboardlines as $board) { if ($board->nbtodolate > 0) { - if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totaltodo += $board->nbtodo; + $totaltodo += $board->nbtodo; $totallate += $board->nbtodolate; } } -//var_dump($totallate, $totaltodo); -if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2); -//var_dump($totallate); + +$totalLateNumber = $totallate; +$totallatePercentage = !empty($totaltodo) ? round($totallate / $totaltodo * 100, 2) : 0; +if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = $totallatePercentage; + $boxwork=''; $boxwork.='
'; $boxwork.=''."\n"; @@ -685,7 +688,7 @@ $boxwork.=''."\n"; // Show dashboard $nbworkboardempty=0; $isIntopOpenedDashBoard = array(); -if (! empty($valid_dashboardlines)) +if (!empty($valid_dashboardlines)) { $openedDashBoard = ''; @@ -746,14 +749,46 @@ if (! empty($valid_dashboardlines)) } } - $openedDashBoard.= ' '."\n"; $openedDashBoard.= ' '."\n"; $openedDashBoard.= ''."\n"; $openedDashBoard.="\n"; } + } - } + if ($showweather && !empty($isIntopOpenedDashBoard)) + { + $appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ?' hideonsmartphone' : ''; + $weather = getWeatherStatus($totallate); + + $text=''; + if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; + else $text=$langs->transnoentitiesnoconv("NoItemLate"); + $text.='. '.$langs->transnoentitiesnoconv("LateDesc"); + + + + $weatherDashBoard= '
'."\n"; + $weatherDashBoard.= '
'."\n"; + $weatherDashBoard.= ' '."\n"; + $weatherDashBoard.= '
'."\n"; + $weatherDashBoard.= ' '.$langs->trans('GlobalOpenedElemView').'' . "\n"; + $weatherDashBoard.= ' '.$langs->transnoentitiesnoconv("NActionsLate", $totalLateNumber).'' . "\n"; + + /*if($totallatePercentage>0){ + $weatherDashBoard.= '
'; + $weatherDashBoard.= ' '.$langs->trans('NActionsLate', price($totallatePercentage).'%').'' . "\n"; + }*/ + + $weatherDashBoard.= '
'."\n"; + $weatherDashBoard.= '
'."\n"; + $weatherDashBoard.= '
'."\n"; + $weatherDashBoard.="\n"; + + $openedDashBoard=$weatherDashBoard.$openedDashBoard; + + + } for ($i = 1; $i <= 10; $i++) { @@ -763,19 +798,14 @@ if (! empty($valid_dashboardlines)) $nbworkboardcount=0; foreach($valid_dashboardlines as $infoKey => $board) { - if(in_array($infoKey, $isIntopOpenedDashBoard)){ + if(in_array($infoKey, $isIntopOpenedDashBoard)) { // skip if info is present on top - continue; - } - + //continue; + } if (empty($board->nbtodo)) $nbworkboardempty++; $nbworkboardcount++; - - - - $boxwork .='
'; $boxwork .= '
'; $sep=($conf->dol_use_jmobile?'
':' '); @@ -800,15 +830,6 @@ if (! empty($valid_dashboardlines)) } $boxwork.='
'; $boxwork .="\n"; - - - - - - - - - } $boxwork .='
'; @@ -932,33 +953,68 @@ function showWeather($totallate, $text, $options, $morecss = '') { global $conf; - $out=''; - $offset=0; - $factor=10; // By default - - $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'; - - $level0=$offset; - if (! empty($conf->global->{$used_conf.'0'})) { - $level0=$conf->global->{$used_conf.'0'}; - } - $level1=$offset+1*$factor; - if (! empty($conf->global->{$used_conf.'1'})) { - $level1=$conf->global->{$used_conf.'1'}; - } - $level2=$offset+2*$factor; - if (! empty($conf->global->{$used_conf.'2'})) { - $level2=$conf->global->{$used_conf.'2'}; - } - $level3=$offset+3*$factor; - if (! empty($conf->global->{$used_conf.'3'})) { - $level3=$conf->global->{$used_conf.'3'}; - } - - if ($totallate <= $level0) $out.=img_weather($text, 'weather-clear.png', $options, 0, $morecss); - elseif ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text, 'weather-few-clouds.png', $options, 0, $morecss); - elseif ($totallate > $level1 && $totallate <= $level2) $out.=img_weather($text, 'weather-clouds.png', $options, 0, $morecss); - elseif ($totallate > $level2 && $totallate <= $level3) $out.=img_weather($text, 'weather-many-clouds.png', $options, 0, $morecss); - elseif ($totallate > $level3) $out.=img_weather($text, 'weather-storm.png', $options, 0, $morecss); - return $out; + $weather = getWeatherStatus($totallate); + return img_weather($text, $weather->picto, $options, 0, $morecss); +} + + +/** + * get weather level + * $conf->global->MAIN_METEO_LEVELx + * + * @param int $totallate Nb of element late + * @return string Return img tag of weather + */ +function getWeatherStatus($totallate) +{ + global $conf; + + $weather = new stdClass(); + $weather->picto = ''; + + $offset=0; + $factor=10; // By default + + $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'; + + $level0=$offset; + $weather->level=0; + if (! empty($conf->global->{$used_conf.'0'})) { + $level0=$conf->global->{$used_conf.'0'}; + } + $level1=$offset+1*$factor; + if (! empty($conf->global->{$used_conf.'1'})) { + $level1=$conf->global->{$used_conf.'1'}; + } + $level2=$offset+2*$factor; + if (! empty($conf->global->{$used_conf.'2'})) { + $level2=$conf->global->{$used_conf.'2'}; + } + $level3=$offset+3*$factor; + if (! empty($conf->global->{$used_conf.'3'})) { + $level3=$conf->global->{$used_conf.'3'}; + } + + if ($totallate <= $level0){ + $weather->picto = 'weather-clear.png'; + $weather->level=0; + } + elseif ($totallate <= $level1){ + $weather->picto = 'weather-few-clouds.png'; + $weather->level=1; + } + elseif ($totallate <= $level2){ + $weather->picto = 'weather-clouds.png'; + $weather->level=2; + } + elseif ($totallate <= $level3){ + $weather->picto = 'weather-many-clouds.png'; + $weather->level=3; + } + else{ + $weather->picto = 'weather-storm.png'; + $weather->level=4; + } + + return $weather; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7f99a51a064..3efd4fd7b21 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -984,3 +984,4 @@ NoRecordedUsers=No users ToClose=To close ToProcess=To process ToApprove=To approve +GlobalOpenedElemView= diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 4796c7cbe3c..cbb43c6b143 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -11,7 +11,7 @@ if (! defined('ISLOADEDBYSTEELSHEET'))  die('Must be call by steelsheet'); ?> min-height: 90px; background: #fff; width: 100%; - box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1), 0px 0px 2px rgba(0, 0, 0, 0.1); + box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); border-radius: 2px; margin-bottom: 15px; } @@ -27,8 +27,21 @@ if (! defined('ISLOADEDBYSTEELSHEET'))  die('Must be call by steelsheet'); ?> .info-box .progress .progress-bar { border-radius: 0; } + .info-box .progress .progress-bar { - background: #fff; + float: left; + width: 0; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #337ab7; + -webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); + box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); + -webkit-transition: width .6s ease; + -o-transition: width .6s ease; + transition: width .6s ease; } .info-box-icon { border-top-left-radius: 2px; @@ -81,6 +94,8 @@ a.info-box-text{ text-decoration: none;} margin: 0; } + + /* ICONS */ .info-box-icon { color: #fff !important; @@ -154,6 +169,62 @@ a.info-box-text{ text-decoration: none;} } +/* USING FONTAWESOME FOR WEATHER */ +.info-box-weather .info-box-icon{ + background: rgba(0, 0, 0, 0); !important; +} +.fa-weather-level0:before{ + content: "\f185"; + color : #cccccc; +} +.fa-weather-level1:before{ + content: "\f6c4"; + color : #cccccc; +} +.fa-weather-level2:before{ + content: "\f0c2"; + color : #cccccc; +} +.fa-weather-level3:before{ + content: "\f740"; + color : #cccccc; +} +.fa-weather-level4:before{ + content: "\f0e7"; + color : #b91f1f; +} + +/* USING IMAGES FOR WEATHER INTEAD OF FONT AWESOME */ +/* For other themes just uncomment this part */ +/*.info-box-weather-level0, +.info-box-weather-level1, +.info-box-weather-level2, +.info-box-weather-level3, +.info-box-weather-level4 { + background-position: 15px 50%; + background-repeat: no-repeat; +} + +.info-box-weather .info-box-icon{ + display: none !important; +} +.info-box-weather-level0 { + background-image: url("img/weather/weather-clear.png"); +} +.info-box-weather-level1 { + background-image: url("img/weather/weather-few-clouds.png"); +} +.info-box-weather-level2 { + background-image: url("img/weather/weather-clouds.png"); +} +.info-box-weather-level3 { + background-image: url("img/weather/weather-many-clouds.png"); +} +.info-box-weather-level4 { + background-image: url("img/weather/weather-storm.png"); +}*/ + + .box-flex-container{ display: flex; /* or inline-flex */