diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index 96b550205..783600547 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -77,6 +77,10 @@ const $props = defineProps({ type: Boolean, default: true, }, + hasDifferentVerb: { + type: Boolean, + default: false, + }, }); const isLoading = ref(false); @@ -87,7 +91,7 @@ const formData = ref(); const saveButtonRef = ref(null); const watchChanges = ref(); const formUrl = computed(() => $props.url); - +const saveData = ref(); const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); defineExpose({ @@ -181,6 +185,7 @@ async function saveChanges(data) { return; } let changes = data || getChanges(); + let url = $props.saveUrl || $props.url + '/crud'; if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges); try { @@ -188,7 +193,8 @@ async function saveChanges(data) { 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 { isLoading.value = false; } @@ -265,6 +271,7 @@ function getChanges() { } else if (originalData.value[i]) { const data = getDifferences(originalData.value[i], row); if (!isEmpty(data)) { + saveData.value = row; updates.push({ data, where: { [pk]: row[pk] }, diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 3c1c80954..2f5d34406 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -888,6 +888,7 @@ components: rate3: Packing price minPrice: Min. Price itemFk: Item id + dated: Date userPanel: copyToken: Token copied to clipboard settings: Settings diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 518985831..8558374fd 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -972,6 +972,7 @@ components: rate3: Precio packing minPrice: Precio mínimo itemFk: Id item + dated: Fecha userPanel: copyToken: Token copiado al portapapeles settings: Configuración diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index eb156ce9f..aa141cb72 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -273,7 +273,8 @@ watch( data-key="ItemFixedPrices" url="FixedPrices/filter" :order="'name DESC'" - save-url="FixedPrices/crud" + save-url="FixedPrices/upsertFixedPrice" + :hasDifferentVerb="true" :columns="columns" :is-editable="true" :right-search="false" diff --git a/src/pages/Item/ItemFixedPriceFilter.vue b/src/pages/Item/ItemFixedPriceFilter.vue index 9c11a2e69..8d1527f99 100644 --- a/src/pages/Item/ItemFixedPriceFilter.vue +++ b/src/pages/Item/ItemFixedPriceFilter.vue @@ -51,24 +51,32 @@ const props = defineProps({ /> - - - - - - - - + + + + {{ t('params.incompatibleFilters') }} + + + + + + + + + + + + + - - - - + en: params: @@ -107,6 +113,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 +124,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