#8944: New date filter and make section use salix's back #1750
|
@ -102,6 +102,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
customMethod: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved', 'submit']);
|
||||
const modelValue = computed(
|
||||
|
@ -237,7 +241,9 @@ async function save() {
|
|||
const url =
|
||||
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
||||
const response = await Promise.resolve(
|
||||
$props.saveFn ? $props.saveFn(body) : axios[method](url, body),
|
||||
$props.saveFn
|
||||
? $props.saveFn(body)
|
||||
: axios[$props.customMethod ?? method](url, body),
|
||||
);
|
||||
|
||||
if ($props.urlCreate) notify('globals.dataCreated', 'positive');
|
||||
|
|
|
@ -894,6 +894,7 @@ components:
|
|||
rate3: Packing price
|
||||
minPrice: Min. Price
|
||||
itemFk: Item id
|
||||
dated: Date
|
||||
userPanel:
|
||||
copyToken: Token copied to clipboard
|
||||
settings: Settings
|
||||
|
|
|
@ -978,6 +978,7 @@ components:
|
|||
rate3: Precio packing
|
||||
minPrice: Precio mínimo
|
||||
itemFk: Id item
|
||||
dated: Fecha
|
||||
userPanel:
|
||||
copyToken: Token copiado al portapapeles
|
||||
settings: Configuración
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, onUnmounted, computed, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
@ -223,6 +224,31 @@ const onDataSaved = () => {
|
|||
selectedRows.value = [];
|
||||
};
|
||||
|
||||
async function saveData(data, getChanges) {
|
||||
const changes = getChanges();
|
||||
if (changes?.updates?.length) {
|
||||
try {
|
||||
for (const change of changes.updates) {
|
||||
const row = data.find((row) => row.id === change.where.id);
|
||||
await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
jon marked this conversation as resolved
Outdated
|
||||
}
|
||||
}
|
||||
|
||||
if (data?.deletes?.length) {
|
||||
try {
|
||||
for (const deleteItem of data.deletes) {
|
||||
await axios.delete(`FixedPrices/${deleteItem}`);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
tableRef.value.reload();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (tableRef.value) {
|
||||
tableRef.value.showForm = false;
|
||||
|
@ -273,7 +299,8 @@ watch(
|
|||
data-key="ItemFixedPrices"
|
||||
url="FixedPrices/filter"
|
||||
:order="'name DESC'"
|
||||
save-url="FixedPrices/crud"
|
||||
save-url="FixedPrices/upsertFixedPrice"
|
||||
:saveFn="saveData"
|
||||
:columns="columns"
|
||||
:is-editable="true"
|
||||
:right-search="false"
|
||||
|
@ -283,7 +310,8 @@ watch(
|
|||
}"
|
||||
v-model:selected="selectedRows"
|
||||
:create="{
|
||||
urlCreate: 'FixedPrices',
|
||||
urlCreate: 'FixedPrices/upsertFixedPrice',
|
||||
customMethod: 'patch',
|
||||
title: t('Create fixed price'),
|
||||
formInitialData: { warehouseFk: warehouse },
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -51,42 +52,41 @@ const props = defineProps({
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<QItemSection>
|
||||
<QIcon name="info" size="sm" class="info-icon cursor-pointer">
|
||||
<QTooltip>{{ t('params.incompatibleFilters') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.dated"
|
||||
:label="t('params.date')"
|
||||
filled
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
jon marked this conversation as resolved
pablone
commented
VnCheckbox VnCheckbox
|
||||
<VnCheckbox
|
||||
v-model="params.showBadDates"
|
||||
:label="t(`params.showBadDates`)"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QItemSection>
|
||||
<QSeparator />
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.started"
|
||||
:label="t('params.started')"
|
||||
filled
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.ended"
|
||||
:label="t('params.ended')"
|
||||
filled
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
<VnCheckbox
|
||||
:label="t('params.mine')"
|
||||
v-model="params.mine"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
|
||||
<QCheckbox
|
||||
v-model="params.showBadDates"
|
||||
:label="t(`params.showBadDates`)"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
>
|
||||
</QCheckbox>
|
||||
|
||||
<QCheckbox
|
||||
<VnCheckbox
|
||||
:label="t('params.hasMinPrice')"
|
||||
v-model="params.hasMinPrice"
|
||||
toggle-indeterminate
|
||||
|
@ -97,6 +97,13 @@ const props = defineProps({
|
|||
</template>
|
||||
</ItemsFilterPanel>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.info-icon {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 90%;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
@ -107,6 +114,8 @@ en:
|
|||
mine: Mine
|
||||
showBadDates: Show future items
|
||||
hasMinPrice: Has Min Price
|
||||
date: Date
|
||||
incompatibleFilters: Cannot select "Date" and "Show future items" at the same time
|
||||
es:
|
||||
params:
|
||||
buyerFk: Comprador
|
||||
|
@ -116,4 +125,6 @@ es:
|
|||
mine: Para mi
|
||||
showBadDates: Ver items a futuro
|
||||
hasMinPrice: Precio mínimo
|
||||
date: Fecha
|
||||
incompatibleFilters: No se puede seleccionar "Fecha" y "Ver items a futuro" a la vez
|
||||
</i18n>
|
||||
|
|
Loading…
Reference in New Issue
hay que dejar que el error se extienda, fijate en lo ostros try catch de la app, si nos ve alex nos mata 2.0