refs #1147 invoice item create inline..
This commit is contained in:
@@ -487,9 +487,21 @@ export default {
|
||||
description: "Selectbox search option not found item message"
|
||||
},
|
||||
|
||||
remoteAction: null,
|
||||
remoteType: 'invoice',
|
||||
currecnyCode: 'USD',
|
||||
remoteAction: {
|
||||
type: String,
|
||||
default: null,
|
||||
description: "Selectbox remote action path"
|
||||
},
|
||||
remoteType: {
|
||||
type: String,
|
||||
default: 'invoice',
|
||||
description: "Ger remote item type."
|
||||
},
|
||||
currencyCode: {
|
||||
type: String,
|
||||
default: 'USD',
|
||||
description: "Get remote item price currecy code"
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -572,7 +584,11 @@ export default {
|
||||
|
||||
onAddItem() {
|
||||
// Get Select Input value
|
||||
var value = this.$children[0].$children[0].$children[0].$refs.input.value;
|
||||
if (this.title) {
|
||||
var value = this.$children[0].$children[0].$children[0].$refs.input.value;
|
||||
} else {
|
||||
var value = this.$children[0].$children[0].$refs.input.value;
|
||||
}
|
||||
|
||||
if (this.add_new.type == 'inline') {
|
||||
this.addInline(value);
|
||||
@@ -582,7 +598,31 @@ export default {
|
||||
},
|
||||
|
||||
addInline(value) {
|
||||
axios.post(this.add_new.path, {
|
||||
'_token': window.Laravel.csrfToken,
|
||||
'type': 'inline',
|
||||
field: this.add_new.field,
|
||||
value: value,
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data.success) {
|
||||
this.selectOptions = [];
|
||||
|
||||
this.selectOptions.push(response.data.data);
|
||||
this.real_model = response.data.data.id;
|
||||
|
||||
this.change();
|
||||
|
||||
if (this.title) {
|
||||
this.$children[0].$children[0].visible = false;
|
||||
} else {
|
||||
this.$children[0].visible = false;
|
||||
}
|
||||
//this.add_new.status = false;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
});
|
||||
},
|
||||
|
||||
onModal(value) {
|
||||
@@ -593,7 +633,11 @@ export default {
|
||||
add_new.status = true;
|
||||
add_new.html = response.data.html;
|
||||
|
||||
this.$children[0].$children[0].visible = false;
|
||||
if (this.title) {
|
||||
this.$children[0].$children[0].visible = false;
|
||||
} else {
|
||||
this.$children[0].visible = false;
|
||||
}
|
||||
|
||||
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
|
||||
resolve({
|
||||
@@ -644,7 +688,7 @@ export default {
|
||||
|
||||
this.change();
|
||||
|
||||
this.add_new.status = false;
|
||||
//this.add_new.status = false;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
4
resources/assets/js/views/sales/invoices.js
vendored
4
resources/assets/js/views/sales/invoices.js
vendored
@@ -16,8 +16,10 @@ import Form from './../../plugins/form';
|
||||
import Error from './../../plugins/error';
|
||||
import BulkAction from './../../plugins/bulk-action';
|
||||
|
||||
import { Link } from 'element-ui';
|
||||
|
||||
// plugin setup
|
||||
Vue.use(DashboardPlugin);
|
||||
Vue.use(DashboardPlugin, Link);
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app',
|
||||
|
||||
25
resources/views/modals/items/create.blade.php
Normal file
25
resources/views/modals/items/create.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
{!! Form::open([
|
||||
'route' => 'items.store',
|
||||
'id' => 'item',
|
||||
'@submit.prevent' => 'onSubmit',
|
||||
'@keydown' => 'form.errors.clear($event.target.name)',
|
||||
'role' => 'form',
|
||||
'class' => 'form-loading-button',
|
||||
'novalidate' => true
|
||||
]) !!}
|
||||
<div class="row">
|
||||
{{ Form::textGroup('name', trans('general.name'), 'tag') }}
|
||||
|
||||
{{ Form::selectAddNewGroup('tax_id', trans_choice('general.taxes', 1), 'percentage', $taxes, setting('default.tax'), ['path' => route('modals.taxes.create')]) }}
|
||||
|
||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||
|
||||
{{ Form::textGroup('sale_price', trans('items.sales_price'), 'money-bill-wave') }}
|
||||
|
||||
{{ Form::textGroup('purchase_price', trans('items.purchase_price'), 'money-bill-wave-alt') }}
|
||||
|
||||
{{ Form::selectAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, null, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=item']) }}
|
||||
|
||||
{!! Form::hidden('enabled', '1', []) !!}
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
@@ -38,6 +38,10 @@
|
||||
:form-error="form.errors.get('{{ $name }}')"
|
||||
@endif
|
||||
|
||||
:remote-action="'{{ $attributes['remote_action'] }}'"
|
||||
:remote-type="'{{ $attributes['remote_type'] }}'"
|
||||
:currency-code="{{ $attributes['currecny_code'] }}"
|
||||
|
||||
:loading-text="'{{ trans('general.loading') }}'"
|
||||
:no-data-text="'{{ trans('general.no_data') }}'"
|
||||
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
|
||||
|
||||
@@ -24,22 +24,10 @@
|
||||
:value="'{{ old('item_id', '') }}'"
|
||||
:add-new="{{ json_encode([
|
||||
'status' => true,
|
||||
'text' => trans('general.form.add_new', ['field' => trans_choice('general.items', 1)]),
|
||||
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
||||
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
||||
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
||||
'buttons' => [
|
||||
'cancel' => [
|
||||
'text' => trans('general.cancel'),
|
||||
'icon' => 'fas fa-times',
|
||||
'class' => 'btn-outline-secondary'
|
||||
],
|
||||
'confirm' => [
|
||||
'text' => trans('general.save'),
|
||||
'icon' => 'fas fa-save',
|
||||
'class' => 'btn-success'
|
||||
]
|
||||
]
|
||||
'text' => trans('general.form.add_new', ['field' => '']),
|
||||
'path' => route('modals.items.store'),
|
||||
'type' => 'inline',
|
||||
'field' => 'name',
|
||||
])}}"
|
||||
@interface="row.item_id = $event"
|
||||
@label="row.name = $event"
|
||||
|
||||
Reference in New Issue
Block a user