diff --git a/src/components/ui/VnNotes.vue b/src/components/ui/VnNotes.vue index bf5e86a16d..8760812353 100644 --- a/src/components/ui/VnNotes.vue +++ b/src/components/ui/VnNotes.vue @@ -1,6 +1,6 @@ + (observationTypes = data)" + /> @@ -62,29 +73,42 @@ onBeforeRouteLeave((to, from, next) => { {{ t('globals.now') }} - - - - - - + + + + + + + + + { class="show" v-bind="$attrs" search-url="notes" + @on-fetch=" + newNote.text = ''; + newNote.observationTypeFk = null; + " > @@ -111,13 +139,28 @@ onBeforeRouteLeave((to, from, next) => { :descriptor="false" :worker-id="note.workerFk" size="md" + :title="note.worker?.user.nickname" /> - - {{ toDateHourMin(note.created) }} + + + + {{ + observationTypes.find( + (ot) => ot.id === note.observationTypeFk + )?.description + }} + + + @@ -131,12 +174,6 @@ onBeforeRouteLeave((to, from, next) => { es: Add note here...: Añadir nota aquí... New note: Nueva nota Save (Enter): Guardar (Intro) - + Observation type: Tipo de observación diff --git a/src/pages/Customer/Card/CustomerNotes.vue b/src/pages/Customer/Card/CustomerNotes.vue index a9121f7f5d..b851746963 100644 --- a/src/pages/Customer/Card/CustomerNotes.vue +++ b/src/pages/Customer/Card/CustomerNotes.vue @@ -22,5 +22,6 @@ const noteFilter = computed(() => { :filter="noteFilter" :body="{ clientFk: route.params.id }" style="overflow-y: auto" + :select-type="true" /> diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue index 5798e7512d..27dfe48e65 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue @@ -25,19 +25,31 @@ const { notify } = useNotify(); const { t } = useI18n(); const newObservation = ref(null); +const obsId = ref(null); const onSubmit = async () => { try { - const data = $props.clients.map((item) => { - return { clientFk: item.clientFk, text: newObservation.value }; - }); - await axios.post('ClientObservations', data); + if (!obsId.value) + obsId.value = ( + await axios.get('ObservationTypes/findOne', { + params: { filter: { where: { description: 'Finance' } } }, + }) + ).data?.id; - const payload = { + const bodyObs = $props.clients.map((item) => { + return { + clientFk: item.clientFk, + text: newObservation.value, + observationTypeFk: obsId.value, + }; + }); + await axios.post('ClientObservations', bodyObs); + + const bodyObsMail = { defaulters: $props.clients, observation: newObservation.value, }; - await axios.post('Defaulters/observationEmail', payload); + await axios.post('Defaulters/observationEmail', bodyObsMail); await $props.promise(); diff --git a/src/pages/Customer/components/CustomerAddressEdit.vue b/src/pages/Customer/components/CustomerAddressEdit.vue index 606867388d..1e5387815b 100644 --- a/src/pages/Customer/components/CustomerAddressEdit.vue +++ b/src/pages/Customer/components/CustomerAddressEdit.vue @@ -240,39 +240,33 @@ function handleLocation(data, location) { class="row q-gutter-md q-mb-md" v-for="(note, index) in notes" > - - - - - - - - - - {{ t('Remove note') }} - - - + + + + + {{ t('Remove note') }} + + - { + const saveBtn = '.q-field__append > .q-btn > .q-btn__content > .q-icon'; + const firstNote = '.q-infinite-scroll :nth-child(1) > .q-card__section--vert'; beforeEach(() => { cy.login('developer'); cy.visit(`/#/claim/${2}/notes`); @@ -7,7 +9,7 @@ describe('ClaimNotes', () => { it('should add a new note', () => { const message = 'This is a new message.'; cy.get('.q-textarea').type(message); - cy.get('.q-field__append > .q-btn > .q-btn__content > .q-icon').click(); //save - cy.get(':nth-child(1) > .q-card__section--vert').should('have.text', message); + cy.get(saveBtn).click(); + cy.get(firstNote).should('have.text', message); }); });