From bba6050c5f3d977ce462dfc69d4de1f70fe19520 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 8 Aug 2023 12:36:11 +0200 Subject: [PATCH 01/12] refs #6082 navBar --- src/components/NavBar.vue | 42 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 7b7b1097f..41654f815 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -6,6 +6,7 @@ import UserPanel from 'components/UserPanel.vue'; import { useState } from 'src/composables/useState'; import { useStateStore } from 'stores/useStateStore'; import PinnedModules from './PinnedModules.vue'; +import { useQuasar } from 'quasar'; const { t } = useI18n(); const session = useSession(); @@ -14,6 +15,7 @@ const state = useState(); const user = state.getUser(); const token = session.getToken(); const appName = 'Lilium'; +const quasar = useQuasar(); onMounted(() => stateStore.setMounted()); @@ -34,7 +36,13 @@ onMounted(() => stateStore.setMounted()); - + stateStore.setMounted());
- + {{ t('globals.pinnedModules') }} - + stateStore.setMounted()); + + -- 2.40.1 From f127c1019bb690739beb9bc835ef153e7566ea74 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 9 Aug 2023 14:41:50 +0200 Subject: [PATCH 02/12] refs #6082 v-if mobile icon search --- src/components/NavBar.vue | 25 ++++++++++--------------- src/components/ui/VnSearchbar.vue | 4 +++- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 41654f815..7f7fc4b4e 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -77,7 +77,14 @@ onMounted(() => stateStore.setMounted()); - + stateStore.setMounted()); diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 453af78af..f495a49bb 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -2,6 +2,8 @@ import { onMounted, ref } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { useArrayData } from 'composables/useArrayData'; +import { useQuasar } from 'quasar'; +const quasar = useQuasar(); const props = defineProps({ dataKey: { @@ -93,7 +95,7 @@ async function search() { autofocus > - + --> -- 2.40.1 From ee7c2389b58d2831e33338741129160bd8d2307e Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 16 Aug 2023 09:03:41 +0200 Subject: [PATCH 04/12] refs 6105 claimNotes and VnNotes created --- src/components/ui/AvatarPicture.vue | 36 +++++ src/components/ui/VnNotes.vue | 156 ++++++++++++++++++++ src/filters/index.js | 2 + src/filters/toDateHour.js | 12 ++ src/pages/Claim/Card/ClaimCard.vue | 36 +++-- src/pages/Claim/Card/ClaimNotes.vue | 86 +++++++++++ src/router/modules/claim.js | 9 ++ test/cypress/integration/ClaimNotes.spec.js | 16 ++ 8 files changed, 342 insertions(+), 11 deletions(-) create mode 100644 src/components/ui/AvatarPicture.vue create mode 100644 src/components/ui/VnNotes.vue create mode 100644 src/filters/toDateHour.js create mode 100644 src/pages/Claim/Card/ClaimNotes.vue create mode 100644 test/cypress/integration/ClaimNotes.spec.js diff --git a/src/components/ui/AvatarPicture.vue b/src/components/ui/AvatarPicture.vue new file mode 100644 index 000000000..a28a660c2 --- /dev/null +++ b/src/components/ui/AvatarPicture.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue new file mode 100644 index 000000000..21c56b0b3 --- /dev/null +++ b/src/components/ui/VnNotes.vue @@ -0,0 +1,156 @@ + + + + + es: + Add note here...: Añadir nota aquí... + Add note: Añadir nota + diff --git a/src/filters/index.js b/src/filters/index.js index 4d24d9f67..158ce1009 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -1,6 +1,7 @@ import toLowerCase from './toLowerCase'; import toDate from './toDate'; import toDateString from './toDateString'; +import toDateHour from './toDateHour'; import toCurrency from './toCurrency'; import toPercentage from './toPercentage'; import toLowerCamel from './toLowerCamel'; @@ -11,6 +12,7 @@ export { toLowerCamel, toDate, toDateString, + toDateHour, toCurrency, toPercentage, dashIfEmpty, diff --git a/src/filters/toDateHour.js b/src/filters/toDateHour.js new file mode 100644 index 000000000..939352404 --- /dev/null +++ b/src/filters/toDateHour.js @@ -0,0 +1,12 @@ +export default function toDateHour(date) { + const dateHour = new Date(date).toLocaleDateString('es-ES', { + timeZone: 'Europe/Madrid', + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }); + return dateHour; +} diff --git a/src/pages/Claim/Card/ClaimCard.vue b/src/pages/Claim/Card/ClaimCard.vue index 2691bbc51..cfc06444f 100644 --- a/src/pages/Claim/Card/ClaimCard.vue +++ b/src/pages/Claim/Card/ClaimCard.vue @@ -3,11 +3,12 @@ import LeftMenu from 'components/LeftMenu.vue'; import { getUrl } from 'composables/getUrl'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import { useStateStore } from 'stores/useStateStore'; -import { computed, onMounted } from 'vue'; +import { computed } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import ClaimDescriptor from './ClaimDescriptor.vue'; +import { onMounted } from 'vue'; const stateStore = useStateStore(); const { t } = useI18n(); const route = useRoute(); @@ -21,11 +22,6 @@ const $props = defineProps({ const entityId = computed(() => { return $props.id || route.params.id; }); -const claimSections = [ - { name: 'Notes', url: '/note/index', icon: 'draft' }, - { name: 'Development', url: '/development', icon: 'vn:traceability' }, - { name: 'Action', url: '/action', icon: 'vn:actions' }, -]; let salixUrl; onMounted(async () => { @@ -49,17 +45,35 @@ onMounted(async () => { - + - {{ t(section.name) }} + {{ t('Notes') }} + + + + + + {{ t('Development') }} + + + + {{ t('Action') }} diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue new file mode 100644 index 000000000..c79c9e486 --- /dev/null +++ b/src/pages/Claim/Card/ClaimNotes.vue @@ -0,0 +1,86 @@ + + + diff --git a/src/router/modules/claim.js b/src/router/modules/claim.js index c43ed5012..9f16f9569 100644 --- a/src/router/modules/claim.js +++ b/src/router/modules/claim.js @@ -103,6 +103,15 @@ export default { }, component: () => import('src/pages/Claim/Card/ClaimLog.vue'), }, + { + name: 'ClaimNotes', + path: 'notes', + meta: { + title: 'notes', + icon: 'vn:details', + }, + component: () => import('src/pages/Claim/Card/ClaimNotes.vue'), + }, ], }, ], diff --git a/test/cypress/integration/ClaimNotes.spec.js b/test/cypress/integration/ClaimNotes.spec.js new file mode 100644 index 000000000..9370c7a9e --- /dev/null +++ b/test/cypress/integration/ClaimNotes.spec.js @@ -0,0 +1,16 @@ +/// +describe('ClaimNotes', () => { + beforeEach(() => { + const claimId = 2; + cy.login('developer'); + cy.visit(`/#/claim/${claimId}/notes`); + }); + + it('should add a new note', () => { + const message = 'This is a new message.'; + cy.get('.add-btn').click(); + cy.get('.note-dialog__content').type(message); + cy.get('.note-dialog__actions .q-btn:nth-child(2)').click(); + cy.get('.notes > :nth-child(1) > .text').should('have.text', message); + }); +}); -- 2.40.1 From 4bac67de38d2ac416536f90e7f211d414862e41c Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 18 Aug 2023 12:12:53 +0200 Subject: [PATCH 05/12] refs 6105 VnNotes and ClaimNotes refactored --- src/components/ui/AvatarPicture.vue | 12 +- src/components/ui/VnNotes.vue | 136 +++++++++----------- src/components/ui/VnPaginate.vue | 2 +- src/pages/Claim/Card/ClaimNotes.vue | 42 +++--- test/cypress/integration/ClaimNotes.spec.js | 2 +- 5 files changed, 87 insertions(+), 107 deletions(-) diff --git a/src/components/ui/AvatarPicture.vue b/src/components/ui/AvatarPicture.vue index a28a660c2..127bc8970 100644 --- a/src/components/ui/AvatarPicture.vue +++ b/src/components/ui/AvatarPicture.vue @@ -8,7 +8,7 @@ const session = useSession(); const token = session.getToken(); - diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue index 21c56b0b3..c05ecdecf 100644 --- a/src/components/ui/VnNotes.vue +++ b/src/components/ui/VnNotes.vue @@ -4,8 +4,8 @@ import AvatarPicture from 'src/components/ui/AvatarPicture.vue'; import { toDateHour } from 'src/filters'; import { ref } from 'vue'; import axios from 'axios'; -import FetchData from 'components/FetchData.vue'; import { useI18n } from 'vue-i18n'; +import VnPaginate from './VnPaginate.vue'; const $props = defineProps({ id: { type: String, required: true }, @@ -15,36 +15,75 @@ const $props = defineProps({ addNote: { type: Boolean, default: false }, }); const { t } = useI18n(); -const notes = ref([]); const noteModal = ref(false); const newNote = ref(''); -const claimObservationRef = ref(); - -function setNotes(data) { - notes.value = data; -} +const vnPaginateRef = ref(); async function fetch() { const body = $props.body; Object.assign(body, { text: newNote.value }); await axios.post($props.url, body); - claimObservationRef.value.fetch(); + vnPaginateRef.value.fetch(); } diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 2a5b878f5..434ebf232 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -49,6 +49,7 @@ const props = defineProps({ }); const emit = defineEmits(['onFetch', 'onPaginate']); +defineExpose({ fetch }); const isLoading = ref(false); const pagination = ref({ sortBy: props.order, @@ -82,7 +83,6 @@ async function fetch() { if (!arrayData.hasMoreData.value) { isLoading.value = false; } - emit('onFetch', store.data); } diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue index c79c9e486..6c8361fde 100644 --- a/src/pages/Claim/Card/ClaimNotes.vue +++ b/src/pages/Claim/Card/ClaimNotes.vue @@ -9,7 +9,6 @@ const user = state.getUser(); const id = route.params.id; const claimFilter = { - order: 'created DESC', where: { claimFk: id }, fields: ['created', 'workerFk', 'text'], include: { @@ -38,7 +37,6 @@ const body = { diff --git a/src/pages/Claim/Card/ClaimNotes.vue b/src/pages/Claim/Card/ClaimNotes.vue index 6c8361fde..9e587533a 100644 --- a/src/pages/Claim/Card/ClaimNotes.vue +++ b/src/pages/Claim/Card/ClaimNotes.vue @@ -25,7 +25,7 @@ const body = { }; - -- 2.40.1 From 36a487a9fcabc916aa746379664588f2841b744f Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 21 Aug 2023 12:50:01 +0200 Subject: [PATCH 07/12] refs #6082 navBar fix mobile --- src/components/NavBar.vue | 17 +++++++---------- src/components/PinnedModules.vue | 16 +++++----------- src/components/ui/VnSearchbar.vue | 6 +----- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index fa0a505f9..7d09b09b8 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -62,7 +62,7 @@ const pinnedModulesRef = ref(); - +
@@ -77,7 +77,7 @@ const pinnedModulesRef = ref(); - + en: Go to Salix: Go to Salix diff --git a/src/components/PinnedModules.vue b/src/components/PinnedModules.vue index c85b6b2fa..5f291b580 100644 --- a/src/components/PinnedModules.vue +++ b/src/components/PinnedModules.vue @@ -35,19 +35,13 @@ async function redirect() {