diff --git a/public/css/app.css b/public/css/app.css index 9758ac10f..4165d56a3 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -745,3 +745,23 @@ input[type="number"] { padding-left: 0; padding-right: 0; } + +#items .select2-container--default .select2-selection--multiple .select2-selection__choice { + background-color: #6da252; + border: 1px solid #6da252; + margin-bottom: 5px; +} + +#items .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { + color: #fffdfd; +} + +#items span.select2.select2-container.select2-container--default .select2-selection.select2-selection--multiple { + border-color: #d2d6de; + border-radius: 0; +} + +#items .select2-container--default.select2-container--focus .select2-selection--multiple { + border-color: #6da252; + border-radius: 0; +} diff --git a/resources/views/incomes/invoices/create.blade.php b/resources/views/incomes/invoices/create.blade.php index 2b9d28ffb..868647f25 100644 --- a/resources/views/incomes/invoices/create.blade.php +++ b/resources/views/incomes/invoices/create.blade.php @@ -248,6 +248,14 @@ 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 ' {{ trans('general.title.new', ['type' => trans_choice('general.tax_rates', 1)]) }}'; + } } }); @@ -269,6 +277,24 @@ placeholder : '{{ trans('general.form.no_file_selected') }}' }); + $(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']); + } + } + }); + }); + var autocomplete_path = "{{ url('common/items/autocomplete') }}"; $(document).on('click', '.form-control.typeahead', function() { diff --git a/resources/views/incomes/invoices/item.blade.php b/resources/views/incomes/invoices/item.blade.php index 882277924..8b65fb23a 100644 --- a/resources/views/incomes/invoices/item.blade.php +++ b/resources/views/incomes/invoices/item.blade.php @@ -7,7 +7,7 @@ @stack('actions_td_end') @stack('name_td_start') - has('item.' . $item_row . '.name') ? 'class="has-error"' : '' !!}"> + has('item.' . $item_row . '.name') ? 'class="has-error"' : '' !!}> @stack('name_input_start') @@ -16,7 +16,7 @@ @stack('name_td_end') @stack('quantity_td_start') - has('item.' . $item_row . '.quantity') ? 'class="has-error"' : '' }}"> + has('item.' . $item_row . '.quantity') ? 'class="has-error"' : '' }}> @stack('quantity_input_start') {!! $errors->first('item.' . $item_row . '.quantity', '

:message

') !!} @@ -24,7 +24,7 @@ @stack('quantity_td_end') @stack('price_td_start') - has('item.' . $item_row . 'price') ? 'class="has-error"' : '' }}"> + has('item.' . $item_row . 'price') ? 'class="has-error"' : '' }}> @stack('price_input_start') @@ -33,9 +33,9 @@ @stack('price_td_end') @stack('taxes_td_start') - has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}"> + has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}> @stack('tax_id_input_start') - {!! Form::select('item[' . $item_row . '][tax_id]', $taxes, empty($item) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)])]) !!} + {!! Form::select('item[' . $item_row . '][tax_id][]', $taxes, empty($item) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]), 'multiple' => 'true']) !!} {!! $errors->first('item.' . $item_row . '.tax_id', '

:message

') !!} @stack('tax_id_input_end')