diff --git a/package.json b/package.json index 88f430d7b..8398eb3f3 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@intlify/unplugin-vue-i18n": "^0.8.1", "@pinia/testing": "^0.1.2", "@quasar/app-vite": "^1.7.3", + "@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15", "@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0", "@vue/test-utils": "^2.4.4", "autoprefixer": "^10.4.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3fe7df55..bdff559cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,6 +49,9 @@ devDependencies: '@quasar/app-vite': specifier: ^1.7.3 version: 1.7.3(eslint@8.56.0)(pinia@2.1.7)(quasar@2.14.5)(vue-router@4.2.5)(vue@3.4.19) + '@quasar/quasar-app-extension-qcalendar': + specifier: 4.0.0-beta.15 + version: 4.0.0-beta.15 '@quasar/quasar-app-extension-testing-unit-vitest': specifier: ^0.4.0 version: 0.4.0(@vue/test-utils@2.4.4)(quasar@2.14.5)(vite@5.1.4)(vitest@0.31.4)(vue@3.4.19) @@ -912,6 +915,13 @@ packages: resolution: {integrity: sha512-SlOhwzXyPQHWgQIS2ncyDdYdksCJvUYNtgsDQqzAKEG3r3d/ejOxvThle79HTK3Q6HB+gQWFG21Ux00Osr5XSw==} dev: false + /@quasar/quasar-app-extension-qcalendar@4.0.0-beta.15: + resolution: {integrity: sha512-i6hQkcP70LXLfVMPZMKQjSg3681gjZmASV3vq6ULzc0LhtBiPneLdVNNtH2itkWxAmaUj+1heQDI5Pa0F7VKLQ==} + engines: {node: '>= 10.0.0', npm: '>= 5.6.0', yarn: '>= 1.6.0'} + dependencies: + '@quasar/quasar-ui-qcalendar': 4.0.0-beta.19 + dev: true + /@quasar/quasar-app-extension-testing-unit-vitest@0.4.0(@vue/test-utils@2.4.4)(quasar@2.14.5)(vite@5.1.4)(vitest@0.31.4)(vue@3.4.19): resolution: {integrity: sha512-eyzdUdmZiCueNS+5nedjMmzdbpCetSrtdGIwW6KplW1dTzRbLiNvYUjpBOxQGmJCgEhWy9zuswJ7MZ/bTql24Q==} engines: {node: '>= 12.22.1', npm: '>= 6.14.12', yarn: '>= 1.17.3'} @@ -939,6 +949,10 @@ packages: - vite dev: true + /@quasar/quasar-ui-qcalendar@4.0.0-beta.19: + resolution: {integrity: sha512-BT0G2JjgKl1bqNrY5utcYeoy8gK+U9k3Pz1YDi1OB265W/jHU6nFoWMEUdY3JdvMccwkXTL2DLVyl3eqAUyLyg==} + dev: true + /@quasar/render-ssr-error@1.0.3: resolution: {integrity: sha512-A8RF99q6/sOSe1Ighnh5syEIbliD3qUYEJd2HyfFyBPSMF+WYGXon5dmzg4nUoK662NgOggInevkDyBDJcZugg==} engines: {node: '>= 16'} diff --git a/quasar.extensions.json b/quasar.extensions.json index e5c5cbfaa..867769090 100644 --- a/quasar.extensions.json +++ b/quasar.extensions.json @@ -1,7 +1,6 @@ { - "@quasar/testing-unit-vitest": { - "options": [ - "scripts" - ] - } -} \ No newline at end of file + "@quasar/testing-unit-vitest": { + "options": ["scripts"] + }, + "@quasar/qcalendar": {} +} diff --git a/src/boot/i18n.js b/src/boot/i18n.js index ede8f5114..b23b6d5fd 100644 --- a/src/boot/i18n.js +++ b/src/boot/i18n.js @@ -1,7 +1,6 @@ import { boot } from 'quasar/wrappers'; import { createI18n } from 'vue-i18n'; import messages from 'src/i18n'; -import { locales } from 'src/i18n/handle'; const i18n = createI18n({ locale: navigator.language || navigator.userLanguage, @@ -13,9 +12,8 @@ const i18n = createI18n({ legacy: false, }); -export default boot(async ({ app }) => { +export default boot(({ app }) => { // Set i18n instance on app - await locales(); app.use(i18n); }); diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 8e9304d3e..f30ea8937 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -47,7 +47,7 @@ const arrayData = useArrayData($props.dataKey || $props.module, { skip: 0, }); const { store } = arrayData; -const entity = computed(() => store.data); +const entity = computed(() =>Array.isArray( store.data) ? store.data[0] : store.data); const isLoading = ref(false); defineExpose({ @@ -67,7 +67,7 @@ async function getData() { try { const { data } = await arrayData.fetch({ append: false, updateRouter: false }); state.set($props.dataKey, data); - emit('onFetch', data); + emit('onFetch', Array.isArray(data) ? data[0] : data); } finally { isLoading.value = false; } diff --git a/src/components/ui/CardSummary.vue b/src/components/ui/CardSummary.vue index 1e1480293..a06837cf4 100644 --- a/src/components/ui/CardSummary.vue +++ b/src/components/ui/CardSummary.vue @@ -32,7 +32,7 @@ const arrayData = useArrayData(props.dataKey || route.meta.moduleName, { skip: 0, }); const { store } = arrayData; -const entity = computed(() => store.data); +const entity = computed(() => Array.isArray(store.data) ? store.data[0] : store.data); const isLoading = ref(false); defineExpose({ diff --git a/src/components/ui/QCalendarMonthWrapper.vue b/src/components/ui/QCalendarMonthWrapper.vue new file mode 100644 index 000000000..e87d9c4c9 --- /dev/null +++ b/src/components/ui/QCalendarMonthWrapper.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/composables/useSession.js b/src/composables/useSession.js index d397d7ed9..8583e10d4 100644 --- a/src/composables/useSession.js +++ b/src/composables/useSession.js @@ -3,31 +3,29 @@ import { useRole } from './useRole'; import { useUserConfig } from './useUserConfig'; import axios from 'axios'; import useNotify from './useNotify'; +const TOKEN_MULTIMEDIA = 'tokenMultimedia'; +const TOKEN = 'token'; export function useSession() { const { notify } = useNotify(); function getToken() { - const localToken = localStorage.getItem('token'); - const sessionToken = sessionStorage.getItem('token'); + const localToken = localStorage.getItem(TOKEN); + const sessionToken = sessionStorage.getItem(TOKEN); return localToken || sessionToken || ''; } function getTokenMultimedia() { - const localTokenMultimedia = localStorage.getItem('token'); // Temporal - const sessionTokenMultimedia = sessionStorage.getItem('token'); // Temporal + const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA); + const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA); return localTokenMultimedia || sessionTokenMultimedia || ''; } function setToken(data) { - if (data.keepLogin) { - localStorage.setItem('token', data.token); - localStorage.setItem('tokenMultimedia', data.tokenMultimedia); - } else { - sessionStorage.setItem('token', data.token); - sessionStorage.setItem('tokenMultimedia', data.tokenMultimedia); - } + const storage = data.keepLogin ? localStorage : sessionStorage; + storage.setItem(TOKEN, data.token); + storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia); } async function destroyToken(url, storage, key) { if (storage.getItem(key)) { @@ -71,8 +69,8 @@ export function useSession() { } function isLoggedIn() { - const localToken = localStorage.getItem('token'); - const sessionToken = sessionStorage.getItem('token'); + const localToken = localStorage.getItem(TOKEN); + const sessionToken = sessionStorage.getItem(TOKEN); return !!(localToken || sessionToken); } diff --git a/src/css/app.scss b/src/css/app.scss index b36036df4..c6848ff63 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -1,5 +1,6 @@ // app global css in SCSS form @import './icons.scss'; +@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass'; body.body--light { --font-color: black; @@ -159,4 +160,15 @@ input::-webkit-inner-spin-button { appearance: none; -webkit-appearance: none; -moz-appearance: none; -} \ No newline at end of file +} + +// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth +.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button { + background-color: $primary !important; + color: white !important; +} + +.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button { + background-color: $primary !important; + color: white !important; +} diff --git a/src/i18n/handle.js b/src/i18n/handle.js deleted file mode 100644 index 331b60b71..000000000 --- a/src/i18n/handle.js +++ /dev/null @@ -1,17 +0,0 @@ -const modules = import.meta.glob(`../pages/**/locale/**.yml`); -import translations from './index'; -const LOCALE_EXTENSION = '.yml'; - -export async function locales() { - for await (const module of Object.keys(modules)) { - const splittedFile = module.split('/'); - const lang = splittedFile.pop().split(LOCALE_EXTENSION)[0]; - const moduleFiles = splittedFile.join('/') + '/' + lang + LOCALE_EXTENSION; - import(moduleFiles).then((t) => { - Object.assign(translations[lang], t.default); - }); - } - return translations; -} - -export default translations; diff --git a/src/i18n/index.js b/src/i18n/index.js index d94f77bb2..aa25fcc14 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -1,10 +1,23 @@ const files = import.meta.glob(`./locale/*.yml`); +const modules = import.meta.glob(`../pages/**/locale/*.yml`); + const translations = {}; for (const file in files) { const lang = file.split('/').at(2).split('.')[0]; - import(file).then((t) => { - translations[lang] = t.default; + + files[file]() + .then((g) => { + translations[lang] = g.default; + }) + .finally(() => { + const actualLang = lang + '.yml'; + for (const module in modules) { + if (!module.endsWith(actualLang)) continue; + modules[module]().then((t) => { + Object.assign(translations[lang], t.default); + }) + } }); } diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 6e5213c81..db34b393c 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -127,13 +127,12 @@ dashboard: customer: pageTitles: customers: Customers - create: Create list: List webPayments: Web Payments extendedList: Extended list notifications: Notifications defaulter: Defaulter - createCustomer: Create customer + customerCreate: New customer summary: Summary basicData: Basic data fiscalData: Fiscal data @@ -281,7 +280,7 @@ entry: notes: Notes dms: File management log: Log - create: Create + entryCreate: New entry latestBuys: Latest buys list: newEntry: New entry @@ -396,7 +395,7 @@ ticket: pageTitles: tickets: Tickets list: List - createTicket: Create ticket + ticketCreate: New ticket summary: Summary basicData: Basic Data boxing: Boxing @@ -472,7 +471,7 @@ claim: pageTitles: claims: Claims list: List - createClaim: Create claim + claimCreate: New claim summary: Summary basicData: Basic Data lines: Lines @@ -545,7 +544,7 @@ invoiceOut: list: List negativeBases: Negative Bases globalInvoicing: Global invoicing - createInvoiceOut: Create invoice out + invoiceOutCreate: Create invoice out summary: Summary basicData: Basic Data list: @@ -618,7 +617,7 @@ shelving: pageTitles: shelving: Shelving shelvingList: Shelving List - create: Create + shelvingCreate: New shelving summary: Summary basicData: Basic Data log: Logs @@ -651,7 +650,7 @@ invoiceIn: pageTitles: invoiceIns: Invoices In list: List - createInvoiceIn: Create invoice in + invoiceInCreate: Create invoice in summary: Summary basicData: Basic data vat: VAT @@ -712,7 +711,7 @@ order: pageTitles: order: Orders orderList: List - create: Create + orderCreate: New order summary: Summary basicData: Basic Data catalog: Catalog @@ -789,6 +788,7 @@ worker: dms: My documentation pbx: Private Branch Exchange log: Log + calendar: Calendar list: name: Name email: Email @@ -905,7 +905,7 @@ route: routes: Routes cmrsList: External CMRs list RouteList: List - create: Create + routeCreate: New route basicData: Basic Data summary: Summary RouteRoadmap: Roadmaps @@ -932,7 +932,7 @@ supplier: suppliers: Suppliers supplier: Supplier list: List - create: Create + supplierCreate: New supplier summary: Summary basicData: Basic data fiscalData: Fiscal data @@ -1038,7 +1038,6 @@ travel: pageTitles: travel: Travels list: List - create: Create summary: Summary extraCommunity: Extra community travelCreate: New travel @@ -1096,8 +1095,8 @@ item: list: List diary: Diary tags: Tags - create: Create wasteBreakdown: Waste breakdown + itemCreate: New item descriptor: item: Item buyer: Buyer @@ -1125,6 +1124,13 @@ item: stemMultiplier: Multiplier producer: Producer landed: Landed + create: + name: Name + tag: Tag + priority: Priority + type: Type + intrastat: Intrastat + origin: Origin components: topbar: {} userPanel: @@ -1151,3 +1157,24 @@ components: VnLv: copyText: '{copyValue} has been copied to the clipboard' iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789' +weekdays: + sun: Sunday + mon: Monday + tue: Tuesday + wed: Wednesday + thu: Thursday + fri: Friday + sat: Saturday +months: + jan: January + feb: February + mar: March + apr: April + may: May + jun: June + jul: July + aug: August + sep: September + oct: October + nov: November + dec: December diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3e0bd4e95..cb5876dd3 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -125,7 +125,7 @@ dashboard: customer: pageTitles: customers: Clientes - create: Crear + customerCreate: Nuevo cliente list: Listado webPayments: Pagos Web extendedList: Listado extendido @@ -278,7 +278,7 @@ entry: notes: Notas dms: Gestión documental log: Historial - create: Crear + entryCreate: Nueva entrada latestBuys: Últimas compras list: newEntry: Nueva entrada @@ -393,7 +393,7 @@ ticket: pageTitles: tickets: Tickets list: Listado - createTicket: Crear ticket + ticketCreate: Nuevo ticket summary: Resumen basicData: Datos básicos boxing: Encajado @@ -469,7 +469,7 @@ claim: pageTitles: claims: Reclamaciones list: Listado - createClaim: Crear reclamación + claimCreate: Crear reclamación summary: Resumen basicData: Datos básicos lines: Líneas @@ -545,7 +545,7 @@ invoiceOut: list: Listado negativeBases: Bases Negativas globalInvoicing: Facturación global - createInvoiceOut: Crear fact. emitida + invoiceOutCreate: Crear fact. emitida summary: Resumen basicData: Datos básicos list: @@ -618,7 +618,7 @@ order: pageTitles: order: Cesta orderList: Listado - create: Crear + orderCreate: Nueva orden summary: Resumen basicData: Datos básicos catalog: Catálogo @@ -668,7 +668,7 @@ shelving: pageTitles: shelving: Carros shelvingList: Listado de carros - create: Crear + shelvingCreate: Nuevo carro summary: Resumen basicData: Datos básicos log: Historial @@ -700,7 +700,7 @@ invoiceIn: pageTitles: invoiceIns: Fact. recibidas list: Listado - createInvoiceIn: Crear fact. recibida + invoiceInCreate: Crear fact. recibida summary: Resumen basicData: Datos básicos vat: IVA @@ -786,6 +786,7 @@ worker: dms: Mi documentación pbx: Centralita log: Historial + calendar: Calendario list: name: Nombre email: Email @@ -902,7 +903,7 @@ route: routes: Rutas cmrsList: Listado de CMRs externos RouteList: Listado - create: Crear + routeCreate: Nueva ruta basicData: Datos básicos summary: Resumen RouteRoadmap: Troncales @@ -929,7 +930,7 @@ supplier: suppliers: Proveedores supplier: Proveedor list: Listado - create: Crear + supplierCreate: Nuevo proveedor summary: Resumen basicData: Datos básicos fiscalData: Datos fiscales @@ -1093,8 +1094,8 @@ item: list: Listado diary: Histórico tags: Etiquetas - create: Crear wasteBreakdown: Deglose de mermas + itemCreate: Nuevo artículo descriptor: item: Artículo buyer: Comprador @@ -1122,6 +1123,13 @@ item: stemMultiplier: Multiplicador producer: Productor landed: F. entrega + create: + name: Nombre + tag: Etiqueta + priority: Prioridad + type: Tipo + intrastat: Intrastat + origin: Origen components: topbar: {} userPanel: @@ -1148,3 +1156,24 @@ components: VnLv: copyText: '{copyValue} se ha copiado al portapepeles' iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789' +weekdays: + sun: Domingo + mon: Lunes + tue: Martes + wed: Miércoles + thu: Jueves + fri: Viernes + sat: Sábado +months: + jan: Enero + feb: Febrero + mar: Marzo + apr: Abril + may: Mayo + jun: Junio + jul: Julio + aug: Agosto + sep: Septiembre + oct: Octubre + nov: Noviembre + dec: Diciembre diff --git a/src/pages/Customer/locale/en.yml b/src/pages/Customer/locale/en.yml index 6eb7cfa85..67bfa6622 100644 --- a/src/pages/Customer/locale/en.yml +++ b/src/pages/Customer/locale/en.yml @@ -1,4 +1,4 @@ customerFilter: filter: - name: Name - socialName: Social name + name: 'Name' + socialName: 'Social name' diff --git a/src/pages/Customer/locale/es.yml b/src/pages/Customer/locale/es.yml index 8fed37092..ec1981257 100644 --- a/src/pages/Customer/locale/es.yml +++ b/src/pages/Customer/locale/es.yml @@ -1,4 +1,4 @@ customerFilter: filter: - name: Nombre - socialName: Razón Social + name: 'Nombre' + socialName: 'Razón Social' diff --git a/src/pages/Entry/Card/EntryBuys.vue b/src/pages/Entry/Card/EntryBuys.vue index 0208b49ba..3b39840c8 100644 --- a/src/pages/Entry/Card/EntryBuys.vue +++ b/src/pages/Entry/Card/EntryBuys.vue @@ -268,16 +268,11 @@ const importBuys = () => { const toggleGroupingMode = async (buy, mode) => { try { - const grouping = 1; - const packing = 2; - const groupingMode = mode === 'grouping' ? grouping : packing; - - const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode; - + const groupingMode = mode === 'grouping' ? mode : 'packing'; + const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode; const params = { groupingMode: newGroupingMode, }; - await axios.patch(`Buys/${buy.id}`, params); buy.groupingMode = newGroupingMode; } catch (err) { @@ -287,9 +282,9 @@ const toggleGroupingMode = async (buy, mode) => { const lockIconType = (groupingMode, mode) => { if (mode === 'packing') { - return groupingMode === 2 ? 'lock' : 'lock_open'; + return groupingMode === 'packing' ? 'lock' : 'lock_open'; } else { - return groupingMode === 1 ? 'lock' : 'lock_open'; + return groupingMode === 'grouping' ? 'lock' : 'lock_open'; } }; diff --git a/src/pages/Item/Card/ItemBasicData.vue b/src/pages/Item/Card/ItemBasicData.vue new file mode 100644 index 000000000..334cf049d --- /dev/null +++ b/src/pages/Item/Card/ItemBasicData.vue @@ -0,0 +1 @@ + diff --git a/src/pages/Item/ItemCreate.vue b/src/pages/Item/ItemCreate.vue index e20f67ac3..18e7522cb 100644 --- a/src/pages/Item/ItemCreate.vue +++ b/src/pages/Item/ItemCreate.vue @@ -1 +1,170 @@ - + + + diff --git a/src/pages/Worker/Card/WorkerBasicData.vue b/src/pages/Worker/Card/WorkerBasicData.vue index c59f4281d..775472065 100644 --- a/src/pages/Worker/Card/WorkerBasicData.vue +++ b/src/pages/Worker/Card/WorkerBasicData.vue @@ -27,6 +27,7 @@ const workerFilter = { }, { relation: 'sip', scope: { fields: ['extension', 'secret'] } }, { relation: 'department', scope: { include: { relation: 'department' } } }, + { relation: 'client', scope: {fields:['phone']} }, ], }; const workersFilter = { @@ -86,6 +87,7 @@ const maritalStatus = [ :label="t('Mobile extension')" clearable /> + @@ -157,6 +159,7 @@ es: Last name: Apellidos Business phone: Teléfono de empresa Mobile extension: Extensión móvil + Personal phone: Teléfono personal Boss: Jefe Marital status: Estado civil Married: Casado/a diff --git a/src/pages/Worker/Card/WorkerCalendar.vue b/src/pages/Worker/Card/WorkerCalendar.vue new file mode 100644 index 000000000..288e78dcf --- /dev/null +++ b/src/pages/Worker/Card/WorkerCalendar.vue @@ -0,0 +1,239 @@ + + + + + + + +en: + addAbsencesText: To start adding absences, click an absence type from the right menu and then on the day you want to add an absence + +es: + Search worker: Buscar trabajador + You can search by worker id or name: Puedes buscar por id o nombre del trabajador + addAbsencesText: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia + diff --git a/src/pages/Worker/Card/WorkerCalendarFilter.vue b/src/pages/Worker/Card/WorkerCalendarFilter.vue new file mode 100644 index 000000000..374762ac1 --- /dev/null +++ b/src/pages/Worker/Card/WorkerCalendarFilter.vue @@ -0,0 +1,248 @@ + + + + + + + +en: + spentHours: Spent {hoursEnjoyed} of {totalHours} hours + usedDays: Used {holidaysEnjoyed} of {totalHolidays} days + paidHolidays: Paid holidays {payedHolidays} days + +es: + Paid holidays: Vacaciones pagadas + Year: Año + Contract: Contrato + Festive: Festivo + Current day: Día actual + spentHours: Utilizadas {hoursEnjoyed} de {totalHours} horas + usedDays: Utilizados {holidaysEnjoyed} de {totalHolidays} días + paidHolidays: Vacaciones pagadas {payedHolidays} días + + diff --git a/src/pages/Worker/Card/WorkerCalendarItem.vue b/src/pages/Worker/Card/WorkerCalendarItem.vue new file mode 100644 index 000000000..584222d19 --- /dev/null +++ b/src/pages/Worker/Card/WorkerCalendarItem.vue @@ -0,0 +1,313 @@ + + + + + + + +es: + Choose an absence type from the right menu: Elige un tipo de ausencia desde el menú de la derecha + diff --git a/src/pages/Worker/Card/WorkerDescriptor.vue b/src/pages/Worker/Card/WorkerDescriptor.vue index a20ad5546..bb4acec69 100644 --- a/src/pages/Worker/Card/WorkerDescriptor.vue +++ b/src/pages/Worker/Card/WorkerDescriptor.vue @@ -31,29 +31,7 @@ const entityId = computed(() => { }); const worker = ref(); -const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['email', 'name', 'nickname'], - }, - }, - { - relation: 'department', - scope: { - include: [ - { - relation: 'department', - }, - ], - }, - }, - { - relation: 'sip', - }, - ], -}; +const filter = { where: { id: route.params.id}}; const sip = ref(null); @@ -82,7 +60,7 @@ const setData = (entity) => { +defineProps({ + color: { + type: String, + default: null, + }, + avatarClass: { + type: String, + default: null, + }, + selected: { + type: Boolean, + default: undefined, + }, +}); +defineEmits(['update:selected']); + + + diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue index dad21cda5..43c493565 100644 --- a/src/pages/Worker/Card/WorkerSummary.vue +++ b/src/pages/Worker/Card/WorkerSummary.vue @@ -10,7 +10,7 @@ import CardSummary from 'components/ui/CardSummary.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnTitle from 'src/components/common/VnTitle.vue'; -const route = useRoute(); +const { params } = useRoute(); const { t } = useI18n(); const $props = defineProps({ @@ -20,53 +20,18 @@ const $props = defineProps({ }, }); -const entityId = computed(() => $props.id || route.params.id); +const entityId = computed(() => $props.id || params.id); const workerUrl = ref(); onMounted(async () => { workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`; }); -const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['email', 'name', 'nickname', 'roleFk'], - include: { - relation: 'role', - scope: { - fields: ['name'], - }, - }, - }, - }, - { - relation: 'department', - scope: { - include: { - relation: 'department', - scope: { - fields: ['name'], - }, - }, - }, - }, - { - relation: 'boss', - }, - { - relation: 'client', - }, - { - relation: 'sip', - }, - ], -}; +const filter = { where: { id: entityId.value } }; - - - diff --git a/src/router/modules/Supplier.js b/src/router/modules/Supplier.js index 64c48146b..da45aad2f 100644 --- a/src/router/modules/Supplier.js +++ b/src/router/modules/Supplier.js @@ -45,7 +45,8 @@ export default { path: 'create', name: 'SupplierCreate', meta: { - title: 'create', + title: 'supplierCreate', + icon: 'add', }, component: () => import('src/pages/Supplier/SupplierCreate.vue'), }, diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js index 75188bd32..76d9a5af1 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -55,7 +55,8 @@ export default { path: 'create', name: 'CustomerCreate', meta: { - title: 'create', + title: 'customerCreate', + icon: 'add', }, component: () => import('src/pages/Customer/CustomerCreate.vue'), }, diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js index 50a651af5..67fc41824 100644 --- a/src/router/modules/entry.js +++ b/src/router/modules/entry.js @@ -34,7 +34,8 @@ export default { path: 'create', name: 'EntryCreate', meta: { - title: 'create', + title: 'entryCreate', + icon: 'add', }, component: () => import('src/pages/Entry/EntryCreate.vue'), }, diff --git a/src/router/modules/item.js b/src/router/modules/item.js index 4b45ca40c..41f3ec92a 100644 --- a/src/router/modules/item.js +++ b/src/router/modules/item.js @@ -11,7 +11,7 @@ export default { redirect: { name: 'ItemMain' }, menus: { main: ['ItemList', 'WasteBreakdown'], - card: [], + card: ['ItemBasicData'], }, children: [ { @@ -85,6 +85,15 @@ export default { }, component: () => import('src/pages/Item/Card/ItemTags.vue'), }, + { + path: 'basic-data', + name: 'ItemBasicData', + meta: { + title: 'basicData', + icon: 'vn:settings', + }, + component: () => import('src/pages/Item/Card/ItemBasicData.vue'), + }, ], }, ], diff --git a/src/router/modules/order.js b/src/router/modules/order.js index 16d73281b..eb5424e75 100644 --- a/src/router/modules/order.js +++ b/src/router/modules/order.js @@ -34,7 +34,8 @@ export default { path: 'create', name: 'OrderCreate', meta: { - title: 'create', + title: 'orderCreate', + icon: 'add', }, component: () => import('src/pages/Order/Card/OrderForm.vue'), }, diff --git a/src/router/modules/route.js b/src/router/modules/route.js index 099492981..f8ededf55 100644 --- a/src/router/modules/route.js +++ b/src/router/modules/route.js @@ -34,7 +34,8 @@ export default { path: 'create', name: 'RouteCreate', meta: { - title: 'create', + title: 'routeCreate', + icon: 'add', }, component: () => import('src/pages/Route/Card/RouteForm.vue'), }, diff --git a/src/router/modules/shelving.js b/src/router/modules/shelving.js index b881ca020..d20ce40f4 100644 --- a/src/router/modules/shelving.js +++ b/src/router/modules/shelving.js @@ -34,7 +34,8 @@ export default { path: 'create', name: 'ShelvingCreate', meta: { - title: 'create', + title: 'shelvingCreate', + icon: 'add', }, component: () => import('src/pages/Shelving/Card/ShelvingForm.vue'), }, diff --git a/src/router/modules/travel.js b/src/router/modules/travel.js index 2f1e2150e..e1a08e9de 100644 --- a/src/router/modules/travel.js +++ b/src/router/modules/travel.js @@ -44,6 +44,7 @@ export default { name: 'TravelCreate', meta: { title: 'travelCreate', + icon: 'add', }, component: () => import('src/pages/Travel/TravelCreate.vue'), }, diff --git a/src/router/modules/worker.js b/src/router/modules/worker.js index 4af2eea50..bf8d6093f 100644 --- a/src/router/modules/worker.js +++ b/src/router/modules/worker.js @@ -19,6 +19,7 @@ export default { 'WorkerNotificationsManager', 'WorkerPBX', 'WorkerLog', + 'WorkerCalendar', 'WorkerDms', ], departmentCard: ['BasicData'], @@ -53,7 +54,7 @@ export default { name: 'WorkerCreate', meta: { title: 'workerCreate', - icon: '', + icon: 'add', }, component: () => import('src/pages/Worker/WorkerCreate.vue'), }, @@ -146,6 +147,15 @@ export default { }, component: () => import('src/pages/Worker/Card/WorkerLog.vue'), }, + { + name: 'WorkerCalendar', + path: 'calendar', + meta: { + title: 'calendar', + icon: 'calendar_today', + }, + component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'), + }, ], }, ], diff --git a/src/stores/useWeekdayStore.js b/src/stores/useWeekdayStore.js new file mode 100644 index 000000000..ad898c9a7 --- /dev/null +++ b/src/stores/useWeekdayStore.js @@ -0,0 +1,95 @@ +import { reactive, ref, computed } from 'vue'; +import { useI18n } from 'vue-i18n'; +import { defineStore } from 'pinia'; + +export const useWeekdayStore = defineStore('weekdayStore', () => { + const { t } = useI18n(); + + const weekdays = [ + { code: 'sun', name: 'Sunday' }, + { code: 'mon', name: 'Monday' }, + { code: 'tue', name: 'Tuesday' }, + { code: 'wed', name: 'Wednesday' }, + { code: 'thu', name: 'Thursday' }, + { code: 'fri', name: 'Friday' }, + { code: 'sat', name: 'Saturday' }, + ]; + + const monthCodes = [ + 'jan', + 'feb', + 'mar', + 'apr', + 'may', + 'jun', + 'jul', + 'aug', + 'sep', + 'oct', + 'nov', + 'dec', + ]; + + const localeOrder = { + es: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'], + en: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], + }; + + const weekdaysMap = reactive({}); + const localeWeekdays = ref([]); + + const initStore = () => { + getWeekdaysMap(); + }; + + const getWeekdaysMap = () => { + if (Object.keys(weekdaysMap).length > 0) return weekdaysMap; + + weekdays.forEach((day, i) => { + const obj = { + ...day, + index: i, + char: day.name.substr(0, 1), + abr: day.name.substr(0, 3), + }; + weekdaysMap[day.code] = obj; + }); + }; + + const getLocales = computed(() => { + // El día de mañana esto permitirá ordenar los weekdays en base a el locale si se lo desea reemplazando localeOrder.es por localeOrder[locale] + const locales = []; + for (let code of localeOrder.es) { + const obj = { + ...weekdaysMap[code], + locale: t(`weekdays.${weekdaysMap[code].code}`), + localeChar: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 1), + localeAbr: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 3), + }; + locales.push(obj); + } + return locales; + }); + + const getLocaleMonths = computed(() => { + const locales = []; + for (let code of monthCodes) { + const obj = { + code: code, + locale: t(`months.${code}`), + }; + locales.push(obj); + } + return locales; + }); + + return { + initStore, + weekdaysMap, + localeWeekdays, + getLocales, + weekdays, + monthCodes, + getLocaleMonths, + }; +});