0
0
Fork 0

Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into 7353-hotfix-fixScopeDays

This commit is contained in:
Jorge Penadés 2024-10-14 16:03:13 +02:00
commit 37dfca3bce
10 changed files with 23 additions and 98 deletions

View File

@ -227,6 +227,8 @@ function nullishToTrue(value) {
} }
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
defineExpose({ opts: myOptions });
</script> </script>
<template> <template>

View File

@ -1,9 +1,7 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
@ -11,17 +9,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const workersOptions = ref([]);
const clientsOptions = ref([]);
</script> </script>
<template> <template>
<FetchData
url="Workers/search"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
<FormModel <FormModel
:url="`Departments/${route.params.id}`" :url="`Departments/${route.params.id}`"
model="department" model="department"
@ -62,7 +51,7 @@ const clientsOptions = ref([]);
<VnSelect <VnSelect
:label="t('department.bossDepartment')" :label="t('department.bossDepartment')"
v-model="data.workerFk" v-model="data.workerFk"
:options="workersOptions" url="Workers/search"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
@ -72,7 +61,7 @@ const clientsOptions = ref([]);
<VnSelect <VnSelect
:label="t('department.selfConsumptionCustomer')" :label="t('department.selfConsumptionCustomer')"
v-model="data.clientFk" v-model="data.clientFk"
:options="clientsOptions" url="Clients"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -15,25 +15,10 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const workers = ref();
const workersCopy = ref();
const states = ref(); const states = ref();
function setWorkers(data) {
workers.value = data;
workersCopy.value = data;
}
</script> </script>
<template> <template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="setWorkers"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">

View File

@ -168,7 +168,6 @@ const downloadCSV = async () => {
} }
} }
" "
:limit="0"
:columns="columns" :columns="columns"
auto-load auto-load
:is-editable="false" :is-editable="false"

View File

@ -15,7 +15,6 @@ const router = useRouter();
const newItemTypeForm = reactive({}); const newItemTypeForm = reactive({});
const workersOptions = ref([]);
const categoriesOptions = ref([]); const categoriesOptions = ref([]);
const temperaturesOptions = ref([]); const temperaturesOptions = ref([]);
@ -25,12 +24,6 @@ const redirectToItemTypeBasicData = (_, { id }) => {
</script> </script>
<template> <template>
<FetchData
url="Workers"
@on-fetch="(data) => (workersOptions = data)"
:filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }"
auto-load
/>
<FetchData <FetchData
url="ItemCategories" url="ItemCategories"
@on-fetch="(data) => (categoriesOptions = data)" @on-fetch="(data) => (categoriesOptions = data)"
@ -61,7 +54,9 @@ const redirectToItemTypeBasicData = (_, { id }) => {
<VnSelect <VnSelect
v-model="data.workerFk" v-model="data.workerFk"
:label="t('itemType.shared.worker')" :label="t('itemType.shared.worker')"
:options="workersOptions" url="Workers"
sort-by="firstName ASC"
:fields="['id', 'firstName']"
option-value="id" option-value="id"
option-label="firstName" option-label="firstName"
hide-selected hide-selected

View File

@ -12,17 +12,10 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const workersOptions = ref([]);
const categoriesOptions = ref([]); const categoriesOptions = ref([]);
const temperaturesOptions = ref([]); const temperaturesOptions = ref([]);
</script> </script>
<template> <template>
<FetchData
url="Workers"
@on-fetch="(data) => (workersOptions = data)"
:filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }"
auto-load
/>
<FetchData <FetchData
url="ItemCategories" url="ItemCategories"
@on-fetch="(data) => (categoriesOptions = data)" @on-fetch="(data) => (categoriesOptions = data)"
@ -50,7 +43,9 @@ const temperaturesOptions = ref([]);
<VnSelect <VnSelect
v-model="data.workerFk" v-model="data.workerFk"
:label="t('shared.worker')" :label="t('shared.worker')"
:options="workersOptions" url="Workers"
sort-by="firstName ASC"
:fields="['id', 'firstName']"
option-value="id" option-value="id"
option-label="firstName" option-label="firstName"
hide-selected hide-selected

View File

@ -126,12 +126,6 @@ onMounted(async () => {
</script> </script>
<template> <template>
<FetchData
url="addresses"
@on-fetch="(data) => (clientOptions = data)"
:filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
auto-load
/>
<FormModelPopup <FormModelPopup
url-create="Orders/new" url-create="Orders/new"
:title="t('Create Order')" :title="t('Create Order')"
@ -165,13 +159,16 @@ onMounted(async () => {
</template> </template>
</VnSelect> </VnSelect>
<VnSelect <VnSelect
ref="addressRef"
:label="t('order.form.addressFk')" :label="t('order.form.addressFk')"
v-model="data.addressId" v-model="data.addressId"
:options="addressList" url="addresses"
:fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']"
sort-by="id"
option-value="id" option-value="id"
option-label="street" option-label="street"
hide-selected hide-selected
:disable="!addressList?.length" :disable="!$refs.addressRef?.length"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">

View File

@ -17,10 +17,6 @@ const props = defineProps({
const agencyFilter = { fields: ['id', 'name'] }; const agencyFilter = { fields: ['id', 'name'] };
const agencyList = ref(null); const agencyList = ref(null);
const salesPersonFilter = {
fields: ['id', 'nickname'],
};
const salesPersonList = ref(null);
const sourceList = ref([]); const sourceList = ref([]);
</script> </script>
@ -32,14 +28,6 @@ const sourceList = ref([]);
auto-load auto-load
@on-fetch="(data) => (agencyList = data)" @on-fetch="(data) => (agencyList = data)"
/> />
<FetchData
url="Workers/search"
:filter="salesPersonFilter"
sort-by="nickname ASC"
@on-fetch="(data) => (salesPersonList = data)"
:params="{ departmentCodes: ['VT'] }"
auto-load
/>
<FetchData <FetchData
url="Orders/getSourceValues" url="Orders/getSourceValues"
:filter="{ fields: ['value'] }" :filter="{ fields: ['value'] }"

View File

@ -1,7 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
@ -14,22 +12,9 @@ const props = defineProps({
}); });
const emit = defineEmits(['search']); const emit = defineEmits(['search']);
const workers = ref();
function setWorkers(data) {
workers.value = data;
}
</script> </script>
<template> <template>
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
sort-by="firstName ASC"
@on-fetch="setWorkers"
auto-load
/>
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"

View File

@ -6,6 +6,7 @@ import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -15,7 +16,6 @@ const props = defineProps({
}, },
}); });
const workers = ref([]);
const provinces = ref([]); const provinces = ref([]);
const states = ref([]); const states = ref([]);
const agencies = ref([]); const agencies = ref([]);
@ -27,12 +27,6 @@ const warehouses = ref([]);
<FetchData url="States" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="States" @on-fetch="(data) => (states = data)" auto-load />
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load /> <FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load />
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load /> <FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="(data) => (workers = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table"> <VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -66,23 +60,19 @@ const warehouses = ref([]);
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection v-if="!workers"> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <VnSelect
</QItemSection>
<QItemSection v-if="workers">
<QSelect
:label="t('Salesperson')" :label="t('Salesperson')"
v-model="params.salesPersonFk" v-model="params.salesPersonFk"
:options="workers" url="Workers/activeWithInheritedRole"
:where="{ role: 'salesPerson' }"
option-value="id" option-value="id"
option-label="name" option-label="firstName"
emit-value :use-like="false"
map-options sort-by="firstName ASC"
use-input
dense dense
outlined outlined
rounded rounded
:input-debounce="0"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>