feat: refs #8118 add VnDropdown component and integrate it into Claim and Ticket summaries #1517

Merged
benjaminedc merged 53 commits from 8118-createComponentVnDropdown into dev 2025-03-26 10:32:30 +00:00
3 changed files with 14 additions and 18 deletions
Showing only changes of commit bce7e2ad56 - Show all commits
src
components/common
pages

View File

@ -11,14 +11,18 @@ const $props = defineProps({
type: Boolean,
default: null,
},
moduleName: {
type: String,
default: null,
},
options: {
benjaminedc marked this conversation as resolved
jorgep commented 2025-02-28 12:21:56 +00:00
Review

No usar moduleName , optionLabel

No usar moduleName , optionLabel
type: Array,
default: null,
},
optionLabel: {
type: String,
default: 'name',
},
benjaminedc marked this conversation as resolved Outdated

añadir también optionValue, tiene que ser flexible, puede que no se quiera usar siempre code, si quieres ponerlo como opción por defecto vale.

añadir también optionValue, tiene que ser flexible, puede que no se quiera usar siempre code, si quieres ponerlo como opción por defecto vale.
optionValue: {
type: String,
default: 'id',
},
});
async function changeState(value) {
@ -37,8 +41,9 @@ async function changeState(value) {
>
<VnSelect
benjaminedc marked this conversation as resolved
jorgep commented 2025-02-28 12:25:15 +00:00
Review

añadir: :option-label="optionLabel", se puede hacer directamente :option-label si se llama igual la variable que quieres pasar, pero al ser camelCase no sé si funciona.

añadir: `:option-label="optionLabel"`, se puede hacer directamente :option-label si se llama igual la variable que quieres pasar, pero al ser camelCase no sé si funciona.
:options="$props.options"
:option-label="$props.optionLabel"
:option-value="$props.optionValue"
hide-selected
option-value="code"
hide-dropdown-icon
focus-on-mount
@update:model-value="changeState"
@ -46,11 +51,8 @@ async function changeState(value) {
<template #option="scope">
benjaminedc marked this conversation as resolved
Review

Este template es el que tiene por defecto VnSelect, no hace falta que lo añadas aquí.

Este template es el que tiene por defecto VnSelect, no hace falta que lo añadas aquí.
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel v-if="$props.moduleName === 'Ticket'">
{{ scope.opt?.name }}
</QItemLabel>
<QItemLabel v-if="$props.moduleName === 'Claim'">
{{ scope.opt?.description }}
<QItemLabel>
{{ scope.opt?.name || scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>

View File

@ -173,9 +173,8 @@ function openDialog(dmsId) {
}
async function changeState(value) {
const newState = claimStates.value.find((state) => state.code == value);
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
benjaminedc marked this conversation as resolved Outdated
jorgep commented 2025-02-28 12:37:01 +00:00
Outdated
Review

Si en VnDropdown, creas la prop optionValue y le dices que use id , ya no te hace falta hacer un find para encontrar el id.

Si en VnDropdown, creas la prop optionValue y le dices que use id , ya no te hace falta hacer un find para encontrar el id.
claimStateFk: newState.id,
claimStateFk: value,
});
router.go(route.fullPath);
}
@ -208,11 +207,7 @@ onMounted(async () => {
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template>
<template #header-right>
<VnDropdown
:moduleName="route.meta.moduleName"
:options="claimStates"
@change-state="changeState($event)"
/>
<VnDropdown :options="claimStates" @change-state="changeState($event)" />
</template>
<template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity.claim" />

View File

@ -114,7 +114,6 @@ onMounted(async () => {
</template>
<template #header-right>
<VnDropdown
:moduleName="route.meta.moduleName"
:moduleId="entityId"
:options="editableStates"
:disable="!isEditable()"
benjaminedc marked this conversation as resolved Outdated

no hace falta usar ":" cuando es texto.

no hace falta usar ":" cuando es texto.