0
0
Fork 0

Merge pull request 'fix(claim): small details' (!582) from 6336-claim-v6 into test

Reviewed-on: verdnatura/salix-front#582
Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
Alex Moreno 2024-08-01 08:55:07 +00:00
commit da85d7d2a0
10 changed files with 70 additions and 44 deletions

View File

@ -159,8 +159,8 @@ onBeforeRouteLeave((to, from, next) => {
quasar.dialog({ quasar.dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t('Unsaved changes will be lost'), title: t('globals.unsavedPopup.title'),
message: t('Are you sure exit without saving?'), message: t('globals.unsavedPopup.subtitle'),
promise: () => next(), promise: () => next(),
}, },
}); });
@ -356,8 +356,3 @@ defineExpose({
padding: 32px; padding: 32px;
} }
</style> </style>
<i18n>
es:
Unsaved changes will be lost: Los cambios que no haya guardado se perderán
Are you sure exit without saving?: ¿Seguro que quiere salir sin guardar?
</i18n>

View File

@ -1,13 +1,18 @@
<script setup> <script setup>
import VnAvatar from 'src/components/ui/VnAvatar.vue';
import { toDateHourMin } from 'src/filters';
import { ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { ref } from 'vue';
import { onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from './VnPaginate.vue'; import { useQuasar } from 'quasar';
import VnUserLink from '../ui/VnUserLink.vue';
import { toDateHourMin } from 'src/filters';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnUserLink from 'components/ui/VnUserLink.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnAvatar from 'components/ui/VnAvatar.vue';
const $props = defineProps({ const $props = defineProps({
url: { type: String, default: null }, url: { type: String, default: null },
filter: { type: Object, default: () => {} }, filter: { type: Object, default: () => {} },
@ -17,6 +22,7 @@ const $props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const state = useState(); const state = useState();
const quasar = useQuasar();
const currentUser = ref(state.getUser()); const currentUser = ref(state.getUser());
const newNote = ref(''); const newNote = ref('');
const vnPaginateRef = ref(); const vnPaginateRef = ref();
@ -33,6 +39,19 @@ async function insert() {
await vnPaginateRef.value.fetch(); await vnPaginateRef.value.fetch();
newNote.value = ''; newNote.value = '';
} }
onBeforeRouteLeave((to, from, next) => {
if (newNote.value)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
</script> </script>
<template> <template>
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote"> <QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">

View File

@ -115,8 +115,8 @@ watch(
); );
watch( watch(
() => props.url, () => [props.url, props.filter],
(url) => fetch({ url }) ([url, filter]) => fetch({ url, filter })
); );
const addFilter = async (filter, params) => { const addFilter = async (filter, params) => {

View File

@ -194,13 +194,6 @@ select:-webkit-autofill {
justify-content: center; justify-content: center;
} }
.q-card,
.q-table,
.q-table__bottom,
.q-drawer {
background-color: var(--vn-section-color);
}
input[type='number'] { input[type='number'] {
-moz-appearance: textfield; -moz-appearance: textfield;
} }
@ -254,6 +247,16 @@ input::-webkit-inner-spin-button {
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
tr {
th {
font-size: 11pt;
}
td {
font-size: 11pt;
border-top: 1px solid var(--vn-page-color);
border-collapse: collapse;
}
}
.shrink { .shrink {
max-width: 75px; max-width: 75px;
} }

View File

@ -31,7 +31,7 @@ const destinationTypes = ref([]);
const totalClaimed = ref(null); const totalClaimed = ref(null);
const DEFAULT_MAX_RESPONSABILITY = 5; const DEFAULT_MAX_RESPONSABILITY = 5;
const DEFAULT_MIN_RESPONSABILITY = 1; const DEFAULT_MIN_RESPONSABILITY = 1;
const arrayData = useArrayData('claimData'); const arrayData = useArrayData('Claim');
const marker_labels = [ const marker_labels = [
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.company') }, { value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.company') },
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.person') }, { value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.person') },

View File

@ -14,7 +14,8 @@ const $props = defineProps({
}); });
const claimId = computed(() => $props.id || route.params.id); const claimId = computed(() => $props.id || route.params.id);
const claimFilter = { const claimFilter = computed(() => {
return {
where: { claimFk: claimId.value }, where: { claimFk: claimId.value },
fields: ['id', 'created', 'workerFk', 'text'], fields: ['id', 'created', 'workerFk', 'text'],
include: { include: {
@ -30,6 +31,7 @@ const claimFilter = {
}, },
}, },
}; };
});
const body = { const body = {
claimFk: claimId.value, claimFk: claimId.value,

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref, computed } from 'vue'; import { ref, computed, watch } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -22,10 +22,8 @@ const claimDms = ref([
}, },
]); ]);
const client = ref({}); const client = ref({});
const inputFile = ref(); const inputFile = ref();
const files = ref({}); const files = ref({});
const spinnerRef = ref(); const spinnerRef = ref();
const claimDmsRef = ref(); const claimDmsRef = ref();
const dmsType = ref({}); const dmsType = ref({});
@ -58,6 +56,14 @@ const claimDmsFilter = ref({
const multimediaDialog = ref(); const multimediaDialog = ref();
const multimediaSlide = ref(); const multimediaSlide = ref();
watch(
() => router.currentRoute.value.params.id,
() => {
claimDmsFilter.value.where.id = router.currentRoute.value.params.id;
claimDmsRef.value.fetch();
}
);
function openDialog(dmsId) { function openDialog(dmsId) {
multimediaSlide.value = dmsId; multimediaSlide.value = dmsId;
multimediaDialog.value = true; multimediaDialog.value = true;

View File

@ -279,7 +279,7 @@ async function changeState(value) {
<ClaimNotes <ClaimNotes
:id="entityId" :id="entityId"
:add-note="false" :add-note="false"
class="max-container-height" style="max-height: 300px"
order="created ASC" order="created ASC"
/> />
</QCard> </QCard>
@ -330,7 +330,7 @@ async function changeState(value) {
<QTable <QTable
:columns="detailsColumns" :columns="detailsColumns"
:rows="salesClaimed" :rows="salesClaimed"
flat separator="horizontal"
dense dense
:rows-per-page-options="[0]" :rows-per-page-options="[0]"
hide-bottom hide-bottom
@ -344,7 +344,7 @@ async function changeState(value) {
</template> </template>
<template #body="props"> <template #body="props">
<QTr :props="props"> <QTr :props="props">
<QTh v-for="col in props.cols" :key="col.name" :props="props"> <QTd v-for="col in props.cols" :key="col.name" :props="props">
<span v-if="col.name != 'description'">{{ <span v-if="col.name != 'description'">{{
t(col.value) t(col.value)
}}</span> }}</span>
@ -359,7 +359,7 @@ async function changeState(value) {
:id="props.row.sale.itemFk" :id="props.row.sale.itemFk"
:sale-fk="props.row.saleFk" :sale-fk="props.row.saleFk"
></ItemDescriptorProxy> ></ItemDescriptorProxy>
</QTh> </QTd>
</QTr> </QTr>
</template> </template>
</QTable> </QTable>
@ -384,7 +384,7 @@ async function changeState(value) {
<template #body-cell-worker="props"> <template #body-cell-worker="props">
<QTd :props="props" class="link"> <QTd :props="props" class="link">
{{ props.value }} {{ props.value }}
<WorkerDescriptorProxy :id="props.row.worker.id" /> <WorkerDescriptorProxy :id="props.row.worker?.id" />
</QTd> </QTd>
</template> </template>
</QTable> </QTable>

View File

@ -100,6 +100,7 @@ defineExpose({ states });
url="Items/withName" url="Items/withName"
option-value="id" option-value="id"
option-label="name" option-label="name"
:use-like="false"
sort-by="id DESC" sort-by="id DESC"
outlined outlined
rounded rounded

View File

@ -125,7 +125,7 @@ const STATE_COLOR = {
<VnTable <VnTable
data-key="ClaimList" data-key="ClaimList"
url="Claims/filter" url="Claims/filter"
:order="['priority ASC', 'created DESC']" :order="['priority ASC', 'created ASC']"
:columns="columns" :columns="columns"
redirect="claim" redirect="claim"
:right-search="false" :right-search="false"