From c64ae1cceea5413a1a1dcfad57cd04ce5ec5be88 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 14 Aug 2023 13:52:25 +0200 Subject: [PATCH] refs #5990 feat(summarys): redesigned --- src/components/LeftMenu.vue | 2 +- src/components/ui/CardSummary.vue | 151 ++- src/components/ui/VnLv.vue | 10 +- src/i18n/en/index.js | 8 + src/i18n/es/index.js | 10 +- src/pages/Claim/Card/ClaimSummary.vue | 223 ++-- src/pages/Customer/Card/CustomerSummary.vue | 681 ++++------- .../InvoiceOut/Card/InvoiceOutSummary.vue | 206 ++-- src/pages/Ticket/Card/TicketSummary.vue | 1009 ++++++----------- src/pages/Worker/Card/WorkerSummary.vue | 284 +---- .../cypress/integration/workerSummary.spec.js | 14 +- 11 files changed, 946 insertions(+), 1652 deletions(-) diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 6196c636a..1aabe1b6b 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -31,7 +31,7 @@ function findMatches(search, item) { const matches = []; function findRoute(search, item) { for (const child of item.children) { - if (search.indexOf(child.name) > -1) { + if (search?.indexOf(child.name) > -1) { matches.push(child); } else if (child.children) { findRoute(search, child); diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index 266dd30b1..cfc652a44 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -43,16 +43,21 @@ watch(props, async () => { + diff --git a/src/components/ui/VnLv.vue b/src/components/ui/VnLv.vue index 1eea26252..9a17fca05 100644 --- a/src/components/ui/VnLv.vue +++ b/src/components/ui/VnLv.vue @@ -1,5 +1,7 @@ @@ -17,15 +20,18 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean'); {{ $props.label }} -
+
- {{ $props.value }} + + {{ $props.dash ? dashIfEmpty($props.value) : $props.value }} +
diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index eaf0d1c58..075f9739b 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -33,6 +33,9 @@ export default { rowRemoved: 'Row removed', pleaseWait: 'Please wait...', noPinnedModules: 'You have dont have any pinned modules', + summary: { + basicData: 'Basic data', + }, }, errors: { statusUnauthorized: 'Access denied', @@ -154,6 +157,8 @@ export default { balanceDue: 'Balance due', balanceDueInfo: 'Deviated invoices minus payments', recoverySince: 'Recovery since', + businessType: 'Business Type', + city: 'City', }, basicData: { socialName: 'Fiscal name', @@ -175,6 +180,7 @@ export default { basicData: 'Basic Data', boxing: 'Boxing', sms: 'Sms', + notes: 'Notes', }, list: { nickname: 'Nickname', @@ -244,6 +250,7 @@ export default { requester: 'Requester', atender: 'Atender', request: 'Request', + weight: 'Weight', goTo: 'Go to', }, }, @@ -411,6 +418,7 @@ export default { userId: 'User ID', role: 'Role', sipExtension: 'Extension', + locker: 'Locker', }, notificationsManager: { activeNotifications: 'Active notifications', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 1eabfc7e6..c235fa4e8 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -33,6 +33,9 @@ export default { rowRemoved: 'Fila eliminada', pleaseWait: 'Por favor, espera...', noPinnedModules: 'No has fijado ningún módulo', + summary: { + basicData: 'Datos básicos', + }, }, errors: { statusUnauthorized: 'Acceso denegado', @@ -119,7 +122,7 @@ export default { province: 'Provincia', country: 'País', street: 'Calle', - isEqualizated: 'Equalizado', + isEqualizated: 'Recargo de equivalencia', isActive: 'Activo', invoiceByAddress: 'Facturar por consignatario', verifiedData: 'Datos verificados', @@ -153,6 +156,8 @@ export default { balanceDue: 'Saldo vencido', balanceDueInfo: 'Facturas fuera de plazo menos recibos', recoverySince: 'Recobro desde', + businessType: 'Tipo de negocio', + city: 'Población', }, basicData: { socialName: 'Nombre fiscal', @@ -174,6 +179,7 @@ export default { basicData: 'Datos básicos', boxing: 'Encajado', sms: 'Sms', + notes: 'Notas', }, list: { nickname: 'Alias', @@ -243,6 +249,7 @@ export default { requester: 'Solicitante', atender: 'Comprador', request: 'Petición de compra', + weight: 'Peso', goTo: 'Ir a', }, }, @@ -411,6 +418,7 @@ export default { userId: 'ID del usuario', role: 'Rol', sipExtension: 'Extensión', + locker: 'Taquilla', }, notificationsManager: { activeNotifications: 'Notificaciones activas', diff --git a/src/pages/Claim/Card/ClaimSummary.vue b/src/pages/Claim/Card/ClaimSummary.vue index ac464d125..dc5ec9544 100644 --- a/src/pages/Claim/Card/ClaimSummary.vue +++ b/src/pages/Claim/Card/ClaimSummary.vue @@ -1,12 +1,14 @@ - - diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue index 00a46e4ad..442697f6c 100644 --- a/src/pages/Ticket/Card/TicketSummary.vue +++ b/src/pages/Ticket/Card/TicketSummary.vue @@ -4,14 +4,15 @@ import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; import axios from 'axios'; import { dashIfEmpty, toDate, toCurrency } from 'src/filters'; -import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; +import CardSummary from 'components/ui/CardSummary.vue'; import FetchData from 'components/FetchData.vue'; import FetchedTags from 'components/ui/FetchedTags.vue'; import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue'; +import VnLv from 'src/components/ui/VnLv.vue'; +import { getUrl } from 'src/composables/getUrl'; -onMounted(() => fetch()); -onUpdated(() => fetch()); +onUpdated(() => summaryRef.value.fetch()); const route = useRoute(); const router = useRouter(); @@ -28,25 +29,22 @@ const $props = defineProps({ const entityId = computed(() => $props.id || route.params.id); +const summaryRef = ref(); const ticket = ref(); const salesLines = ref(null); const editableStates = ref([]); +const ticketUrl = ref(); -async function fetch() { - const { data } = await axios.get(`Tickets/${entityId.value}/summary`); +onMounted(async () => { + ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/'; +}); +async function setData(data) { if (data) { ticket.value = data; salesLines.value = data.sales; } } -function stateColor(state) { - if (state.code === 'OK') return 'text-green'; - if (state.code === 'FREE') return 'text-blue-3'; - if (state.alertLevel === 1) return 'text-primary'; - if (state.alertLevel === 0) return 'text-red'; -} - function formattedAddress() { if (!ticket.value) return ''; @@ -76,7 +74,7 @@ async function changeState(value) { }; await axios.post(`TicketTrackings/changeState`, formData); - await router.go(route.fullPath); + router.go(route.fullPath); } @@ -86,638 +84,379 @@ async function changeState(value) { @on-fetch="(data) => (editableStates = data)" auto-load /> -
- - - + diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue index 7fc4802c6..05ccdc373 100644 --- a/src/pages/Worker/Card/WorkerSummary.vue +++ b/src/pages/Worker/Card/WorkerSummary.vue @@ -3,11 +3,11 @@ import axios from 'axios'; import { ref, onMounted, computed, onUpdated } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; +import CardSummary from 'components/ui/CardSummary.vue'; +import { getUrl } from 'src/composables/getUrl'; +import VnLv from 'src/components/ui/VnLv.vue'; import WorkerDescriptorProxy from './WorkerDescriptorProxy.vue'; - -onMounted(() => fetch()); -onUpdated(() => fetch()); +import { dashIfEmpty } from 'src/filters'; const route = useRoute(); const { t } = useI18n(); @@ -20,8 +20,11 @@ const $props = defineProps({ }); const entityId = computed(() => $props.id || route.params.id); +const workerUrl = ref(); -const worker = ref(null); +onMounted(async () => { + workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`; +}); const filter = { include: [ @@ -59,230 +62,59 @@ const filter = { }, ], }; - -function fetch() { - const id = entityId.value; - axios.get(`/Workers/${id}`, { params: { filter } }).then((response) => { - worker.value = response.data; - }); -} - -function sipExtension() { - if (worker.value.sip) return worker.value.sip.extension; - return '-'; -} - diff --git a/test/cypress/integration/workerSummary.spec.js b/test/cypress/integration/workerSummary.spec.js index cef26d061..7228b4b31 100644 --- a/test/cypress/integration/workerSummary.spec.js +++ b/test/cypress/integration/workerSummary.spec.js @@ -1,15 +1,15 @@ describe('WorkerSummary', () => { beforeEach(() => { - cy.viewport(1280, 720) - cy.login('developer') + cy.viewport(1280, 720); + cy.login('developer'); cy.visit('/#/worker/19/summary'); }); it('should load worker summary', () => { - cy.get('div[class="header bg-primary q-pa-sm q-mb-md"').should('have.text', '19 - salesBoss salesBoss'); - cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(0).should('have.text', 'Basic data'); - cy.get('div[class="q-item__label q-item__label--header text-h6"]').eq(1).should('have.text', 'User data'); - cy.get('div[class="q-item__section column q-item__section--main justify-center"]').eq(0).should('have.text', 'NamesalesBossNick'); + cy.get('.summaryHeader > div').should('have.text', '19 - salesBoss salesBoss'); + cy.get(':nth-child(1) > :nth-child(2) > .value > span').should( + 'have.text', + 'salesBossNick' + ); }); - });