diff --git a/CHANGELOG.md b/CHANGELOG.md index 250aa01a2..778d04638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - (Item) => Se añade la opción de añadir un comentario del motivo de hacer una foto +- (Worker) => Se añade la opción de crear un trabajador ajeno a la empresa +- (Route) => Ahora se muestran todos los cmrs ## [2418.01] diff --git a/src/components/common/VnInput.vue b/src/components/common/VnInput.vue index 6144f975d..c84a55122 100644 --- a/src/components/common/VnInput.vue +++ b/src/components/common/VnInput.vue @@ -13,6 +13,10 @@ const $props = defineProps({ type: Boolean, default: false, }, + info: { + type: String, + default: '', + }, }); const { t } = useI18n(); @@ -83,6 +87,11 @@ const inputRules = [ v-if="hover && value && !$attrs.disabled" @click="value = null" > + + + {{ info }} + + diff --git a/src/components/common/VnRadio.vue b/src/components/common/VnRadio.vue new file mode 100644 index 000000000..4eeb9dbe9 --- /dev/null +++ b/src/components/common/VnRadio.vue @@ -0,0 +1,6 @@ + + diff --git a/src/components/ui/VnSubToolbar.vue b/src/components/ui/VnSubToolbar.vue index c0d129613..8c86c056a 100644 --- a/src/components/ui/VnSubToolbar.vue +++ b/src/components/ui/VnSubToolbar.vue @@ -18,7 +18,7 @@ onMounted(() => { const observer = new MutationObserver( () => (hasContent.value = - actions.value.childNodes.length + data.value.childNodes.length) + actions.value?.childNodes?.length + data.value?.childNodes?.length) ); if (actions.value) observer.observe(actions.value, opts); if (data.value) observer.observe(data.value, opts); diff --git a/src/composables/useAcl.js b/src/composables/useAcl.js new file mode 100644 index 000000000..46aaa3c25 --- /dev/null +++ b/src/composables/useAcl.js @@ -0,0 +1,33 @@ +import axios from 'axios'; +import { useState } from './useState'; + +export function useAcl() { + const state = useState(); + + async function fetch() { + const { data } = await axios.get('VnUsers/acls'); + const acls = {}; + data.forEach((acl) => { + acls[acl.model] = acls[acl.model] || {}; + acls[acl.model][acl.property] = acls[acl.model][acl.property] || {}; + acls[acl.model][acl.property][acl.accessType] = true; + }); + + state.setAcls(acls); + } + + function hasAny(model, prop, accessType) { + const acls = state.getAcls().value[model]; + if (acls) + return ['*', prop].some((key) => { + const acl = acls[key]; + return acl && (acl['*'] || acl[accessType]); + }); + } + + return { + fetch, + hasAny, + state, + }; +} diff --git a/src/composables/useSession.js b/src/composables/useSession.js index 56bce0279..ca2abef00 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -1,5 +1,6 @@ import { useState } from './useState'; import { useRole } from './useRole'; +import { useAcl } from './useAcl'; import { useUserConfig } from './useUserConfig'; import axios from 'axios'; import useNotify from './useNotify'; @@ -88,6 +89,7 @@ export function useSession() { setSession(data); await useRole().fetch(); + await useAcl().fetch(); await useUserConfig().fetch(); await useTokenConfig().fetch(); diff --git a/src/composables/useState.js b/src/composables/useState.js index f20209494..c2ac1740c 100644 --- a/src/composables/useState.js +++ b/src/composables/useState.js @@ -15,6 +15,7 @@ if (sessionStorage.getItem('user')) user.value = JSON.parse(sessionStorage.getItem('user')); const roles = ref([]); +const acls = ref([]); const tokenConfig = ref({}); const drawer = ref(true); const headerMounted = ref(false); @@ -42,6 +43,14 @@ export function useState() { function setRoles(data) { roles.value = data; } + + function getAcls() { + return computed(() => acls.value); + } + + function setAcls(data) { + acls.value = data; + } function getTokenConfig() { return computed(() => { return tokenConfig.value; @@ -69,6 +78,8 @@ export function useState() { setUser, getRoles, setRoles, + getAcls, + setAcls, getTokenConfig, setTokenConfig, set, diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 8ccdf640f..a0a72ed54 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -962,7 +962,7 @@ roadmap: route: pageTitles: routes: Routes - cmrsList: External CMRs list + cmrsList: CMRs list RouteList: List routeCreate: New route basicData: Basic Data diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 452421343..7815f3c45 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -950,7 +950,7 @@ roadmap: route: pageTitles: routes: Rutas - cmrsList: Listado de CMRs externos + cmrsList: Listado de CMRs RouteList: Listado routeCreate: Nueva ruta basicData: Datos básicos diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue index 0886383de..02f230c03 100644 --- a/src/pages/Customer/Card/CustomerBalance.vue +++ b/src/pages/Customer/Card/CustomerBalance.vue @@ -234,7 +234,7 @@ const showBalancePdf = (balance) => { diff --git a/src/pages/Entry/Card/EntryDescriptor.vue b/src/pages/Entry/Card/EntryDescriptor.vue index 656f8d5fd..807ccdae4 100644 --- a/src/pages/Entry/Card/EntryDescriptor.vue +++ b/src/pages/Entry/Card/EntryDescriptor.vue @@ -34,7 +34,7 @@ const entryFilter = { { relation: 'travel', scope: { - fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'], + fields: ['id', 'landed', 'shipped', 'agencyModeFk', 'warehouseOutFk'], include: [ { relation: 'agency', @@ -125,10 +125,8 @@ watch; :label="t('entry.descriptor.agency')" :value="entity.travel?.agency?.name" /> - + + { :value="entry.travel.agency.name" /> - + { v-model="entry.travel.isDelivered" :disable="true" /> - + { +