diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index d8fb231f0..b8ddbef3d 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -1238,6 +1238,8 @@ zone: pageTitles: zones: Zone zonesList: Zones + zoneCreate: New zone + locations: Locations deliveryList: Delivery days upcomingList: Upcoming deliveries components: diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 67e075935..7489a4747 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -1237,6 +1237,8 @@ zone: pageTitles: zones: Zona zonesList: Zonas + zoneCreate: Nueva zona + locations: Localizaciones deliveryList: Días de entrega upcomingList: Próximos repartos components: diff --git a/src/pages/Zone/Card/ZoneSummary.vue b/src/pages/Zone/Card/ZoneSummary.vue index 00df03cb0..7e49da7cc 100644 --- a/src/pages/Zone/Card/ZoneSummary.vue +++ b/src/pages/Zone/Card/ZoneSummary.vue @@ -50,10 +50,10 @@ const filter = computed(() => { /> - + -import { computed, onMounted, onUpdated, ref } from 'vue'; +import { reactive, ref } from 'vue'; import { useI18n } from 'vue-i18n'; -import { QIcon, QInput, QItem, QItemSection, QSelect } from 'quasar'; +import { useRouter } from 'vue-router'; +import FormModel from 'components/FormModel.vue'; +import VnRow from 'components/ui/VnRow.vue'; +import VnSelect from 'src/components/common/VnSelect.vue'; +import FetchData from 'components/FetchData.vue'; import VnInput from 'src/components/common/VnInput.vue'; - -import { useRoute, useRouter } from 'vue-router'; -import axios from 'axios'; - -onMounted(() => fetch()); -onUpdated(() => fetch()); +import VnInputTime from 'components/common/VnInputTime.vue'; +import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; const { t } = useI18n(); -const route = useRoute(); const router = useRouter(); -const $props = defineProps({ - id: { - type: Number, - required: false, - default: null, - }, + +const newZoneForm = reactive({ + travelingDays: 0, + price: 0.2, + bonus: 0.2, + hour: Date.vnNew(), }); -const entityId = computed(() => $props.id || route.params.id); +const warehousesOptions = ref([]); +const agencyOptions = ref([]); -let zoneTypes = []; -let originalData = {}; -const zone = ref({}); -const filteredZoneTypes = ref(zoneTypes); - -async function onSubmit() { - try { - const params = { - id: entityId.value, - label: zone.value.label, - plate: zone.value.plate, - volume: zone.value.volume, - typeFk: zone.value.typeFk, - }; - await axios.patch('Zones', params).then((res) => { - if (res.status == 200) router.push({ path: `/zone/list` }); - }); - } catch (error) { - // - } -} - -async function onReset() { - if (entityId.value) { - zone.value = { ...originalData }; - } else { - zone.value = {}; - } -} - -async function fetch() { - try { - await axios.get('ZoneTypes').then(async (res) => { - if (res.data) { - filteredZoneTypes.value = zoneTypes = res.data; - } - }); - if (entityId.value) { - await axios.get(`Zones/${entityId.value}`).then(async (res) => { - const data = res.data; - if (data) { - zone.value.label = data.label; - zone.value.plate = data.plate; - zone.value.volume = data.volume; - zone.value.typeFk = data.typeFk; - originalData = { ...zone.value }; - } - }); - } - } catch (e) { - // - } -} - -function filterType(val, update) { - update(() => { - const needle = val.toLowerCase(); - filteredZoneTypes.value = zoneTypes.filter( - (v) => v.name.toLowerCase().indexOf(needle) > -1 - ); - }); -} +const redirectToZoneLocations = (_, { id }) => { + router.push({ name: 'ZoneLocations', params: { id } }); +}; - - - - - - - - - - - - - - - - - - - - - - - - {{ t('zone.warnings.noData') }} - - - - - - - - - - - - + (warehousesOptions = data)" + auto-load + /> + (agencyOptions = data)" + auto-load + /> + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/pages/Zone/ZoneList.vue b/src/pages/Zone/ZoneList.vue index f260eb134..79273b198 100644 --- a/src/pages/Zone/ZoneList.vue +++ b/src/pages/Zone/ZoneList.vue @@ -30,7 +30,7 @@ async function remove(row) { try { await axios.delete(`Zones/${row.id}`).then(async () => { quasar.notify({ - message: t('zone.list.removeItem'), + message: t('list.removeItem'), type: 'positive', }); store.data.splice(store.data.indexOf(row), 1); @@ -61,23 +61,23 @@ async function remove(row) { > - + - + - {{ t('zone.list.create') }} + {{ t('list.create') }} diff --git a/src/pages/Zone/locale/en.yml b/src/pages/Zone/locale/en.yml index e62111d57..68227253c 100644 --- a/src/pages/Zone/locale/en.yml +++ b/src/pages/Zone/locale/en.yml @@ -1,19 +1,22 @@ -zone: - list: - volume: Volume - clone: Clone - id: Id - name: Name - agency: Agency - close: Close - price: Price - create: Create zone - openSummary: Details - create: - name: Name - agency: Agency - close: Close - price: Price - type: - submit: Save - reset: Reset +list: + volume: Volume + clone: Clone + id: Id + name: Name + agency: Agency + close: Close + price: Price + create: Create zone + openSummary: Details +create: + name: Name + warehouse: Warehouse + agency: Agency + travelingDays: Traveling days + closingHour: Closing hour + price: Price + bonus: Bonus + volumetric: Volumetric +type: + submit: Save + reset: Reset diff --git a/src/pages/Zone/locale/es.yml b/src/pages/Zone/locale/es.yml index 5d7a265bf..6db837145 100644 --- a/src/pages/Zone/locale/es.yml +++ b/src/pages/Zone/locale/es.yml @@ -1,19 +1,22 @@ -zone: - list: - volume: Volumen - clone: Clonar - id: Id - name: Nombre - agency: Agencia - close: Cierre - price: Precio - create: Crear zona - openSummary: Detalles - create: - name: Nombre - agency: Agencia - close: Cierre - price: Precio - type: - submit: Guardar - reset: Reiniciar +list: + volume: Volumen + clone: Clonar + id: Id + name: Nombre + agency: Agencia + close: Cierre + price: Precio + create: Crear zona + openSummary: Detalles +create: + name: Nombre + warehouse: Almacén + agency: Agencia + travelingDays: Días de viaje + closingHour: Hora de cierre + price: Precio + bonus: Bonificación + volumetric: Volumétrico +type: + submit: Guardar + reset: Reiniciar diff --git a/src/router/modules/zone.js b/src/router/modules/zone.js index 079dfaa84..ecf750bdc 100644 --- a/src/router/modules/zone.js +++ b/src/router/modules/zone.js @@ -11,58 +11,54 @@ export default { component: RouterView, redirect: { name: 'ZoneMain' }, menus: { - main: [ - /*'ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'*/ - ], - card: [ - // - ], + main: ['ZoneList', 'ZoneDeliveryList', 'ZoneUpcomingList'], + card: ['ZoneLocations'], }, children: [ - // { - // path: '/zone', - // name: 'ZoneMain', - // component: () => import('src/pages/Zone/ZoneMain.vue'), - // redirect: { name: 'ZoneList' }, - // children: [ - // { - // path: 'list', - // name: 'ZoneList', - // meta: { - // title: 'zonesList', - // icon: 'vn:zone', - // }, - // component: () => import('src/pages/Zone/ZoneList.vue'), - // }, - // { - // path: 'create', - // name: 'ZoneCreate', - // meta: { - // title: 'zoneCreate', - // icon: 'create', - // }, - // component: () => import('src/pages/Zone/ZoneCreate.vue'), - // }, - // { - // path: ':id/edit', - // name: 'ZoneEdit', - // meta: { - // title: 'zoneEdit', - // icon: 'edit', - // }, - // component: () => import('src/pages/Zone/ZoneCreate.vue'), - // }, - // { - // path: 'counter', - // name: 'ZoneCounter', - // meta: { - // title: 'zoneCounter', - // icon: 'add_circle', - // }, - // component: () => import('src/pages/Zone/ZoneCounter.vue'), - // }, - // ], - // }, + { + path: '/zone', + name: 'ZoneMain', + component: () => import('src/pages/Zone/ZoneMain.vue'), + redirect: { name: 'ZoneList' }, + children: [ + { + path: 'list', + name: 'ZoneList', + meta: { + title: 'zonesList', + icon: 'vn:zone', + }, + component: () => import('src/pages/Zone/ZoneList.vue'), + }, + { + path: 'create', + name: 'ZoneCreate', + meta: { + title: 'zoneCreate', + icon: 'create', + }, + component: () => import('src/pages/Zone/ZoneCreate.vue'), + }, + { + path: ':id/edit', + name: 'ZoneEdit', + meta: { + title: 'zoneEdit', + icon: 'edit', + }, + component: () => import('src/pages/Zone/ZoneCreate.vue'), + }, + { + path: 'counter', + name: 'ZoneCounter', + meta: { + title: 'zoneCounter', + icon: 'add_circle', + }, + component: () => import('src/pages/Zone/ZoneCounter.vue'), + }, + ], + }, { name: 'ZoneCard', path: ':id', @@ -78,6 +74,16 @@ export default { }, component: () => import('src/pages/Zone/Card/ZoneSummary.vue'), }, + { + name: 'ZoneLocations', + path: 'location', + meta: { + title: 'locations', + icon: 'vn:greuge', + }, + component: () => import('src/pages/Zone/Card/ZoneLocations.vue'), + }, + // { // path: '/zone/delivery', // name: 'ZoneDeliveryMain',