From 5417c1691ab2d8b73711a4023fb0629fc82662fe Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 9 Aug 2023 15:16:00 +0200 Subject: [PATCH 1/5] refs #5990 refactor: cardSummary --- src/components/ui/CardSummary.vue | 93 ++++++++++++++++--------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index b3fb9746b..d1b346c5c 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -2,6 +2,8 @@ import { onMounted, ref, watch } from 'vue'; import axios from 'axios'; import SkeletonSummary from 'components/ui/SkeletonSummary.vue'; +import VnLv from 'src/components/ui/VnLv.vue'; + onMounted(() => fetch()); const entity = ref(); @@ -44,9 +46,9 @@ watch(props, async () => { From 63e15c96cb442af12c4980f50893b5f6eba5bb08 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 10 Aug 2023 15:38:31 +0200 Subject: [PATCH 2/5] refs #5990 feat(cardSummary): add slot --- src/components/ui/CardSummary.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index d1b346c5c..266dd30b1 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -50,6 +50,7 @@ watch(props, async () => { +
From c64ae1cceea5413a1a1dcfad57cd04ce5ec5be88 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 14 Aug 2023 13:52:25 +0200 Subject: [PATCH 3/5] 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' + ); }); - }); From e383615092fd46e908fced09b488b1b823f45a5e Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 16 Aug 2023 07:28:47 +0200 Subject: [PATCH 4/5] refs #5990 feat(summarys): cusom colors --- src/components/ui/CardSummary.vue | 4 ++-- src/css/app.scss | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index cfc652a44..75559f076 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -101,7 +101,7 @@ watch(props, async () => { > .q-card { width: 100%; - background-color: rgb(58, 58, 58); + background-color: var(--vn-gray); padding: 15px; font-size: 16px; min-width: 275px; @@ -119,7 +119,7 @@ watch(props, async () => { margin-right: 10px; } .value { - color: white; //$light-black; + color: var(--vn-text); //$light-black; width: max-content; overflow: hidden; white-space: nowrap; diff --git a/src/css/app.scss b/src/css/app.scss index 466219906..7d1acd53b 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -35,4 +35,11 @@ body.body--light { color: white; } } + --vn-text: #000000; + --vn-gray: #dddddd; +} + +body.body--dark { + --vn-text: #ffffff; + --vn-gray: #313131; } From 4f9cdd2112b5a0fc912f9c7be2bbdad08005318f Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 16 Aug 2023 07:35:29 +0200 Subject: [PATCH 5/5] refs #5990 feat(summarys): custom colors --- src/components/ui/CardSummary.vue | 4 ++-- src/css/app.scss | 2 ++ src/css/quasar.variables.scss | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index 75559f076..561798968 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -111,7 +111,7 @@ watch(props, async () => { flex-direction: row; margin-top: 5px; .label { - color: rgb(131, 131, 131); //$gray; + color: var(--vn-label); width: 10em; overflow: hidden; white-space: nowrap; @@ -119,7 +119,7 @@ watch(props, async () => { margin-right: 10px; } .value { - color: var(--vn-text); //$light-black; + color: var(--vn-text); width: max-content; overflow: hidden; white-space: nowrap; diff --git a/src/css/app.scss b/src/css/app.scss index 7d1acd53b..bf501f011 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -37,9 +37,11 @@ body.body--light { } --vn-text: #000000; --vn-gray: #dddddd; + --vn-label: #5f5f5f; } body.body--dark { --vn-text: #ffffff; --vn-gray: #313131; + --vn-label: #a8a8a8; } diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index 5d20efe73..b2414d4ce 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -47,4 +47,4 @@ $dark: #292929; $layout-shadow-dark: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0px 10px rgba(0, 0, 0, 0.24); $spacing-md: 16px; -$label-color: rgba(255, 255, 255, 0.6); +$label-color: #ffffff99;