Update input select create
This commit is contained in:
parent
8b112f3409
commit
a8c6b6f638
|
@ -27,7 +27,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const popup = ref(null);
|
const showForm = ref(false);
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -38,35 +38,31 @@ const value = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const isDeliveryAssistant = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
return role.hasAny($props.rolesAllowedToCreate);
|
return role.hasAny($props.rolesAllowedToCreate);
|
||||||
});
|
});
|
||||||
|
|
||||||
const openCreateForm = () => {
|
const toggleForm = () => {
|
||||||
popup.value.show();
|
showForm.value = !showForm.value;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSelectFilter
|
<VnSelectFilter v-model="value" :options="options">
|
||||||
label="Label"
|
<template v-if="isAllowedToCreate" #append>
|
||||||
v-model="value"
|
|
||||||
:options="options"
|
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
hide-selected
|
|
||||||
>
|
|
||||||
<template v-if="isDeliveryAssistant" #append>
|
|
||||||
<QIcon
|
<QIcon
|
||||||
@click.stop.prevent="openCreateForm()"
|
@click.stop.prevent="toggleForm()"
|
||||||
name="add"
|
name="add"
|
||||||
size="19px"
|
size="19px"
|
||||||
class="add-icon"
|
class="add-icon"
|
||||||
/>
|
/>
|
||||||
<QDialog ref="popup" cover transition-show="scale" transition-hide="scale">
|
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||||
<slot name="form" />
|
<slot name="form" @close-form="toggleForm()" />
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
|
<slot :name="slotName" v-bind="slotData" :key="slotName" />
|
||||||
|
</template>
|
||||||
</VnSelectFilter>
|
</VnSelectFilter>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue