diff --git a/src/App.vue b/src/App.vue index ab9032cf5..8eae0d1a6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -67,7 +67,7 @@ function responseError(error) { axios.interceptors.response.use((response) => { const { method } = response.config; - const isSaveRequest = method === 'post' || method === 'patch'; + const isSaveRequest = method === 'patch'; if (isSaveRequest) { quasar.notify({ message: t('globals.dataSaved'), diff --git a/src/components/SmartCard.vue b/src/components/SmartCard.vue index a8652e6e8..b7b95a659 100644 --- a/src/components/SmartCard.vue +++ b/src/components/SmartCard.vue @@ -43,10 +43,11 @@ const pagination = ref({ page: 1, }); -const rows = ref([]); +const rows = ref(null); onMounted(() => { if ($props.autoLoad) fetch(); + else rows.value = []; }); async function fetch() { @@ -74,6 +75,7 @@ async function fetch() { hasMoreData.value = data.length === rowsPerPage; + if (!rows.value) rows.value = []; for (const row of data) rows.value.push(row); pagination.value.rowsNumber = rows.value.length; @@ -87,7 +89,7 @@ async function fetch() { async function onLoad(...params) { const done = params[1]; - if (rows.value.length === 0) return done(false); + if (!rows.value || rows.value.length === 0) return done(false); pagination.value.page = pagination.value.page + 1; @@ -100,7 +102,7 @@ async function onLoad(...params) { - + @@ -138,6 +140,25 @@ async function onLoad(...params) { + + + + + + + + + + + + + + + + + + + diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 901c62981..9a06f8094 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -63,7 +63,6 @@ async function saveDarkMode(value) { } async function saveLanguage(value) { - console.log(value); const query = `/Accounts/${user.value.id}`; await axios.patch(query, { lang: value, diff --git a/src/filters/toDate.js b/src/filters/toDate.js index de6ff4cda..932c0557e 100644 --- a/src/filters/toDate.js +++ b/src/filters/toDate.js @@ -1,10 +1,12 @@ import { useI18n } from 'vue-i18n'; -export default function (value) { +export default function (value, options = {}) { if (!value) return; + if (!options.dateStyle) options.dateStyle = 'short'; + const { locale } = useI18n(); const date = new Date(value); - return new Intl.DateTimeFormat(locale.value).format(date) + return new Intl.DateTimeFormat(locale.value, options).format(date) } \ No newline at end of file diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 703f2ce48..fea777704 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -12,9 +12,18 @@ export default { theme: 'Theme', logOut: 'Log out', dataSaved: 'Data saved', + add: 'Add', + create: 'Create', save: 'Save', + remove: 'Remove', reset: 'Reset', - noChanges: 'No changes to save' + cancel: 'Cancel', + yes: 'Yes', + no: 'No', + noChanges: 'No changes to save', + confirmRemove: 'You are about to delete this row. Are you sure?', + rowAdded: 'Row added', + rowRemoved: 'Row removed' }, moduleIndex: { allModules: 'All modules' @@ -177,6 +186,14 @@ export default { created: 'Created', state: 'State' }, + rmaList: { + code: 'Code', + newRma: 'New RMA...' + }, + rma: { + user: 'User', + created: 'Created' + }, card: { claimId: 'Claim ID', assignedTo: 'Assigned', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index e33469c9f..5a46932b2 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -12,9 +12,18 @@ export default { theme: 'Tema', logOut: 'Cerrar sesión', dataSaved: 'Datos guardados', + add: 'Añadir', + create: 'Crear', save: 'Guardar', + remove: 'Eliminar', reset: 'Restaurar', - noChanges: 'Sin cambios que guardar' + cancel: 'Cancelar', + yes: 'Si', + no: 'No', + noChanges: 'Sin cambios que guardar', + confirmRemove: 'Vas a eliminar este registro. ¿Continuar?', + rowAdded: 'Fila añadida', + rowRemoved: 'Fila eliminada' }, moduleIndex: { allModules: 'Todos los módulos' @@ -165,8 +174,10 @@ export default { claims: 'Reclamaciones', list: 'Listado', createClaim: 'Crear reclamación', + rmaList: 'RMA', summary: 'Resumen', - basicData: 'Datos básicos' + basicData: 'Datos básicos', + rma: 'RMA' }, list: { customer: 'Cliente', @@ -174,6 +185,14 @@ export default { created: 'Creada', state: 'Estado' }, + rmaList: { + code: 'Código', + newRma: 'Nuevo RMA...' + }, + rma: { + user: 'Usuario', + created: 'Creado' + }, card: { claimId: 'ID reclamación', assignedTo: 'Asignada a', diff --git a/src/pages/Claim/Card/ClaimRma.vue b/src/pages/Claim/Card/ClaimRma.vue index dd48c7597..8ec51acf7 100644 --- a/src/pages/Claim/Card/ClaimRma.vue +++ b/src/pages/Claim/Card/ClaimRma.vue @@ -1,9 +1,10 @@ - + - - + + + + + - - - - - - - - - {{ t('claim.rma.code') }} - {{ row.code }} - - - - - - - {{ t('claim.rma.worker') }} - {{ row.workerFk }} - - - - - - - {{ t('claim.rma.remove') }} - - - - + + + {{ t('claim.rma.user') }} + {{ row.worker.user.name }} + + + + + + {{ t('claim.rma.created') }} + {{ toDate(row.created, { timeStyle: 'medium' }) }} + + + + + + + {{ t('globals.remove') }} + + + + + + + + {{ t('globals.confirmRemove') }} + + + + + + + + - diff --git a/src/pages/Claim/ClaimRmaList.vue b/src/pages/Claim/ClaimRmaList.vue index 56aefe748..3d1ff4ef4 100644 --- a/src/pages/Claim/ClaimRmaList.vue +++ b/src/pages/Claim/ClaimRmaList.vue @@ -55,52 +55,61 @@ function hide() { - - - + + + - + + $(0) entries + - - - - - - {{ t('claim.rma.code') }} - {{ row.code }} - - - - - - - {{ t('claim.rma.remove') }} - - - - + + + + + + {{ t('claim.rmaList.code') }} + {{ row.code }} + + + + + + + {{ t('globals.remove') }} + + + - You are about to delete this entry. Are you sure? + {{ t('globals.confirmRemove') }} - - + + -