Merge pull request 'fix: fix front' (!1061) from hotfix-irpfDaysOnWard into master
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1061
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-12-16 11:05:34 +00:00
commit 98674e528c
3 changed files with 40 additions and 120 deletions

View File

@ -1,42 +1,33 @@
<script setup> <script setup>
import { ref, computed, onMounted, watch } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { toCurrency } from 'filters/index';
import { dashIfEmpty, toCurrency } from 'filters/index';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
import ItemRequestDenyForm from './ItemRequestDenyForm.vue'; import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ItemRequestFilter from './ItemRequestFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
const stateStore = useStateStore(); const stateStore = useStateStore();
let filterParams = ref({});
const denyFormRef = ref(null); const denyFormRef = ref(null);
const denyRequestId = ref(null); const denyRequestId = ref(null);
const denyRequestIndex = ref(null); const denyRequestIndex = ref(null);
const itemRequestsOptions = ref([]); const itemRequestsOptions = ref([]);
const arrayData = useArrayData('ItemRequests', {
url: 'TicketRequests/filter',
userParams: filterParams,
order: ['shippedDate ASC', 'isOk ASC'],
});
const store = arrayData.store;
const userParams = { const userParams = {
state: 'pending', state: 'pending',
daysOnward: 7, daysOnward: 7,
}; };
const tableRef = ref(); const tableRef = ref();
watch( onMounted(async () => {
() => store.data, stateStore.rightDrawer = true;
(value) => (itemRequestsOptions.value = value) });
);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -220,14 +211,14 @@ const onDenyAccept = (_, responseData) => {
denyRequestIndex.value = null; denyRequestIndex.value = null;
tableRef.value.reload(); tableRef.value.reload();
}; };
onMounted(async () => {
await arrayData.fetch({ append: false });
stateStore.rightDrawer = true;
});
</script> </script>
<template> <template>
<RightMenu>
<template #right-panel>
<ItemRequestFilter data-key="itemRequest" ref="tableRef" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="itemRequest" data-key="itemRequest"
@ -236,6 +227,7 @@ onMounted(async () => {
:columns="columns" :columns="columns"
:user-params="userParams" :user-params="userParams"
:is-editable="true" :is-editable="true"
:right-search="false"
auto-load auto-load
:disable-option="{ card: true }" :disable-option="{ card: true }"
chip-locale="item.params" chip-locale="item.params"
@ -297,14 +289,17 @@ onMounted(async () => {
<template #moreFilterPanel="{ params }"> <template #moreFilterPanel="{ params }">
<VnInputNumber <VnInputNumber
:label="t('params.scopeDays')" :label="t('params.scopeDays')"
v-model.number="params.scopeDays" v-model.number="params.daysOnward"
@keyup.enter="(evt) => handleScopeDays(evt.target.value)" @keyup.enter="(evt) => handleScopeDays(evt.target.value)"
@remove="handleScopeDays()" @remove="handleScopeDays()"
class="q-px-xs q-pr-lg" class="q-px-xs q-pr-lg"
filled filled
dense dense
lazy-rules
is-outlined
/> />
</template> </template>
<template #column-denyOptions="{ row, rowIndex }"> <template #column-denyOptions="{ row, rowIndex }">
<QTd class="sticky no-padding"> <QTd class="sticky no-padding">
<QIcon <QIcon

View File

@ -6,7 +6,6 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -42,20 +41,6 @@ const exprBuilder = (param, value) => {
}; };
} }
}; };
const add = (paramsObj, key) => {
if (paramsObj[key] === undefined) {
paramsObj[key] = 1;
} else {
paramsObj[key]++;
}
};
const decrement = (paramsObj, key) => {
if (paramsObj[key] === 0) return;
paramsObj[key]--;
};
</script> </script>
<template> <template>
@ -79,8 +64,7 @@ const decrement = (paramsObj, key) => {
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>
<span v-if="tag.label !== 'state'">{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
<span v-else>{{ t(`${tag.value}`) }}</span>
</div> </div>
</template> </template>
<template #body="{ params, searchFn }"> <template #body="{ params, searchFn }">
@ -174,83 +158,6 @@ const decrement = (paramsObj, key) => {
</VnSelect> </VnSelect>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('params.myTeam')"
@update:model-value="searchFn()"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QCard bordered>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.from')"
v-model="params.from"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.to')"
v-model="params.to"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
v-model="params.scopeDays"
:label="t('globals.daysOnward')"
type="number"
dense
outlined
rounded
:min="0"
>
<template #append>
<QBtn
icon="add"
flat
dense
size="12px"
shortcut="+"
@click="add(params, 'scopeDays')"
/>
<QBtn
icon="remove"
flat
dense
size="12px"
@click="decrement(params, 'scopeDays')"
/>
</template>
</VnInput>
</QItemSection>
</QItem>
<QIcon name="info" style="position: absolute; top: 4px; right: 4px">
<QTooltip max-width="300px">
{{ t('dateFiltersTooltip') }}
</QTooltip>
</QIcon>
</QCard>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.mine')"
v-model="params.mine"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
@ -267,6 +174,16 @@ const decrement = (paramsObj, key) => {
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.daysOnward')"
v-model="params.daysOnward"
lazy-rules
is-outlined
/>
</QItemSection>
</QItem>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>

View File

@ -23,6 +23,7 @@ const insertTag = () => {
workerPitCrudRef.value.insert(); workerPitCrudRef.value.insert();
}; };
const quasar = useQuasar(); const quasar = useQuasar();
const deleteRelative = async (id) => { const deleteRelative = async (id) => {
await new Promise((resolve) => { await new Promise((resolve) => {
quasar quasar
@ -62,7 +63,6 @@ const deleteRelative = async (id) => {
> >
<template #form="{ data }"> <template #form="{ data }">
<QCard class="q-px-lg q-py-lg"> <QCard class="q-px-lg q-py-lg">
<VnTitle :text="t('IRPF')" />
<VnRow> <VnRow>
<VnInput <VnInput
:label="t('familySituation')" :label="t('familySituation')"
@ -100,8 +100,12 @@ const deleteRelative = async (id) => {
:label="t(`spousePension`)" :label="t(`spousePension`)"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow wrap>
<QCheckbox v-model="data.isDependend" :label="t(`isDependend`)" /> <QCheckbox
clearable
v-model="data.isDependend"
:label="t(`isDependend`)"
/>
<QCheckbox <QCheckbox
v-model="data.hasHousingPaymentBefore" v-model="data.hasHousingPaymentBefore"
:label="t(`hasHousingPaymentBefore`)" :label="t(`hasHousingPaymentBefore`)"
@ -127,7 +131,11 @@ const deleteRelative = async (id) => {
:filter="{ :filter="{
where: { workerFk: route.params.id }, where: { workerFk: route.params.id },
}" }"
:data-required="{ workerFk: route.params.id }" :data-required="{
workerFk: route.params.id,
isJointCustody: false,
isDependend: false,
}"
:has-sub-toolbar="false" :has-sub-toolbar="false"
> >
<template #body="{ rows }"> <template #body="{ rows }">