diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 1345ec955..de614ea95 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -61,7 +61,7 @@ const $props = defineProps({ } }); -const emit = defineEmits(['onFetch']); +const emit = defineEmits(['onFetch', 'onDataSaved']); defineExpose({ save, @@ -89,7 +89,7 @@ const isLoading = ref(false); // Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas const isResetting = ref(false); const hasChanges = ref(!$props.observeFormChanges); -const originalData = ref({...$props.formInitialData}); +const originalData = ref({ ...$props.formInitialData }); const formData = computed(() => state.get($props.model)); const formUrl = computed(() => $props.url); @@ -122,7 +122,7 @@ async function fetch() { } async function save() { - if (!hasChanges.value) { + if ($props.observeFormChanges && !hasChanges.value) { notify('globals.noChanges', 'negative'); return; } @@ -136,6 +136,7 @@ async function save() { } else { await axios.patch($props.urlUpdate || $props.url, body); } + emit('onDataSaved', formData.value); } catch (err) { notify('errors.create', 'negative'); } diff --git a/src/components/common/VnSelectCreate.vue b/src/components/common/VnSelectCreate.vue new file mode 100644 index 000000000..b01bb365f --- /dev/null +++ b/src/components/common/VnSelectCreate.vue @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index 568da613f..a0605bbae 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -1,5 +1,5 @@ + + + (workersOptions = data)" + auto-load + url="Workers/search?departmentCodes" + /> + (businessTypesOptions = data)" + auto-load + url="BusinessTypes" + /> + (citiesLocationOptions = data)" + auto-load + url="Towns/location" + /> + (provincesLocationOptions = data)" + auto-load + url="Provinces/location" + /> + (countriesOptions = data)" + auto-load + url="Countries" + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ scope.opt.name }} + + {{ + `${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})` + }} + + + + + + + + + + + + + + {{ + `${scope.opt.name} (${scope.opt.country.country})` + }} + + + + + + + + + + + + + + + + + + + + + + + + + + +es: + Comercial name: Nombre comercial + Salesperson: Comercial + Business type: Tipo de negocio + Tax number: NIF / CIF + Business name: Razón social + Street: Dirección fiscal + Postcode: Código postal + City: Población + Province: Provincia + Country: País + Web user: Usuario web + Email: Email + Is equalizated: Recargo de equivalencia + diff --git a/src/pages/Customer/CustomerCreateNewPostcode.vue b/src/pages/Customer/CustomerCreateNewPostcode.vue new file mode 100644 index 000000000..10f3b7d2f --- /dev/null +++ b/src/pages/Customer/CustomerCreateNewPostcode.vue @@ -0,0 +1,143 @@ + + + + (townsLocationOptions = data)" + auto-load + url="Towns/location" + /> + (provincesOptions = data)" + auto-load + url="Provinces" + /> + (countriesOptions = data)" + auto-load + url="Countries" + /> + + {{ t('New postcode') }} + {{ t('Please, ensure you put the correct data!') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + +es: + New postcode: Nuevo código postal + Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos! + City: Ciudad + Province: Provincia + Country: País + diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index 7e37bb88a..540afcc4c 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -28,25 +28,29 @@ function viewSummary(id) { }, }); } + +const redirectToCreateView = () => { + router.push({ name: 'CustomerCreate' }); +}; {{ t('globals.collapseMenu') }} @@ -55,7 +59,7 @@ function viewSummary(id) { - + @@ -63,18 +67,18 @@ function viewSummary(id) { @@ -103,6 +107,12 @@ function viewSummary(id) { + + + + {{ t('New client') }} + + @@ -117,4 +127,5 @@ function viewSummary(id) { es: Search customer: Buscar cliente You can search by customer id or name: Puedes buscar por id o nombre del cliente + New client: Nuevo cliente diff --git a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue index 62acd0a79..c61b9f7ff 100644 --- a/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue +++ b/src/pages/InvoiceOut/InvoiceOutGlobalForm.vue @@ -57,18 +57,6 @@ const getStatus = computed({ }, }); -const onFetchCompanies = (companies) => { - companiesOptions.value = [...companies]; -}; - -const onFetchPrinters = (printers) => { - printersOptions.value = [...printers]; -}; - -const onFetchClients = (clients) => { - clientsOptions.value = [...clients]; -}; - onMounted(async () => { await invoiceOutGlobalStore.init(); formData.value = { ...formInitialData.value }; @@ -76,9 +64,13 @@ onMounted(async () => { - onFetchCompanies(data)" auto-load /> - onFetchPrinters(data)" auto-load /> - onFetchClients(data)" auto-load /> + (companiesOptions = data)" + auto-load + /> + (printersOptions = data)" auto-load /> + (clientsOptions = data)" auto-load /> -import { onMounted, ref, reactive } from 'vue'; +import { ref, computed, onBeforeMount } from 'vue'; import { useI18n } from 'vue-i18n'; import { QCheckbox, QBtn } from 'quasar'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; -import VnInput from 'src/components/common/VnInput.vue'; +import InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue'; -import invoiceOutService from 'src/services/invoiceOut.service'; import { toCurrency } from 'src/filters'; import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js'; -import VnInputDate from 'components/common/VnInputDate.vue'; +import { useStateStore } from 'stores/useStateStore'; +import { useArrayData } from 'composables/useArrayData'; const invoiceOutGlobalStore = useInvoiceOutGlobalStore(); - -const rows = ref([]); +const stateStore = useStateStore(); const { t } = useI18n(); -const dateRange = reactive({ - from: Date.vnFirstDayOfMonth().toISOString(), - to: Date.vnLastDayOfMonth().toISOString(), +const arrayData = ref(null); + +function exprBuilder(param, value) { + switch (param) { + case 'from': + case 'to': + return; + default: + return { [param]: value }; + } +} + +onBeforeMount(async () => { + const defaultParams = { + from: Date.vnFirstDayOfMonth().toISOString(), + to: Date.vnLastDayOfMonth().toISOString(), + }; + arrayData.value = useArrayData('InvoiceOutNegative', { + url: 'InvoiceOuts/negativeBases', + limit: 0, + userParams: defaultParams, + exprBuilder: exprBuilder, + }); + await arrayData.value.fetch({ append: false }); + + stateStore.rightDrawer = true; }); +const rows = computed(() => arrayData.value.store.data); + const selectedCustomerId = ref(0); const selectedWorkerId = ref(0); -const filter = ref({ - company: null, - country: null, - clientId: null, - client: null, - amount: null, - base: null, - ticketId: null, - active: null, - hasToInvoice: null, - verifiedData: null, - comercial: null, -}); - const tableColumnComponents = { company: { component: 'span', @@ -106,70 +116,70 @@ const tableColumnComponents = { }, }; -const columns = ref([ +const columns = computed(() => [ { - label: 'company', + label: t('invoiceOut.negativeBases.company'), field: 'company', name: 'company', align: 'left', }, { - label: 'country', + label: t('invoiceOut.negativeBases.country'), field: 'country', name: 'country', align: 'left', }, { - label: 'clientId', + label: t('invoiceOut.negativeBases.clientId'), field: 'clientId', name: 'clientId', align: 'left', }, { - label: 'client', + label: t('invoiceOut.negativeBases.client'), field: 'clientSocialName', name: 'client', align: 'left', }, { - label: 'amount', + label: t('invoiceOut.negativeBases.amount'), field: 'amount', name: 'amount', align: 'left', format: (value) => toCurrency(value), }, { - label: 'base', + label: t('invoiceOut.negativeBases.base'), field: 'taxableBase', name: 'base', align: 'left', }, { - label: 'ticketId', + label: t('invoiceOut.negativeBases.ticketId'), field: 'ticketFk', name: 'ticketId', align: 'left', }, { - label: 'active', + label: t('invoiceOut.negativeBases.active'), field: 'isActive', name: 'active', align: 'left', }, { - label: 'hasToInvoice', + label: t('invoiceOut.negativeBases.hasToInvoice'), field: 'hasToInvoice', name: 'hasToInvoice', align: 'left', }, { - label: 'verifiedData', + label: t('invoiceOut.negativeBases.verifiedData'), field: 'isTaxDataChecked', name: 'verifiedData', align: 'left', }, { - label: 'comercial', + label: t('invoiceOut.negativeBases.comercial'), field: 'comercialName', name: 'comercial', align: 'left', @@ -177,52 +187,10 @@ const columns = ref([ ]); const downloadCSV = async () => { - await invoiceOutGlobalStore.getNegativeBasesCsv(dateRange.from, dateRange.to); -}; - -const search = async () => { - const and = []; - Object.keys(filter.value).forEach((key) => { - if (filter.value[key]) { - and.push({ - [key]: filter.value[key], - }); - } - }); - const searchFilter = { - limit: 20, - }; - - if (and.length) { - searchFilter.where = { - and, - }; - } - - const params = { - ...dateRange, - filter: JSON.stringify(searchFilter), - }; - rows.value = await invoiceOutService.getNegativeBases(params); -}; - -const refresh = () => { - dateRange.from = Date.vnFirstDayOfMonth().toISOString(); - dateRange.to = Date.vnLastDayOfMonth().toISOString(); - filter.value = { - company: null, - country: null, - clientId: null, - client: null, - amount: null, - base: null, - ticketId: null, - active: null, - hasToInvoice: null, - verifiedData: null, - comercial: null, - }; - search(); + await invoiceOutGlobalStore.getNegativeBasesCsv( + arrayData.value.store.userParams.from, + arrayData.value.store.userParams.to + ); }; const selectCustomerId = (id) => { @@ -232,82 +200,33 @@ const selectCustomerId = (id) => { const selectWorkerId = (id) => { selectedWorkerId.value = id; }; - -onMounted(async () => { - refresh(); -}); + + + + + + + + + + + + + + + - - - - - - - - - - - {{ rows.length }} {{ t('results') }} - - - - - - - - - - {{ t(`invoiceOut.negativeBases.${col.label}`) }} - - - - - { " >{{ props.value }} - - + + @@ -344,10 +257,6 @@ onMounted(async () => { border-radius: 4px; padding: 6px 6px 6px 6px; } - -.text-results { - color: var(--vn-label); -} diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue new file mode 100644 index 000000000..028246aeb --- /dev/null +++ b/src/pages/InvoiceOut/InvoiceOutNegativeBasesFilter.vue @@ -0,0 +1,134 @@ + + + + + + + {{ t(`params.${tag.label}`) }}: + {{ formatFn(tag.value) }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +en: + params: + from: From + to: To + company: Company + country: Country + clientId: Client Id + clientSocialName: Client + amount: Amount + comercialName: Comercial +es: + params: + from: Desde + to: Hasta + company: Empresa + country: País + clientId: Id cliente + clientSocialName: Cliente + amount: Importe + comercialName: Comercial + Date is required: La fecha es requerida + + diff --git a/src/pages/Travel/Card/TravelCard.vue b/src/pages/Travel/Card/TravelCard.vue index 6309c14ab..b5e555a44 100644 --- a/src/pages/Travel/Card/TravelCard.vue +++ b/src/pages/Travel/Card/TravelCard.vue @@ -1,12 +1,16 @@ - + + + diff --git a/src/pages/Travel/ExtraCommunityFilter.vue b/src/pages/Travel/ExtraCommunityFilter.vue index 57c3ec4bf..73aa13ccf 100644 --- a/src/pages/Travel/ExtraCommunityFilter.vue +++ b/src/pages/Travel/ExtraCommunityFilter.vue @@ -1,5 +1,5 @@ - onFetchAgencies(data)" auto-load /> - onFetchWarehouses(data)" auto-load /> + (agenciesOptions = data)" + auto-load + /> + (warehousesOptions = data)" + auto-load + /> diff --git a/src/pages/Travel/TravelFilter.vue b/src/pages/Travel/TravelFilter.vue index d4cb286c2..52a755c34 100644 --- a/src/pages/Travel/TravelFilter.vue +++ b/src/pages/Travel/TravelFilter.vue @@ -1,5 +1,5 @@
{{ t('Please, ensure you put the correct data!') }}