Invoice/Bill create/edit page javascript code line changes.
This commit is contained in:
		@@ -174,9 +174,7 @@
 | 
			
		||||
        var item_row = '{{ $item_row }}';
 | 
			
		||||
        var autocomplete_path = "{{ url('common/items/autocomplete') }}";
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            var currency_code = $('#currency_code').val();
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function() {
 | 
			
		||||
            @if (old('item'))
 | 
			
		||||
            $('#vendor_id').trigger('change');
 | 
			
		||||
            @endif
 | 
			
		||||
@@ -258,7 +256,7 @@
 | 
			
		||||
                url: '{{ url("expenses/bills/addItem") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {item_row: item_row, currency_code : currency_code},
 | 
			
		||||
                data: {item_row: item_row, currency_code : $('#currency_code').val()},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('#items tbody #addItem').before(json['html']);
 | 
			
		||||
@@ -300,24 +298,6 @@
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#tax-add-new', function(e){
 | 
			
		||||
            tax_name = $('.select2-search__field').val();
 | 
			
		||||
 | 
			
		||||
            $('#modal-create-tax').remove();
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("modals/taxes/create") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {name: tax_name},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('body').append(json['html']);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '.form-control.typeahead', function() {
 | 
			
		||||
            input_id = $(this).attr('id').split('-');
 | 
			
		||||
 | 
			
		||||
@@ -356,6 +336,24 @@
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#tax-add-new', function(e) {
 | 
			
		||||
            tax_name = $('.select2-search__field').val();
 | 
			
		||||
 | 
			
		||||
            $('#modal-create-tax').remove();
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("modals/taxes/create") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {name: tax_name},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('body').append(json['html']);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $('a[rel=popover]').popover({
 | 
			
		||||
            html: true,
 | 
			
		||||
            placement: 'bottom',
 | 
			
		||||
 
 | 
			
		||||
@@ -155,74 +155,7 @@
 | 
			
		||||
        var item_row = '{{ $item_row }}';
 | 
			
		||||
        var autocomplete_path = "{{ url('common/items/autocomplete') }}";
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#button-add-item', function (e) {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("expenses/bills/addItem") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {item_row: item_row, currency_code : currency_code},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('#items tbody #addItem').before(json['html']);
 | 
			
		||||
                        //$('[rel=tooltip]').tooltip();
 | 
			
		||||
 | 
			
		||||
                        $('[data-toggle="tooltip"]').tooltip('hide');
 | 
			
		||||
 | 
			
		||||
                        $('#item-row-' + item_row + ' .tax-select2').select2({
 | 
			
		||||
                            placeholder: {
 | 
			
		||||
                                id: '-1', // the value of the option
 | 
			
		||||
                                text: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
                            },
 | 
			
		||||
                            escapeMarkup: function (markup) {
 | 
			
		||||
                                return markup;
 | 
			
		||||
                            },
 | 
			
		||||
                            language: {
 | 
			
		||||
                                noResults: function () {
 | 
			
		||||
                                    return '<span id="tax-add-new"><i class="fa fa-plus"> {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}</span>';
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        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++;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#tax-add-new', function(e){
 | 
			
		||||
            tax_name = $('.select2-search__field').val();
 | 
			
		||||
 | 
			
		||||
            $('#modal-create-tax').remove();
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("modals/taxes/create") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {name: tax_name},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('body').append(json['html']);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function(){
 | 
			
		||||
            var currency_code = $('#currency_code').val();
 | 
			
		||||
 | 
			
		||||
        $(document).ready(function() {
 | 
			
		||||
            $('#vendor_id').trigger('change');
 | 
			
		||||
 | 
			
		||||
            itemTableResize();
 | 
			
		||||
@@ -326,6 +259,53 @@
 | 
			
		||||
        });
 | 
			
		||||
        @endif
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#button-add-item', function (e) {
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("expenses/bills/addItem") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {item_row: item_row, currency_code : $('#currency_code').val()},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('#items tbody #addItem').before(json['html']);
 | 
			
		||||
                        //$('[rel=tooltip]').tooltip();
 | 
			
		||||
 | 
			
		||||
                        $('[data-toggle="tooltip"]').tooltip('hide');
 | 
			
		||||
 | 
			
		||||
                        $('#item-row-' + item_row + ' .tax-select2').select2({
 | 
			
		||||
                            placeholder: {
 | 
			
		||||
                                id: '-1', // the value of the option
 | 
			
		||||
                                text: "{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}"
 | 
			
		||||
                            },
 | 
			
		||||
                            escapeMarkup: function (markup) {
 | 
			
		||||
                                return markup;
 | 
			
		||||
                            },
 | 
			
		||||
                            language: {
 | 
			
		||||
                                noResults: function () {
 | 
			
		||||
                                    return '<span id="tax-add-new"><i class="fa fa-plus"> {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}</span>';
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
                        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++;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '.form-control.typeahead', function() {
 | 
			
		||||
            input_id = $(this).attr('id').split('-');
 | 
			
		||||
 | 
			
		||||
@@ -364,6 +344,24 @@
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#tax-add-new', function(e) {
 | 
			
		||||
            tax_name = $('.select2-search__field').val();
 | 
			
		||||
 | 
			
		||||
            $('#modal-create-tax').remove();
 | 
			
		||||
 | 
			
		||||
            $.ajax({
 | 
			
		||||
                url: '{{ url("modals/taxes/create") }}',
 | 
			
		||||
                type: 'GET',
 | 
			
		||||
                dataType: 'JSON',
 | 
			
		||||
                data: {name: tax_name},
 | 
			
		||||
                success: function(json) {
 | 
			
		||||
                    if (json['success']) {
 | 
			
		||||
                        $('body').append(json['html']);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $('a[rel=popover]').popover({
 | 
			
		||||
            html: true,
 | 
			
		||||
            placement: 'bottom',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user