#6877 - itemRequestMod #362
|
@ -2,7 +2,7 @@
|
||||||
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
|
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { dateRange } from 'src/filters';
|
||||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
|
@ -29,28 +29,19 @@ const exprBuilder = (param, value) => {
|
||||||
case 'landed':
|
case 'landed':
|
||||||
return {
|
return {
|
||||||
'tr.landed': {
|
'tr.landed': {
|
||||||
between: getDateRange(value),
|
between: dateRange(value),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateRange = reactive({
|
const datedRange = reactive({
|
||||||
from: null,
|
from: null,
|
||||||
to: null,
|
to: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getDateRange = (val) => {
|
|
||||||
const minHour = new Date(val);
|
|
||||||
minHour.setHours(0, 0, 0, 0);
|
|
||||||
const maxHour = new Date(val);
|
|
||||||
maxHour.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return [minHour, maxHour];
|
|
||||||
};
|
|
||||||
|
|
||||||
const from = computed({
|
const from = computed({
|
||||||
get: () => dateRange.from,
|
get: () => datedRange.from,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
updateFrom(val);
|
updateFrom(val);
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
@ -58,7 +49,7 @@ const from = computed({
|
||||||
});
|
});
|
||||||
|
|
||||||
const to = computed({
|
const to = computed({
|
||||||
get: () => dateRange.to,
|
get: () => datedRange.to,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
updateTo(val);
|
updateTo(val);
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
@ -173,17 +164,17 @@ const fetchItemLastEntries = async () => {
|
||||||
|
|
||||||
const updateFrom = async (date) => {
|
const updateFrom = async (date) => {
|
||||||
date.setHours(0, 0, 0, 0);
|
date.setHours(0, 0, 0, 0);
|
||||||
dateRange.from = date.toISOString();
|
datedRange.from = date.toISOString();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateTo = async (date) => {
|
const updateTo = async (date) => {
|
||||||
date.setHours(23, 59, 59, 59);
|
date.setHours(23, 59, 59, 59);
|
||||||
dateRange.to = date.toISOString();
|
datedRange.to = date.toISOString();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateFilter = async () => {
|
const updateFilter = async () => {
|
||||||
arrayData.store.userFilter.where.landed = {
|
arrayData.store.userFilter.where.landed = {
|
||||||
between: [dateRange.from, dateRange.to],
|
between: [datedRange.from, datedRange.to],
|
||||||
};
|
};
|
||||||
await fetchItemLastEntries();
|
await fetchItemLastEntries();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, onBeforeMount, watch } from 'vue';
|
import { ref, computed, onMounted, onBeforeMount, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
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 ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
@ -9,7 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
||||||
import ItemRequestFilter from './ItemRequestFilter.vue';
|
import ItemRequestFilter from './ItemRequestFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { toDateFormat } from 'src/filters/date';
|
import { toDateFormat } from 'src/filters/date';
|
||||||
|
@ -21,7 +21,7 @@ import axios from 'axios';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
const workersOptions = ref([]);
|
||||||
let filterParams = ref({});
|
let filterParams = ref({});
|
||||||
const denyFormRef = ref(null);
|
const denyFormRef = ref(null);
|
||||||
const denyRequestId = ref(null);
|
const denyRequestId = ref(null);
|
||||||
|
@ -147,6 +147,7 @@ const confirmRequest = async (request) => {
|
||||||
const params = {
|
const params = {
|
||||||
itemFk: request.itemFk,
|
itemFk: request.itemFk,
|
||||||
quantity: request.saleQuantity,
|
quantity: request.saleQuantity,
|
||||||
|
attenderFk: request.attenderFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
|
@ -206,6 +207,13 @@ onBeforeMount(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
|||||||
|
url="Workers"
|
||||||
|
:filter="{ where: { role: 'buyer' } }"
|
||||||
|
order="id"
|
||||||
|
@on-fetch="(data) => (workersOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
<template v-if="stateStore.isHeaderMounted()">
|
||||||
<Teleport to="#searchbar">
|
<Teleport to="#searchbar">
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
|
@ -278,8 +286,14 @@ onBeforeMount(() => {
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-attender="{ row }">
|
<template #body-cell-attender="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat dense color="primary"> {{ row.attenderName }}</QBtn>
|
<VnSelect
|
||||||
<WorkerDescriptorProxy :id="row.attenderFk" />
|
v-model="row.attenderFk"
|
||||||
|
:options="workersOptions"
|
||||||
|
hide-selected
|
||||||
|
option-label="firstName"
|
||||||
|
option-value="id"
|
||||||
|
dense
|
||||||
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-item="{ row }">
|
<template #body-cell-item="{ row }">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { dateRange } from 'src/filters';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
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';
|
||||||
|
@ -44,15 +44,6 @@ const exprBuilder = (param, value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const dateRange = (value) => {
|
|
||||||
const minHour = new Date(value);
|
|
||||||
minHour.setHours(0, 0, 0, 0);
|
|
||||||
const maxHour = new Date(value);
|
|
||||||
maxHour.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return [minHour, maxHour];
|
|
||||||
};
|
|
||||||
|
|
||||||
const add = (paramsObj, key) => {
|
const add = (paramsObj, key) => {
|
||||||
if (paramsObj[key] === undefined) {
|
if (paramsObj[key] === undefined) {
|
||||||
paramsObj[key] = 1;
|
paramsObj[key] = 1;
|
||||||
|
@ -201,6 +192,7 @@ const decrement = (paramsObj, key) => {
|
||||||
v-model="params.from"
|
v-model="params.from"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
emit-date-format
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -211,6 +203,7 @@ const decrement = (paramsObj, key) => {
|
||||||
v-model="params.to"
|
v-model="params.to"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
emit-date-format
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
Loading…
Reference in New Issue
Probar en dev este desplegable pq puede que sea lento