Item tax #337

Merged
jsegarra merged 9 commits from :feature/ItemTax into dev 2024-05-02 12:23:54 +00:00
12 changed files with 126 additions and 43 deletions

View File

@ -124,11 +124,16 @@ async function onSubmit() {
});
}
isLoading.value = true;
await saveChanges();
await saveChanges($props.saveFn ? formData.value : null);
}
async function saveChanges(data) {
if ($props.saveFn) return $props.saveFn(data, getChanges);
if ($props.saveFn) {
$props.saveFn(data, getChanges);
isLoading.value = false;
hasChanges.value = false;
Review

Falt añadir el hasChanges

Falt añadir el hasChanges
Review

Corregido: 4be559bbe8

Corregido: https://gitea.verdnatura.es/verdnatura/salix-front/commit/4be559bbe8ce672f2348b86407a2ba32624404f7
return;
}
const changes = data || getChanges();
try {
await axios.post($props.saveUrl || $props.url + '/crud', changes);

View File

@ -990,7 +990,7 @@ supplier:
billingData: Billing data
payMethod: Pay method
payDeadline: Pay deadline
payDay: Día de pago
payDay: Pay day
account: Account
fiscalData: Fiscal data
sageTaxType: Sage tax type
@ -1132,9 +1132,9 @@ item:
fixedPrice: Fixed prices
wasteBreakdown: Waste breakdown
itemCreate: New item
log: Log
barcode: Barcodes
tax: Tax
barcode: Barcode
log: Log
botanical: Botanical
itemTypeCreate: New item type
family: Item Type

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -11,10 +11,6 @@ const route = useRoute();
const { t } = useI18n();
const customerContactsRef = ref(null);
onMounted(() => {
if (customerContactsRef.value) customerContactsRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
@ -30,6 +26,7 @@ onMounted(() => {
model="CustomerContacts"
ref="customerContactsRef"
url="ClientContacts"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pl-lg q-py-md">

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -21,10 +21,6 @@ const sortEntryObservationOptions = (data) => {
);
};
onMounted(() => {
if (entryObservationsRef.value) entryObservationsRef.value.reload();
});
const columns = computed(() => [
{
name: 'observationType',
@ -65,6 +61,7 @@ const columns = computed(() => [
ref="entryObservationsRef"
:data-required="{ entryFk: params.id }"
v-model:selected="selected"
auto-load
>
<template #body="{ rows, validate }">
<QTable

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -23,10 +23,6 @@ const focusLastInput = () => {
if (lastInput) lastInput.focus();
});
};
onMounted(async () => {
if (itemBarcodeRef.value) itemBarcodeRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
@ -42,6 +38,7 @@ onMounted(async () => {
model="ItemBarcodes"
ref="itemBarcodeRef"
url="ItemBarcodes"
auto-load
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">

View File

@ -1 +1,91 @@
<template>Item tax</template>
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import CrudModel from 'components/CrudModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const route = useRoute();
const { t } = useI18n();
const { notify } = useNotify();
const taxesFilter = {
fields: ['id', 'countryFk', 'taxClassFk'],
include: [
{
relation: 'country',
scope: {
fields: ['country'],
},
},
],
};
const ItemTaxRef = ref(null);
const taxesOptions = ref([]);
const submitTaxes = async (data) => {
try {
let payload = data.map((tax) => ({
id: tax.id,
taxClassFk: tax.taxClassFk,
}));
await axios.post(`Items/updateTaxes`, payload);
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error saving taxes', err);
}
};
</script>
<template>
<FetchData
Review

Estoy es raro no?

Estoy es raro no?
Review

PArece que...no es la unica .
Si buscas ".value.reload();"...hay unos 9 resultados. Voy a ver....

PArece que...no es la unica . Si buscas ".value.reload();"...hay unos 9 resultados. Voy a ver....
Review

Mmm...parece que, en este caso no se puso el auto-load, y por tanto hace falta el reload

Mmm...parece que, en este caso no se puso el auto-load, y por tanto hace falta el reload
Review

Corregido @alexm

Corregido @alexm
url="TaxClasses"
:filter="{
fields: ['id', 'description', 'code'],
}"
@on-fetch="(data) => (taxesOptions = data)"
auto-load
/>
<CrudModel
:url="`items/${route.params.id}/taxes`"
:save-fn="submitTaxes"
:filter="taxesFilter"
:default-remove="false"
data-key="ItemTax"
model="ItemTax"
ref="ItemTaxRef"
auto-load
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<VnInput
:label="t('tax.country')"
v-model="row.country.country"
disable
/>
<VnSelect
:label="t('tax.class')"
v-model="row.taxClassFk"
:options="taxesOptions"
option-label="description"
option-value="id"
hide-selected
/>
</VnRow>
</QCard>
</template>
</CrudModel>
</template>

View File

@ -11,3 +11,6 @@ itemDiary:
showBefore: Show what's before the inventory
since: Since
warehouse: Warehouse
tax:
country: Country
class: Class

View File

@ -11,3 +11,6 @@ itemDiary:
showBefore: Mostrar lo anterior al inventario
since: Desde
warehouse: Almacén
tax:
country: País
class: Clase

View File

@ -3,9 +3,9 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import FetchData from 'components/FetchData.vue';
import { onMounted, ref } from 'vue';
import { ref } from 'vue';
import CrudModel from 'components/CrudModel.vue';
import RoadmapAddStopForm from "pages/Route/Roadmap/RoadmapAddStopForm.vue";
import RoadmapAddStopForm from 'pages/Route/Roadmap/RoadmapAddStopForm.vue';
const { t } = useI18n();
const route = useRoute();
@ -21,10 +21,6 @@ const updateDefaultStop = (data) => {
eta.setDate(eta.getDate() + 1);
defaultStop.value.eta = eta.toISOString();
};
onMounted(() => {
if (roadmapStopsCrudRef.value) roadmapStopsCrudRef.value.reload();
});
</script>
<template>
<VnSubToolbar />
@ -43,6 +39,7 @@ onMounted(() => {
:filter="{ where: { roadmapFk: route.params?.id } }"
:default-remove="false"
:data-required="defaultStop"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">
@ -51,7 +48,10 @@ onMounted(() => {
:key="index"
class="row no-wrap"
>
<RoadmapAddStopForm :roadmap-fk="route.params?.id" :form-data="row" />
<RoadmapAddStopForm
:roadmap-fk="route.params?.id"
:form-data="row"
/>
<div class="col-1 row justify-center items-center">
<QIcon
name="delete"

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -59,10 +59,6 @@ const setWireTransfer = async () => {
console.error('Error setting wire transfer', err);
}
};
onMounted(() => {
if (supplierAccountRef.value) supplierAccountRef.value.reload();
});
</script>
<template>
<FetchData
@ -94,6 +90,7 @@ onMounted(() => {
:default-remove="false"
:data-required="{ supplierFk: route.params.id }"
@save-changes="onChangesSaved()"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -26,10 +26,6 @@ const supplierAgencyFilter = {
const redirectToCreateView = () => {
router.push({ name: 'SupplierAgencyTermCreate' });
};
onMounted(() => {
if (supplierAgencyTermRef.value) supplierAgencyTermRef.value.reload();
});
</script>
<template>
<FetchData
@ -49,6 +45,7 @@ onMounted(() => {
:data-required="{
supplierFk: route.params.id,
}"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { ref, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -19,10 +19,6 @@ const insertRow = () => {
if (lastInput) lastInput.focus();
});
};
onMounted(() => {
if (supplierContactRef.value) supplierContactRef.value.reload();
});
</script>
<template>
@ -36,6 +32,7 @@ onMounted(() => {
ref="supplierContactRef"
:default-remove="false"
:data-required="{ supplierFk: route.params.id }"
auto-load
>
<template #body="{ rows }">
<QCard class="q-pa-md">