Merge pull request 'feat: refs #8118 add VnDropdown component and integrate it into Claim and Ticket summaries' (!1517) from 8118-createComponentVnDropdown into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1517 Reviewed-by: Jorge Penadés <jorgep@verdnatura.es>
This commit is contained in:
commit
ceb18df7ff
|
@ -0,0 +1,53 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import VnSelect from './VnSelect.vue';
|
||||||
|
|
||||||
|
const stateBtnDropdownRef = ref();
|
||||||
|
|
||||||
|
const emit = defineEmits(['changeState']);
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
disable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
optionLabel: {
|
||||||
|
type: String,
|
||||||
|
default: 'name',
|
||||||
|
},
|
||||||
|
optionValue: {
|
||||||
|
type: String,
|
||||||
|
default: 'id',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function changeState(value) {
|
||||||
|
stateBtnDropdownRef.value?.hide();
|
||||||
|
emit('changeState', value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QBtnDropdown
|
||||||
|
ref="stateBtnDropdownRef"
|
||||||
|
color="black"
|
||||||
|
text-color="white"
|
||||||
|
:label="$t('globals.changeState')"
|
||||||
|
:disable="$props.disable"
|
||||||
|
>
|
||||||
|
<VnSelect
|
||||||
|
:options="$props.options"
|
||||||
|
:option-label="$props.optionLabel"
|
||||||
|
:option-value="$props.optionValue"
|
||||||
|
hide-selected
|
||||||
|
hide-dropdown-icon
|
||||||
|
focus-on-mount
|
||||||
|
@update:model-value="changeState"
|
||||||
|
>
|
||||||
|
</VnSelect>
|
||||||
|
</QBtnDropdown>
|
||||||
|
</template>
|
|
@ -21,6 +21,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||||
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
|
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
|
||||||
|
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -36,7 +37,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const ClaimStates = ref([]);
|
const claimStates = ref([]);
|
||||||
const claimDmsRef = ref();
|
const claimDmsRef = ref();
|
||||||
const claimDms = ref([]);
|
const claimDms = ref([]);
|
||||||
const multimediaDialog = ref();
|
const multimediaDialog = ref();
|
||||||
|
@ -173,7 +174,9 @@ function openDialog(dmsId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
|
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
|
||||||
|
claimStateFk: value,
|
||||||
|
});
|
||||||
router.go(route.fullPath);
|
router.go(route.fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,13 +186,18 @@ function claimUrl(section) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="ClaimStates"
|
||||||
|
:filter="{ fields: ['id', 'description'] }"
|
||||||
|
@on-fetch="(data) => (claimStates = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="ClaimDms"
|
url="ClaimDms"
|
||||||
:filter="claimDmsFilter"
|
:filter="claimDmsFilter"
|
||||||
@on-fetch="(data) => setClaimDms(data)"
|
@on-fetch="(data) => setClaimDms(data)"
|
||||||
ref="claimDmsRef"
|
ref="claimDmsRef"
|
||||||
/>
|
/>
|
||||||
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
|
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`Claims/${entityId}/getSummary`"
|
:url="`Claims/${entityId}/getSummary`"
|
||||||
|
@ -201,34 +209,11 @@ function claimUrl(section) {
|
||||||
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
|
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<QBtnDropdown
|
<VnDropdown
|
||||||
side
|
:options="claimStates"
|
||||||
top
|
option-label="description"
|
||||||
color="black"
|
@change-state="changeState"
|
||||||
text-color="white"
|
/>
|
||||||
:label="t('globals.changeState')"
|
|
||||||
>
|
|
||||||
<QList>
|
|
||||||
<QVirtualScroll
|
|
||||||
class="max-container-height"
|
|
||||||
:items="ClaimStates"
|
|
||||||
separator
|
|
||||||
v-slot="{ item, index }"
|
|
||||||
>
|
|
||||||
<QItem
|
|
||||||
:key="index"
|
|
||||||
dense
|
|
||||||
clickable
|
|
||||||
v-close-popup
|
|
||||||
@click="changeState(item.id)"
|
|
||||||
>
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ item.description }}</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</QVirtualScroll>
|
|
||||||
</QList>
|
|
||||||
</QBtnDropdown>
|
|
||||||
</template>
|
</template>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
<ClaimDescriptorMenu :claim="entity.claim" />
|
<ClaimDescriptorMenu :claim="entity.claim" />
|
||||||
|
|
|
@ -21,6 +21,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
|
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
@ -40,7 +41,7 @@ const ticket = computed(() => summary.value?.entity);
|
||||||
const editableStates = ref([]);
|
const editableStates = ref([]);
|
||||||
const ticketUrl = ref();
|
const ticketUrl = ref();
|
||||||
const grafanaUrl = 'https://grafana.verdnatura.es';
|
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||||
const stateBtnDropdownRef = ref();
|
|
||||||
const descriptorData = useArrayData('Ticket');
|
const descriptorData = useArrayData('Ticket');
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
@ -67,7 +68,6 @@ function isEditable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
stateBtnDropdownRef.value?.hide();
|
|
||||||
const formData = {
|
const formData = {
|
||||||
ticketFk: entityId.value,
|
ticketFk: entityId.value,
|
||||||
code: value,
|
code: value,
|
||||||
|
@ -113,25 +113,12 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<div>
|
<VnDropdown
|
||||||
<QBtnDropdown
|
:disable="!isEditable()"
|
||||||
ref="stateBtnDropdownRef"
|
:options="editableStates"
|
||||||
color="black"
|
option-value="code"
|
||||||
text-color="white"
|
@change-state="changeState"
|
||||||
:label="t('globals.changeState')"
|
/>
|
||||||
:disable="!isEditable()"
|
|
||||||
>
|
|
||||||
<VnSelect
|
|
||||||
:options="editableStates"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="code"
|
|
||||||
hide-dropdown-icon
|
|
||||||
focus-on-mount
|
|
||||||
@update:model-value="changeState"
|
|
||||||
/>
|
|
||||||
</QBtnDropdown>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
<TicketDescriptorMenu :ticket="entity" />
|
<TicketDescriptorMenu :ticket="entity" />
|
||||||
|
|
Loading…
Reference in New Issue