javier94
Member
I have asked to the yootheme support if the stacked bar is supported... if we can not find.. i can make the presentation with this one color bar... maybe would be ok
i have been testing the bar.. but something is weird.. as you can see here.. i added other process to have 3 progress bar and test the colors..
https://iocleane-cp22.webjoomla.es/oldselectiumlab/index.php/ca/resultats
15/07 --> we are today at 14/07 --> should be red color.. color is ok ... is less than 1 day --> but till tomorrow will not be 100%.. should almost 100 but not 100
09/07 --> when data is end --> color should be red color.. because date of element is older than today --> and % should be 100% --> appears orange color and percentatge 16,7%
22/07 --> i create this data to see --> when is more than 6 days... so color should be green.. and percentaje i dont know.. but not 0% ( or maybe tomorrow percentatge grow)
there is something is not calculating perfect --> IF we can Solving these small mistakes would be fine and the bar would be ok...
last code is:
----------------------------
// get the date from the 'raw' placeholder
$myDate = '{job_a_offer___fi_proces_raw}';
// make sure it's a date and (for example) not blank (if we don't do this, DateTime will error out)
if (FabrikWorker::isDate($myDate)) {
// use DateTime to get the days diff
$myDate = new DateTime($myDate);
$today = new DateTime();
$diff = $myDate->diff($today);
// if days is >6, just set it to 6
$days = $diff->days >= 6 ? 6 : $diff->days;
// get the percentage
$percent = round((($days / 6) * 100), 1);
// flip the percentage into the value we show
$value = 100 - $percent;
// set the bg class
if ($days >= 6) {
$color = 'green';
}
else if ($days <= 5 && $days >= 3) {
$color = 'orange';
}
else {
$color = 'red';
}
// render it
return '<div class="progress">
<div class="progress-bar ' . $color . '" role="progressbar" aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100" style="width:' . $value . '%; background:' .$color . '">
<span class="sr-only">' . $value . '% Complete</span>
</div>';
}
// if it wasn't a date, return empty
return;
--------------------------
Many thanks!!
i have been testing the bar.. but something is weird.. as you can see here.. i added other process to have 3 progress bar and test the colors..
https://iocleane-cp22.webjoomla.es/oldselectiumlab/index.php/ca/resultats
15/07 --> we are today at 14/07 --> should be red color.. color is ok ... is less than 1 day --> but till tomorrow will not be 100%.. should almost 100 but not 100
09/07 --> when data is end --> color should be red color.. because date of element is older than today --> and % should be 100% --> appears orange color and percentatge 16,7%
22/07 --> i create this data to see --> when is more than 6 days... so color should be green.. and percentaje i dont know.. but not 0% ( or maybe tomorrow percentatge grow)
there is something is not calculating perfect --> IF we can Solving these small mistakes would be fine and the bar would be ok...
last code is:
----------------------------
// get the date from the 'raw' placeholder
$myDate = '{job_a_offer___fi_proces_raw}';
// make sure it's a date and (for example) not blank (if we don't do this, DateTime will error out)
if (FabrikWorker::isDate($myDate)) {
// use DateTime to get the days diff
$myDate = new DateTime($myDate);
$today = new DateTime();
$diff = $myDate->diff($today);
// if days is >6, just set it to 6
$days = $diff->days >= 6 ? 6 : $diff->days;
// get the percentage
$percent = round((($days / 6) * 100), 1);
// flip the percentage into the value we show
$value = 100 - $percent;
// set the bg class
if ($days >= 6) {
$color = 'green';
}
else if ($days <= 5 && $days >= 3) {
$color = 'orange';
}
else {
$color = 'red';
}
// render it
return '<div class="progress">
<div class="progress-bar ' . $color . '" role="progressbar" aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100" style="width:' . $value . '%; background:' .$color . '">
<span class="sr-only">' . $value . '% Complete</span>
</div>';
}
// if it wasn't a date, return empty
return;
--------------------------
Many thanks!!