diff --git a/CHANGELOG.md b/CHANGELOG.md index e34523545..fd8a900b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- (Worker) => Se crea la sección Taquilla + ### Fixed - (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index b18433d4e..2c2acb61c 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -156,9 +156,12 @@ const startFormWatcher = () => { async function fetch() { try { - const { data } = await axios.get($props.url, { + let { data } = await axios.get($props.url, { params: { filter: JSON.stringify($props.filter) }, }); + + if (Array.isArray(data)) data = data[0] ?? {}; + state.set($props.model, data); originalData.value = data && JSON.parse(JSON.stringify(data)); diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 6d0badffb..a062e4d80 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -1,5 +1,5 @@ diff --git a/src/pages/Worker/locale/es.yml b/src/pages/Worker/locale/es.yml index 86dd9d0d9..a960dffe6 100644 --- a/src/pages/Worker/locale/es.yml +++ b/src/pages/Worker/locale/es.yml @@ -1,2 +1,3 @@ Search worker: Buscar trabajador You can search by worker id or name: Puedes buscar por id o nombre del trabajador +Locker: Taquilla diff --git a/src/pages/Zone/Card/ZoneCard.vue b/src/pages/Zone/Card/ZoneCard.vue index 948636c55..9d6895f36 100644 --- a/src/pages/Zone/Card/ZoneCard.vue +++ b/src/pages/Zone/Card/ZoneCard.vue @@ -1,6 +1,15 @@ diff --git a/src/pages/Zone/Card/ZoneDescriptor.vue b/src/pages/Zone/Card/ZoneDescriptor.vue index 93e951801..8f0aa9e07 100644 --- a/src/pages/Zone/Card/ZoneDescriptor.vue +++ b/src/pages/Zone/Card/ZoneDescriptor.vue @@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n'; import CardDescriptor from 'components/ui/CardDescriptor.vue'; import VnLv from 'src/components/ui/VnLv.vue'; import { toTimeFormat } from 'src/filters/date'; +import { toCurrency } from 'filters/index'; import useCardDescription from 'src/composables/useCardDescription'; @@ -73,24 +74,11 @@ const setData = (entity) => { --> - - -es: - Summary: Detalles - The zone will be deleted: El envío será eliminado - Do you want to delete this zone?: ¿Quieres eliminar este envío? - All zones with current agency: Todos los envíos con la agencia actual - Agency: Agencia - Closing hour: Hora de cierre - zoneing days: Días de viaje - Price: Precio - Bonus: Bonificación - diff --git a/src/pages/Zone/Card/ZoneSummary.vue b/src/pages/Zone/Card/ZoneSummary.vue index 00df03cb0..b39d2aaab 100644 --- a/src/pages/Zone/Card/ZoneSummary.vue +++ b/src/pages/Zone/Card/ZoneSummary.vue @@ -2,14 +2,16 @@ import { ref, onMounted, computed } from 'vue'; import { useRoute } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { dashIfEmpty } from 'src/filters'; -import { getUrl } from 'src/composables/getUrl'; + import VnLv from 'src/components/ui/VnLv.vue'; -import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import CardSummary from 'components/ui/CardSummary.vue'; -import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnTitle from 'src/components/common/VnTitle.vue'; +import { getUrl } from 'src/composables/getUrl'; +import { toCurrency } from 'filters/index'; +import { toTimeFormat } from 'src/filters/date'; +import axios from 'axios'; + const route = useRoute(); const { t } = useI18n(); @@ -23,71 +25,84 @@ const $props = defineProps({ const entityId = computed(() => $props.id || route.params.id); const zoneUrl = ref(); -onMounted(async () => { - zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`; +const filter = computed(() => { + const filter = { + include: { + relation: 'agencyMode', + fields: ['name'], + }, + where: { + id: route.params.id, + }, + }; + return filter; }); -const filter = computed(() => { - return { where: { id: entityId.value } }; +const columns = computed(() => [ + { + label: t('summary.name'), + name: 'name', + field: 'warehouse', + align: 'left', + format: (val) => val.name, + }, +]); +const warehouses = ref([]); + +const getWarehouses = async () => { + const params = { + filter: { + include: { + relation: 'warehouse', + fields: ['name'], + }, + }, + }; + + const { data } = await axios.get(`Zones/${entityId.value}/warehouses`, { params }); + warehouses.value = data; +}; + +onMounted(async () => { + zoneUrl.value = (await getUrl('')) + `zone/${entityId.value}/`; + await getWarehouses(); });