diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index 55b2f5fee..ed34e9eee 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -151,7 +151,7 @@ const col = computed(() => { }; } if ( - (newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) && + (/^is[A-Z]/.test(newColumn.name) || /^has[A-Z]/.test(newColumn.name)) && newColumn.component == null ) newColumn.component = 'checkbox'; diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index be39570ee..dca30516f 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -154,7 +154,7 @@ watch( const isTableMode = computed(() => mode.value == TABLE_MODE); -function setUserParams(watchedParams) { +function setUserParams(watchedParams, watchedOrder) { if (!watchedParams) return; if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); @@ -163,7 +163,7 @@ function setUserParams(watchedParams) { ? JSON.parse(watchedParams?.filter) : watchedParams?.filter; const where = filter?.where; - const order = filter?.order; + const order = watchedOrder ?? filter?.order; watchedParams = { ...watchedParams, ...where }; delete watchedParams.filter; diff --git a/src/components/common/VnCurrency.vue b/src/components/common/VnCurrency.vue deleted file mode 100644 index b892e5012..000000000 --- a/src/components/common/VnCurrency.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - -es: - amount: importe - diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 7debe5b1e..0e41e53aa 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -82,23 +82,26 @@ onMounted(() => { }); function setUserParams(watchedParams) { - if (!watchedParams) return; + if (!watchedParams || Object.keys(watchedParams).length == 0) return; if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); + if (typeof watchedParams?.filter == 'string') + watchedParams.filter = JSON.parse(watchedParams.filter); + watchedParams = { ...watchedParams, ...watchedParams.filter?.where }; + const order = watchedParams.filter?.order; + delete watchedParams.filter; - userParams.value = { ...userParams.value, ...watchedParams }; - emit('setUserParams', userParams.value); + userParams.value = { ...userParams.value, ...sanitizer(watchedParams) }; + emit('setUserParams', userParams.value, order); } watch( - () => route.query[$props.searchUrl], - (val) => setUserParams(val) -); - -watch( - () => [store.userParams, store.userFilter], - ([userParams, userFilter]) => setUserParams({ ...userParams, filter: userFilter }) + () => [route.query[$props.searchUrl], arrayData.store.userParams], + ([newSearchUrl, newUserParams], [oldSearchUrl, oldUserParams]) => { + if (newSearchUrl || oldSearchUrl) setUserParams(newSearchUrl); + if (newUserParams || oldUserParams) setUserParams(newUserParams); + } ); watch( diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index d2cd83560..12680d0cb 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -262,6 +262,7 @@ globals: unsavedPopup: title: Unsaved changes will be lost subtitle: Are you sure exit without saving? + createInvoiceIn: Create invoice in errors: statusUnauthorized: Access denied statusInternalServerError: An internal server error has ocurred diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index b926bd50b..747a10d51 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -264,6 +264,8 @@ globals: unsavedPopup: title: Los cambios que no haya guardado se perderán subtitle: ¿Seguro que quiere salir sin guardar? + createInvoiceIn: Crear factura recibida + errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor diff --git a/src/pages/Customer/Payments/CustomerPaymentsFilter.vue b/src/pages/Customer/Payments/CustomerPaymentsFilter.vue index 1b79868c0..8982cba5a 100644 --- a/src/pages/Customer/Payments/CustomerPaymentsFilter.vue +++ b/src/pages/Customer/Payments/CustomerPaymentsFilter.vue @@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; -import VnCurrency from 'src/components/common/VnCurrency.vue'; +import VnInputNumber from 'src/components/common/VnInputNumber.vue'; const { t } = useI18n(); const props = defineProps({ @@ -47,7 +47,11 @@ const props = defineProps({ - + diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue index da24e50fa..cba2a31d2 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptor.vue @@ -130,8 +130,6 @@ onBeforeMount(async () => { }); onBeforeRouteUpdate(async (to, from) => { - invoiceInCorrection.correcting.length = 0; - invoiceInCorrection.corrected = null; if (to.params.id !== from.params.id) { await setInvoiceCorrection(to.params.id); const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`); @@ -140,6 +138,8 @@ onBeforeRouteUpdate(async (to, from) => { }); async function setInvoiceCorrection(id) { + invoiceInCorrection.correcting.length = 0; + invoiceInCorrection.corrected = null; const { data: correctingData } = await axios.get('InvoiceInCorrections', { params: { filter: { where: { correctingFk: id } } }, }); @@ -198,7 +198,6 @@ async function cloneInvoice() { const isAdministrative = () => hasAny(['administrative']); const isAgricultural = () => { - console.error(config); if (!config.value) return false; return ( invoiceIn.value?.supplier?.sageFarmerWithholdingFk === diff --git a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue index d2b43c57a..d88996929 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue @@ -8,9 +8,11 @@ import { useArrayData } from 'src/composables/useArrayData'; import CrudModel from 'src/components/CrudModel.vue'; import FetchData from 'src/components/FetchData.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; -import VnCurrency from 'src/components/common/VnCurrency.vue'; import { toCurrency } from 'src/filters'; import useNotify from 'src/composables/useNotify.js'; +import VnInput from 'src/components/common/VnInput.vue'; +import VnInputDate from 'src/components/common/VnInputDate.vue'; +import VnInputNumber from 'src/components/common/VnInputNumber.vue'; const route = useRoute(); const { notify } = useNotify(); @@ -22,9 +24,6 @@ const rowsSelected = ref([]); const banks = ref([]); const invoiceInFormRef = ref(); const invoiceId = +route.params.id; - -const placeholder = 'yyyy/mm/dd'; - const filter = { where: { invoiceInFk: invoiceId } }; const columns = computed(() => [ @@ -104,42 +103,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, > +