diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs diff --git a/src/boot/axios.js b/src/boot/axios.js index e3e7289af..4fd83ddea 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -1,11 +1,10 @@ import axios from 'axios'; -import { Notify } from 'quasar'; import { useSession } from 'src/composables/useSession'; import { Router } from 'src/router'; -import { i18n } from './i18n'; +import useNotify from 'src/composables/useNotify.js'; const session = useSession(); -const { t } = i18n.global; +const { notify } = useNotify(); axios.defaults.baseURL = '/api/'; @@ -27,10 +26,7 @@ const onResponse = (response) => { const isSaveRequest = method === 'patch'; if (isSaveRequest) { - Notify.create({ - message: t('globals.dataSaved'), - type: 'positive', - }); + notify('globals.dataSaved', 'positive'); } return response; @@ -67,10 +63,7 @@ const onResponseError = (error) => { return Promise.reject(error); } - Notify.create({ - message: t(message), - type: 'negative', - }); + notify(message, 'negative'); return Promise.reject(error); }; diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index c26a9c4a5..d5d8e2a91 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -148,7 +148,7 @@ async function onSubmit() { await saveChanges($props.saveFn ? formData.value : null); } -async function onSumbitAndGo() { +async function onSubmitAndGo() { await onSubmit(); push({ path: $props.goTo }); } @@ -339,7 +339,7 @@ watch(formUrl, async () => { />
+
@@ -332,7 +339,7 @@ defineExpose({ - + { - if (closeButton.value) closeButton.value.click(); +const selectedClient = (client) => { + transferInvoiceParams.selectedClientData = client; }; -const transferInvoice = async () => { +const makeInvoice = async () => { + const hasToInvoiceByAddress = + transferInvoiceParams.selectedClientData.hasToInvoiceByAddress; + + const params = { + id: transferInvoiceParams.id, + cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk, + invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk, + newClientFk: transferInvoiceParams.newClientFk, + refFk: transferInvoiceParams.refFk, + siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk, + makeInvoice: checked.value, + }; + try { - const { data } = await axios.post( - 'InvoiceOuts/transferInvoice', - transferInvoiceParams - ); + if (checked.value && hasToInvoiceByAddress) { + const response = await new Promise((resolve) => { + quasar + .dialog({ + component: VnConfirm, + componentProps: { + title: t('Bill destination client'), + message: t('transferInvoiceInfo'), + }, + }) + .onOk(() => { + resolve(true); + }) + .onCancel(() => { + resolve(false); + }); + }); + if (!response) { + return; + } + } + + const { data } = await axios.post('InvoiceOuts/transferInvoice', params); notify(t('Transferred invoice'), 'positive'); - closeForm(); - router.push('InvoiceOutSummary', { id: data.id }); + const id = data?.[0]; + if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); } catch (err) { console.error('Error transfering invoice', err); } @@ -52,22 +85,30 @@ const transferInvoice = async () => { +en: + checkInfo: New tickets from the destination customer will be generated in the consignee by default. + transferInvoiceInfo: Destination customer is marked to bill in the consignee + confirmTransferInvoice: The destination customer has selected to bill in the consignee, do you want to continue? es: Transfer invoice: Transferir factura Transfer client: Transferir cliente @@ -157,4 +215,7 @@ es: Class: Clase Type: Tipo Transferred invoice: Factura transferida + Bill destination client: Facturar cliente destino + transferInvoiceInfo: Los nuevos tickets del cliente destino, serán generados en el consignatario por defecto. + confirmTransferInvoice: El cliente destino tiene marcado facturar por consignatario, desea continuar? diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 691d3db8f..9c3b456b1 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -11,6 +11,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import VnRow from 'components/ui/VnRow.vue'; import FetchData from 'components/FetchData.vue'; import { useClipboard } from 'src/composables/useClipboard'; +import VnImg from 'src/components/ui/VnImg.vue'; const state = useState(); const session = useSession(); @@ -47,7 +48,6 @@ const darkMode = computed({ }); const user = state.getUser(); -const token = session.getTokenMultimedia(); const warehousesData = ref(); const companiesData = ref(); const accountBankData = ref(); @@ -149,10 +149,7 @@ function saveUserData(param, value) {
- +
diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index 6cd62d83e..c10c0fdb3 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -7,6 +7,7 @@ import { dashIfEmpty } from 'src/filters'; import VnSelect from 'components/common/VnSelect.vue'; import VnInput from 'components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import VnInputTime from 'components/common/VnInputTime.vue'; import VnComponent from 'components/common/VnComponent.vue'; const model = defineModel(undefined, { required: true }); @@ -71,6 +72,15 @@ const defaultComponents = { label: $props.showLabel && $props.column.label, }, }, + time: { + component: markRaw(VnInputTime), + attrs: { + disable: !$props.isEditable, + }, + forceAttrs: { + label: $props.showLabel && $props.column.label, + }, + }, checkbox: { component: markRaw(QCheckbox), attrs: (prop) => { diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 3d489cf73..85c0afa6f 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -7,6 +7,7 @@ import { useArrayData } from 'composables/useArrayData'; import VnSelect from 'components/common/VnSelect.vue'; import VnInput from 'components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import VnInputTime from 'components/common/VnInputTime.vue'; import VnTableColumn from 'components/VnTable/VnColumn.vue'; const $props = defineProps({ @@ -75,6 +76,15 @@ const components = { }, forceAttrs, }, + time: { + component: markRaw(VnInputTime), + attrs: { + disable: !$props.isEditable, + }, + forceAttrs: { + label: $props.showLabel && $props.column.label, + }, + }, checkbox: { component: markRaw(QCheckbox), event: updateEvent, diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 07e82abed..4cd964012 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -22,6 +22,10 @@ const $props = defineProps({ type: String, default: '', }, + clearable: { + type: Boolean, + default: true, + }, }); const { t } = useI18n(); @@ -88,7 +92,7 @@ const inputRules = [ diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 3c1a12f24..77ab2692d 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,5 +1,6 @@ + diff --git a/src/components/common/VnProgressModal.vue b/src/components/common/VnProgressModal.vue new file mode 100644 index 000000000..cfd948d5f --- /dev/null +++ b/src/components/common/VnProgressModal.vue @@ -0,0 +1,97 @@ + + + + + +es: + Progress: Progreso + Total progress: Progreso total + Cancelled: Cancelado + diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 04ccca889..52cb68438 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -1,6 +1,5 @@ \ No newline at end of file diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 218e28600..9eff3d322 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -7,8 +7,11 @@ import toDate from 'filters/toDate'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue'; const { t } = useI18n(); -const params = defineModel({ default: {}, required: true, type: Object }); const $props = defineProps({ + modelValue: { + type: Object, + default: () => {} + }, dataKey: { type: String, required: true, @@ -60,13 +63,14 @@ const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']); const arrayData = useArrayData($props.dataKey, { exprBuilder: $props.exprBuilder, searchUrl: $props.searchUrl, - navigate: {}, + navigate: $props.redirect ? {} : null, }); const route = useRoute(); const store = arrayData.store; - +const userParams = ref({}) onMounted(() => { - emit('init', { params: params.value }); + userParams.value = $props.modelValue ?? {} + emit('init', { params: userParams.value }); }); function setUserParams(watchedParams) { @@ -75,7 +79,7 @@ function setUserParams(watchedParams) { if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams); watchedParams = { ...watchedParams, ...watchedParams.filter?.where }; delete watchedParams.filter; - params.value = { ...params.value, ...watchedParams }; + userParams.value = { ...userParams.value, ...watchedParams }; } watch( @@ -94,12 +98,12 @@ async function search(evt) { store.filter.where = {}; isLoading.value = true; - const filter = { ...params.value }; + const filter = { ...userParams.value }; store.userParamsChanged = true; store.filter.skip = 0; store.skip = 0; - const { params: newParams } = await arrayData.addFilter({ params: params.value }); - params.value = newParams; + const { params: newParams } = await arrayData.addFilter({ params: userParams.value }); + userParams.value = newParams; if (!$props.showAll && !Object.values(filter).length) store.data = []; @@ -109,7 +113,7 @@ async function search(evt) { async function reload() { isLoading.value = true; - const params = Object.values(params.value).filter((param) => param); + const params = Object.values(userParams.value).filter((param) => param); await arrayData.fetch({ append: false }); if (!$props.showAll && !params.length) store.data = []; @@ -123,17 +127,17 @@ async function clearFilters() { store.filter.skip = 0; store.skip = 0; // Filtrar los params no removibles - const removableFilters = Object.keys(params.value).filter((param) => + const removableFilters = Object.keys(userParams.value).filter((param) => $props.unremovableParams.includes(param) ); const newParams = {}; // Conservar solo los params que no son removibles for (const key of removableFilters) { - newParams[key] = params.value[key]; + newParams[key] = userParams.value[key]; } - params.value = {}; - params.value = { ...newParams }; // Actualizar los params con los removibles - await arrayData.applyFilter({ params: params.value }); + userParams.value = {}; + userParams.value = { ...newParams }; // Actualizar los params con los removibles + await arrayData.applyFilter({ params: userParams.value }); if (!$props.showAll) { store.data = []; @@ -145,8 +149,8 @@ async function clearFilters() { const tagsList = computed(() => { const tagList = []; - for (const key of Object.keys(params.value)) { - const value = params.value[key]; + for (const key of Object.keys(userParams.value)) { + const value = userParams.value[key]; if (value == null || ($props.hiddenTags || []).includes(key)) continue; tagList.push({ label: key, value }); } @@ -161,7 +165,7 @@ const customTags = computed(() => ); async function remove(key) { - params.value[key] = undefined; + userParams.value[key] = undefined; search(); emit('remove', key); } @@ -236,7 +240,7 @@ function formatValue(value) { - +