refs #6795 fix claims
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-02-08 13:59:37 +01:00
parent 346fed0578
commit 2f081841f9
10 changed files with 60 additions and 32 deletions

View File

@ -79,7 +79,7 @@ onMounted(() => {
if ($props.url && $props.modelValue) fetchFilter($props.modelValue); if ($props.url && $props.modelValue) fetchFilter($props.modelValue);
}); });
async function filter(val, options) { function filter(val, options) {
const search = val.toString().toLowerCase(); const search = val.toString().toLowerCase();
if (!search) return options; if (!search) return options;
@ -119,7 +119,7 @@ async function filterHandler(val, update) {
myOptions.value = await fetchFilter(val); myOptions.value = await fetchFilter(val);
return; return;
} }
myOptions.value = await filter(val, myOptionsOriginal.value); myOptions.value = filter(val, myOptionsOriginal.value);
}, },
(ref) => { (ref) => {
if (val !== '' && ref.options.length > 0) { if (val !== '' && ref.options.length > 0) {

View File

@ -90,17 +90,16 @@ watch(props, async () => {
background-color: var(--vn-gray); background-color: var(--vn-gray);
> .q-card.vn-one { > .q-card.vn-one {
width: 350px;
flex: 1; flex: 1;
} }
> .q-card.vn-two { > .q-card.vn-two {
flex: 2; flex: 40%;
} }
> .q-card.vn-three { > .q-card.vn-three {
flex: 4; flex: 75%;
} }
> .q-card.vn-max { > .q-card.vn-max {
width: 100%; flex: 100%;
} }
> .q-card { > .q-card {

View File

@ -46,7 +46,7 @@ async function insert() {
</slot> </slot>
<QItem class="full-width justify-between items-start"> <QItem class="full-width justify-between items-start">
<VnUserLink <VnUserLink
:name="`${note.worker.firstName} ${note.worker.lastName}`" :name="`${note.worker.user.nickname}`"
:worker-id="note.worker.id" :worker-id="note.worker.id"
/> />
@ -63,15 +63,8 @@ async function insert() {
</QCard> </QCard>
</template> </template>
</VnPaginate> </VnPaginate>
<QPageSticky position="bottom-right" :offset="[25, 25]"> <QPageSticky position="bottom-right" :offset="[25, 25]" v-if="addNote">
<QBtn <QBtn color="primary" icon="add" size="lg" round @click="noteModal = true" />
v-if="addNote"
color="primary"
icon="add"
size="lg"
round
@click="noteModal = true"
/>
</QPageSticky> </QPageSticky>
<QDialog v-model="noteModal" @hide="newNote = ''"> <QDialog v-model="noteModal" @hide="newNote = ''">
<QCard> <QCard>

View File

@ -105,6 +105,7 @@ export function useArrayData(key, userOptions) {
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
} else { } else {
store.data = response.data; store.data = response.data;
if (!document.querySelectorAll('[role="dialog"]'))
updateRouter && updateStateParams(); updateRouter && updateStateParams();
} }

View File

@ -496,6 +496,7 @@ export default {
responsible: 'Responsible', responsible: 'Responsible',
worker: 'Worker', worker: 'Worker',
redelivery: 'Redelivery', redelivery: 'Redelivery',
returnOfMaterial: 'RMA',
}, },
basicData: { basicData: {
customer: 'Customer', customer: 'Customer',

View File

@ -495,6 +495,7 @@ export default {
responsible: 'Responsable', responsible: 'Responsable',
worker: 'Trabajador', worker: 'Trabajador',
redelivery: 'Devolución', redelivery: 'Devolución',
returnOfMaterial: 'RMA',
}, },
basicData: { basicData: {
customer: 'Cliente', customer: 'Cliente',

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toPercentage } from 'src/filters'; import { toDate, toPercentage } from 'src/filters';
@ -10,6 +10,7 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -22,7 +23,7 @@ const $props = defineProps({
const route = useRoute(); const route = useRoute();
const state = useState(); const state = useState();
const { t } = useI18n(); const { t } = useI18n();
const salixUrl = ref();
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
@ -85,6 +86,9 @@ const setData = (entity) => {
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity.client.name, entity.id);
state.set('ClaimDescriptor', entity); state.set('ClaimDescriptor', entity);
}; };
onMounted(async () => {
salixUrl.value = await getUrl('');
});
</script> </script>
<template> <template>
@ -167,6 +171,20 @@ const setData = (entity) => {
> >
<QTooltip>{{ t('claim.card.claimedTicket') }}</QTooltip> <QTooltip>{{ t('claim.card.claimedTicket') }}</QTooltip>
</QBtn> </QBtn>
<QBtn
size="md"
icon="assignment"
color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'"
>
</QBtn>
<QBtn
size="md"
icon="visibility"
color="primary"
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
>
</QBtn>
</QCardActions> </QCardActions>
</template> </template>
</CardDescriptor> </CardDescriptor>

View File

@ -19,6 +19,12 @@ const claimFilter = {
relation: 'worker', relation: 'worker',
scope: { scope: {
fields: ['id', 'firstName', 'lastName'], fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname'],
},
},
}, },
}, },
}; };
@ -30,7 +36,8 @@ const body = {
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center">
<VnNotes style="overflow-y: scroll;" <VnNotes
style="overflow-y: scroll"
:add-note="$props.addNote" :add-note="$props.addNote"
:id="id" :id="id"
url="claimObservations" url="claimObservations"

View File

@ -42,9 +42,9 @@ onMounted(async () => {
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`; claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
}); });
watch(entityId, async (id) => { watch(entityId, async (id, old) => {
claimDmsFilter.value.where = { claimFk: id }; // claimDmsFilter.value.where = { claimFk: id };
await claimDmsRef.value.fetch(); // await claimDmsRef.value.fetch();
}); });
const detailsColumns = ref([ const detailsColumns = ref([
@ -170,7 +170,6 @@ function openDialog(dmsId) {
:filter="claimDmsFilter" :filter="claimDmsFilter"
@on-fetch="(data) => setClaimDms(data)" @on-fetch="(data) => setClaimDms(data)"
limit="20" limit="20"
auto-load
ref="claimDmsRef" ref="claimDmsRef"
/> />
<CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`"> <CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`">
@ -210,8 +209,22 @@ function openDialog(dmsId) {
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.customer')">
<template #value>
<VnUserLink
:name="claim.client?.name"
:worker-id="claim.client?.id"
/>
</template>
</VnLv>
<VnLv :label="t('claim.summary.returnOfMaterial')" :value="claim.rma" />
<QCheckbox
:align-items="right"
:label="t('claim.basicData.picked')"
v-model="claim.hasToPickUp"
/>
</QCard> </QCard>
<QCard class="vn-two claimVnNotes"> <QCard class="vn-three claimVnNotes full-height">
<a class="header" :href="`#/claim/${entityId}/notes`"> <a class="header" :href="`#/claim/${entityId}/notes`">
{{ t('claim.summary.notes') }} {{ t('claim.summary.notes') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />
@ -248,6 +261,7 @@ function openDialog(dmsId) {
</template> </template>
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-max" v-if="claimDms.length > 0"> <QCard class="vn-max" v-if="claimDms.length > 0">
<a class="header" :href="`#/claim/${entityId}/photos`"> <a class="header" :href="`#/claim/${entityId}/photos`">
{{ t('claim.summary.photos') }} {{ t('claim.summary.photos') }}
@ -291,7 +305,7 @@ function openDialog(dmsId) {
</div> </div>
</QCard> </QCard>
<QCard class="vn-max" v-if="developments.length > 0"> <QCard class="vn-max">
<a class="header" :href="claimUrl + 'action'"> <a class="header" :href="claimUrl + 'action'">
{{ t('claim.summary.actions') }} {{ t('claim.summary.actions') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />

View File

@ -118,12 +118,6 @@ function viewSummary(id) {
</VnLv> </VnLv>
</template> </template>
<template #actions> <template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
class="bg-vn-dark"
outline
/>
<QBtn <QBtn
:label="t('components.smartCard.viewDescription')" :label="t('components.smartCard.viewDescription')"
@click.stop @click.stop