feat: add reject cancel option to QuotationCard and KebabAction components

This commit is contained in:
puriphatt 2025-03-13 11:47:30 +07:00
parent ab51d7a8db
commit f850511173
2 changed files with 39 additions and 3 deletions

View file

@ -24,6 +24,7 @@ defineProps<{
hideAction?: boolean; hideAction?: boolean;
useCancel?: boolean; useCancel?: boolean;
disableCancel?: boolean; disableCancel?: boolean;
useRejectCancel?: boolean;
customData?: { customData?: {
label: string; label: string;
@ -41,6 +42,7 @@ defineEmits<{
(e: 'example'): void; (e: 'example'): void;
(e: 'preview'): void; (e: 'preview'): void;
(e: 'cancel'): void; (e: 'cancel'): void;
(e: 'rejectCancel'): void;
}>(); }>();
const rand = Math.random(); const rand = Math.random();
@ -62,15 +64,16 @@ const rand = Math.random();
solid solid
/> />
</div> </div>
<div class="q-mr-sm" style="font-size: 90%"> <div class="q-mr-sm col row q-gutter-xs" style="font-size: 90%">
<BadgeComponent <BadgeComponent
:title="status" :title="status"
:hsla-color="badgeColor || '--blue-6-hsl'" :hsla-color="badgeColor || '--blue-6-hsl'"
:border="urgent" :border="urgent"
/> />
<slot name="badge"></slot>
</div> </div>
<nav class="col text-right no-wrap"> <nav class="text-right no-wrap">
<q-btn <q-btn
v-if="!hidePreview" v-if="!hidePreview"
flat flat
@ -97,6 +100,7 @@ const rand = Math.random();
hide-toggle hide-toggle
:use-cancel :use-cancel
:disable-cancel :disable-cancel
:use-reject-cancel
:hide-delete="hideKebabDelete" :hide-delete="hideKebabDelete"
:hide-view="hideKebabView" :hide-view="hideKebabView"
:hide-edit="hideKebabEdit" :hide-edit="hideKebabEdit"
@ -106,6 +110,7 @@ const rand = Math.random();
@upload="$emit('upload')" @upload="$emit('upload')"
@delete="$emit('delete')" @delete="$emit('delete')"
@cancel="$emit('cancel')" @cancel="$emit('cancel')"
@reject-cancel="$emit('rejectCancel')"
/> />
</nav> </nav>
</header> </header>

View file

@ -15,6 +15,7 @@ const props = withDefaults(
useLink?: boolean; useLink?: boolean;
useUpload?: boolean; useUpload?: boolean;
useCancel?: boolean; useCancel?: boolean;
useRejectCancel?: boolean;
disableCancel?: boolean; disableCancel?: boolean;
disableDelete?: boolean; disableDelete?: boolean;
}>(), }>(),
@ -31,6 +32,7 @@ defineEmits<{
(e: 'upload'): void; (e: 'upload'): void;
(e: 'delete'): void; (e: 'delete'): void;
(e: 'cancel'): void; (e: 'cancel'): void;
(e: 'rejectCancel'): void;
(e: 'changeStatus'): void; (e: 'changeStatus'): void;
}>(); }>();
@ -193,12 +195,41 @@ watch(
}" }"
/> />
<span class="col-9 q-px-md flex items-center"> <span class="col-9 q-px-md flex items-center">
<slot name="labelDelete"> <slot name="labelCancel">
{{ $t('general.cancel') }} {{ $t('general.cancel') }}
</slot> </slot>
</span> </span>
</q-item> </q-item>
<q-item
v-if="useRejectCancel"
v-close-popup
dense
class="row"
style="white-space: nowrap"
:clickable="!disableCancel"
:id="`btn-kebab-delete-${idName}`"
:class="{
'surface-3': disableCancel,
'app-text-muted': disableCancel,
}"
@click.stop="() => $emit('rejectCancel')"
>
<q-icon
size="xs"
name="mdi-close"
class="col-3"
:class="{
'app-text-negative': !disableCancel,
}"
/>
<span class="col-9 q-px-md flex items-center">
<slot name="labelRejectCancel">
{{ $t('requestList.status.work.RejectCancel') }}
</slot>
</span>
</q-item>
<q-item v-if="!hideToggle" dense> <q-item v-if="!hideToggle" dense>
<q-item-section class="q-py-sm"> <q-item-section class="q-py-sm">
<div class="q-pa-sm surface-2 rounded flex items-center"> <div class="q-pa-sm surface-2 rounded flex items-center">