diff --git a/package-lock.json b/package-lock.json index 2e96d2ccf..a3a9dcc63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "23.36.01", + "version": "23.40.01", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index b713c906a..3e26b483b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-front", - "version": "23.36.01", + "version": "23.40.01", "description": "Salix frontend", "productName": "Salix", "author": "Verdnatura", @@ -9,7 +9,7 @@ "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" diff --git a/src/boot/axios.js b/src/boot/axios.js index bdc661ae2..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,7 +58,7 @@ const onResponseError = (error) => { break; } - if (session.isLoggedIn() && response.status === 401) { + if (session.isLoggedIn() && response?.status === 401) { session.destroy(); const hash = window.location.hash; const url = hash.slice(1); diff --git a/src/components/CrudModel.vue b/src/components/CrudModel.vue index ed869a565..2a4982fce 100644 --- a/src/components/CrudModel.vue +++ b/src/components/CrudModel.vue @@ -8,6 +8,7 @@ import { useStateStore } from 'stores/useStateStore'; import VnPaginate from 'components/ui/VnPaginate.vue'; import VnConfirm from 'components/ui/VnConfirm.vue'; import SkeletonTable from 'components/ui/SkeletonTable.vue'; +import { tMobile } from 'src/composables/tMobile'; const quasar = useQuasar(); const stateStore = useStateStore(); @@ -62,9 +63,10 @@ const hasChanges = ref(false); const originalData = ref(); const vnPaginateRef = ref(); const formData = ref(); +const saveButtonRef = ref(null); const formUrl = computed(() => $props.url); -const emit = defineEmits(['onFetch', 'update:selected']); +const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']); defineExpose({ reload, @@ -73,12 +75,9 @@ defineExpose({ onSubmit, reset, hasChanges, + saveChanges, }); -function tMobile(...args) { - if (!quasar.platform.is.mobile) return t(...args); -} - async function fetch(data) { if (data && Array.isArray(data)) { let $index = 0; @@ -135,6 +134,7 @@ async function saveChanges(data) { hasChanges.value = false; isLoading.value = false; + emit('saveChanges', data); } async function insert() { @@ -269,7 +269,7 @@ watch(formUrl, async () => { - + { /> { :title="t('globals.save')" v-if="$props.defaultSave" /> + { const search = val.toLowerCase(); if (val === '') return options; + return options.filter((row) => { const id = row.id; const name = row[$props.optionLabel].toLowerCase(); @@ -41,9 +44,17 @@ const filter = (val, options) => { }; const filterHandler = (val, update) => { - update(() => { - myOptions.value = filter(val, myOptionsOriginal.value); - }); + update( + () => { + myOptions.value = filter(val, myOptionsOriginal.value); + }, + (ref) => { + if (val !== '' && ref.options.length > 0) { + ref.setOptionIndex(-1); + ref.moveOptionSelection(1, true); + } + } + ); }; watch(options, (newValue) => { @@ -70,7 +81,15 @@ const value = computed({ map-options use-input @filter="filterHandler" - clearable - clear-icon="close" - /> + hide-selected + fill-input + ref="vnSelectRef" + > + + + diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 2475f56e9..d21d073f2 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -140,14 +140,6 @@ async function onLoad(...params) { {{ t('No data to display') }} -
-
- {{ t('No results found') }} -
-
-import { ref, computed } from 'vue'; +import { ref, computed, onMounted } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import CrudModel from 'components/CrudModel.vue'; import FetchData from 'components/FetchData.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue'; +import { getUrl } from 'composables/getUrl'; +import { tMobile } from 'composables/tMobile'; const route = useRoute(); + const { t } = useI18n(); const claimDevelopmentForm = ref(); @@ -16,6 +19,12 @@ const claimResponsibles = ref([]); const claimRedeliveries = ref([]); const workers = ref([]); const selected = ref([]); +const insertButtonRef = ref(); +let salixUrl; + +onMounted(async () => { + salixUrl = await getUrl(`claim/${route.params.id}`); +}); const developmentsFilter = { fields: [ @@ -43,6 +52,7 @@ const columns = computed(() => [ model: 'claimReasonFk', optionValue: 'id', optionLabel: 'description', + tabIndex: 1, }, { name: 'claimResult', @@ -54,6 +64,7 @@ const columns = computed(() => [ model: 'claimResultFk', optionValue: 'id', optionLabel: 'description', + tabIndex: 2, }, { name: 'claimResponsible', @@ -65,6 +76,7 @@ const columns = computed(() => [ model: 'claimResponsibleFk', optionValue: 'id', optionLabel: 'description', + tabIndex: 3, }, { name: 'worker', @@ -75,6 +87,7 @@ const columns = computed(() => [ model: 'workerFk', optionValue: 'id', optionLabel: 'nickname', + tabIndex: 4, }, { name: 'claimRedelivery', @@ -86,8 +99,13 @@ const columns = computed(() => [ model: 'claimRedeliveryFk', optionValue: 'id', optionLabel: 'description', + tabIndex: 5, }, ]); + +function goToAction() { + location.href = `${salixUrl}/action`; +} diff --git a/src/pages/Claim/Card/ClaimLines.vue b/src/pages/Claim/Card/ClaimLines.vue index 8680ff922..c03291b85 100644 --- a/src/pages/Claim/Card/ClaimLines.vue +++ b/src/pages/Claim/Card/ClaimLines.vue @@ -40,7 +40,6 @@ const claimLinesForm = ref(); const claim = ref(null); async function onFetchClaim(data) { claim.value = data; - fetchMana(); } @@ -147,8 +146,11 @@ function showImportDialog() { quasar .dialog({ component: ClaimLinesImport, + componentProps: { + ticketId: claim.value.ticketFk, + }, }) - .onOk(() => arrayData.refresh()); + .onOk(() => claimLinesForm.value.reload()); }