diff --git a/.eslintrc.js b/.eslintrc.js index 09dc09c1e..c8bdecb1a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -64,7 +64,7 @@ module.exports = { }, overrides: [ { - files: ['test/cypress/**/*.spec.{js,ts}'], + files: ['test/cypress/**/*.*'], extends: [ // Add Cypress-specific lint rules, globals and Cypress plugin // See https://github.com/cypress-io/eslint-plugin-cypress#rules diff --git a/.vscode/settings.json b/.vscode/settings.json index ecc1d50d7..5026b7d3b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,6 @@ ], "[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" - } + }, + "cSpell.words": ["axios"] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 243d67a34..828d5be48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2350.01] - 2023-12-14 + +### Added + +- (Carros) => Se añade contador de carros. #6545 +- (Reclamaciones) => Se añade la sección para hacer acciones sobre una reclamación. #5654 + +### Changed + +### Fixed + +- (Reclamaciones) => Se corrige el color de la barra según el tema y el evento de actualziar cantidades #6334 + ## [2253.01] - 2023-01-05 ### Added diff --git a/cypress.config.js b/cypress.config.js index 31aad6a86..2b5b40d08 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -7,7 +7,7 @@ module.exports = defineConfig({ screenshotsFolder: 'test/cypress/screenshots', supportFile: 'test/cypress/support/index.js', videosFolder: 'test/cypress/videos', - video: true, + video: false, specPattern: 'test/cypress/integration/*.spec.js', experimentalRunAllSpecs: true, component: { diff --git a/package-lock.json b/package-lock.json index 4fe3c0cdc..a3a9dcc63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "0.0.1", + "version": "23.40.01", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 705e26640..af9ed1ee3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "0.0.1", + "version": "23.50.01", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", @@ -9,13 +9,13 @@ "lint": "eslint --ext .js,.vue ./", "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore", "test:e2e": "cypress open", - "test:e2e:ci": "cypress run --browser chromium", + "test:e2e:ci": "cd ../salix && gulp docker && cd ../salix-front && cypress run --browser chromium", "test": "echo \"See package.json => scripts for available tests.\" && exit 0", "test:unit": "vitest", "test:unit:ci": "vitest run" }, "dependencies": { - "@quasar/cli": "^2.2.1", + "@quasar/cli": "^2.3.0", "@quasar/extras": "^1.16.4", "axios": "^1.4.0", "chromium": "^3.0.3", diff --git a/quasar.config.js b/quasar.config.js index cbcbae4dc..3a7dc1f1e 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -66,7 +66,9 @@ module.exports = configure(function (/* ctx */) { // publicPath: '/', // analyze: true, // env: {}, - // rawDefine: {} + rawDefine: { + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) + }, // ignorePublicFolder: true, // minify: false, // polyfillModulePreload: true, @@ -89,11 +91,12 @@ module.exports = configure(function (/* ctx */) { vitePlugins: [ [ - VueI18nPlugin, + VueI18nPlugin({ + runtimeOnly: false + }), { // if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false` // compositionOnly: false, - // you need to set i18n resource including paths ! include: path.resolve(__dirname, './src/i18n/**'), }, diff --git a/src/assets/logo.svg b/src/assets/salix.svg similarity index 100% rename from src/assets/logo.svg rename to src/assets/salix.svg diff --git a/src/assets/salix_dark.svg b/src/assets/salix_dark.svg new file mode 100644 index 000000000..10de3af4f --- /dev/null +++ b/src/assets/salix_dark.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/logo_icon.svg b/src/assets/salix_icon.svg similarity index 100% rename from src/assets/logo_icon.svg rename to src/assets/salix_icon.svg diff --git a/src/assets/vn.svg b/src/assets/vn.svg new file mode 100644 index 000000000..23b6df49c --- /dev/null +++ b/src/assets/vn.svg @@ -0,0 +1,158 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/vn_dark.svg b/src/assets/vn_dark.svg new file mode 100644 index 000000000..4d53b7b39 --- /dev/null +++ b/src/assets/vn_dark.svg @@ -0,0 +1,161 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/vn_icon.svg b/src/assets/vn_icon.svg new file mode 100644 index 000000000..738c8157c --- /dev/null +++ b/src/assets/vn_icon.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/boot/axios.js b/src/boot/axios.js index cbd5e7213..c58cc2d08 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -46,7 +46,7 @@ const onResponseError = (error) => { message = responseError.message; } - switch (response.status) { + switch (response?.status) { case 500: message = 'errors.statusInternalServerError'; break; @@ -58,12 +58,13 @@ const onResponseError = (error) => { break; } - if (session.isLoggedIn() && response.status === 401) { + if (session.isLoggedIn() && response?.status === 401) { session.destroy(); - Router.push({ path: '/login' }); - } else if(!session.isLoggedIn()) - { - message = 'login.loginError'; + const hash = window.location.hash; + const url = hash.slice(1); + Router.push({ path: url }); + } else if (!session.isLoggedIn()) { + return Promise.reject(error); } Notify.create({ @@ -77,7 +78,4 @@ const onResponseError = (error) => { axios.interceptors.request.use(onRequest, onRequestError); axios.interceptors.response.use(onResponse, onResponseError); -export { - onRequest, - onResponseError -} +export { onRequest, onResponseError }; diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue new file mode 100644 index 000000000..a5156dc79 --- /dev/null +++ b/src/components/CrudModel.vue @@ -0,0 +1,325 @@ + + + + + { + "en": { + "confirmDeletion": "Confirm deletion", + "confirmDeletionMessage": "Are you sure you want to delete this?" + }, + "es": { + "confirmDeletion": "Confirmar eliminación", + "confirmDeletionMessage": "Seguro que quieres eliminar?" + } + } + diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 0a4580289..e8a9e4c17 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -4,12 +4,14 @@ import { onMounted, onUnmounted, computed, ref, watch } from 'vue'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; import { useState } from 'src/composables/useState'; +import { useStateStore } from 'stores/useStateStore'; import { useValidator } from 'src/composables/useValidator'; import SkeletonForm from 'components/ui/SkeletonForm.vue'; const quasar = useQuasar(); -const { t } = useI18n(); const state = useState(); +const stateStore = useStateStore(); +const { t } = useI18n(); const { validate } = useValidator(); const $props = defineProps({ @@ -25,6 +27,14 @@ const $props = defineProps({ type: Object, default: null, }, + urlUpdate: { + type: String, + default: null, + }, + defaultActions: { + type: Boolean, + default: true, + }, }); const emit = defineEmits(['onFetch']); @@ -41,17 +51,21 @@ onUnmounted(() => { const isLoading = ref(false); const hasChanges = ref(false); -const formData = computed(() => state.get($props.model)); const originalData = ref(); +const formData = computed(() => state.get($props.model)); const formUrl = computed(() => $props.url); +function tMobile(...args) { + if (!quasar.platform.is.mobile) return t(...args); +} + async function fetch() { const { data } = await axios.get($props.url, { params: { filter: $props.filter }, }); state.set($props.model, data); - originalData.value = Object.assign({}, data); + originalData.value = data && JSON.parse(JSON.stringify(data)); watch(formData.value, () => (hasChanges.value = true)); @@ -66,15 +80,20 @@ async function save() { }); } isLoading.value = true; - await axios.patch($props.url, formData.value); + await axios.patch($props.urlUpdate || $props.url, formData.value); - originalData.value = formData.value; + originalData.value = JSON.parse(JSON.stringify(formData.value)); hasChanges.value = false; isLoading.value = false; } function reset() { state.set($props.model, originalData.value); + originalData.value = JSON.parse(JSON.stringify(originalData.value)); + + watch(formData.value, () => (hasChanges.value = true)); + + emit('onFetch', state.get($props.model)); hasChanges.value = false; } // eslint-disable-next-line vue/no-dupe-keys @@ -103,22 +122,48 @@ watch(formUrl, async () => { {{ t('globals.changesToSave') }} - - -
- - - + + + - + + +
+ +
+ + + + +
-
+ { color="primary" /> + diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 8839bd030..2eac97c65 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -1,6 +1,6 @@