This commit is contained in:
Cüneyt Şentürk 2021-09-03 00:02:16 +03:00
parent cc73dee749
commit 59282c36f0

View File

@ -2,10 +2,7 @@
namespace App\Traits;
use Akaunting\Money\Money;
use App\Utilities\Chartjs;
use Balping\JsonRaw\Raw;
trait Charts
@ -138,18 +135,18 @@ trait Charts
};
if (typeof input === 'number') {
input = input.toFixed(fixed(opt.precision));
input = input.toFixed(fixed(opt.precision));
};
var negative = input.indexOf('-') >= 0 ? '-' : '';
var numbers = toStr(input).replace(/\D+/g, '') || '0';
var currency = numbersToCurrency(numbers, opt.precision);
var parts = toStr(currency).split('.');
var integer = parts[0].replace(/(\d)(?=(?:\d{3})+\b)/gm, opt.thousands);;
var integer = parts[0].replace(/(\d)(?=(?:\d{3})+\b)/gm, opt.thousands);
var decimal = parts[1];
if(opt.isPrefix == 1) {
return opt.symbol + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal)
if (opt.isPrefix == 1) {
return opt.symbol + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal);
}
return negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.symbol;
@ -193,18 +190,18 @@ trait Charts
};
if (typeof input === 'number') {
input = input.toFixed(fixed(opt.precision));
input = input.toFixed(fixed(opt.precision));
};
var negative = input.indexOf('-') >= 0 ? '-' : '';
var numbers = toStr(input).replace(/\D+/g, '') || '0';
var currency = numbersToCurrency(numbers, opt.precision);
var parts = toStr(currency).split('.');
var integer = parts[0].replace(/(\d)(?=(?:\d{3})+\b)/gm, opt.thousands);;
var integer = parts[0].replace(/(\d)(?=(?:\d{3})+\b)/gm, opt.thousands);
var decimal = parts[1];
if(opt.isPrefix == 1) {
return opt.symbol + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal)
if (opt.isPrefix == 1) {
return opt.symbol + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal);
} else {
return negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.symbol;
}
@ -222,7 +219,7 @@ trait Charts
'ticks' => [
'padding' => 10,
'fontColor' => '#9e9e9e',
]],
],
'gridLines' => [
'drawBorder' => false,
'color' => 'rgba(29,140,248,0.1)',