selectbox add new new style
This commit is contained in:
parent
080c6616c2
commit
67f35aa9a2
@ -55,6 +55,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
<el-option-group
|
<el-option-group
|
||||||
@ -67,6 +69,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-option-group>
|
</el-option-group>
|
||||||
|
|
||||||
@ -124,6 +128,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
<el-option-group
|
<el-option-group
|
||||||
@ -136,6 +142,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-option-group>
|
</el-option-group>
|
||||||
|
|
||||||
@ -193,6 +201,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
<el-option-group
|
<el-option-group
|
||||||
@ -205,6 +215,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-option-group>
|
</el-option-group>
|
||||||
|
|
||||||
@ -262,6 +274,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
<el-option-group
|
<el-option-group
|
||||||
@ -274,6 +288,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-option-group>
|
</el-option-group>
|
||||||
|
|
||||||
@ -331,6 +347,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
<el-option-group
|
<el-option-group
|
||||||
@ -343,6 +361,8 @@
|
|||||||
:key="value"
|
:key="value"
|
||||||
:label="label"
|
:label="label"
|
||||||
:value="value">
|
:value="value">
|
||||||
|
<span class="float-left">{{ label }}</span>
|
||||||
|
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-option-group>
|
</el-option-group>
|
||||||
|
|
||||||
@ -356,7 +376,9 @@
|
|||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<component v-bind:is="add_new_html" @submit="onSubmit"></component>
|
<component v-bind:is="add_new_html" @submit="onSubmit" @cancel="onCancel"></component>
|
||||||
|
|
||||||
|
<span slot="infoBlock" class="badge badge-success badge-resize float-right" v-if="new_options[real_model]">{{ new_text }}</span>
|
||||||
|
|
||||||
<select :name="name" v-model="real_model" class="d-none">
|
<select :name="name" v-model="real_model" class="d-none">
|
||||||
<option v-for="(label, value) in selectOptions" :value="value">{{ label }}</option>
|
<option v-for="(label, value) in selectOptions" :value="value">{{ label }}</option>
|
||||||
@ -447,6 +469,7 @@ export default {
|
|||||||
path: null,
|
path: null,
|
||||||
type: 'modal', // modal, inline
|
type: 'modal', // modal, inline
|
||||||
field: 'name',
|
field: 'name',
|
||||||
|
new_text: 'New',
|
||||||
buttons: {}
|
buttons: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -493,15 +516,28 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
add_new: this.addNew,
|
add_new: {
|
||||||
|
text: this.addNew.text,
|
||||||
|
show: false,
|
||||||
|
path: this.addNew.path,
|
||||||
|
type: this.addNew.type, // modal, inline
|
||||||
|
field: this.addNew.name,
|
||||||
|
buttons: this.addNew.buttons
|
||||||
|
},
|
||||||
add_new_text: this.addNew.text,
|
add_new_text: this.addNew.text,
|
||||||
|
new_text: this.addNew.new_text,
|
||||||
selectOptions: this.options,
|
selectOptions: this.options,
|
||||||
real_model: this.model,
|
real_model: this.model,
|
||||||
add_new_html: '',
|
add_new_html: '',
|
||||||
form: {},
|
form: {},
|
||||||
|
new_options: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.new_options = {};
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.real_model = this.value;
|
this.real_model = this.value;
|
||||||
|
|
||||||
@ -534,14 +570,14 @@ export default {
|
|||||||
|
|
||||||
axios.get(this.add_new.path)
|
axios.get(this.add_new.path)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
add_new.status = true;
|
add_new.show = true;
|
||||||
add_new.html = response.data.html;
|
add_new.html = response.data.html;
|
||||||
|
|
||||||
this.$children[0].$children[0].visible = false;
|
this.$children[0].$children[0].visible = false;
|
||||||
|
|
||||||
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
|
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
|
||||||
resolve({
|
resolve({
|
||||||
template: '<div><akaunting-modal-add-new :show="add_new.status" @submit="onSubmit" @cancel="add_new.status = false" :buttons="add_new.buttons" :title="add_new.text" :is_component=true :message="add_new.html"></akaunting-modal-add-new></div>',
|
template: '<div><akaunting-modal-add-new :show="add_new.show" @submit="onSubmit" @cancel="onCancel" :buttons="add_new.buttons" :title="add_new.text" :is_component=true :message="add_new.html"></akaunting-modal-add-new></div>',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
AkauntingModalAddNew,
|
AkauntingModalAddNew,
|
||||||
@ -562,6 +598,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
onSubmit(event) {
|
onSubmit(event) {
|
||||||
this.$emit('submit', event);
|
this.$emit('submit', event);
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel(event) {
|
||||||
|
this.$emit('cancel', event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -584,11 +624,15 @@ export default {
|
|||||||
|
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
this.selectOptions[response.data.data.id] = response.data.data['name'];
|
this.selectOptions[response.data.data.id] = response.data.data['name'];
|
||||||
|
this.new_options[response.data.data.id] = response.data.data.id;
|
||||||
this.real_model = response.data.data.id.toString();
|
this.real_model = response.data.data.id.toString();
|
||||||
|
|
||||||
this.change();
|
this.change();
|
||||||
|
|
||||||
//this.add_new.status = false;
|
this.add_new.show = false;
|
||||||
|
|
||||||
|
this.add_new.html = '';
|
||||||
|
this.add_new_html = null;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -600,6 +644,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onCancel() {
|
||||||
|
this.add_new.show = false;
|
||||||
|
this.add_new.html = null;
|
||||||
|
this.add_new_html = null;
|
||||||
|
},
|
||||||
|
|
||||||
addModal() {
|
addModal() {
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -667,4 +717,11 @@ export default {
|
|||||||
.el-select__footer div span {
|
.el-select__footer div span {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge-resize {
|
||||||
|
float: right;
|
||||||
|
margin-top: -32px;
|
||||||
|
margin-right: 35px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
||||||
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
||||||
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
||||||
|
'new_text' => trans('modules.new'),
|
||||||
'buttons' => [
|
'buttons' => [
|
||||||
'cancel' => [
|
'cancel' => [
|
||||||
'text' => trans('general.cancel'),
|
'text' => trans('general.cancel'),
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@if (!empty($attributes['v-error']))
|
@if (!empty($attributes['v-error']))
|
||||||
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
||||||
@else
|
@else
|
||||||
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
|
:form-classes="[{'has-error': form.errors.has('{{ $name }}') }]"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
icon="{{ $icon }}"
|
icon="{{ $icon }}"
|
||||||
@ -29,6 +29,7 @@
|
|||||||
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
||||||
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
||||||
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
||||||
|
'new_text' => trans('modules.new'),
|
||||||
'buttons' => [
|
'buttons' => [
|
||||||
'cancel' => [
|
'cancel' => [
|
||||||
'text' => trans('general.cancel'),
|
'text' => trans('general.cancel'),
|
||||||
@ -46,7 +47,7 @@
|
|||||||
@elseif (!empty($attributes['data-field']))
|
@elseif (!empty($attributes['data-field']))
|
||||||
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
||||||
@else
|
@else
|
||||||
@interface="form.{{ $name }} = $event"
|
@interface="form.{{ $name }} = $event; form.errors.clear('{{ $name }}');"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!empty($attributes['change']))
|
@if (!empty($attributes['change']))
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@if (!empty($attributes['v-error']))
|
@if (!empty($attributes['v-error']))
|
||||||
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
:form-classes="[{'has-error': {{ $attributes['v-error'] }} }]"
|
||||||
@else
|
@else
|
||||||
:form-classes="[{'has-error': form.errors.get('{{ $name }}') }]"
|
:form-classes="[{'has-error': form.errors.has('{{ $name }}') }]"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
icon="{{ $icon }}"
|
icon="{{ $icon }}"
|
||||||
@ -29,6 +29,7 @@
|
|||||||
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
'path' => isset($attributes['path']) ? $attributes['path']: false,
|
||||||
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
'type' => isset($attributes['type']) ? $attributes['type'] : 'modal',
|
||||||
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
'field' => isset($attributes['field']) ? $attributes['field'] : 'name',
|
||||||
|
'new_text' => trans('modules.new'),
|
||||||
'buttons' => [
|
'buttons' => [
|
||||||
'cancel' => [
|
'cancel' => [
|
||||||
'text' => trans('general.cancel'),
|
'text' => trans('general.cancel'),
|
||||||
@ -48,7 +49,7 @@
|
|||||||
@elseif (!empty($attributes['data-field']))
|
@elseif (!empty($attributes['data-field']))
|
||||||
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
@interface="{{ 'form.' . $attributes['data-field'] . '.' . $name . ' = $event' }}"
|
||||||
@else
|
@else
|
||||||
@interface="form.{{ $name }} = $event"
|
@interface="form.{{ $name }} = $event; form.errors.clear('{{ $name }}');"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (!empty($attributes['change']))
|
@if (!empty($attributes['change']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user