refs #451 Invoice item currency
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
<td>
|
||||
@stack('price_input_start')
|
||||
<input value="{{ empty($item) ? '' : $item->price }}" class="form-control text-right" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
|
||||
<input value="{{ $currency->code }}" name="item[{{ $item_row }}][currency]" type="hidden" id="item-currency-{{ $item_row }}">
|
||||
@stack('price_input_end')
|
||||
</td>
|
||||
@stack('price_td_end')
|
||||
|
@ -161,11 +161,13 @@
|
||||
var item_row = '{{ $item_row }}';
|
||||
|
||||
$(document).on('click', '#button-add-item', function (e) {
|
||||
var currency_code = $('#currency_code').val();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("incomes/invoices/addItem") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {item_row: item_row, currency_code : $('#currency_code').val()},
|
||||
data: {item_row: item_row, currency_code : currency_code},
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#items tbody #addItem').before(json['html']);
|
||||
@ -371,6 +373,11 @@
|
||||
$('#currency_rate').val(data.currency_rate);
|
||||
|
||||
$('.input-price').each(function(){
|
||||
input_price_id = $(this).attr('id');
|
||||
input_currency_id = input_price_id.replace('price', 'currency');
|
||||
|
||||
$('#' + input_currency_id).val(data.currency_code);
|
||||
|
||||
amount = $(this).maskMoney('unmasked')[0];
|
||||
|
||||
$(this).maskMoney({
|
||||
|
@ -142,11 +142,13 @@
|
||||
var item_row = '{{ $item_row }}';
|
||||
|
||||
$(document).on('click', '#button-add-item', function (e) {
|
||||
var currency_code = $('#currency_code').val();
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("incomes/invoices/addItem") }}',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {item_row: item_row},
|
||||
data: {item_row: item_row, currency_code : currency_code},
|
||||
success: function(json) {
|
||||
if (json['success']) {
|
||||
$('#items tbody #addItem').before(json['html']);
|
||||
@ -403,12 +405,11 @@
|
||||
});
|
||||
|
||||
function totalItem() {
|
||||
|
||||
$.ajax({
|
||||
url: '{{ url("common/items/totalItem") }}',
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'],#items input[type=\'number\'],#items input[type=\'hidden\'], #items textarea, #items select'),
|
||||
data: $('#currency_code, #discount input[type=\'number\'], #items input[type=\'text\'], #items input[type=\'number\'], #items input[type=\'hidden\'], #items textarea, #items select'),
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
@ -424,6 +425,11 @@
|
||||
$('#grand-total').html(data.grand_total);
|
||||
|
||||
$('.input-price').each(function(){
|
||||
input_price_id = $(this).attr('id');
|
||||
input_currency_id = input_price_id.replace('price', 'currency');
|
||||
|
||||
$('#' + input_currency_id).val(data.currency_code);
|
||||
|
||||
amount = $(this).maskMoney('unmasked')[0];
|
||||
|
||||
$(this).maskMoney({
|
||||
|
@ -25,6 +25,7 @@
|
||||
<td>
|
||||
@stack('price_input_start')
|
||||
<input value="{{ empty($item) ? '' : $item->price }}" class="form-control text-right input-price" required="required" name="item[{{ $item_row }}][price]" type="text" id="item-price-{{ $item_row }}">
|
||||
<input value="{{ $currency->code }}" name="item[{{ $item_row }}][currency]" type="hidden" id="item-currency-{{ $item_row }}">
|
||||
@stack('price_input_end')
|
||||
</td>
|
||||
@stack('price_td_end')
|
||||
|
Reference in New Issue
Block a user