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 b3fb9746b..561798968 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(); @@ -41,15 +43,21 @@ watch(props, async () => { 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' + ); }); - });