Merge pull request 'feat: #8237 changed observation type to be SalesPerson by default' (!1623) from 8237-defaultObservationType into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1623
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
PAU ROVIRA ROSALENY 2025-03-25 06:16:16 +00:00
commit 97ceffc96c
1 changed files with 16 additions and 3 deletions

View File

@ -40,6 +40,11 @@ const quasar = useQuasar();
const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]);
const vnPaginateRef = ref();
const defaultObservationType = computed(() =>
observationTypes.value.find(ot => ot.code === 'salesPerson')?.id
);
let originalText;
function handleClick(e) {
@ -111,14 +116,22 @@ function fetchData([data]) {
originalText = data?.notes;
emit('onFetch', data);
}
const handleObservationTypes = (data) => {
observationTypes.value = data;
if(defaultObservationType.value) {
newNote.observationTypeFk = defaultObservationType.value;
}
};
</script>
<template>
<FetchData
v-if="selectType"
url="ObservationTypes"
:filter="{ fields: ['id', 'description'] }"
:filter="{ fields: ['id', 'description', 'code'] }"
auto-load
@on-fetch="(data) => (observationTypes = data)"
@on-fetch="handleObservationTypes"
/>
<FetchData
v-if="justInput"
@ -154,6 +167,7 @@ function fetchData([data]) {
filled
size="lg"
autogrow
autofocus
@keyup.enter.stop="handleClick"
:required="isRequired"
clearable
@ -189,7 +203,6 @@ function fetchData([data]) {
:search-url="false"
@on-fetch="
newNote.text = '';
newNote.observationTypeFk = null;
"
>
<template #body="{ rows }">