0
0
Fork 0

feat: replace stickyButtons by subtoolbar

This commit is contained in:
Javier Segarra 2024-07-12 15:22:29 +02:00
parent 4cbca1ca64
commit fceeaea1f5
2 changed files with 24 additions and 49 deletions

View File

@ -392,22 +392,6 @@ function highlightNewRow(index) {
const openEditTableCellDialog = () => {
editTableCellDialogRef.value.show();
};
async function showBadDates() {
try {
if (!checked.value) fixedPrices.value = fixedPricesOriginalData.value;
else {
rowsSelected.value = [];
const { data } = await axios.get('FixedPrices/filter', {
params: {
showBadDates: checked.value,
},
});
fixedPrices.value = data;
}
} catch (error) {
console.error(error);
}
}
const onEditCellDataSaved = async () => {
rowsSelected.value = [];
await fetchFixedPrices();
@ -480,13 +464,16 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</RightMenu>
<VnSubToolbar>
<template #st-data>
<QCheckbox
size="sm"
v-model="checked"
:label="t(`Show future items`)"
@update:model-value="showBadDates"
<QBtn
v-if="rowsSelected.length"
@click="openEditTableCellDialog()"
color="primary"
icon="edit"
>
</QCheckbox>
<QTooltip>
{{ t('Edit fixed price(s)') }}
</QTooltip>
</QBtn>
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-md">
@ -700,32 +687,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
{{ t('Add') }}
</QTooltip>
</QPageSticky>
<QPageSticky v-if="rowsSelected.length" :offset="[20, 60]">
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
<QTooltip>
{{ t('Edit fixed price(s)') }}
</QTooltip>
</QPageSticky>
<QPageSticky
:offset="[20, 120]"
v-if="tableRef?.rows?.length > 0 && checked && rowsSelected.length > 0"
>
<QBtn
color="primary"
fab
icon="delete"
@click.stop="
openConfirmationModal(
t('This row will be removed'),
t('Do you want to clone this item?'),
() => removeFuturePrice()
)
"
/>
<QTooltip>
{{ t('Add') }}
</QTooltip>
</QPageSticky>
<QDialog ref="editTableCellDialogRef">
<EditTableCellValueForm
edit-url="FixedPrices/editFixedPrice"

View File

@ -30,7 +30,9 @@ const sanitizeParam = (param) => {
};
const $params = ref({});
onMounted(() => {
['mine', 'hasMinPrice'].forEach((tag) => ($params.value[tag] = sanitizeParam(tag)));
['mine', 'hasMinPrice', 'showBadDates'].forEach(
(tag) => ($params.value[tag] = sanitizeParam(tag))
);
});
const pushParam = (param) => ({
param: { [param]: $params.value[param] },
@ -109,6 +111,17 @@ const pushParam = (param) => ({
@update:model-value="searchFn(pushParam('mine'))"
/>
</QItemSection>
<QItemSection>
<QCheckbox
size="sm"
v-model="checked"
:label="t(`Show future items`)"
:true-value="'true'"
:false-value="'false'"
@update:model-value="searchFn(pushParam('showBadDates'))"
>
</QCheckbox>
</QItemSection>
<QItemSection>
<QCheckbox
:label="t('components.itemsFilterPanel.hasMinPrice')"