refs #451 Bill create and edit item price mask

This commit is contained in:
cuneytsenturk
2018-08-17 18:17:33 +03:00
parent 15455de4ca
commit ca6788686e
8 changed files with 579 additions and 187 deletions

View File

@@ -139,6 +139,7 @@
<!-- /.box-footer -->
{!! Form::close() !!}
</div>
@endsection
@push('js')
@@ -164,7 +165,7 @@
url: '{{ url("expenses/bills/addItem") }}',
type: 'GET',
dataType: 'JSON',
data: {item_row: item_row},
data: {item_row: item_row, currency_code : $('#currency_code').val()},
success: function(json) {
if (json['success']) {
$('#items tbody #addItem').before(json['html']);
@@ -179,6 +180,19 @@
}
});
var currency = json['data']['currency'];
$("#item-price-" + item_row).maskMoney({
thousands : currency.thousands_separator,
decimal : currency.decimal_mark,
precision : currency.precision,
allowZero : true,
prefix : (currency.symbol_first) ? currency.symbol : '',
suffix : (currency.symbol_first) ? '' : currency.symbol
});
$("#item-price-" + item_row).trigger('focusout');
item_row++;
}
}
@@ -186,6 +200,20 @@
});
$(document).ready(function(){
$(".input-price").maskMoney({
thousands : '{{ $currency->thousands_separator }}',
decimal : '{{ $currency->decimal_mark }}',
precision : {{ $currency->precision }},
allowZero : true,
@if($currency->symbol_first)
prefix : '{{ $currency->symbol }}'
@else
suffix : '{{ $currency->symbol }}'
@endif
});
$('.input-price').trigger('focusout');
//Date picker
$('#billed_at').datepicker({
format: 'yyyy-mm-dd',
@@ -341,6 +369,23 @@
$('#currency_code').val(data.currency_code);
$('#currency_rate').val(data.currency_rate);
$('.input-price').each(function(){
amount = $(this).maskMoney('unmasked')[0];
$(this).maskMoney({
thousands : data.thousands_separator,
decimal : data.decimal_mark,
precision : data.precision,
allowZero : true,
prefix : (data.symbol_first) ? data.symbol : '',
suffix : (data.symbol_first) ? '' : data.symbol
});
$(this).val(amount);
$(this).trigger('focusout');
});
// This event Select2 Stylesheet
$('#currency_code').trigger('change');
}