dev #89

Merged
jgallego merged 28 commits from dev into test 2023-08-31 09:12:54 +00:00
7 changed files with 47 additions and 78 deletions
Showing only changes of commit 330db88ccc - Show all commits

View File

@ -27,7 +27,7 @@ async function insert() {
} }
</script> </script>
<template> <template>
<div class="notes row justify-center"> <div class="column items-center">
<VnPaginate <VnPaginate
:data-key="$props.url" :data-key="$props.url"
:url="$props.url" :url="$props.url"
@ -38,63 +38,51 @@ async function insert() {
ref="vnPaginateRef" ref="vnPaginateRef"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QCard <QCard class="q-pa-md" v-for="(note, index) in rows" :key="index">
class="row justify-between items-center flex-wrap-wrap q-pa-md q-ma-md" <QCardSection horizontal>
v-for="(note, index) in rows"
:key="index"
>
<div class="picture q-pa-sm col-6 col-lg-2">
<slot name="picture"> <slot name="picture">
<VnAvatar :worker="note.workerFk"> <VnAvatar :worker="note.workerFk" />
<template #description>
<span class="link">
{{
`${note.worker.firstName} ${note.worker.lastName}`
}}
</span>
<WorkerDescriptorProxy :id="note.worker.id" />
</template>
</VnAvatar>
</slot> </slot>
</div> <QItem class="full-width justify-between items-start">
<div class="text q-mx-auto q-pa-xs col col-lg-8"> <span class="link">
{{ `${note.worker.firstName} ${note.worker.lastName}` }}
<WorkerDescriptorProxy :id="note.worker.id" />
</span>
<slot name="actions">
{{ toDateHour(note.created) }}
</slot>
</QItem>
</QCardSection>
<QCardSection>
<slot name="text"> <slot name="text">
{{ note.text }} {{ note.text }}
</slot> </slot>
</div> </QCardSection>
<div class="actions self-baseline text-right col-6 col-lg-2">
<slot name="actions">
<div>
{{ toDateHour(note.created) }}
</div>
</slot>
</div>
</QCard> </QCard>
</template> </template>
</VnPaginate> </VnPaginate>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn <QBtn
v-if="addNote" v-if="addNote"
class="add-btn"
color="primary" color="primary"
icon="add" icon="add"
size="xl" size="lg"
round round
@click="noteModal = true" @click="noteModal = true"
/> />
</QPageSticky> </QPageSticky>
<QDialog v-model="noteModal" persistent> <QDialog v-model="noteModal" persistent>
<QCard class="note-dialog column q-pa-sm"> <QCard>
<QCardSection class="note-dialog__header row self-start justify-between"> <QCardSection>
<div class="note-dialog__title row items-center text-primary text-h6"> <QItem class="q-px-none">
<QIcon name="draft" class="note-dialog__title-icon q-mr-sm" /> <span class="text-primary text-h6 full-width">
<div class="text-h6 note-dialog__title-text"> <QIcon name="draft" class="q-mr-xs" />
{{ t('Add note') }} {{ t('Add note') }}
</div> </span>
</div>
<QBtn icon="close" flat round dense v-close-popup /> <QBtn icon="close" flat round dense v-close-popup />
</QItem>
</QCardSection> </QCardSection>
<QCardSection class="note-dialog__content"> <QCardSection>
<QInput <QInput
autofocus autofocus
type="textarea" type="textarea"
@ -105,7 +93,7 @@ async function insert() {
v-model="newNote" v-model="newNote"
></QInput> ></QInput>
</QCardSection> </QCardSection>
<QCardActions class="note-dialog__actions self-end q-mr-md"> <QCardActions class="justify-end q-mr-sm">
<QBtn <QBtn
flat flat
:label="t('globals.close')" :label="t('globals.close')"
@ -125,25 +113,7 @@ async function insert() {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-card { .q-card {
max-width: 60em; max-width: 80em;
min-width: 340px;
}
.note-dialog {
&__header {
width: 100%;
}
&__content {
width: 95%;
}
}
@media (max-width: $breakpoint-md) {
.avatar-picture {
width: 135px;
}
.text {
order: 3;
}
} }
</style> </style>
<i18n> <i18n>

View File

@ -266,6 +266,7 @@ export default {
rma: 'RMA', rma: 'RMA',
photos: 'Photos', photos: 'Photos',
log: 'Audit logs', log: 'Audit logs',
notes: 'Notes',
}, },
list: { list: {
customer: 'Customer', customer: 'Customer',

View File

@ -265,6 +265,7 @@ export default {
rma: 'RMA', rma: 'RMA',
photos: 'Fotos', photos: 'Fotos',
log: 'Registros de auditoría', log: 'Registros de auditoría',
notes: 'Notas',
}, },
list: { list: {
customer: 'Cliente', customer: 'Cliente',

View File

@ -44,17 +44,6 @@ onMounted(async () => {
<LeftMenu source="card" /> <LeftMenu source="card" />
<QSeparator /> <QSeparator />
<QList> <QList>
<QItem
active-class="text-primary"
:to="`/claim/${entityId}/notes`"
clickable
v-ripple
>
<QItemSection avatar>
<QIcon name="draft" />
</QItemSection>
<QItemSection> {{ t('Notes') }} </QItemSection>
</QItem>
<QItem <QItem
active-class="text-primary" active-class="text-primary"
clickable clickable

View File

@ -25,7 +25,7 @@ const body = {
}; };
</script> </script>
<template> <template>
<div class="claim-notes col items-center"> <div class="col items-center">
<VnNotes <VnNotes
:add-note="true" :add-note="true"
:id="id" :id="id"

View File

@ -11,7 +11,14 @@ export default {
redirect: { name: 'ClaimMain' }, redirect: { name: 'ClaimMain' },
menus: { menus: {
main: ['ClaimList', 'ClaimRmaList'], main: ['ClaimList', 'ClaimRmaList'],
card: ['ClaimBasicData', 'ClaimLines', 'ClaimRma', 'ClaimPhotos', 'ClaimLog'], card: [
'ClaimBasicData',
'ClaimLines',
'ClaimRma',
'ClaimPhotos',
'ClaimLog',
'ClaimNotes',
],
}, },
children: [ children: [
{ {
@ -108,7 +115,7 @@ export default {
path: 'notes', path: 'notes',
meta: { meta: {
title: 'notes', title: 'notes',
icon: 'vn:details', icon: 'draft',
}, },
component: () => import('src/pages/Claim/Card/ClaimNotes.vue'), component: () => import('src/pages/Claim/Card/ClaimNotes.vue'),
}, },

View File

@ -1,16 +1,17 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ClaimNotes', () => { describe('ClaimNotes', () => {
beforeEach(() => { beforeEach(() => {
const claimId = 2;
cy.login('developer'); cy.login('developer');
cy.visit(`/#/claim/${claimId}/notes`); cy.visit(`/#/claim/${2}/notes`);
}); });
it('should add a new note', () => { it('should add a new note', () => {
const message = 'This is a new message.'; const message = 'This is a new message.';
cy.get('.add-btn').click(); cy.get('.q-page-sticky button').click();
cy.get('.note-dialog__content').type(message); cy.get('.q-dialog .q-card__section:nth-child(2)').type(message);
cy.get('.note-dialog__actions .q-btn:nth-child(2)').click(); cy.get('.q-card__actions button:nth-child(2)').click();
cy.get('.notes .q-card .text').eq(0).should('have.text', message); cy.get('.q-card .q-card__section:nth-child(2)')
.eq(0)
.should('have.text', message);
}); });
}); });