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 DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
|
||||
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -36,7 +37,7 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const ClaimStates = ref([]);
|
||||
const claimStates = ref([]);
|
||||
const claimDmsRef = ref();
|
||||
const claimDms = ref([]);
|
||||
const multimediaDialog = ref();
|
||||
|
@ -173,7 +174,9 @@ function openDialog(dmsId) {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -183,13 +186,18 @@ function claimUrl(section) {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="ClaimStates"
|
||||
:filter="{ fields: ['id', 'description'] }"
|
||||
@on-fetch="(data) => (claimStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="ClaimDms"
|
||||
:filter="claimDmsFilter"
|
||||
@on-fetch="(data) => setClaimDms(data)"
|
||||
ref="claimDmsRef"
|
||||
/>
|
||||
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Claims/${entityId}/getSummary`"
|
||||
|
@ -201,34 +209,11 @@ function claimUrl(section) {
|
|||
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
|
||||
</template>
|
||||
<template #header-right>
|
||||
<QBtnDropdown
|
||||
side
|
||||
top
|
||||
color="black"
|
||||
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>
|
||||
<VnDropdown
|
||||
:options="claimStates"
|
||||
option-label="description"
|
||||
@change-state="changeState"
|
||||
/>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<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 TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import VnDropdown from 'src/components/common/VnDropdown.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
@ -40,7 +41,7 @@ const ticket = computed(() => summary.value?.entity);
|
|||
const editableStates = ref([]);
|
||||
const ticketUrl = ref();
|
||||
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||
const stateBtnDropdownRef = ref();
|
||||
|
||||
const descriptorData = useArrayData('Ticket');
|
||||
|
||||
onMounted(async () => {
|
||||
|
@ -67,7 +68,6 @@ function isEditable() {
|
|||
}
|
||||
|
||||
async function changeState(value) {
|
||||
stateBtnDropdownRef.value?.hide();
|
||||
const formData = {
|
||||
ticketFk: entityId.value,
|
||||
code: value,
|
||||
|
@ -113,25 +113,12 @@ onMounted(async () => {
|
|||
</div>
|
||||
</template>
|
||||
<template #header-right>
|
||||
<div>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
: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>
|
||||
<VnDropdown
|
||||
:disable="!isEditable()"
|
||||
:options="editableStates"
|
||||
option-value="code"
|
||||
@change-state="changeState"
|
||||
/>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<TicketDescriptorMenu :ticket="entity" />
|
||||
|
|
Loading…
Reference in New Issue