Added comma in US currency format [ch16628]
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
@@ -44,7 +44,11 @@ class Helper
|
||||
public static function formatCurrencyOutput($cost)
|
||||
{
|
||||
if (is_numeric($cost)) {
|
||||
return number_format($cost, 2, '.', '');
|
||||
|
||||
if (Setting::getSettings()->digit_separator=='1.234,56') {
|
||||
return number_format($cost, 2, ',', '.');
|
||||
}
|
||||
return number_format($cost, 2, '.', ',');
|
||||
}
|
||||
// It's already been parsed.
|
||||
return $cost;
|
||||
|
||||
@@ -145,7 +145,6 @@ class AssetPresenter extends Presenter
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'title' => trans('general.purchase_cost'),
|
||||
'formatter' => 'numberWithCommas',
|
||||
'footerFormatter' => 'sumFormatter',
|
||||
], [
|
||||
'field' => 'order_number',
|
||||
|
||||
@@ -400,7 +400,7 @@ Form::macro('time_display_format', function ($name = 'time_display_format', $sel
|
||||
|
||||
Form::macro('digit_separator', function ($name = 'digit_separator', $selected = null, $class = null) {
|
||||
$formats = [
|
||||
'1234.56',
|
||||
'1,234.56',
|
||||
'1.234,56',
|
||||
];
|
||||
|
||||
|
||||
@@ -608,9 +608,13 @@
|
||||
|
||||
function numberWithCommas(value) {
|
||||
if ((value) && ("{{$snipeSettings->digit_separator}}" == "1.234,56")){
|
||||
var parts = value.toString().split(".");
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
return parts.join(",");
|
||||
var parts = value.toString().split(".");
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
return parts.join(",");
|
||||
} else {
|
||||
var parts = value.toString().split(",");
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
return parts.join(".");
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user