diff --git a/src/components/ui/VnAvatar.vue b/src/components/ui/VnAvatar.vue new file mode 100644 index 000000000..127bc8970 --- /dev/null +++ b/src/components/ui/VnAvatar.vue @@ -0,0 +1,26 @@ + + + + + + + + + + {{ $props.description }} + + + + + diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue new file mode 100644 index 000000000..139b0ab5a --- /dev/null +++ b/src/components/ui/VnNotes.vue @@ -0,0 +1,123 @@ + + + + + + + + + + + + + {{ `${note.worker.firstName} ${note.worker.lastName}` }} + + + + {{ toDateHour(note.created) }} + + + + + + {{ note.text }} + + + + + + + + + + + + + + + {{ t('Add note') }} + + + + + + + + + + + + + + + + + + es: + Add note here...: Añadir nota aquí... + Add note: Añadir nota + 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/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/i18n/en/index.js b/src/i18n/en/index.js index 4cafee136..d7519ba53 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -266,6 +266,7 @@ export default { rma: 'RMA', photos: 'Photos', log: 'Audit logs', + notes: 'Notes', }, list: { customer: 'Customer', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 13e3fd626..fc2c80f55 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -265,6 +265,7 @@ export default { rma: 'RMA', photos: 'Fotos', log: 'Registros de auditoría', + notes: 'Notas', }, list: { customer: 'Cliente', diff --git a/src/pages/Claim/Card/ClaimCard.vue b/src/pages/Claim/Card/ClaimCard.vue index 2691bbc51..9f1ecc416 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,24 @@ onMounted(async () => { - + - {{ t(section.name) }} + {{ 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..94b53c8a2 --- /dev/null +++ b/src/pages/Claim/Card/ClaimNotes.vue @@ -0,0 +1,37 @@ + + + + + + diff --git a/src/router/modules/claim.js b/src/router/modules/claim.js index c43ed5012..40aaef73b 100644 --- a/src/router/modules/claim.js +++ b/src/router/modules/claim.js @@ -11,7 +11,14 @@ export default { redirect: { name: 'ClaimMain' }, menus: { main: ['ClaimList', 'ClaimRmaList'], - card: ['ClaimBasicData', 'ClaimLines', 'ClaimRma', 'ClaimPhotos', 'ClaimLog'], + card: [ + 'ClaimBasicData', + 'ClaimLines', + 'ClaimRma', + 'ClaimPhotos', + 'ClaimLog', + 'ClaimNotes', + ], }, children: [ { @@ -103,6 +110,15 @@ export default { }, component: () => import('src/pages/Claim/Card/ClaimLog.vue'), }, + { + name: 'ClaimNotes', + path: 'notes', + meta: { + title: 'notes', + icon: 'draft', + }, + 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..5b52dd339 --- /dev/null +++ b/test/cypress/integration/ClaimNotes.spec.js @@ -0,0 +1,17 @@ +/// +describe('ClaimNotes', () => { + beforeEach(() => { + cy.login('developer'); + cy.visit(`/#/claim/${2}/notes`); + }); + + it('should add a new note', () => { + const message = 'This is a new message.'; + cy.get('.q-page-sticky button').click(); + cy.get('.q-dialog .q-card__section:nth-child(2)').type(message); + cy.get('.q-card__actions button:nth-child(2)').click(); + cy.get('.q-card .q-card__section:nth-child(2)') + .eq(0) + .should('have.text', message); + }); +});
+ {{ $props.description }} +