diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index ccffb2ec2..47836c05b 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -8,7 +8,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnInput from 'src/components/common/VnInput.vue'; import CreateNewCityForm from './CreateNewCityForm.vue'; import CreateNewProvinceForm from './CreateNewProvinceForm.vue'; -import VnSelectCreate from 'components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'components/common/VnSelectDialog.vue'; import FormModelPopup from './FormModelPopup.vue'; const emit = defineEmits(['onDataSaved']); @@ -85,7 +85,7 @@ const onProvinceCreated = async ({ name }, formData) => { />
- { @on-data-saved="onCityCreated($event, data)" /> - +
- { @on-data-saved="onProvinceCreated($event, data)" /> - +
+import { ref, reactive, computed } from 'vue'; +import { useI18n } from 'vue-i18n'; + +import VnRow from 'components/ui/VnRow.vue'; +import FetchData from 'components/FetchData.vue'; +import VnInputDate from 'src/components/common/VnInputDate.vue'; +import VnSelectFilter from 'components/common/VnSelectFilter.vue'; +import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue'; + +import axios from 'axios'; +import { toDate } from 'src/filters'; + +const emit = defineEmits(['travelSelected']); + +const { t } = useI18n(); + +const travelFilter = { + include: [ + { + relation: 'agency', + scope: { + fields: ['name'], + }, + }, + { + relation: 'warehouseIn', + scope: { + fields: ['name'], + }, + }, + { + relation: 'warehouseOut', + scope: { + fields: ['name'], + }, + }, + ], +}; + +const travelFilterParams = reactive({}); +const closeButton = ref(null); +const isLoading = ref(false); +const agenciesOptions = ref([]); +const warehousesOptions = ref([]); +const tableRows = ref([]); +const loading = ref(false); + +const tableColumns = computed(() => [ + { + label: t('entry.basicData.id'), + name: 'id', + field: 'id', + align: 'left', + }, + { + label: t('entry.basicData.warehouseOut'), + name: 'warehouseOutFk', + field: 'warehouseOutFk', + align: 'left', + format: (val) => + warehousesOptions.value.find((warehouse) => warehouse.id === val).name, + }, + { + label: t('entry.basicData.warehouseIn'), + name: 'warehouseInFk', + field: 'warehouseInFk', + align: 'left', + format: (val) => + warehousesOptions.value.find((warehouse) => warehouse.id === val).name, + }, + { + label: t('entry.basicData.shipped'), + name: 'shipped', + field: 'shipped', + align: 'left', + format: (val) => toDate(val), + }, + { + label: t('entry.basicData.landed'), + name: 'landed', + field: 'landed', + align: 'left', + format: (val) => toDate(val), + }, +]); + +const fetchResults = async () => { + try { + let filter = travelFilter; + const params = travelFilterParams; + const where = {}; + for (let key in params) { + const value = params[key]; + if (!value) continue; + + switch (key) { + case 'agencyModeFk': + case 'warehouseInFk': + case 'warehouseOutFk': + case 'shipped': + case 'landed': + where[key] = value; + } + } + + filter.where = where; + const { data } = await axios.get('Travels', { + params: { filter: JSON.stringify(filter) }, + }); + tableRows.value = data; + } catch (err) { + console.error('Error fetching travels'); + } +}; + +const closeForm = () => { + if (closeButton.value) closeButton.value.click(); +}; + +const selectTravel = ({ id }) => { + console.log('row:: ', id); + emit('travelSelected', id); + closeForm(); +}; + + + + + +es: + Filter travels: Filtro envíos + Enter a new search: Introduce una nueva búsqueda + + + diff --git a/src/components/common/VnSelectCreate.vue b/src/components/common/VnSelectDialog.vue similarity index 80% rename from src/components/common/VnSelectCreate.vue rename to src/components/common/VnSelectDialog.vue index bdc3f5cc8..2ec3d1b1a 100644 --- a/src/components/common/VnSelectCreate.vue +++ b/src/components/common/VnSelectDialog.vue @@ -20,6 +20,10 @@ const $props = defineProps({ type: Array, default: () => ['developer'], }, + actionIcon: { + type: String, + default: 'add', + }, }); const role = useRole(); @@ -48,9 +52,9 @@ const toggleForm = () => { diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index eb257e0c9..e9723ebb2 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -322,6 +322,12 @@ export default { booked: 'Booked', raid: 'Raid', excludedFromAvailable: 'Inventory', + agency: 'Agency', + warehouseOut: 'Warehouse Out', + warehouseIn: 'Warehouse In', + shipped: 'Shipped', + landed: 'Landed', + id: 'ID', }, buys: { groupingPrice: 'Grouping price', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 5141fff4e..86d56ba3e 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -321,6 +321,12 @@ export default { booked: 'Asentado', raid: 'Redada', excludedFromAvailable: 'Inventario', + agency: 'Agencia', + warehouseOut: 'Alm. salida', + warehouseIn: 'Alm. entrada', + shipped: 'F. envío', + landed: 'F. entrega', + id: 'ID', }, buys: { groupingPrice: 'Precio grouping', diff --git a/src/pages/Customer/Card/CustomerBillingData.vue b/src/pages/Customer/Card/CustomerBillingData.vue index a455e6db2..94f089f7b 100644 --- a/src/pages/Customer/Card/CustomerBillingData.vue +++ b/src/pages/Customer/Card/CustomerBillingData.vue @@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; -import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; const { t } = useI18n(); @@ -63,7 +63,7 @@ const getBankEntities = async () => {
- { - +
diff --git a/src/pages/Customer/Card/CustomerFiscalData.vue b/src/pages/Customer/Card/CustomerFiscalData.vue index 0edcc3c07..e5cdcb22a 100644 --- a/src/pages/Customer/Card/CustomerFiscalData.vue +++ b/src/pages/Customer/Card/CustomerFiscalData.vue @@ -9,7 +9,7 @@ import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; -import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; const { t } = useI18n(); const route = useRoute(); @@ -114,7 +114,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
- - +
- - +
diff --git a/src/pages/Customer/components/CustomerConsigneeCreate.vue b/src/pages/Customer/components/CustomerConsigneeCreate.vue index 92ce47bf2..7bc6c2e88 100644 --- a/src/pages/Customer/components/CustomerConsigneeCreate.vue +++ b/src/pages/Customer/components/CustomerConsigneeCreate.vue @@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; -import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue'; @@ -113,7 +113,7 @@ const toCustomerConsignees = () => {
- { - +
@@ -223,7 +223,7 @@ const toCustomerConsignees = () => { />
- { - +
diff --git a/src/pages/Customer/components/CustomerConsigneeEdit.vue b/src/pages/Customer/components/CustomerConsigneeEdit.vue index 43649c58e..98996e479 100644 --- a/src/pages/Customer/components/CustomerConsigneeEdit.vue +++ b/src/pages/Customer/components/CustomerConsigneeEdit.vue @@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; -import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue'; @@ -168,7 +168,7 @@ const onDataSaved = () => {
- { - +
@@ -278,7 +278,7 @@ const onDataSaved = () => { />
- { - +
diff --git a/src/pages/Entry/Card/EntryBasicData.vue b/src/pages/Entry/Card/EntryBasicData.vue index 9dc59ec21..a98a1227f 100644 --- a/src/pages/Entry/Card/EntryBasicData.vue +++ b/src/pages/Entry/Card/EntryBasicData.vue @@ -8,6 +8,8 @@ import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnInput from 'src/components/common/VnInput.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; +import FilterTravelForm from 'src/components/FilterTravelForm.vue'; import { toDate } from 'src/filters'; @@ -18,6 +20,10 @@ const suppliersOptions = ref([]); const travelsOptions = ref([]); const companiesOptions = ref([]); const currenciesOptions = ref([]); + +const onFilterTravelSelected = (formData, id) => { + formData.travelFk = id; +}; - +
diff --git a/src/pages/Worker/WorkerCreate.vue b/src/pages/Worker/WorkerCreate.vue index 5cc3993ea..0883995e6 100644 --- a/src/pages/Worker/WorkerCreate.vue +++ b/src/pages/Worker/WorkerCreate.vue @@ -7,7 +7,7 @@ import FormModel from 'components/FormModel.vue'; import VnRow from 'components/ui/VnRow.vue'; import VnInputDate from 'components/common/VnInputDate.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; -import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; +import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import VnInput from 'src/components/common/VnInput.vue'; @@ -184,7 +184,7 @@ onMounted(async () => {
- { - +
{ :rules="validate('Worker.iban')" />
- { - +