Merge branch 'dev' of https: refs #8258//gitea.verdnatura.es/verdnatura/salix-front into 8258-uppercaseInputs
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-10 07:44:02 +01:00
commit 3148461dc1
32 changed files with 306 additions and 117 deletions

View File

@ -25,6 +25,7 @@
"axios": "^1.4.0", "axios": "^1.4.0",
"chromium": "^3.0.3", "chromium": "^3.0.3",
"croppie": "^2.6.5", "croppie": "^2.6.5",
"moment": "^2.30.1",
"pinia": "^2.1.3", "pinia": "^2.1.3",
"quasar": "^2.14.5", "quasar": "^2.14.5",
"validator": "^13.9.0", "validator": "^13.9.0",

View File

@ -20,6 +20,9 @@ dependencies:
croppie: croppie:
specifier: ^2.6.5 specifier: ^2.6.5
version: 2.6.5 version: 2.6.5
moment:
specifier: ^2.30.1
version: 2.30.1
pinia: pinia:
specifier: ^2.1.3 specifier: ^2.1.3
version: 2.1.7(typescript@5.5.4)(vue@3.4.19) version: 2.1.7(typescript@5.5.4)(vue@3.4.19)
@ -832,8 +835,8 @@ packages:
vue-i18n: vue-i18n:
optional: true optional: true
dependencies: dependencies:
'@intlify/message-compiler': 10.0.0 '@intlify/message-compiler': 11.0.0-rc.1
'@intlify/shared': 10.0.0 '@intlify/shared': 11.0.0-rc.1
jsonc-eslint-parser: 1.4.1 jsonc-eslint-parser: 1.4.1
source-map: 0.6.1 source-map: 0.6.1
vue-i18n: 9.9.1(vue@3.4.19) vue-i18n: 9.9.1(vue@3.4.19)
@ -847,11 +850,11 @@ packages:
'@intlify/message-compiler': 9.9.1 '@intlify/message-compiler': 9.9.1
'@intlify/shared': 9.9.1 '@intlify/shared': 9.9.1
/@intlify/message-compiler@10.0.0: /@intlify/message-compiler@11.0.0-rc.1:
resolution: {integrity: sha512-OcaWc63NC/9p1cMdgoNKBj4d61BH8sUW1Hfs6YijTd9656ZR4rNqXAlRnBrfS5ABq0vjQjpa8VnyvH9hK49yBw==} resolution: {integrity: sha512-TGw2uBfuTFTegZf/BHtUQBEKxl7Q/dVGLoqRIdw8lFsp9g/53sYn5iD+0HxIzdYjbWL6BTJMXCPUHp9PxDTRPw==}
engines: {node: '>= 16'} engines: {node: '>= 16'}
dependencies: dependencies:
'@intlify/shared': 10.0.0 '@intlify/shared': 11.0.0-rc.1
source-map-js: 1.0.2 source-map-js: 1.0.2
dev: true dev: true
@ -862,8 +865,8 @@ packages:
'@intlify/shared': 9.9.1 '@intlify/shared': 9.9.1
source-map-js: 1.0.2 source-map-js: 1.0.2
/@intlify/shared@10.0.0: /@intlify/shared@11.0.0-rc.1:
resolution: {integrity: sha512-6ngLfI7DOTew2dcF9WMJx+NnMWghMBhIiHbGg+wRvngpzD5KZJZiJVuzMsUQE1a5YebEmtpTEfUrDp/NqVGdiw==} resolution: {integrity: sha512-8tR1xe7ZEbkabTuE/tNhzpolygUn9OaYp9yuYAF4MgDNZg06C3Qny80bes2/e9/Wm3aVkPUlCw6WgU7mQd0yEg==}
engines: {node: '>= 16'} engines: {node: '>= 16'}
dev: true dev: true
@ -887,7 +890,7 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@intlify/bundle-utils': 4.0.0(vue-i18n@9.9.1) '@intlify/bundle-utils': 4.0.0(vue-i18n@9.9.1)
'@intlify/shared': 10.0.0 '@intlify/shared': 11.0.0-rc.1
'@rollup/pluginutils': 4.2.1 '@rollup/pluginutils': 4.2.1
'@vue/compiler-sfc': 3.4.19 '@vue/compiler-sfc': 3.4.19
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
@ -4960,6 +4963,10 @@ packages:
uuid: 8.3.2 uuid: 8.3.2
dev: true dev: true
/moment@2.30.1:
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
dev: false
/ms@2.0.0: /ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}

View File

@ -2,9 +2,9 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnRow from '../ui/VnRow.vue'; import VnRow from '../ui/VnRow.vue';
import VnInput from './VnInput.vue';
import FetchData from '../FetchData.vue'; import FetchData from '../FetchData.vue';
import useNotify from 'src/composables/useNotify'; import useNotify from 'src/composables/useNotify';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const props = defineProps({ const props = defineProps({
submitFn: { type: Function, default: () => {} }, submitFn: { type: Function, default: () => {} },
@ -70,19 +70,19 @@ defineExpose({ show: () => changePassDialog.value.show() });
</QCardSection> </QCardSection>
<QForm ref="form"> <QForm ref="form">
<QCardSection> <QCardSection>
<VnInput <VnInputPassword
v-if="props.askOldPass" v-if="props.askOldPass"
:label="t('Old password')" :label="t('Old password')"
v-model="passwords.oldPassword" v-model="passwords.oldPassword"
type="password"
:required="true" :required="true"
:toggle-visibility="true"
autofocus autofocus
/> />
<VnInput <VnInputPassword
:label="t('New password')" :label="t('New password')"
v-model="passwords.newPassword" v-model="passwords.newPassword"
type="password"
:required="true" :required="true"
:toggle-visibility="true"
:info=" :info="
t('passwordRequirements', { t('passwordRequirements', {
length: requirements.length, length: requirements.length,
@ -95,10 +95,10 @@ defineExpose({ show: () => changePassDialog.value.show() });
autofocus autofocus
/> />
<VnInput <VnInputPassword
:label="t('Repeat password')" :label="t('Repeat password')"
v-model="passwords.repeatPassword" v-model="passwords.repeatPassword"
type="password" :toggle-visibility="true"
/> />
</QCardSection> </QCardSection>
</QForm> </QForm>

View File

@ -49,6 +49,7 @@ const $props = defineProps({
}); });
const vnInputRef = ref(null); const vnInputRef = ref(null);
const showPassword = ref(false);
const value = computed({ const value = computed({
get() { get() {
return $props.modelValue; return $props.modelValue;
@ -141,7 +142,7 @@ const handleInsertMode = (e) => {
hide-bottom-space hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'" :data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
> >
<template v-if="$slots.prepend" #prepend> <template #prepend>
<slot name="prepend" /> <slot name="prepend" />
</template> </template>
<template #append> <template #append>
@ -165,7 +166,7 @@ const handleInsertMode = (e) => {
emit('remove'); emit('remove');
} }
" "
></QIcon> />
<slot name="append" v-if="$slots.append && !$attrs.disabled" /> <slot name="append" v-if="$slots.append && !$attrs.disabled" />
<QIcon v-if="info" name="info"> <QIcon v-if="info" name="info">
<QTooltip max-width="350px"> <QTooltip max-width="350px">
@ -176,14 +177,3 @@ const handleInsertMode = (e) => {
</QInput> </QInput>
</div> </div>
</template> </template>
<i18n>
en:
inputMin: Must be more than {value}
maxLength: The value exceeds {value} characters
inputMax: Must be less than {value}
es:
inputMin: Debe ser mayor a {value}
maxLength: El valor excede los {value} carácteres
inputMax: Debe ser menor a {value}
</i18n>

View File

@ -0,0 +1,31 @@
<script setup>
import VnInput from 'src/components/common/VnInput.vue';
import { ref } from 'vue';
const model = defineModel({ type: [Number, String] });
const $props = defineProps({
toggleVisibility: {
type: Boolean,
default: false,
},
});
const showPassword = ref(false);
</script>
<template>
<VnInput
v-bind="{ ...$attrs }"
v-model="model"
:type="
$props.toggleVisibility ? (showPassword ? 'text' : 'password') : $attrs.type
"
>
<template #append v-if="toggleVisibility">
<QIcon
:name="showPassword ? 'visibility_off' : 'visibility'"
class="cursor-pointer"
@click="showPassword = !showPassword"
/>
</template>
</VnInput>
</template>

View File

@ -0,0 +1,81 @@
import { describe, expect, it } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import FetchedTags from 'src/components/ui/FetchedTags.vue';
describe('tags computed property', () => {
it('returns an object with the correct keys and values', () => {
const vm = createWrapper(FetchedTags, {
props: {
item: {
tag1: 'JavaScript',
value1: 'Programming Language',
tag2: 'Vue',
value2: 'Framework',
tag3: 'EmptyTag',
},
tag: 'tag',
value: 'value',
columns: 2,
},
}).vm;
expect(vm.tags).toEqual({
JavaScript: 'Programming Language',
Vue: 'Framework',
EmptyTag: '',
});
});
it('returns an empty object if the item prop is an empty object', () => {
const vm = createWrapper(FetchedTags, {
props: {
item: {},
tag: 'tag',
value: 'value',
},
}).vm;
expect(vm.tags).toEqual({});
});
it('should calculate the correct columnStyle when columns prop is defined', () => {
const vm = createWrapper(FetchedTags, {
props: {
item: {
tag1: 'JavaScript',
value1: 'Programming Language',
tag2: 'Vue',
value2: 'Framework',
tag3: 'EmptyTag',
},
tag: 'tag',
value: 'value',
columns: 2,
},
}).vm;
const expectedStyle = {
'grid-template-columns': 'repeat(2, 1fr)',
'max-width': '8rem',
};
expect(vm.columnStyle).toEqual(expectedStyle);
});
it('should return an empty object for columnStyle when columns prop is not defined', () => {
const vm = createWrapper(FetchedTags, {
props: {
item: {
tag1: 'JavaScript',
value1: 'Programming Language',
tag2: 'Vue',
value2: 'Framework',
tag3: 'EmptyTag',
},
tag: 'tag',
value: 'value',
columns: null,
},
}).vm;
expect(vm.columnStyle).toEqual({});
});
});

View File

@ -104,12 +104,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
store.hasMoreData = limit && response.data.length >= limit; store.hasMoreData = limit && response.data.length >= limit;
processData(response.data, { map: !!store.mapKey, append }); if (!append && !isDialogOpened() && updateRouter) {
if (!append && !isDialogOpened()) updateRouter && updateStateParams(); if (updateStateParams(response.data)?.redirect) return;
}
store.isLoading = false; store.isLoading = false;
canceller = null; canceller = null;
processData(response.data, { map: !!store.mapKey, append });
return response; return response;
} }
@ -239,7 +241,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
if (Object.values(store.userParams).length) await fetch({}); if (Object.values(store.userParams).length) await fetch({});
} }
function updateStateParams() { function updateStateParams(data) {
if (!route?.path) return; if (!route?.path) return;
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
if (store?.searchUrl) if (store?.searchUrl)
@ -256,15 +258,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const { path } = matches.at(-1); const { path } = matches.at(-1);
const to = const to =
store?.data?.length === 1 data?.length === 1
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`) ? path.replace(/\/(list|:id)|-list/, `/${data[0].id}`)
: path.replace(/:id.*/, ''); : path.replace(/:id.*/, '');
if (route.path != to) { if (route.path != to) {
const pushUrl = { path: to }; const pushUrl = { path: to };
if (to.endsWith('/list') || to.endsWith('/')) if (to.endsWith('/list') || to.endsWith('/'))
pushUrl.query = newUrl.query; pushUrl.query = newUrl.query;
return router.push(pushUrl); return router.push(pushUrl) && { redirect: true };
} }
} }

View File

@ -1,5 +1,6 @@
export default function toDateHourMin(date) { export default function toDateHourMin(date) {
const dateHour = new Date(date).toLocaleDateString('es-ES', { if (!date) return date;
return new Date(date).toLocaleDateString('es-ES', {
timeZone: 'Europe/Madrid', timeZone: 'Europe/Madrid',
year: 'numeric', year: 'numeric',
month: '2-digit', month: '2-digit',
@ -7,5 +8,4 @@ export default function toDateHourMin(date) {
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
}); });
return dateHour;
} }

View File

@ -1,5 +1,6 @@
export default function toDateHourMinSec(date) { export default function toDateHourMinSec(date) {
const dateHour = new Date(date).toLocaleDateString('es-ES', { if (!date) return date;
return new Date(date).toLocaleDateString('es-ES', {
timeZone: 'Europe/Madrid', timeZone: 'Europe/Madrid',
year: 'numeric', year: 'numeric',
month: '2-digit', month: '2-digit',
@ -8,5 +9,4 @@ export default function toDateHourMinSec(date) {
minute: '2-digit', minute: '2-digit',
second: '2-digit', second: '2-digit',
}); });
return dateHour;
} }

View File

@ -455,12 +455,26 @@ entry:
packingOut: Package out packingOut: Package out
landing: Landing landing: Landing
isExcludedFromAvailable: Es inventory isExcludedFromAvailable: Es inventory
params:
toShipped: To
fromShipped: From
warehouseiNFk: Warehouse
daysOnward: Days onward
daysAgo: Days ago
warehouseInFk: Warehouse in
ticket: ticket:
params: params:
ticketFk: Ticket ID ticketFk: Ticket ID
weekDay: Weekday weekDay: Weekday
agencyModeFk: Agency agencyModeFk: Agency
id: Worker id: Worker
state: State
created: Created
externalId: External ID
counter: Counter
freightItemName: Freight item name
packageItemName: Package item name
longName: Long name
card: card:
customerId: Customer ID customerId: Customer ID
customerCard: Customer card customerCard: Customer card

View File

@ -456,12 +456,25 @@ entry:
packingOut: Embalaje envíos packingOut: Embalaje envíos
landing: Llegada landing: Llegada
isExcludedFromAvailable: Es inventario isExcludedFromAvailable: Es inventario
params:
toShipped: Hasta
fromShipped: Desde
warehouseInFk: Alm. entrada
daysOnward: Días adelante
daysAgo: Días atras
ticket: ticket:
params: params:
ticketFk: ID de ticket ticketFk: ID de ticket
weekDay: Salida weekDay: Salida
agencyModeFk: Agencia agencyModeFk: Agencia
id: Comercial id: Comercial
created: Creado
state: Estado
externalId: ID externo
counter: Contador
freightItemName: Nombre
packageItemName: Embalaje
longName: Descripción
card: card:
customerId: ID cliente customerId: ID cliente
customerCard: Ficha del cliente customerCard: Ficha del cliente

View File

@ -6,6 +6,7 @@ import FormModelPopup from 'components/FormModelPopup.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
@ -61,10 +62,10 @@ const redirectToAccountBasicData = (_, { id }) => {
hide-selected hide-selected
:rules="validate('VnUser.roleFk')" :rules="validate('VnUser.roleFk')"
/> />
<VnInput <VnInputPassword
v-model="data.password" v-model="data.password"
:label="t('ldap.password')" :label="t('ldap.password')"
type="password" :toggle-visibility="true"
:rules="validate('VnUser.password')" :rules="validate('VnUser.password')"
/> />
<QCheckbox <QCheckbox

View File

@ -8,6 +8,7 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
@ -128,10 +129,9 @@ onMounted(async () => await getInitialLdapConfig());
:required="true" :required="true"
:rules="validate('LdapConfig.rdn')" :rules="validate('LdapConfig.rdn')"
/> />
<VnInput <VnInputPassword
:label="t('ldap.password')" :label="t('ldap.password')"
clearable clearable
type="password"
v-model="data.password" v-model="data.password"
:required="true" :required="true"
:rules="validate('LdapConfig.password')" :rules="validate('LdapConfig.password')"

View File

@ -4,9 +4,9 @@ import { computed, ref } from 'vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import AccountSummary from './Card/AccountSummary.vue'; import AccountSummary from './Card/AccountSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnInput from 'src/components/common/VnInput.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -168,10 +168,9 @@ function exprBuilder(param, value) {
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<QCardSection> <QCardSection>
<VnInput <VnInputPassword
:label="t('Password')" :label="t('Password')"
v-model="data.password" v-model="data.password"
type="password"
:required="true" :required="true"
autocomplete="new-password" autocomplete="new-password"
/> />

View File

@ -8,6 +8,7 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
@ -143,10 +144,9 @@ onMounted(async () => await getInitialSambaConfig());
v-model="data.adUser" v-model="data.adUser"
:rules="validate('SambaConfigs.adUser')" :rules="validate('SambaConfigs.adUser')"
/> />
<VnInput <VnInputPassword
:label="t('samba.passwordAD')" :label="t('samba.passwordAD')"
clearable clearable
type="password"
v-model="data.adPassword" v-model="data.adPassword"
/> />
<VnInput <VnInput

View File

@ -9,6 +9,7 @@ import { useArrayData } from 'src/composables/useArrayData';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnChangePassword from 'src/components/common/VnChangePassword.vue'; import VnChangePassword from 'src/components/common/VnChangePassword.vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const $props = defineProps({ const $props = defineProps({
hasAccount: { hasAccount: {
@ -97,14 +98,13 @@ async function sync() {
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip> <QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
</QIcon></QCheckbox </QIcon></QCheckbox
> >
<QInput <VnInputPassword
v-if="shouldSyncPassword" v-if="shouldSyncPassword"
:label="t('login.password')" :label="t('login.password')"
v-model="syncPassword" v-model="syncPassword"
class="full-width" class="full-width"
clearable clearable
clear-icon="close" clear-icon="close"
type="password"
/> />
</template> </template>
</VnConfirm> </VnConfirm>

View File

@ -95,6 +95,7 @@ customer:
isToBeMailed: Mailing isToBeMailed: Mailing
hasSepaVnl: VNL B2B received hasSepaVnl: VNL B2B received
params: params:
id: Id
isWorker: Is Worker isWorker: Is Worker
payMethod: Payment Method payMethod: Payment Method
workerFk: Author workerFk: Author
@ -102,4 +103,15 @@ customer:
created: Last Update Date created: Last Update Date
creditInsurance: Credit Insurance creditInsurance: Credit Insurance
defaulterSinced: Defaulted Since defaulterSinced: Defaulted Since
hasRecovery: Has Recovery hasRecovery: Has Recovery
socialName: Social name
city: City
phone: Phone
postcode: Postcode
campaign: Campaign
grouped: Grouped
search: Contains
itemId: Item Id
ticketFk: Ticket Id
description: Description
quantity: Quantity

View File

@ -97,6 +97,7 @@ customer:
isToBeMailed: Env. emails isToBeMailed: Env. emails
hasSepaVnl: Recibido B2B VNL hasSepaVnl: Recibido B2B VNL
params: params:
id: ID
isWorker: Es trabajador isWorker: Es trabajador
payMethod: F. Pago payMethod: F. Pago
workerFk: Autor workerFk: Autor
@ -104,4 +105,15 @@ customer:
created: Fecha Ú. O. created: Fecha Ú. O.
creditInsurance: Crédito A. creditInsurance: Crédito A.
defaulterSinced: Desde defaulterSinced: Desde
hasRecovery: Tiene recobro hasRecovery: Tiene recobro
socialName: Razón social
campaign: Campaña
city: Ciudad
phone: Teléfono
postcode: Código postal
grouped: Agrupado
search: Contiene
itemId: Id Artículo
ticketFk: Id Ticket
description: Descripción
quantity: Cantidad

View File

@ -1,24 +1,24 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
const { openReport } = usePrintService();
const { openReport } = usePrintService();
const buyRows = ref([]);
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
id: { id: {
type: String, type: Number,
required: false, required: false,
default: null, default: null,
}, },
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const entriesTableColumns = computed(() => [ const entriesTableColumns = computed(() => [
{ {
align: 'left', align: 'left',
@ -63,34 +63,39 @@ const entriesTableColumns = computed(() => [
field: 'grouping', field: 'grouping',
}, },
]); ]);
</script>
function downloadCSV(rows) {
const headers = ['id', 'itemFk', 'name', 'stickers', 'packing', 'comment'];
const csvRows = rows.map((row) => {
const buy = row;
const item = buy.item || {};
return [
buy.id,
buy.itemFk,
item.name || '',
buy.stickers,
buy.packing,
item.comment || '',
].join(',');
});
const csvContent = [headers.join(','), ...csvRows].join('\n');
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `${entityId.value}data.csv`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
<template> <template>
<QDialog ref="dialogRef"> <QDialog ref="dialogRef">
<QCard style="min-width: 800px"> <QCard style="min-width: 800px">
<QCardSection class="row items-center q-pb-none">
<QAvatar
:icon="icon"
color="primary"
text-color="white"
size="xl"
v-if="icon"
/>
<span class="text-h6 text-grey">{{ title }}</span>
<QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
</QCardSection>
<QCardActions align="right">
<QBtn
:label="t('myEntries.printLabels')"
color="primary"
icon="print"
:loading="isLoading"
@click="openReport(`Entries/${entityId}/labelSupplier`)"
unelevated
autofocus
/>
</QCardActions>
<QCardSection class="row items-center"> <QCardSection class="row items-center">
<VnPaginate <VnPaginate
ref="entryBuysPaginateRef" ref="entryBuysPaginateRef"
@ -101,6 +106,7 @@ const entriesTableColumns = computed(() => [
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable
ref="buyRows"
:rows="rows" :rows="rows"
:columns="entriesTableColumns" :columns="entriesTableColumns"
row-key="id" row-key="id"
@ -110,6 +116,26 @@ const entriesTableColumns = computed(() => [
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
:no-data-label="t('globals.noResults')" :no-data-label="t('globals.noResults')"
> >
<template #top-left>
<QBtn
:label="t('myEntries.downloadCsv')"
color="primary"
icon="csv"
@click="downloadCSV(rows)"
unelevated
/>
</template>
<template #top-right>
<QBtn
class="q-mr-lg"
:label="t('myEntries.printLabels')"
color="primary"
icon="print"
@click="
openReport(`Entries/${entityId}/labelSupplier`)
"
/>
</template>
<template #body="props"> <template #body="props">
<QTr> <QTr>
<QTd v-for="col in props.cols" :key="col.name"> <QTd v-for="col in props.cols" :key="col.name">
@ -118,7 +144,6 @@ const entriesTableColumns = computed(() => [
<QBtn <QBtn
icon="visibility" icon="visibility"
v-if="props.row.stickers > 0" v-if="props.row.stickers > 0"
:loading="isLoading"
@click=" @click="
openReport( openReport(
`Entries/${props.row.id}/buy-label-supplier` `Entries/${props.row.id}/buy-label-supplier`

View File

@ -102,7 +102,7 @@ const columns = computed(() => [
actions: [ actions: [
{ {
title: t('myEntries.printLabels'), title: t('myEntries.printLabels'),
icon: 'print', icon: 'move_item',
isPrimary: true, isPrimary: true,
action: (row) => printBuys(row.id), action: (row) => printBuys(row.id),
}, },

View File

@ -17,13 +17,6 @@ myEntries:
warehouseInFk: Warehouse in warehouseInFk: Warehouse in
daysOnward: Days onward daysOnward: Days onward
daysAgo: Days ago daysAgo: Days ago
downloadCsv: Download CSV
wasteRecalc: wasteRecalc:
recalcOk: The wastes were successfully recalculated recalcOk: The wastes were successfully recalculated
entry:
params:
toShipped: To
fromShipped: From
warehouseiNFk: Warehouse
daysOnward: Days onward
daysAgo: Days ago

View File

@ -20,13 +20,6 @@ myEntries:
warehouseInFk: Alm. entrada warehouseInFk: Alm. entrada
daysOnward: Días adelante daysOnward: Días adelante
daysAgo: Días atras daysAgo: Días atras
downloadCsv: Descargar CSV
wasteRecalc: wasteRecalc:
recalcOk: Se han recalculado las mermas correctamente recalcOk: Se han recalculado las mermas correctamente
entry:
params:
toShipped: Hasta
fromShipped: Desde
warehouseInFk: Alm. entrada
daysOnward: Días adelante
daysAgo: Días atras

View File

@ -3,7 +3,7 @@ import { ref } from 'vue';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin'; import { useLogin } from 'src/composables/useLogin';
@ -63,11 +63,10 @@ async function onSubmit() {
:rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]" :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
color="primary" color="primary"
/> />
<VnInput <VnInputPassword
type="password"
v-model="password" v-model="password"
:label="t('login.password')" :label="t('login.password')"
lazy-rules :toggle-visibility="true"
:rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]" :rules="[(val) => (val && val.length > 0) || t('login.fieldRequired')]"
class="red" class="red"
/> />

View File

@ -7,6 +7,7 @@ import axios from 'axios';
import VnInput from 'components/common/VnInput.vue'; import VnInput from 'components/common/VnInput.vue';
import VnOutForm from 'components/ui/VnOutForm.vue'; import VnOutForm from 'components/ui/VnOutForm.vue';
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const router = useRouter(); const router = useRouter();
@ -54,8 +55,7 @@ async function onSubmit() {
<template> <template>
<VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.resetPassword')"> <VnOutForm @submit="onSubmit" :title="t('globals.pageTitles.resetPassword')">
<template #default> <template #default>
<VnInput <VnInputPassword
type="password"
:label="t('login.password')" :label="t('login.password')"
v-model="newPassword" v-model="newPassword"
:info=" :info="
@ -72,9 +72,8 @@ async function onSubmit() {
<template #prepend> <template #prepend>
<QIcon name="password" /> <QIcon name="password" />
</template> </template>
</VnInput> </VnInputPassword>
<VnInput <VnInputPassword
type="password"
:label="t('resetPassword.repeatPassword')" :label="t('resetPassword.repeatPassword')"
v-model="repeatPassword" v-model="repeatPassword"
required required
@ -82,7 +81,7 @@ async function onSubmit() {
<template #prepend> <template #prepend>
<QIcon name="password" /> <QIcon name="password" />
</template> </template>
</VnInput> </VnInputPassword>
</template> </template>
<template #buttons> <template #buttons>
<QBtn <QBtn

View File

@ -1,4 +1,18 @@
route: route:
params:
etd: ETD
tractorPlate: Plate
price: Price
observations: Observations
id: ID
name: Name
cmrFk: CMR id
hasCmrDms: Attached in gestdoc
ticketFk: Ticketd id
routeFk: Route id
shipped: Shipped
agencyAgreement: Agency agreement
agencyModeName: Agency route
Worker: Worker Worker: Worker
Agency: Agency Agency: Agency
Vehicle: Vehicle Vehicle: Vehicle

View File

@ -39,6 +39,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
:url="`Suppliers/${entityId}/getSummary`" :url="`Suppliers/${entityId}/getSummary`"
@on-fetch="(data) => setData(data)" @on-fetch="(data) => setData(data)"
data-key="SupplierSummary" data-key="SupplierSummary"
module-name="Supplier"
> >
<template #header> <template #header>
<span>{{ supplier.id }} - {{ supplier.name }}</span> <span>{{ supplier.id }} - {{ supplier.name }}</span>

View File

@ -201,7 +201,7 @@ const getExpeditionState = async (expedition) => {
const openGrafana = (expeditionFk) => { const openGrafana = (expeditionFk) => {
useOpenURL( useOpenURL(
`https://grafana.verdnatura.es/d/d552ab74-85b4-4e7f-a279-fab7cd9c6124/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}` `https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
); );
}; };

View File

@ -597,7 +597,7 @@ const getColor = (percentage) => {
v-if="entry.isCustomInspectionRequired" v-if="entry.isCustomInspectionRequired"
name="warning" name="warning"
color="negative" color="negative"
size="xs" size="md"
:title="t('requiresInspection')" :title="t('requiresInspection')"
> >
</QIcon> </QIcon>
@ -627,7 +627,7 @@ const getColor = (percentage) => {
<QBtn <QBtn
v-if="entry.evaNotes" v-if="entry.evaNotes"
icon="comment" icon="comment"
size="sm" size="md"
flat flat
color="primary" color="primary"
> >

View File

@ -22,6 +22,7 @@ import { useVnConfirm } from 'composables/useVnConfirm';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { toTimeFormat, secondsToHoursMinutes } from 'filters/date.js'; import { toTimeFormat, secondsToHoursMinutes } from 'filters/date.js';
import toDateString from 'filters/toDateString.js'; import toDateString from 'filters/toDateString.js';
import moment from 'moment';
import { date } from 'quasar'; import { date } from 'quasar';
const route = useRoute(); const route = useRoute();
@ -64,6 +65,7 @@ const selectedDateFormatted = ref(toDateString(defaultDate.value));
const arrayData = useArrayData('workerData'); const arrayData = useArrayData('workerData');
const acl = useAcl(); const acl = useAcl();
const selectedDateYear = computed(() => moment(selectedDate.value).isoWeekYear());
const worker = computed(() => arrayData.store?.data); const worker = computed(() => arrayData.store?.data);
const canSend = computed(() => const canSend = computed(() =>
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }]) acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
@ -278,7 +280,7 @@ const fetchHours = async () => {
const fetchWeekData = async () => { const fetchWeekData = async () => {
const where = { const where = {
year: selectedDate.value.getFullYear(), year: selectedDateYear.value,
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
}; };
const mail = ( const mail = (
@ -370,7 +372,7 @@ const showReasonForm = () => {
const updateWorkerTimeControlMail = async (state, reason) => { const updateWorkerTimeControlMail = async (state, reason) => {
const params = { const params = {
year: selectedDate.value.getFullYear(), year: selectedDateYear.value,
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
state, state,
}; };
@ -400,7 +402,7 @@ const resendEmail = async () => {
const params = { const params = {
recipient: worker.value[0]?.user?.emailUser?.email, recipient: worker.value[0]?.user?.emailUser?.email,
week: selectedWeekNumber.value, week: selectedWeekNumber.value,
year: selectedDate.value.getFullYear(), year: selectedDateYear.value,
workerId: Number(route.params.id), workerId: Number(route.params.id),
state: 'SENDED', state: 'SENDED',
}; };

View File

@ -102,8 +102,7 @@ const getWorkWeekElements = () => {
}; };
const paintWorkWeeks = async () => { const paintWorkWeeks = async () => {
for (var i = 0; i < workWeeksElements.value.length; i++) { for (const element of workWeeksElements.value) {
const element = workWeeksElements.value[i];
const week = Number(element.innerHTML); const week = Number(element.innerHTML);
const weekState = workerTimeControlMailsMap.value.get(week); const weekState = workerTimeControlMailsMap.value.get(week);
const { className, title } = stateClasses[weekState] || {}; const { className, title } = stateClasses[weekState] || {};

View File

@ -4,7 +4,7 @@ import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
</script> </script>
<template> <template>
<VnSection data-key="WorkerDepartment"> <VnSection data-key="WorkerDepartment" :search-bar="false">
<template #body> <template #body>
<div class="flex flex-center q-pa-md"> <div class="flex flex-center q-pa-md">
<WorkerDepartmentTree /> <WorkerDepartmentTree />

View File

@ -19,6 +19,7 @@ describe('Login', () => {
it('should fail to log in using wrong password', () => { it('should fail to log in using wrong password', () => {
cy.get('input[aria-label="Username"]').type('employee'); cy.get('input[aria-label="Username"]').type('employee');
cy.get('input[aria-label="Password"]').type('wrongPassword'); cy.get('input[aria-label="Password"]').type('wrongPassword');
cy.get('.q-field__append > .q-icon');
cy.get('button[type="submit"]').click(); cy.get('button[type="submit"]').click();
cy.get('.q-notification__message').should( cy.get('.q-notification__message').should(
'have.text', 'have.text',