From ee7c2389b58d2831e33338741129160bd8d2307e Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 16 Aug 2023 09:03:41 +0200 Subject: [PATCH] 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); + }); +});