refs #451 Banking -> Account currency issue solved
This commit is contained in:
parent
e9d6cecf14
commit
e83eade56a
@ -270,16 +270,15 @@ class Currencies extends Controller
|
||||
{
|
||||
$json = new \stdClass();
|
||||
|
||||
$account_id = request('account_id');
|
||||
$code = request('code');
|
||||
|
||||
if ($account_id) {
|
||||
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
|
||||
// Get currency object
|
||||
$currency = Currency::where('code', $code)->first();
|
||||
|
||||
$json->currency_code = Account::where('id', $account_id)->pluck('currency_code')->first();
|
||||
$json->currency_name = $currencies[$json->currency_code];
|
||||
}
|
||||
// it should be integer for amount mask
|
||||
$currency->precision = (int) $currency->precision;
|
||||
|
||||
return response()->json($json);
|
||||
return response()->json($currency);
|
||||
}
|
||||
|
||||
public function config()
|
||||
@ -288,9 +287,13 @@ class Currencies extends Controller
|
||||
|
||||
$code = request('code');
|
||||
|
||||
// Get currency object
|
||||
$currency = Currency::where('code', $code)->first();
|
||||
if ($code) {
|
||||
$currency = config('money.' . $code);
|
||||
$currency['symbol_first'] = $currency['symbol_first'] ? 1 : 0;
|
||||
|
||||
return response()->json($currency);
|
||||
$json = (object) $currency;
|
||||
}
|
||||
|
||||
return response()->json($json);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,8 @@
|
||||
|
||||
opening_balance = $('#opening_balance').maskMoney('unmasked')[0];
|
||||
|
||||
alert(opening_balance);
|
||||
|
||||
$("#opening_balance").maskMoney({
|
||||
thousands : data.thousands_separator,
|
||||
decimal : data.decimal_mark,
|
||||
@ -91,7 +93,7 @@
|
||||
|
||||
$('#opening_balance').val(opening_balance);
|
||||
|
||||
$('#opening_balance').trigger('focus');
|
||||
$('#opening_balance').trigger('focusout');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
$('#opening_balance').val(opening_balance);
|
||||
|
||||
$('#opening_balance').trigger('focus');
|
||||
$('#opening_balance').trigger('focusout');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user