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/i18n/locale/en.yml b/src/i18n/locale/en.yml index c2e988857..db34b393c 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -1095,6 +1095,7 @@ item: list: List diary: Diary tags: Tags + wasteBreakdown: Waste breakdown itemCreate: New item descriptor: item: Item @@ -1123,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: diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 14ce4d3e9..cb5876dd3 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -1094,6 +1094,7 @@ item: list: Listado diary: Histórico tags: Etiquetas + wasteBreakdown: Deglose de mermas itemCreate: Nuevo artículo descriptor: item: Artículo @@ -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: 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/Supplier/Card/SupplierSummary.vue b/src/pages/Supplier/Card/SupplierSummary.vue index 9d00ba8f7..4cd1f46f5 100644 --- a/src/pages/Supplier/Card/SupplierSummary.vue +++ b/src/pages/Supplier/Card/SupplierSummary.vue @@ -1,10 +1,9 @@