0
0
Fork 0

Merge pull request 'test To Dev' (!665) from testToDev into dev

Reviewed-on: verdnatura/salix-front#665
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-09-02 13:12:20 +00:00
commit 6c113e33fd
17 changed files with 82 additions and 244 deletions

View File

@ -97,7 +97,12 @@ const title = ref();
:rules="validate('client.salesPersonFk')"
:use-like="false"
:emit-value="false"
@update:model-value="(val) => (title = val?.nickname)"
@update:model-value="
(val) => {
title = val?.nickname;
data.salesPersonFk = val?.id;
}
"
>
<template #prepend>
<VnAvatar

View File

@ -19,8 +19,6 @@ const { t } = useI18n();
const { hasAny } = useRole();
const isAdministrative = () => hasAny(['administrative']);
const suppliersOptions = ref([]);
const travelsOptions = ref([]);
const companiesOptions = ref([]);
const currenciesOptions = ref([]);
@ -29,20 +27,6 @@ const onFilterTravelSelected = (formData, id) => {
};
</script>
<template>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Travels/filter"
:filter="{ fields: ['id', 'warehouseInName'] }"
order="id"
@on-fetch="(data) => (travelsOptions = data)"
auto-load
/>
<FetchData
ref="companiesRef"
url="Companies"
@ -71,9 +55,10 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelect
:label="t('entry.basicData.supplier')"
v-model="data.supplierFk"
:options="suppliersOptions"
url="Suppliers"
option-value="id"
option-label="nickname"
:fields="['id', 'nickname']"
hide-selected
:required="true"
map-options
@ -92,7 +77,8 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelectDialog
:label="t('entry.basicData.travel')"
v-model="data.travelFk"
:options="travelsOptions"
url="Travels/filter"
:fields="['id', 'warehouseInName']"
option-value="id"
option-label="warehouseInName"
map-options

View File

@ -20,7 +20,6 @@ const props = defineProps({
const currenciesOptions = ref([]);
const companiesOptions = ref([]);
const suppliersOptions = ref([]);
const stateStore = useStateStore();
onMounted(async () => {
@ -45,14 +44,6 @@ onMounted(async () => {
@on-fetch="(data) => (currenciesOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname', 'name'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
@ -135,9 +126,11 @@ onMounted(async () => {
:label="t('params.supplierFk')"
v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions"
url="Suppliers"
option-value="id"
option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="nickname"
hide-selected
dense
outlined

View File

@ -19,15 +19,6 @@ const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null });
const onGenusCreated = (response, formData) => {
itemGenusOptions.value = [...itemGenusOptions.value, response];
formData.genusFk = response.id;
};
const onSpecieCreated = (response, formData) => {
itemSpeciesOptions.value = [...itemSpeciesOptions.value, response];
formData.specieFk = response.id;
};
const entityId = computed(() => {
return route.params.id;
});
@ -47,18 +38,6 @@ onMounted(async () => {
}"
@on-fetch="(data) => (itemBotanicals = data)"
/>
<FetchData
url="Genera"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemGenusOptions = data)"
auto-load
/>
<FetchData
url="Species"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemSpeciesOptions = data)"
auto-load
/>
<FormModel
url-update="ItemBotanicals"
model="entry"
@ -69,36 +48,35 @@ onMounted(async () => {
<template #form="{ data }">
<VnRow>
<VnSelectDialog
ref="genusRef"
:label="t('Genus')"
v-model="data.genusFk"
:options="itemGenusOptions"
url="Genera"
option-label="name"
option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected
>
<template #form>
<CreateGenusForm
@on-data-saved="
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
@on-data-saved="(_, res) => (data.genusFk = res.id)"
/>
</template>
</VnSelectDialog>
<VnSelectDialog
:label="t('Species')"
v-model="data.specieFk"
:options="itemSpeciesOptions"
url="Species"
option-label="name"
option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected
>
<template #form>
<CreateSpecieForm
@on-data-saved="
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
@on-data-saved="(_, res) => (data.specieFk = res.id)"
/>
</template>
</VnSelectDialog>

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
@ -24,8 +23,6 @@ const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
const rowsSelected = ref([]);
const parkingsOptions = ref([]);
const shelvingsOptions = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
@ -104,7 +101,9 @@ const columns = computed(() => [
filterValue: null,
event: getInputEvents,
attrs: {
options: parkingsOptions.value,
url: 'parkings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code',
'option-label': 'code',
dense: true,
@ -124,7 +123,9 @@ const columns = computed(() => [
filterValue: null,
event: getInputEvents,
attrs: {
options: shelvingsOptions.value,
url: 'shelvings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code',
'option-label': 'code',
dense: true,
@ -188,18 +189,6 @@ onMounted(async () => {
</script>
<template>
<FetchData
url="parkings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (parkingsOptions = data)"
/>
<FetchData
url="shelvings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#st-data">
<div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222">
@ -237,7 +226,6 @@ onMounted(async () => {
</QBtn>
</Teleport>
</template>
<QPage class="column items-center q-pa-md">
<QTable
:rows="rows"

View File

@ -24,6 +24,7 @@ const getSelectedTagValues = async (tag) => {
const filter = {
fields: ['value'],
order: 'value ASC',
limit: 30,
};
const params = { filter: JSON.stringify(filter) };
@ -126,7 +127,7 @@ const insertTag = (rows) => {
:key="row.tagFk"
:label="t('Value')"
v-model="row.value"
:options="valueOptionsMap.get(row.tagFk)"
:url="`Tags/${row.tagFk}/filterValue`"
option-label="value"
option-value="value"
emit-value
@ -135,6 +136,7 @@ const insertTag = (rows) => {
:is-clearable="false"
:required="false"
:rules="validate('itemTag.tagFk')"
:use-like="false"
/>
<VnInput
v-else-if="

View File

@ -30,7 +30,7 @@ const itemTypesRef = ref(null);
const categoriesOptions = ref([]);
const itemTypesOptions = ref([]);
const buyersOptions = ref([]);
const suppliersOptions = ref([]);
const tagOptions = ref([]);
const tagValues = ref([]);
const fieldFiltersValues = ref([]);
const moreFields = ref([]);
@ -161,12 +161,6 @@ onMounted(async () => {
@on-fetch="(data) => (buyersOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }"
@ -261,9 +255,11 @@ onMounted(async () => {
:label="t('params.supplierFk')"
v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions"
url="Suppliers"
option-value="id"
option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="name ASC"
hide-selected
dense
outlined

View File

@ -22,7 +22,6 @@ import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n();
const { notify } = useNotify();
const stateStore = useStateStore();
const workersOptions = ref([]);
let filterParams = ref({});
const denyFormRef = ref(null);
const denyRequestId = ref(null);
@ -208,13 +207,6 @@ onBeforeMount(() => {
</script>
<template>
<FetchData
url="Workers"
:filter="{ where: { role: 'buyer' } }"
order="id"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnSearchbar
data-key="ItemRequests"
url="TicketRequests/filter"
@ -268,7 +260,9 @@ onBeforeMount(() => {
<QTd>
<VnSelect
v-model="row.attenderFk"
:options="workersOptions"
:where="{ role: 'buyer' }"
sort-by="id"
url="Workers"
hide-selected
option-label="firstName"
option-value="id"

View File

@ -24,7 +24,6 @@ const stateOptions = [
const itemTypesOptions = ref([]);
const warehousesOptions = ref([]);
const workersOptions = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
@ -72,18 +71,6 @@ const decrement = (paramsObj, key) => {
@on-fetch="(data) => (warehousesOptions = data)"
auto-load
/>
<FetchData
url="Workers/search"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
:params="{
departmentCodes: ['VT'],
}"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
@ -162,7 +149,10 @@ const decrement = (paramsObj, key) => {
:label="t('params.requesterFk')"
v-model="params.requesterFk"
@update:model-value="searchFn()"
:options="workersOptions"
url="Workers/search"
:fields="['id', 'name']"
order="name ASC"
:params="{ departmentCodes: ['VT'] }"
option-value="id"
option-label="name"
hide-selected

View File

@ -3,6 +3,7 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
@ -15,25 +16,13 @@ const props = defineProps({
const emit = defineEmits(['search']);
const workers = ref();
const parkings = ref();
function setWorkers(data) {
workers.value = data;
}
function setParkings(data) {
parkings.value = data;
}
</script>
<template>
<FetchData
url="Parkings"
:filter="{ fields: ['id', 'code'] }"
sort-by="code ASC"
@on-fetch="setParkings"
auto-load
/>
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@ -54,44 +43,36 @@ function setParkings(data) {
</template>
<template #body="{ params }">
<QItem class="q-my-sm">
<QItemSection v-if="!parkings">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="parkings">
<QSelect
<QItemSection>
<VnSelect
v-model="params.parkingFk"
url="Parkings"
:fields="['id', 'code']"
:label="t('params.parkingFk')"
option-value="id"
option-label="code"
:filter-options="['id', 'code']"
dense
outlined
rounded
:label="t('params.parkingFk')"
v-model="params.parkingFk"
:options="parkings"
option-value="id"
option-label="code"
emit-value
map-options
use-input
:input-debounce="0"
sort-by="code ASC"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="!workers">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="workers">
<QSelect
<QItemSection>
<VnSelect
dense
outlined
rounded
:label="t('params.userFk')"
v-model="params.userFk"
:options="workers"
url="Workers/activeWithInheritedRole"
option-value="id"
option-label="name"
emit-value
map-options
use-input
:input-debounce="0"
option-label="firstName"
:where="{ role: 'salesPerson' }"
sort-by="firstName ASC"
:use-like="false"
/>
</QItemSection>
</QItem>

View File

@ -1,12 +1,12 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import { computed } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
@ -20,30 +20,6 @@ const defaultInitialData = {
isRecyclable: false,
};
const parkingFilter = { fields: ['id', 'code'] };
const parkingList = ref([]);
const parkingListCopy = ref([]);
const setParkingList = (data) => {
parkingList.value = data;
parkingListCopy.value = data;
};
const parkingSelectFilter = {
options: parkingList,
filterFn: (options, value) => {
const search = value.trim().toLowerCase();
if (!search || search === '') {
return parkingListCopy.value;
}
return options.value.filter((option) =>
option.code.toLowerCase().startsWith(search)
);
},
};
const shelvingFilter = {
include: [
{
@ -68,12 +44,6 @@ const onSave = (shelving, newShelving) => {
</script>
<template>
<VnSubToolbar v-if="isNew" />
<FetchData
url="Parkings"
:filter="parkingFilter"
@on-fetch="setParkingList"
auto-load
/>
<FormModel
:url="isNew ? null : `Shelvings/${entityId}`"
:url-create="isNew ? 'Shelvings' : null"
@ -84,27 +54,22 @@ const onSave = (shelving, newShelving) => {
:form-initial-data="isNew ? defaultInitialData : null"
@on-data-saved="onSave"
>
<template #form="{ data, validate, filter }">
<template #form="{ data, validate }">
<VnRow>
<VnInput
v-model="data.code"
:label="t('shelving.basicData.code')"
:rules="validate('Shelving.code')"
/>
<QSelect
<VnSelect
v-model="data.parkingFk"
:options="parkingList"
url="Parkings"
option-value="id"
option-label="code"
emit-value
:filter-options="['id', 'code']"
:fields="['id', 'code']"
:label="t('shelving.basicData.parking')"
map-options
use-input
@filter="
(value, update) => filter(value, update, parkingSelectFilter)
"
:rules="validate('Shelving.parkingFk')"
:input-debounce="0"
/>
</VnRow>
<VnRow>

View File

@ -30,7 +30,6 @@ const { t } = useI18n();
const agencyFetchRef = ref(null);
const zonesFetchRef = ref(null);
const clientsOptions = ref([]);
const warehousesOptions = ref([]);
const companiesOptions = ref([]);
const agenciesOptions = ref([]);
@ -273,15 +272,6 @@ const redirectToCustomerAddress = () => {
onMounted(() => onFormModelInit());
</script>
<template>
<FetchData
url="Clients"
:filter="{
fields: ['id', 'name'],
order: 'id',
}"
@on-fetch="(data) => (clientsOptions = data)"
auto-load
/>
<FetchData
url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)"
@ -317,7 +307,9 @@ onMounted(() => onFormModelInit());
v-model="clientId"
option-value="id"
option-label="name"
:options="clientsOptions"
url="Clients"
:fields="['id', 'name']"
sort-by="id"
hide-selected
map-options
:required="true"

View File

@ -17,9 +17,7 @@ const { t } = useI18n();
const state = useState();
const user = state.getUser();
const stateFetchDataRef = ref(null);
const statesOptions = ref([]);
const workersOptions = ref([]);
const onStateFkChange = (formData) => (formData.userFk = user.value.id);
</script>
@ -30,12 +28,6 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
auto-load
@on-fetch="(data) => (statesOptions = data)"
/>
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (workersOptions = data)"
/>
<FormModelPopup
:title="t('Create tracking')"
url-create="Tickets/state"
@ -57,7 +49,9 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
<VnSelect
:label="t('tracking.worker')"
v-model="data.userFk"
:options="workersOptions"
url="Workers/search"
fields=" ['id', 'name']"
sort-by="name ASC"
hide-selected
option-label="name"
option-value="id"

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, onUnmounted, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketEditManaProxy from './TicketEditMana.vue';
@ -35,7 +34,6 @@ const selectedExpeditions = ref([]);
const allColumnNames = ref([]);
const visibleColumns = ref([]);
const newTicketWithRoute = ref(false);
const itemsOptions = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
@ -139,7 +137,9 @@ const columns = computed(() => [
filterValue: null,
event: getInputEvents,
attrs: {
options: itemsOptions.value,
url: 'Items',
fields: ['id', 'name'],
'sort-by': 'name ASC',
'option-value': 'id',
'option-label': 'name',
dense: true,
@ -274,12 +274,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</script>
<template>
<FetchData
url="Items"
auto-load
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemsOptions = data)"
/>
<VnSubToolbar>
<template #st-data>
<TableVisibleColumns

View File

@ -38,7 +38,6 @@ const ticketConfig = ref(null);
const isLocked = ref(false);
const isTicketEditable = ref(false);
const sales = ref([]);
const itemsWithNameOptions = ref([]);
const editableStatesOptions = ref([]);
const selectedSales = ref([]);
const mana = ref(null);
@ -435,12 +434,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
auto-load
@on-fetch="(data) => (isLocked = data)"
/>
<FetchData
url="Items/withName"
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
auto-load
@on-fetch="(data) => (itemsWithNameOptions = data)"
/>
<FetchData
url="States/editableStates"
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
@ -626,10 +619,12 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</div>
<VnSelect
v-else
:options="itemsWithNameOptions"
hide-selected
option-label="name"
option-value="id"
url="Items/withName"
:fields="['id', 'name']"
sort-by="id DESC"
@update:model-value="changeQuantity(row)"
v-model="row.itemFk"
>

View File

@ -26,8 +26,6 @@ const saleTrackingFetchDataRef = ref(null);
const sales = ref([]);
const saleTrackings = ref([]);
const itemShelvignsSales = ref([]);
const shelvingsOptions = ref([]);
const parkingsOptions = ref([]);
const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`);
const oldQuantity = ref(null);
@ -330,12 +328,6 @@ const qCheckBoxController = (sale, action) => {
auto-load
@on-fetch="(data) => (sales = data)"
/>
<FetchData
url="Shelvings"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<FetchData url="Parkings" auto-load @on-fetch="(data) => (parkingsOptions = data)" />
<QTable
:rows="sales"
:columns="columns"
@ -500,7 +492,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-shelving="{ row }">
<QTd auto-width>
<VnSelect
:options="shelvingsOptions"
url="Shelvings"
hide-selected
option-label="code"
option-value="code"
@ -513,7 +505,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-parking="{ row }">
<QTd auto-width>
<VnSelect
:options="parkingsOptions"
url="Parkings"
hide-selected
option-label="code"
option-value="id"

View File

@ -20,7 +20,6 @@ const props = defineProps({
const warehousesOptions = ref([]);
const continentsOptions = ref([]);
const agenciesOptions = ref([]);
const suppliersOptions = ref([]);
const warehousesByContinent = ref({});
const add = (paramsObj, key) => {
@ -76,12 +75,6 @@ warehouses();
@on-fetch="(data) => (agenciesOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
@ -220,7 +213,7 @@ warehouses();
<VnSelect
:label="t('globals.pageTitles.supplier')"
v-model="params.cargoSupplierFk"
:options="suppliersOptions"
url="Suppliers"
option-value="id"
option-label="name"
hide-selected