diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index aa629767d..952b7dd8c 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -227,6 +227,8 @@ function nullishToTrue(value) { } const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val); + +defineExpose({ opts: myOptions }); </script> <template> diff --git a/src/pages/Department/Card/DepartmentBasicData.vue b/src/pages/Department/Card/DepartmentBasicData.vue index 98abfd6b9..141bb4159 100644 --- a/src/pages/Department/Card/DepartmentBasicData.vue +++ b/src/pages/Department/Card/DepartmentBasicData.vue @@ -1,9 +1,7 @@ <script setup> -import { ref } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import FetchData from 'components/FetchData.vue'; import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.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 { t } = useI18n(); - -const workersOptions = ref([]); -const clientsOptions = ref([]); </script> <template> - <FetchData - url="Workers/search" - @on-fetch="(data) => (workersOptions = data)" - auto-load - /> - <FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load /> <FormModel :url="`Departments/${route.params.id}`" model="department" @@ -62,7 +51,7 @@ const clientsOptions = ref([]); <VnSelect :label="t('department.bossDepartment')" v-model="data.workerFk" - :options="workersOptions" + url="Workers/search" option-value="id" option-label="name" hide-selected @@ -72,7 +61,7 @@ const clientsOptions = ref([]); <VnSelect :label="t('department.selfConsumptionCustomer')" v-model="data.clientFk" - :options="clientsOptions" + url="Clients" option-value="id" option-label="name" hide-selected diff --git a/src/pages/InvoiceOut/InvoiceOutFilter.vue b/src/pages/InvoiceOut/InvoiceOutFilter.vue index d0d42ea9b..9ce8cc254 100644 --- a/src/pages/InvoiceOut/InvoiceOutFilter.vue +++ b/src/pages/InvoiceOut/InvoiceOutFilter.vue @@ -15,25 +15,10 @@ const props = defineProps({ required: true, }, }); - -const workers = ref(); -const workersCopy = ref(); const states = ref(); - -function setWorkers(data) { - workers.value = data; - workersCopy.value = data; -} </script> - <template> <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"> <template #tags="{ tag, formatFn }"> <div class="q-gutter-x-xs"> diff --git a/src/pages/InvoiceOut/InvoiceOutList.vue b/src/pages/InvoiceOut/InvoiceOutList.vue index 5157d957b..09de62b27 100644 --- a/src/pages/InvoiceOut/InvoiceOutList.vue +++ b/src/pages/InvoiceOut/InvoiceOutList.vue @@ -13,6 +13,8 @@ import { toCurrency, toDate } from 'src/filters/index'; import { useStateStore } from 'stores/useStateStore'; import { QBtn } from 'quasar'; import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue'; +import RightMenu from 'src/components/common/RightMenu.vue'; +import InvoiceOutFilter from './InvoiceOutFilter.vue'; const { t } = useI18n(); const stateStore = useStateStore(); @@ -179,6 +181,11 @@ watchEffect(selectedRows); :label="t('searchInvoice')" data-key="invoiceOut" /> + <RightMenu> + <template #right-panel> + <InvoiceOutFilter data-key="invoiceOut" /> + </template> + </RightMenu> <VnSubToolbar> <template #st-actions> <QBtn @@ -203,6 +210,7 @@ watchEffect(selectedRows); active: true, }, }" + :right-search="false" v-model:selected="selectedRows" order="id DESC" :columns="columns" diff --git a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue index 774b42478..53a1f2ec1 100644 --- a/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue +++ b/src/pages/InvoiceOut/InvoiceOutNegativeBases.vue @@ -168,7 +168,6 @@ const downloadCSV = async () => { } } " - :limit="0" :columns="columns" auto-load :is-editable="false" diff --git a/src/pages/Item/ItemTypeCreate.vue b/src/pages/Item/ItemTypeCreate.vue index b7b06bbe6..290a40389 100644 --- a/src/pages/Item/ItemTypeCreate.vue +++ b/src/pages/Item/ItemTypeCreate.vue @@ -15,7 +15,6 @@ const router = useRouter(); const newItemTypeForm = reactive({}); -const workersOptions = ref([]); const categoriesOptions = ref([]); const temperaturesOptions = ref([]); @@ -25,12 +24,6 @@ const redirectToItemTypeBasicData = (_, { id }) => { </script> <template> - <FetchData - url="Workers" - @on-fetch="(data) => (workersOptions = data)" - :filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }" - auto-load - /> <FetchData url="ItemCategories" @on-fetch="(data) => (categoriesOptions = data)" @@ -61,7 +54,9 @@ const redirectToItemTypeBasicData = (_, { id }) => { <VnSelect v-model="data.workerFk" :label="t('itemType.shared.worker')" - :options="workersOptions" + url="Workers" + sort-by="firstName ASC" + :fields="['id', 'firstName']" option-value="id" option-label="firstName" hide-selected diff --git a/src/pages/ItemType/Card/ItemTypeBasicData.vue b/src/pages/ItemType/Card/ItemTypeBasicData.vue index 51e24272d..d35fbb17d 100644 --- a/src/pages/ItemType/Card/ItemTypeBasicData.vue +++ b/src/pages/ItemType/Card/ItemTypeBasicData.vue @@ -12,17 +12,10 @@ import VnSelect from 'src/components/common/VnSelect.vue'; const route = useRoute(); const { t } = useI18n(); -const workersOptions = ref([]); const categoriesOptions = ref([]); const temperaturesOptions = ref([]); </script> <template> - <FetchData - url="Workers" - @on-fetch="(data) => (workersOptions = data)" - :filter="{ order: 'firstName ASC', fields: ['id', 'firstName'] }" - auto-load - /> <FetchData url="ItemCategories" @on-fetch="(data) => (categoriesOptions = data)" @@ -50,7 +43,9 @@ const temperaturesOptions = ref([]); <VnSelect v-model="data.workerFk" :label="t('shared.worker')" - :options="workersOptions" + url="Workers" + sort-by="firstName ASC" + :fields="['id', 'firstName']" option-value="id" option-label="firstName" hide-selected diff --git a/src/pages/Monitor/Ticket/MonitorTickets.vue b/src/pages/Monitor/Ticket/MonitorTickets.vue index 16d5abffb..d24230c64 100644 --- a/src/pages/Monitor/Ticket/MonitorTickets.vue +++ b/src/pages/Monitor/Ticket/MonitorTickets.vue @@ -25,7 +25,11 @@ const stateOpts = ref([]); const zoneOpts = ref([]); const visibleColumns = ref([]); const { viewSummary } = useSummaryDialog(); -const [from, to] = dateRange(Date.vnNew()); +const from = Date.vnNew(); +from.setHours(0, 0, 0, 0); +const to = new Date(from.getTime()); +to.setDate(to.getDate() + 1); +to.setHours(23, 59, 59, 999); function exprBuilder(param, value) { switch (param) { diff --git a/src/pages/Order/Card/OrderCreateDialog.vue b/src/pages/Order/Card/OrderCreateDialog.vue index 27b0171f2..bcc62aa43 100644 --- a/src/pages/Order/Card/OrderCreateDialog.vue +++ b/src/pages/Order/Card/OrderCreateDialog.vue @@ -126,12 +126,6 @@ onMounted(async () => { </script> <template> - <FetchData - url="addresses" - @on-fetch="(data) => (clientOptions = data)" - :filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }" - auto-load - /> <FormModelPopup url-create="Orders/new" :title="t('Create Order')" @@ -165,13 +159,16 @@ onMounted(async () => { </template> </VnSelect> <VnSelect + ref="addressRef" :label="t('order.form.addressFk')" v-model="data.addressId" - :options="addressList" + url="addresses" + :fields="['id', 'nickname', 'defaultAddressFk', 'street', 'city']" + sort-by="id" option-value="id" option-label="street" hide-selected - :disable="!addressList?.length" + :disable="!$refs.addressRef?.length" > <template #option="scope"> <QItem v-bind="scope.itemProps"> diff --git a/src/pages/Order/Card/OrderFilter.vue b/src/pages/Order/Card/OrderFilter.vue index be47eed54..917369919 100644 --- a/src/pages/Order/Card/OrderFilter.vue +++ b/src/pages/Order/Card/OrderFilter.vue @@ -17,10 +17,6 @@ const props = defineProps({ const agencyFilter = { fields: ['id', 'name'] }; const agencyList = ref(null); -const salesPersonFilter = { - fields: ['id', 'nickname'], -}; -const salesPersonList = ref(null); const sourceList = ref([]); </script> @@ -32,14 +28,6 @@ const sourceList = ref([]); auto-load @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 url="Orders/getSourceValues" :filter="{ fields: ['value'] }" diff --git a/src/pages/Shelving/Card/ShelvingFilter.vue b/src/pages/Shelving/Card/ShelvingFilter.vue index 0056ffaec..56cf4f58c 100644 --- a/src/pages/Shelving/Card/ShelvingFilter.vue +++ b/src/pages/Shelving/Card/ShelvingFilter.vue @@ -1,7 +1,5 @@ <script setup> -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'; @@ -14,22 +12,9 @@ const props = defineProps({ }); const emit = defineEmits(['search']); - -const workers = ref(); - -function setWorkers(data) { - workers.value = data; -} </script> <template> - <FetchData - url="Workers/activeWithInheritedRole" - :filter="{ where: { role: 'salesPerson' } }" - sort-by="firstName ASC" - @on-fetch="setWorkers" - auto-load - /> <VnFilterPanel :data-key="props.dataKey" :search-button="true" diff --git a/src/pages/Supplier/Card/SupplierAccounts.vue b/src/pages/Supplier/Card/SupplierAccounts.vue index 177466478..bc009d3ad 100644 --- a/src/pages/Supplier/Card/SupplierAccounts.vue +++ b/src/pages/Supplier/Card/SupplierAccounts.vue @@ -99,7 +99,11 @@ const setWireTransfer = async () => { :key="index" class="row q-gutter-md q-mb-md" > - <VnInput :label="t('supplier.accounts.iban')" v-model="row.iban"> + <VnInput + :label="t('supplier.accounts.iban')" + v-model="row.iban" + :required="true" + > <template #append> <QIcon name="info" class="cursor-info"> <QTooltip>{{ t('components.iban_tooltip') }}</QTooltip> @@ -113,6 +117,7 @@ const setWireTransfer = async () => { option-label="bic" option-value="id" hide-selected + :required="true" :roles-allowed-to-create="['financial']" > <template #form> diff --git a/src/pages/Supplier/SupplierList.vue b/src/pages/Supplier/SupplierList.vue index ad668f0c0..ea79947a4 100644 --- a/src/pages/Supplier/SupplierList.vue +++ b/src/pages/Supplier/SupplierList.vue @@ -3,6 +3,8 @@ import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import VnTable from 'components/VnTable/VnTable.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; +import RightMenu from 'src/components/common/RightMenu.vue'; +import SupplierListFilter from './SupplierListFilter.vue'; const { t } = useI18n(); const tableRef = ref(); @@ -93,6 +95,11 @@ const columns = computed(() => [ <template> <VnSearchbar data-key="SuppliersList" :limit="20" :label="t('Search suppliers')" /> + <RightMenu> + <template #right-panel> + <SupplierListFilter data-key="SuppliersList" /> + </template> + </RightMenu> <VnTable ref="tableRef" data-key="SuppliersList" @@ -109,6 +116,7 @@ const columns = computed(() => [ return data; }, }" + :right-search="false" order="id ASC" :columns="columns" auto-load diff --git a/src/pages/Ticket/TicketCreateDialog.vue b/src/pages/Ticket/TicketCreateDialog.vue index 1493adc53..4138884bf 100644 --- a/src/pages/Ticket/TicketCreateDialog.vue +++ b/src/pages/Ticket/TicketCreateDialog.vue @@ -27,7 +27,6 @@ const initialFormState = reactive({ warehouseId: user.value.warehouseFk, landed: null, }); -const clientOptions = ref([]); const agenciesOptions = ref([]); const addressesOptions = ref([]); const warehousesOptions = ref([]); @@ -111,12 +110,6 @@ const redirectToTicketList = (_, { id }) => { </script> <template> - <FetchData - url="Clients" - @on-fetch="(data) => (clientOptions = data)" - :filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }" - auto-load - /> <FetchData url="Warehouses" @on-fetch="(data) => (warehousesOptions = data)" @@ -137,7 +130,9 @@ const redirectToTicketList = (_, { id }) => { <VnSelect :label="t('ticket.create.client')" v-model="data.clientId" - :options="clientOptions" + url="Clients" + :fields="['id', 'name', 'defaultAddressFk']" + sort-by="id" option-value="id" option-label="name" hide-selected diff --git a/src/pages/Ticket/TicketFilter.vue b/src/pages/Ticket/TicketFilter.vue index 3b9833ce2..95cac4a47 100644 --- a/src/pages/Ticket/TicketFilter.vue +++ b/src/pages/Ticket/TicketFilter.vue @@ -6,6 +6,7 @@ import FetchData from 'components/FetchData.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; +import VnSelect from 'src/components/common/VnSelect.vue'; const { t } = useI18n(); const props = defineProps({ @@ -15,7 +16,6 @@ const props = defineProps({ }, }); -const workers = ref([]); const provinces = ref([]); const states = ref([]); const agencies = ref([]); @@ -27,12 +27,6 @@ const warehouses = ref([]); <FetchData url="States" @on-fetch="(data) => (states = 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="Workers/activeWithInheritedRole" - :filter="{ where: { role: 'salesPerson' } }" - @on-fetch="(data) => (workers = data)" - auto-load - /> <VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table"> <template #tags="{ tag, formatFn }"> <div class="q-gutter-x-xs"> @@ -66,23 +60,19 @@ const warehouses = ref([]); </QItemSection> </QItem> <QItem> - <QItemSection v-if="!workers"> - <QSkeleton type="QInput" class="full-width" /> - </QItemSection> - <QItemSection v-if="workers"> - <QSelect + <QItemSection> + <VnSelect :label="t('Salesperson')" v-model="params.salesPersonFk" - :options="workers" + url="Workers/activeWithInheritedRole" + :where="{ role: 'salesPerson' }" option-value="id" - option-label="name" - emit-value - map-options - use-input + option-label="firstName" + :use-like="false" + sort-by="firstName ASC" dense outlined rounded - :input-debounce="0" /> </QItemSection> </QItem> diff --git a/src/pages/Zone/ZoneDeliveryPanel.vue b/src/pages/Zone/ZoneDeliveryPanel.vue index 088811b01..423095d6e 100644 --- a/src/pages/Zone/ZoneDeliveryPanel.vue +++ b/src/pages/Zone/ZoneDeliveryPanel.vue @@ -94,9 +94,9 @@ watch( url="Postcodes/location" :fields="['geoFk', 'code', 'townFk', 'countryFk']" sort-by="code, townFk" - option-value="code" + option-value="geoFk" option-label="code" - option-filter="code" + :filter-options="['code', 'geoFk']" hide-selected dense outlined