feat: disable create new if not select branch

This commit is contained in:
Methapon2001 2024-12-12 12:09:28 +07:00
parent ae5412da5f
commit 13149724c6
2 changed files with 20 additions and 4 deletions

View file

@ -92,16 +92,30 @@ onMounted(async () => {
</template>
<template #before-options v-if="creatable">
<q-item clickable v-close-popup @click.stop="$emit('create')">
<q-item
:disable="creatableDisabled"
clickable
v-close-popup
@click.stop="$emit('create')"
>
<q-item-section>
<b class="row items-center">
<span class="row items-center">
<q-icon
name="mdi-plus-circle-outline"
class="q-mr-sm"
style="color: hsl(var(--positive-bg))"
/>
{{ $t('general.add', { text: $t('quotation.newCustomer') }) }}
</b>
<b>
{{ $t('general.add', { text: $t('quotation.newCustomer') }) }}
</b>
<span
v-if="creatableDisabled && creatableDisabledText"
class="app-text-muted q-pl-xs"
style="font-size: 80%"
>
{{ creatableDisabledText }}
</span>
</span>
</q-item-section>
</q-item>

View file

@ -4,6 +4,8 @@ import { Ref, watch } from 'vue';
export type SelectProps<T extends (...args: any[]) => any> = {
params?: Parameters<T>[0];
creatable?: boolean;
creatableDisabled?: boolean;
creatableDisabledText?: string;
label?: string;
placeholder?: string;
readonly?: boolean;