feat: refs #8944 new date filter and make section use salix's back
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jon Elias 2025-04-25 12:50:28 +02:00
parent f145351cf1
commit c679b77bbd
5 changed files with 50 additions and 30 deletions

View File

@ -77,6 +77,10 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
hasDifferentVerb: {
type: Boolean,
default: false,
},
}); });
const isLoading = ref(false); const isLoading = ref(false);
@ -87,7 +91,7 @@ const formData = ref();
const saveButtonRef = ref(null); const saveButtonRef = ref(null);
const watchChanges = ref(); const watchChanges = ref();
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);
const saveData = ref();
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
defineExpose({ defineExpose({
@ -181,6 +185,7 @@ async function saveChanges(data) {
return; return;
} }
let changes = data || getChanges(); let changes = data || getChanges();
let url = $props.saveUrl || $props.url + '/crud';
if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges); if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges);
try { try {
@ -188,7 +193,8 @@ async function saveChanges(data) {
return; return;
} }
await axios.post($props.saveUrl || $props.url + '/crud', changes); if ($props.hasDifferentVerb) await axios.patch(url, saveData.value);
else await axios.post(url, changes);
} finally { } finally {
isLoading.value = false; isLoading.value = false;
} }
@ -265,6 +271,7 @@ function getChanges() {
} else if (originalData.value[i]) { } else if (originalData.value[i]) {
const data = getDifferences(originalData.value[i], row); const data = getDifferences(originalData.value[i], row);
if (!isEmpty(data)) { if (!isEmpty(data)) {
saveData.value = row;
updates.push({ updates.push({
data, data,
where: { [pk]: row[pk] }, where: { [pk]: row[pk] },

View File

@ -888,6 +888,7 @@ components:
rate3: Packing price rate3: Packing price
minPrice: Min. Price minPrice: Min. Price
itemFk: Item id itemFk: Item id
dated: Date
userPanel: userPanel:
copyToken: Token copied to clipboard copyToken: Token copied to clipboard
settings: Settings settings: Settings

View File

@ -972,6 +972,7 @@ components:
rate3: Precio packing rate3: Precio packing
minPrice: Precio mínimo minPrice: Precio mínimo
itemFk: Id item itemFk: Id item
dated: Fecha
userPanel: userPanel:
copyToken: Token copiado al portapapeles copyToken: Token copiado al portapapeles
settings: Configuración settings: Configuración

View File

@ -273,7 +273,8 @@ watch(
data-key="ItemFixedPrices" data-key="ItemFixedPrices"
url="FixedPrices/filter" url="FixedPrices/filter"
:order="'name DESC'" :order="'name DESC'"
save-url="FixedPrices/crud" save-url="FixedPrices/upsertFixedPrice"
:hasDifferentVerb="true"
:columns="columns" :columns="columns"
:is-editable="true" :is-editable="true"
:right-search="false" :right-search="false"

View File

@ -51,24 +51,32 @@ const props = defineProps({
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QSeparator />
<QItemSection>
<QIcon name="info" size="sm" class="info-icon cursor-pointer">
<QTooltip>{{ t('params.incompatibleFilters') }}</QTooltip>
</QIcon>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.started" v-model="params.dated"
:label="t('params.started')" :label="t('params.date')"
filled filled
@update:model-value="searchFn()"
/> />
</QItemSection> </QItemSection>
</QItem>
<QItem>
<QItemSection> <QItemSection>
<VnInputDate <QCheckbox
v-model="params.ended" v-model="params.showBadDates"
:label="t('params.ended')" :label="t(`params.showBadDates`)"
filled toggle-indeterminate
@update:model-value="searchFn()" @update:model-value="searchFn()"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
</QItemSection>
<QSeparator />
<QItem> <QItem>
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
@ -77,15 +85,6 @@ const props = defineProps({
toggle-indeterminate toggle-indeterminate
@update:model-value="searchFn()" @update:model-value="searchFn()"
/> />
<QCheckbox
v-model="params.showBadDates"
:label="t(`params.showBadDates`)"
toggle-indeterminate
@update:model-value="searchFn()"
>
</QCheckbox>
<QCheckbox <QCheckbox
:label="t('params.hasMinPrice')" :label="t('params.hasMinPrice')"
v-model="params.hasMinPrice" v-model="params.hasMinPrice"
@ -97,6 +96,13 @@ const props = defineProps({
</template> </template>
</ItemsFilterPanel> </ItemsFilterPanel>
</template> </template>
<style lang="scss" scoped>
.info-icon {
position: relative;
top: 0;
left: 90%;
}
</style>
<i18n> <i18n>
en: en:
params: params:
@ -107,6 +113,8 @@ en:
mine: Mine mine: Mine
showBadDates: Show future items showBadDates: Show future items
hasMinPrice: Has Min Price hasMinPrice: Has Min Price
date: Date
incompatibleFilters: Cannot select "Date" and "Show future items" at the same time
es: es:
params: params:
buyerFk: Comprador buyerFk: Comprador
@ -116,4 +124,6 @@ es:
mine: Para mi mine: Para mi
showBadDates: Ver items a futuro showBadDates: Ver items a futuro
hasMinPrice: Precio mínimo hasMinPrice: Precio mínimo
date: Fecha
incompatibleFilters: No se puede seleccionar "Fecha" y "Ver items a futuro" a la vez
</i18n> </i18n>