nova-money-field icon indicating copy to clipboard operation
nova-money-field copied to clipboard

Red for negative and Green for positive values

Open eAvio opened this issue 3 years ago • 1 comments

Hi,

This would be very nice addon.

In Money.php it could be something like this:

   $formattedValue = $this->inMinorUnits ? $value / $this->minorUnit($currency) : (float) $value;

   if($value < 0)
   {
       $formattedValue = '<span style="color:red">' . $value . '</span>';
   }
   else
   {
       $formattedValue = '<span style="color:green">' . $value . '</span>';
   }
              
   return $formattedValue;

and then in IndexField.vue and detailField.vue we should allow value in html format

v-html="formattedValue">

eAvio avatar Feb 13 '21 16:02 eAvio

hi @eAvio - this seems like a reasonable idea, Questions

  • would this affect only detail/display or would this also apply edit screens
  • would this be configurable as to the colours?
  • i'm guessing in detail/display this would be the text colour..

BinaryKitten avatar Feb 13 '21 21:02 BinaryKitten