From 9a566ba87c07d2256c2c2e76e6a6788cab0bc6c1 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 6 Dec 2023 09:48:51 +0100 Subject: [PATCH 1/4] feat(wagonCounter): refs #6545 move to test --- src/i18n/en/index.js | 1 + src/i18n/es/index.js | 1 + src/pages/Wagon/WagonCounter.vue | 128 +++++++++++++++++++++++++++++++ src/router/modules/wagon.js | 11 ++- 4 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 src/pages/Wagon/WagonCounter.vue diff --git a/src/i18n/en/index.js b/src/i18n/en/index.js index 948332d46..7ff2b41f6 100644 --- a/src/i18n/en/index.js +++ b/src/i18n/en/index.js @@ -448,6 +448,7 @@ export default { typesList: 'Types List', typeCreate: 'Create type', typeEdit: 'Edit type', + wagonCounter: 'Trolley counter', }, type: { name: 'Name', diff --git a/src/i18n/es/index.js b/src/i18n/es/index.js index 9b452ab22..b65375a2c 100644 --- a/src/i18n/es/index.js +++ b/src/i18n/es/index.js @@ -448,6 +448,7 @@ export default { typesList: 'Listado tipos', typeCreate: 'Crear tipo', typeEdit: 'Editar tipo', + wagonCounter: 'Contador de carros', }, type: { name: 'Nombre', diff --git a/src/pages/Wagon/WagonCounter.vue b/src/pages/Wagon/WagonCounter.vue new file mode 100644 index 000000000..38e9bc529 --- /dev/null +++ b/src/pages/Wagon/WagonCounter.vue @@ -0,0 +1,128 @@ + + + + +es: + Substract 1: Quitar 1 + Flush: Vaciar + Are you sure?: ¿Estás seguro? + It will set to 0: Se pondrá a 0 + diff --git a/src/router/modules/wagon.js b/src/router/modules/wagon.js index 3fb808778..238e482dd 100644 --- a/src/router/modules/wagon.js +++ b/src/router/modules/wagon.js @@ -10,7 +10,7 @@ export default { component: RouterView, redirect: { name: 'WagonMain' }, menus: { - main: ['WagonList', 'WagonTypeList'], + main: ['WagonList', 'WagonTypeList', 'WagonCounter'], card: [], }, children: [ @@ -47,6 +47,15 @@ export default { }, component: () => import('src/pages/Wagon/WagonCreate.vue'), }, + { + path: 'counter', + name: 'WagonCounter', + meta: { + title: 'wagonCounter', + icon: 'add_circle', + }, + component: () => import('src/pages/Wagon/WagonCounter.vue'), + }, ], }, { From e963eddfe6615c21a81f09b00675785f68d7e392 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 6 Dec 2023 12:09:03 +0100 Subject: [PATCH 2/4] feat(wagonCounter): refs #6545 add +30 button and correct images --- src/pages/Wagon/WagonCounter.vue | 38 ++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/pages/Wagon/WagonCounter.vue b/src/pages/Wagon/WagonCounter.vue index 38e9bc529..1c4d9e371 100644 --- a/src/pages/Wagon/WagonCounter.vue +++ b/src/pages/Wagon/WagonCounter.vue @@ -11,19 +11,20 @@ const session = useSession(); const token = session.getToken(); const counters = ref({ - alquilerBandeja: { count: 0, id: 1, title: 'Alquiler de CC Bandeja' }, - bandejaRota: { count: 0, id: 2, title: 'CC Bandeja Rota' }, - carryOficial: { count: 0, id: 3, title: ' Alquiler de CC Carry OFICIAL' }, - candadoRojo: { count: 0, id: 4, title: 'CC Candado rojo' }, - sacadores: { count: 0, id: 5, title: 'CC Sacadores' }, - sinChapa: { count: 0, id: 6, title: 'CC Sin Chapa' }, - carroRoto: { count: 0, id: 7, title: 'Carro Roto' }, + alquilerBandeja: { count: 0, id: 96001, title: 'CC Bandeja' }, + bandejaRota: { count: 0, id: 88381, title: 'CC Bandeja Rota' }, + carryOficial: { count: 0, id: 96000, title: 'CC Carry OFICIAL TAG5' }, + candadoRojo: { count: 0, id: 142252, title: 'CC Candado rojo' }, + sacadores: { count: 0, id: 142260, title: 'CC Sacadores' }, + sinChapa: { count: 0, id: 142258, title: 'CC Sin Chapa' }, + carroRoto: { count: 0, id: 142251, title: 'Carro Roto' }, }); const actions = { add: (value) => value + 1, - substract: (value) => (value ? value - 1 : 0), + subtract: (value) => (value ? value - 1 : 0), flush: () => 0, + addSpecific: (value) => value + 30, }; onMounted(() => { @@ -57,7 +58,7 @@ function confirm() { component: VnConfirm, componentProps: { title: t('Are you sure?'), - message: t('Se pondrá el contador a cero'), + message: t('The counter will be reset to zero'), }, }) .onOk(() => resolve(true)) @@ -86,9 +87,20 @@ function confirm() { color="warning" dense size="sm" - @click="handleEvent(name, 'substract')" + @click="handleEvent(name, 'addSpecific')" > - {{ t('Substract 1') }} + {{ t('Add 30') }} + + + + + {{ t('Subtract 1') }} es: - Substract 1: Quitar 1 + Subtract 1: Quitar 1 + Add 30: Añadir 30 Flush: Vaciar Are you sure?: ¿Estás seguro? It will set to 0: Se pondrá a 0 + The counter will be reset to zero: Se pondrá el contador a cero From 6c524932ee20393cfd814e1d559ffc92e429f598 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 6 Dec 2023 14:14:47 +0100 Subject: [PATCH 3/4] feat(addSpecific): refs #6545 add feats and fixes --- src/pages/Wagon/WagonCounter.vue | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/pages/Wagon/WagonCounter.vue b/src/pages/Wagon/WagonCounter.vue index 1c4d9e371..eb0a705e8 100644 --- a/src/pages/Wagon/WagonCounter.vue +++ b/src/pages/Wagon/WagonCounter.vue @@ -14,17 +14,17 @@ const counters = ref({ alquilerBandeja: { count: 0, id: 96001, title: 'CC Bandeja' }, bandejaRota: { count: 0, id: 88381, title: 'CC Bandeja Rota' }, carryOficial: { count: 0, id: 96000, title: 'CC Carry OFICIAL TAG5' }, - candadoRojo: { count: 0, id: 142252, title: 'CC Candado rojo' }, + candadoRojo: { count: 0, id: 96002, title: 'CC Carry NO OFICIAL' }, sacadores: { count: 0, id: 142260, title: 'CC Sacadores' }, - sinChapa: { count: 0, id: 142258, title: 'CC Sin Chapa' }, + sinChapa: { count: 0, id: 2214, title: 'DC Carry Sin Placa CC' }, carroRoto: { count: 0, id: 142251, title: 'Carro Roto' }, }); const actions = { - add: (value) => value + 1, - subtract: (value) => (value ? value - 1 : 0), + add: (counter) => counter + 1, + subtract: (counter) => (counter ? counter - 1 : 0), flush: () => 0, - addSpecific: (value) => value + 30, + addSpecific: (counter, amount) => counter + amount, }; onMounted(() => { @@ -39,14 +39,14 @@ function getUrl(id) { return `/api/Images/catalog/200x200/${id}/download?access_token=${token}`; } -async function handleEvent(type, action) { +async function handleEvent(type, action, amount) { const counter = counters.value[type].count; let isOk = true; if (action == 'flush') isOk = await confirm(); if (isOk) { - counters.value[type].count = actions[action](counter); + counters.value[type].count = actions[action](counter, amount); localStorage.setItem(type, counters.value[type].count); } } @@ -87,10 +87,21 @@ function confirm() { color="warning" dense size="sm" - @click="handleEvent(name, 'addSpecific')" + v-if="props.title === 'CC Bandeja'" + @click="handleEvent(name, 'addSpecific', 30)" > {{ t('Add 30') }} + + {{ t('Add 10') }} + Date: Wed, 6 Dec 2023 15:17:50 +0100 Subject: [PATCH 4/4] feat: refs #6545 isTray --- src/pages/Wagon/WagonCounter.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Wagon/WagonCounter.vue b/src/pages/Wagon/WagonCounter.vue index eb0a705e8..bd5d2ca67 100644 --- a/src/pages/Wagon/WagonCounter.vue +++ b/src/pages/Wagon/WagonCounter.vue @@ -11,8 +11,8 @@ const session = useSession(); const token = session.getToken(); const counters = ref({ - alquilerBandeja: { count: 0, id: 96001, title: 'CC Bandeja' }, - bandejaRota: { count: 0, id: 88381, title: 'CC Bandeja Rota' }, + alquilerBandeja: { count: 0, id: 96001, title: 'CC Bandeja', isTray: true }, + bandejaRota: { count: 0, id: 88381, title: 'CC Bandeja Rota', isTray: true }, carryOficial: { count: 0, id: 96000, title: 'CC Carry OFICIAL TAG5' }, candadoRojo: { count: 0, id: 96002, title: 'CC Carry NO OFICIAL' }, sacadores: { count: 0, id: 142260, title: 'CC Sacadores' }, @@ -87,7 +87,7 @@ function confirm() { color="warning" dense size="sm" - v-if="props.title === 'CC Bandeja'" + v-if="props.isTray" @click="handleEvent(name, 'addSpecific', 30)" > {{ t('Add 30') }}