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