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 () => { /> +defineProps({ + title: { type: String, default: null }, + content: { type: [String, Number], default: null }, +}); + + diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index b2084479d..8bb2a603e 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -39,6 +39,7 @@ const $props = defineProps({ }); const state = useState(); +const route = useRoute(); const { t } = useI18n(); const { viewSummary } = useSummaryDialog(); let arrayData; @@ -57,7 +58,7 @@ onBeforeMount(async () => { store = arrayData.store; entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data)); // It enables to load data only once if the module is the same as the dataKey - if ($props.dataKey !== useRoute().meta.moduleName) await getData(); + if ($props.dataKey !== route.meta.moduleName || !route.params.id) await getData(); watch( () => [$props.url, $props.filter], async () => await getData() diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index cab5b98be..ceff9028a 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -22,6 +22,10 @@ const props = defineProps({ type: String, default: '', }, + moduleName: { + type: String, + default: null, + }, }); const emit = defineEmits(['onFetch']); const route = useRoute(); @@ -83,7 +87,7 @@ function existSummary(routes) { v-if="showRedirectToSummaryIcon" class="header link" :to="{ - name: `${route.meta.moduleName}Summary`, + name: `${moduleName ?? route.meta.moduleName}Summary`, params: { id: entityId || entity.id }, }" > diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 5bc1db7fa..cff8eabe9 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -113,6 +113,7 @@ globals: name: Name new: New comment: Comment + observations: Observations 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 a37e844f3..4c2006359 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -114,6 +114,7 @@ globals: name: Nombre new: Nuevo comment: Comentario + observations: Observaciones errors: statusUnauthorized: Acceso denegado statusInternalServerError: Ha ocurrido un error interno del servidor diff --git a/src/pages/Claim/Card/ClaimBasicData.vue b/src/pages/Claim/Card/ClaimBasicData.vue index 50c9502d2..977a4dc5b 100644 --- a/src/pages/Claim/Card/ClaimBasicData.vue +++ b/src/pages/Claim/Card/ClaimBasicData.vue @@ -17,26 +17,6 @@ const { t } = useI18n(); const { getTokenMultimedia } = useSession(); const token = getTokenMultimedia(); -const claimFilter = { - fields: [ - 'id', - 'clientFk', - 'created', - 'workerFk', - 'claimStateFk', - 'packages', - 'pickup', - ], - include: [ - { - relation: 'client', - scope: { - fields: ['name'], - }, - }, - ], -}; - const claimStates = ref([]); const claimStatesCopy = ref([]); const optionsList = ref([]); @@ -87,11 +67,10 @@ const statesFilter = { />