Move out functionality

This commit is contained in:
benguozakinci@gmail.com 2021-09-02 14:50:07 +03:00
parent 0a9193479a
commit bcc97e3d72

View File

@ -95,24 +95,9 @@ trait Charts
]; ];
} }
public function formatMoney( ){ public function formatMoney($str){
return new Raw(
} "
public function getLineChartOptions()
{
return [
'tooltips' => [
'backgroundColor' => '#000000',
'titleFontColor' => '#ffffff',
'bodyFontColor' => '#e5e5e5',
'bodySpacing' => 4,
'YrPadding' => 12,
'mode' => 'nearest',
'intersect' => 0,
'position' => 'nearest',
'callbacks' => [
'label' => new Raw("function(tooltipItem, data) {
const moneySettings = { const moneySettings = {
decimal: '" . config('money.' . setting('default.currency') . '.decimal_mark') . "', decimal: '" . config('money.' . setting('default.currency') . '.decimal_mark') . "',
thousands: '". config('money.' . setting('default.currency') . '.thousands_separator') . "', thousands: '". config('money.' . setting('default.currency') . '.thousands_separator') . "',
@ -121,7 +106,7 @@ trait Charts
precision: '" . config('money.' . setting('default.currency') . '.precision') . "', precision: '" . config('money.' . setting('default.currency') . '.precision') . "',
}; };
const formattedCurrency = function (input, opt = moneySettings) { const $str = function (input, opt = moneySettings) {
function fixed (precision) { function fixed (precision) {
return Math.max(0, Math.min(precision, 20)); return Math.max(0, Math.min(precision, 20));
}; };
@ -157,8 +142,24 @@ trait Charts
} }
return negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.suffix; return negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.suffix;
}; }"
);
}
public function getLineChartOptions()
{
return [
'tooltips' => [
'backgroundColor' => '#000000',
'titleFontColor' => '#ffffff',
'bodyFontColor' => '#e5e5e5',
'bodySpacing' => 4,
'YrPadding' => 12,
'mode' => 'nearest',
'intersect' => 0,
'position' => 'nearest',
'callbacks' => [
'label' => new Raw("function(tooltipItem, data) {
return formattedCurrency(tooltipItem.yLabel, moneySettings); return formattedCurrency(tooltipItem.yLabel, moneySettings);
}") }")
], ],