Fixes varios #2 #88

Merged
jsegarra merged 17 commits from wbuezas/hedera-web-mindshore:bugfix/fixes-2 into 4922-vueMigration 2024-10-04 18:14:44 +00:00
27 changed files with 613 additions and 336 deletions

View File

@ -82,7 +82,7 @@ const props = defineProps({
}
});
const emit = defineEmits(['onDataSaved']);
const emit = defineEmits(['onDataSaved', 'onDataFetched']);
const { t } = useI18n();
const jApi = inject('jApi');
@ -133,6 +133,7 @@ const fetchFormData = async () => {
formData.value = { ...modelInfo.value.data[0] };
loading.value = false;
emit('onDataFetched', formData.value);
};
const onSubmitSuccess = () => {
@ -200,10 +201,7 @@ defineExpose({
</script>
<template>
<QCard
class="form-container"
v-bind="$attrs"
>
<QCard class="form-container" v-bind="$attrs">
<QForm
v-if="!loading"
ref="addressFormRef"
@ -213,14 +211,8 @@ defineExpose({
<span v-if="title" class="text-h6 text-bold">
{{ title }}
</span>
<slot
name="form"
:data="formData"
/>
<slot
name="extraForm"
:data="formData"
/>
<slot name="form" :data="formData" />
<slot name="extraForm" :data="formData" />
<component
v-if="isHeaderMounted"
:is="showBottomActions ? 'div' : Teleport"
@ -254,24 +246,21 @@ defineExpose({
<slot name="actions" :data="formData" />
</component>
</QForm>
<QSpinner
v-else
color="primary"
size="3em"
:thickness="2"
/>
<QSpinner v-else color="primary" size="3em" :thickness="2" />
</QCard>
</template>
<style lang="scss" scoped>
.no-form-container {
padding: 0 !important;
box-shadow: none;
border: none;
}
.form-container {
width: 100%;
height: max-content;
padding: 0 !important;
padding: 32px;
max-width: 544px;
display: flex;
justify-content: center;
@ -280,7 +269,6 @@ defineExpose({
.form {
display: flex;
flex-direction: column;
padding: 32px;
width: 100%;
}
</style>

View File

@ -0,0 +1,38 @@
<script setup>
import { useI18n } from 'vue-i18n';
defineProps({
emptyMessage: {
type: String,
default: 'emptyList'
},
emptyIcon: {
type: String,
default: 'block'
},
rows: {
type: Array,
default: () => []
},
loading: {
type: Boolean,
default: false
}
});
const { t } = useI18n();
</script>
<template>
<QList v-bind="$attrs" class="column items-center">
<span
v-if="!rows?.length"
class="flex items-center q-pa-md justify-center items-center"
>
<QIcon :name="emptyIcon" size="sm" class="q-mr-sm" />
{{ t(emptyMessage) }}
</span>
<QSpinner v-if="loading" color="primary" size="3em" :thickness="2" />
<slot v-else />
</QList>
</template>

View File

@ -70,6 +70,7 @@ onMounted(() => {
bg-color="white"
is-outlined
:clearable="false"
class="searchbar"
>
<template #prepend>
<QIcon name="search" class="cursor-pointer" @click="search()" />
@ -77,6 +78,15 @@ onMounted(() => {
</VnInput>
</template>
<style lang="scss" scoped>
@import 'src/css/responsive';
.searchbar {
@include mobile {
max-width: 120px;
}
}
</style>
<i18n lang="yaml">
en-US:
search: Search

View File

@ -1,5 +1,17 @@
@mixin mobile {
@media screen and (max-width: 1023px) {
@media screen and (max-width: 768px) {
@content;
}
}
@mixin tablet {
@media screen and (min-width: 769px) and (max-width: 1024px) {
@content;
}
}
@mixin desktop {
@media screen and (min-width: 1025px) {
@content;
}
}

View File

@ -51,6 +51,7 @@ export default {
of: 'de',
// Sections titles
titles: {
Home: 'Inici',
Orders: 'Comandes',
Ticket: `Detall de l'encarrec`,
@ -68,7 +69,7 @@ export default {
Photos: 'Imatges',
Images: 'Imatges',
Items: 'Articles',
Agencies: 'Agències',
Agencies: 'Paquets per agència',
Reports: 'Informes',
Configuration: 'Configuració',
Shelves: 'Prestatgeries',
@ -78,7 +79,31 @@ export default {
Checkout: `Configurar l'encarrec`,
'Address details': 'Configuració',
'Admin news details': `Afegir o editar notícia`,
'Access log': 'Registre daccés',
'Access log': 'Registre daccés'
},
menuTitles: {
Home: 'Inici',
Orders: 'Comandes',
Basket: 'Cistella',
Catalog: 'Catàleg',
Administration: 'Administració',
Agencies: 'Agències',
Reports: 'Informes',
Shelves: 'Prestatgeries',
Configuration: 'Configuració',
'Pending orders': 'Pendents',
'Last orders': 'Confirmades',
Invoices: 'Factures',
'Control panel': 'Panell de control',
Users: 'Usuaris',
Connections: 'Connexions',
Visits: 'Visites',
News: 'Gestió de notícies',
Photos: 'Imatges',
Items: 'Articles',
Account: 'Compte',
Addresses: 'Adreces'
},
//
orderLoadedIntoBasket: 'Comanda carregada a la cistella!',
loadAnOrder:
@ -94,6 +119,7 @@ export default {
confirmDelete: 'Estàs segur que vols esborrar la línia?',
emptyList: 'Llista buida',
logInAsGuest: `Accedir com a convidat`,
logIn: 'Iniciar sessió',
haveForgottenPassword: '¿Has oblidat la teva contrasenya?',
signUp: 'Registrar-me',
notACustomerYet: `Encara no ets client?`,
@ -106,6 +132,8 @@ export default {
shoppingCart: 'Cistella de la compra',
available: 'Disponible',
minQuantity: 'Quantitat mínima',
introduceSearchTerm: 'Introdueix un terme de cerca',
noOrdersFound: `No s'han trobat comandes`,
// Image related translations
'Cant lock cache': 'No es pot bloquejar la memòria cau',
'Bad file format': 'Format de fitxer no reconegut',

View File

@ -63,6 +63,7 @@ export default {
},
// Sections titles
titles: {
Home: 'Home',
Orders: 'Orders',
Ticket: 'Detalle del pedido',
@ -80,7 +81,7 @@ export default {
Photos: 'Images',
Images: 'Images',
Items: 'Items',
Agencies: 'Agencies',
Agencies: 'Bundles by agency',
Reports: 'Reports',
Configuration: 'Configuration',
Shelves: 'Shelves',
@ -90,7 +91,32 @@ export default {
Checkout: 'Configure order',
'Address details': 'Configuration',
'Admin news details': 'Add or edit new',
'Access log': 'Access log',
'Access log': 'Access log'
},
menuTitles: {
Home: 'Home',
Orders: 'Orders',
Basket: 'Basket',
Catalog: 'Catalog',
Administration: 'Administration',
Agencies: 'Agencies',
Reports: 'Reports',
Shelves: 'Shelves',
Configuration: 'Configuration',
'Pending orders': 'Pending',
'Last orders': 'Confirmed',
Invoices: 'Invoices',
'Control panel': 'Control panel',
Users: 'Users',
Connections: 'Connections',
Visits: 'Visits',
News: 'News',
Photos: 'Images',
Items: 'Items',
Account: 'Account',
Addresses: 'Addresses'
},
//
orderLoadedIntoBasket: 'Order loaded into basket!',
loadAnOrder: 'Please load a pending order to the cart or start a new one',
@ -127,7 +153,8 @@ export default {
save: 'Save',
cancel: 'Cancel',
of: 'of',
loginAsGuest: 'Login as guest',
logInAsGuest: 'Login as guest',
logIn: 'Log in',
haveForgottenPassword: 'Have you forgotten your password?',
signUp: 'Sign up',
notACustomerYet: 'Not a customer yet?',
@ -139,6 +166,8 @@ export default {
shoppingCart: 'Shopping cart',
available: 'Available',
minQuantity: 'Minimum quantity',
introduceSearchTerm: 'Enter a search term',
noOrdersFound: 'No orders found',
// Image related translations
'Cant lock cache': 'The cache could not be blocked',
'Bad file format': 'Unrecognized file format',

View File

@ -60,6 +60,7 @@ export default {
},
// Sections titles
titles: {
Home: 'Inicio',
Orders: 'Pedidos',
Ticket: 'Pedido',
@ -77,7 +78,7 @@ export default {
Photos: 'Imágenes',
Images: 'Imágenes',
Items: 'Artículos',
Agencies: 'Agencias',
Agencies: 'Bultos por agencia',
Reports: 'Informes',
Configuration: 'Configuración',
Shelves: 'Estanterías',
@ -87,7 +88,32 @@ export default {
Checkout: 'Configurar pedido',
'Address details': 'Configuración',
'Admin news details': 'Añadir o editar noticia',
'Access log': 'Registro de accesos',
'Access log': 'Registro de accesos'
},
menuTitles: {
Home: 'Inicio',
Orders: 'Pedidos',
Basket: 'Cesta',
Catalog: 'Catálogo',
Administration: 'Administración',
Agencies: 'Agencias',
Reports: 'Informes',
Shelves: 'Estanterías',
Configuration: 'Configuración',
'Pending orders': 'Pendientes',
'Last orders': 'Confirmados',
Invoices: 'Facturas',
'Control panel': 'Panel de control',
Users: 'Usuarios',
Connections: 'Conexiones',
Visits: 'Visitas',
News: 'Noticias',
Photos: 'Imágenes',
Items: 'Artículos',
Account: 'Cuenta',
Addresses: 'Direcciones'
},
//
orderLoadedIntoBasket: '¡Pedido cargado en la cesta!',
loadAnOrder:
@ -138,6 +164,8 @@ export default {
shoppingCart: 'Cesta de la compra',
available: 'Disponible',
minQuantity: 'Cantidad mínima',
introduceSearchTerm: 'Introduce un término de búsqueda',
noOrdersFound: 'No se encontrado pedidos',
// Image related translations
'Cant lock cache': 'La caché no pudo ser bloqueada',
'Bad file format': 'Formato de archivo no reconocido',

View File

@ -51,6 +51,7 @@ export default {
of: 'de',
// Sections titles
titles: {
Home: 'Accueil',
Orders: 'Commandes',
Ticket: 'Détail de la commande',
@ -68,7 +69,7 @@ export default {
Photos: 'Images',
Images: 'Images',
Items: 'Articles',
Agencies: 'Agences',
Agencies: 'Liste par agence',
Reports: 'Rapports',
Configuration: 'Configuration',
Shelves: 'Étagères',
@ -78,7 +79,32 @@ export default {
Checkout: 'Configurer la commande',
'Address details': 'Configuration',
'Admin news details': 'Ajouter ou éditer une nouvelle',
'Access log': "Journal d'accès",
'Access log': "Journal d'accès"
},
menuTitles: {
Home: 'Accueil',
Orders: 'Commandes',
Basket: 'Panier',
Catalog: 'Catalogue',
Administration: 'Administration',
Agencies: 'Agences',
Reports: 'Rapports',
Shelves: 'Étagères',
Configuration: 'Configuration',
'Pending orders': 'En attente',
'Last orders': 'Confirmées',
Invoices: 'Factures',
'Control panel': 'Panneau de configuration',
Users: 'Utilisateurs',
Connections: 'Connexions',
Visits: 'Visites',
News: 'Nouvelles',
Photos: 'Images',
Items: 'Articles',
Account: 'Compte',
Addresses: 'Adresses'
},
//
orderLoadedIntoBasket: 'Commande chargée dans le panier!',
loadAnOrder:
@ -94,6 +120,7 @@ export default {
emptyList: 'Vider la liste',
confirmDelete: 'Voulez-vous vraiment supprimer la ligne?',
logInAsGuest: `Entrez en tant qu'invité`,
logIn: 'Se connecter',
haveForgottenPassword: 'Avez-vous oublié votre mot de passe?',
signUp: `S'inscrire`,
notACustomerYet: `Pas encore client?`,
@ -106,6 +133,8 @@ export default {
shoppingCart: 'Panier',
available: 'Disponible',
minQuantity: 'Quantité minimum',
introduceSearchTerm: 'Entrez un terme de recherche',
noOrdersFound: 'Aucune commande trouvée',
// Image related translations
'Cant lock cache': "Le cache n'a pas pu être verrouillé",
'Bad file format': 'Format de fichier non reconnu',

View File

@ -50,6 +50,7 @@ export default {
},
of: 'de',
// Sections titles
titles: {
Home: 'Início',
Orders: 'Pedidos',
Ticket: 'Detalhe do pedido',
@ -67,7 +68,7 @@ export default {
Photos: 'Imagens',
Images: 'Imagens',
Items: 'Artigos',
Agencies: 'Agências',
Agencies: 'Bultos por agencia',
Reports: 'Informes',
Configuration: 'Configuração',
Shelves: 'Estantes',
@ -77,7 +78,31 @@ export default {
Checkout: 'Configurar encomenda',
'Address details': 'Configuração',
'Admin news details': 'Adicionar ou editar notícia',
'Access log': 'Registo de acessos',
'Access log': 'Registo de acessos'
},
menuTitles: {
Home: 'Início',
Orders: 'Pedidos',
Basket: 'Carrinho',
Catalog: 'Catálogo',
Administration: 'Administração',
Agencies: 'Agências',
Reports: 'Informes',
Shelves: 'Estantes',
Configuration: 'Configuração',
'Pending orders': 'Pendentes',
'Last orders': 'Confirmados',
Invoices: 'Faturas',
'Control panel': 'Painel de controle',
Users: 'Usuários',
Connections: 'Conexões',
Visits: 'Visitas',
News: 'Notícias',
Photos: 'Imagens',
Items: 'Artigos',
Account: 'Conta',
Addresses: 'Moradas'
},
//
orderLoadedIntoBasket: 'Pedido carregado na cesta!',
loadAnOrder: 'Carregue um pedido pendente no carrinho ou inicie um novo',
@ -92,6 +117,7 @@ export default {
confirmDelete: 'Tens certeza que queres eliminar esta linha?',
emptyList: 'Lista vazia',
logInAsGuest: 'Entrar como convidado',
logIn: 'Iniciar sessão',
haveForgottenPassword: 'Esqueceu a senha?',
signUp: 'Registar',
notACustomerYet: 'Ainda não é cliente?',
@ -104,6 +130,8 @@ export default {
shoppingCart: 'Cesta da compra',
available: 'Disponível',
minQuantity: 'Quantidade mínima',
introduceSearchTerm: 'Digite um termo de pesquisa',
noOrdersFound: 'Nenhum pedido encontrado',
// Image related translations
'Cant lock cache': 'O cache não pôde ser bloqueado',
'Bad file format': 'Formato de arquivo inválido',

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from 'vue';
import { ref, onMounted, computed } from 'vue';
import { storeToRefs } from 'pinia';
import { useRouter } from 'vue-router';
@ -10,13 +10,19 @@ import { useAppStore } from 'stores/app';
const router = useRouter();
const userStore = useUserStore();
const appStore = useAppStore();
const hiddenMenuItems = new Set(['Reports']);
const refreshContentKey = ref(0);
const { user, supplantedUser } = storeToRefs(userStore);
const { menuEssentialLinks, title, subtitle, useRightDrawer, rightDrawerOpen } =
storeToRefs(appStore);
const actions = ref(null);
const leftDrawerOpen = ref(false);
const filteredMenuItems = computed(() =>
menuEssentialLinks.value.filter(
item => !hiddenMenuItems.has(item.description)
)
);
const toggleLeftDrawer = () => {
leftDrawerOpen.value = !leftDrawerOpen.value;
};
@ -35,6 +41,7 @@ const logout = async () => {
const logoutSupplantedUser = async () => {
await userStore.logoutSupplantedUser();
await appStore.getMenuLinks();
refreshContentKey.value++;
};
</script>
@ -90,15 +97,17 @@ const logoutSupplantedUser = async () => {
/>
</div>
</div>
<QList v-for="item in menuEssentialLinks" :key="item.id">
<QList v-for="item in filteredMenuItems" :key="item.id">
<QItem v-if="!item.childs" :to="`/${item.path}`">
<QItemSection>
<QItemLabel>{{ $t(item.description) }}</QItemLabel>
<QItemLabel>{{
$t(`menuTitles.${item.description}`)
}}</QItemLabel>
</QItemSection>
</QItem>
<QExpansionItem
v-if="item.childs"
:label="$t(item.description)"
:label="$t(`menuTitles.${item.description}`)"
expand-separator
>
<QList>
@ -110,7 +119,9 @@ const logoutSupplantedUser = async () => {
>
<QItemSection>
<QItemLabel>
{{ $t(subitem.description) }}
{{
$t(`menuTitles.${subitem.description}`)
}}
</QItemLabel>
</QItemSection>
</QItem>
@ -118,7 +129,7 @@ const logoutSupplantedUser = async () => {
</QExpansionItem>
</QList>
</QDrawer>
<QPageContainer>
<QPageContainer :key="refreshContentKey">
<router-view />
</QPageContainer>
</QLayout>

View File

@ -53,6 +53,10 @@ const updateUserNickname = async nickname => {
}
};
const formatMailData = data => {
data.isToBeMailed = Boolean(data.isToBeMailed);
};
onMounted(() => fetchLanguagesSql());
</script>
@ -116,18 +120,20 @@ onMounted(() => fetchLanguagesSql());
</template>
<template #extraForm>
<VnForm
class="no-form-container"
class="no-form-container q-mt-md"
ref="vnFormRef2"
:pks="pks"
table="myClient"
schema="hedera"
:fetch-form-data-sql="fetchConfigDataSql"
:default-actions="false"
@on-data-fetched="$event => formatMailData($event)"
>
<template #form="{ data }">
<QCheckbox
v-model="data.isToBeMailed"
:label="t('isToBeMailed')"
:toggle-indeterminate="false"
@update:model-value="vnFormRef2.submit()"
dense
/>

View File

@ -90,20 +90,12 @@ onMounted(() => getCountries());
@on-data-saved="goBack()"
>
<template #form="{ data }">
<VnInput
v-model="data.nickname"
:label="t('name')"
/>
<VnInput
v-model="data.street"
:label="t('address')"
/>
<VnInput
v-model="data.city"
:label="t('city')"
/>
<VnInput v-model="data.nickname" :label="t('name')" />
<VnInput v-model="data.street" :label="t('address')" />
<VnInput v-model="data.city" :label="t('city')" />
<VnInput
v-model="data.postalCode"
type="number"
:label="t('postalCode')"
/>
<VnSelect

View File

@ -4,6 +4,7 @@ import { ref, onMounted, inject } from 'vue';
import { useRouter } from 'vue-router';
import CardList from 'src/components/ui/CardList.vue';
import VnList from 'src/components/ui/VnList.vue';
import useNotify from 'src/composables/useNotify.js';
import { useVnConfirm } from 'src/composables/useVnConfirm.js';
@ -104,7 +105,11 @@ onMounted(async () => {
</QBtn>
</Teleport>
<QPage class="vn-w-sm">
<QList class="rounded-borders shadow-1 shadow-transition" separator>
<VnList
class="rounded-borders shadow-1 shadow-transition"
separator
:rows="addresses"
>
<CardList
v-for="(address, index) in addresses"
:key="index"
@ -158,7 +163,7 @@ onMounted(async () => {
</QBtn>
</template>
</CardList>
</QList>
</VnList>
</QPage>
</template>

View File

@ -3,6 +3,7 @@ import { onMounted, inject, ref } from 'vue';
import { useRoute } from 'vue-router';
import CardList from 'src/components/ui/CardList.vue';
import VnList from 'src/components/ui/VnList.vue';
import { formatDateTitle } from 'src/lib/filters.js';
@ -72,7 +73,7 @@ onMounted(async () => {
<span>{{ user?.phone }} </span>
</template>
</CardList>
<QList>
<VnList :rows="accessLogs">
<CardList
v-for="(accessLog, index) in accessLogs"
:key="index"
@ -101,6 +102,6 @@ onMounted(async () => {
</span>
</template>
</CardList>
</QList>
</VnList>
</QPage>
</template>

View File

@ -4,6 +4,7 @@ import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnList from 'src/components/ui/VnList.vue';
import { date as qdate } from 'quasar';
import { useUserStore } from 'stores/user';
@ -80,15 +81,12 @@ onBeforeUnmount(() => clearInterval(intervalId.value));
</div>
</Teleport>
<QPage class="vn-w-xs">
<QList class="flex justify-center">
<QSpinner
v-if="loading"
color="primary"
size="3em"
:thickness="2"
/>
<VnList
class="flex justify-center"
:loading="loading"
:rows="connections"
>
<CardList
v-else
v-for="(connection, index) in connections"
:key="index"
:to="{ name: 'accessLog', params: { id: connection.userId } }"
@ -133,8 +131,7 @@ onBeforeUnmount(() => clearInterval(intervalId.value));
</QBtn>
</template>
</CardList>
<pre>{{ connections }}</pre>
</QList>
</VnList>
</QPage>
</template>

View File

@ -1,15 +1,14 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnImg from 'src/components/ui/VnImg.vue';
import VnSearchBar from 'src/components/ui/VnSearchBar.vue';
import VnList from 'src/components/ui/VnList.vue';
import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia';
const { t } = useI18n();
const appStore = useAppStore();
const { isHeaderMounted } = storeToRefs(appStore);
@ -39,19 +38,14 @@ const onSearch = data => (items.value = data || []);
/>
</Teleport>
<QPage class="vn-w-xs">
<QList class="flex justify-center">
<span v-if="!loading && !items.length" class="flex items-center">
<QIcon name="refresh" size="sm" class="q-mr-sm" />
{{ t('introduceSearchTerm') }}
</span>
<QSpinner
v-if="loading"
color="primary"
size="3em"
:thickness="2"
/>
<VnList
class="flex justify-center"
empty-message="introduceSearchTerm"
empty-icon="refresh"
:loading="loading"
:rows="items"
>
<CardList
v-else
v-for="(item, index) in items"
:key="index"
:clickable="false"
@ -82,19 +76,6 @@ const onSearch = data => (items.value = data || []);
<span>{{ item.image }}</span>
</template>
</CardList>
</QList>
</VnList>
</QPage>
</template>
<i18n lang="yaml">
en-US:
introduceSearchTerm: Enter a search term
es-ES:
introduceSearchTerm: Introduce un término de búsqueda
ca-ES:
introduceSearchTerm: Introdueix un terme de cerca
fr-FR:
introduceSearchTerm: Entrez un terme de recherche
pt-PT:
introduceSearchTerm: Digite um termo de pesquisa
</i18n>

View File

@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnImg from 'src/components/ui/VnImg.vue';
import VnList from 'src/components/ui/VnList.vue';
import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia';
@ -22,12 +23,14 @@ const news = ref([]);
const getNews = async () => {
try {
loading.value = true;
news.value = await jApi.query(
`SELECT n.id, u.nickname, n.priority, n.image, n.title
FROM news n
JOIN account.user u ON u.id = n.userFk
ORDER BY priority, n.created DESC`
);
loading.value = false;
} catch (error) {
console.error('Error getting news:', error);
}
@ -66,15 +69,8 @@ onMounted(async () => getNews());
</QBtn>
</Teleport>
<QPage class="vn-w-sm">
<QList class="flex justify-center">
<QSpinner
v-if="loading"
color="primary"
size="3em"
:thickness="2"
/>
<VnList class="flex justify-center" :loading="loading" :rows="news">
<CardList
v-else
v-for="(newsItem, index) in news"
:key="index"
:to="{ name: 'adminNewsDetails', params: { id: newsItem.id } }"
@ -115,7 +111,7 @@ onMounted(async () => getNews());
</QBtn>
</template>
</CardList>
</QList>
</VnList>
</QPage>
</template>

View File

@ -5,6 +5,7 @@ import { useRouter } from 'vue-router';
import CardList from 'src/components/ui/CardList.vue';
import VnSearchBar from 'src/components/ui/VnSearchBar.vue';
import VnList from 'src/components/ui/VnList.vue';
import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia';
@ -49,19 +50,14 @@ const supplantUser = async user => {
/>
</Teleport>
<QPage class="vn-w-xs">
<QList class="flex justify-center">
<span v-if="!loading && !users.length" class="flex items-center">
<QIcon name="refresh" size="sm" class="q-mr-sm" />
{{ t('noData') }}
</span>
<QSpinner
v-if="loading"
color="primary"
size="3em"
:thickness="2"
/>
<VnList
class="flex justify-center"
empty-message="noData"
empty-icon="refresh"
:loading="loading"
:rows="users"
>
<CardList
v-else
v-for="(user, index) in users"
:key="index"
:to="{ name: 'accessLog', params: { id: user.id } }"
@ -87,7 +83,7 @@ const supplantUser = async user => {
<QBadge v-else color="negative">{{ t('Disabled') }}</QBadge>
</template>
</CardList>
</QList>
</VnList>
</QPage>
</template>

View File

@ -1,6 +1,6 @@
<template>
<Teleport v-if="isHeaderMounted" to="#actions">
<div class="q-gutter-x-sm row">
<div class="row">
<VnSearchBar :search-term="search" @on-search-error="items = []" />
<QBtn
:icon="viewTypeButtonContent.icon"
@ -24,6 +24,15 @@
{{ t('shoppingCart') }}
</QTooltip>
</QBtn>
<QBtn
v-if="!isDesktop"
flat
dense
round
icon="menu"
aria-label="Menu"
@click="toggleRightDrawer()"
/>
</div>
</Teleport>
<div style="padding-bottom: 5em">
@ -290,7 +299,7 @@ const appStore = useAppStore();
const userStore = useUserStore();
const route = useRoute();
const router = useRouter();
const { isHeaderMounted, rightDrawerOpen, basketOrderId } =
const { isHeaderMounted, rightDrawerOpen, basketOrderId, isDesktop } =
storeToRefs(appStore);
const { isGuest } = storeToRefs(userStore);
const { notify } = useNotify();
@ -915,6 +924,10 @@ const redirectToBasket = () => {
router.push({ name: 'basket' });
};
const toggleRightDrawer = () => {
rightDrawerOpen.value = !rightDrawerOpen.value;
};
watch(
() => route.query.search,
val => {

View File

@ -16,10 +16,11 @@ const route = useRoute();
const router = useRouter();
const { notify } = useNotify();
const appStore = useAppStore();
const { localeDates } = storeToRefs(appStore);
const { localeDates, isMobile } = storeToRefs(appStore);
const stepperRef = ref(null);
const showNavigationButtons = ref(true);
const loading = ref(false);
const today = ref(null);
const addresses = ref([]);
@ -210,6 +211,13 @@ const getWarehouses = async () => {
}
};
const hideNavigationButtons = () => {
showNavigationButtons.value = false;
setTimeout(() => {
showNavigationButtons.value = true;
}, 350);
};
const onNextStep = async stepIndex => {
const currentStep = steps[orderForm.value.method][stepIndex];
if (currentStep.onBeforeNextStep) {
@ -220,6 +228,8 @@ const onNextStep = async stepIndex => {
return;
}
hideNavigationButtons();
currentStep.stepDone = true;
await stepperRef.value.next();
@ -230,6 +240,7 @@ const onNextStep = async stepIndex => {
};
const onPreviousStep = async stepIndex => {
hideNavigationButtons();
await stepperRef.value.previous();
const previousStep = steps[orderForm.value.method][stepIndex - 1];
@ -301,15 +312,16 @@ onMounted(async () => {
</script>
<template>
<QPage class="vn-w-sm">
<QPage class="page-container">
<QStepper
v-if="steps[orderForm.method] && steps[orderForm.method].length"
v-model="currentStep"
ref="stepperRef"
animated
keep-alive
:flat="isMobile"
contracted
class="default-radius"
class="default-radius stepper-container"
>
<QStep
v-for="(step, stepIndex) in steps[orderForm.method]"
@ -317,6 +329,7 @@ onMounted(async () => {
:name="step.name"
:done="step.stepDone"
done-color="accent"
class="step-container full-height"
>
<!-- Method step -->
<div
@ -436,33 +449,88 @@ onMounted(async () => {
<span>{{ confirmPlaceText }}</span>
</div>
</div>
<QStepperNavigation class="flex justify-between">
<QBtn
flat
v-if="showNavigationButtons"
color="primary"
@click="onPreviousStep(stepIndex)"
:label="step.backButtonLabel || t('back')"
class="q-ml-sm"
:class="{ invisible: currentStep === 'method' }"
/>
:disabled="currentStep === 'method'"
icon="arrow_back"
dense
class="left-navigation-button"
>
<QTooltip>
{{ t(`${step.backButtonLabel || 'back'}`) }}
</QTooltip>
</QBtn>
<QBtn
v-if="showNavigationButtons"
@click="onNextStep(stepIndex)"
color="primary"
:label="step.nextButtonLabel || t('next')"
/>
</QStepperNavigation>
:color="currentStep === 'confirm' ? 'accent ' : 'primary'"
:icon="
currentStep === 'confirm' ? 'check' : 'arrow_forward'
"
dense
class="right-navigation-button"
>
<QTooltip>
{{ t(`${step.nextButtonLabel || 'next'}`) }}
</QTooltip>
</QBtn>
</QStep>
</QStepper>
</QPage>
</template>
<style lang="scss" scoped>
<style lang="scss">
@import 'src/css/responsive';
.step-title {
min-width: 100%;
margin-bottom: 16px;
text-align: center;
font-weight: bold;
}
.page-container {
max-width: 544px;
margin: auto;
@include mobile {
max-height: calc(100svh - 64px);
padding: 0 !important;
}
}
.stepper-container > * {
@include mobile {
max-height: calc(100svh - 136px);
}
}
.step-container {
@include mobile {
.q-stepper__step-content {
height: calc(100svh - 64px);
}
}
}
.left-navigation-button {
position: absolute;
left: 5px;
top: 50%;
@include mobile {
top: 35%;
}
}
.right-navigation-button {
position: absolute;
right: 5px;
top: 50%;
@include mobile {
top: 35%;
}
}
</style>
<i18n lang="yaml">

View File

@ -114,15 +114,9 @@ onMounted(async () => {
{{ t('downloadInvoicePdf') }}
</QTooltip>
</QBtn>
<QIcon
v-else
name="warning"
:title="t('notDownloadable')"
color="warning"
size="sm"
>
<QIcon v-else name="warning" color="warning" size="sm">
<QTooltip>
{{ t('requestTheInvoiceToComercial') }}
{{ t('notDownloadable') }}
</QTooltip>
</QIcon>
</QTd>

View File

@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import VnList from 'src/components/ui/VnList.vue';
import useNotify from 'src/composables/useNotify.js';
import { currency, formatDateTitle } from 'src/lib/filters.js';
@ -90,13 +91,7 @@ const onConfirmPay = async () => {
</QBtn>
</Teleport>
<QPage class="vn-w-sm">
<div
v-if="!orders?.length"
class="text-subtitle1 text-center text-grey-7 q-pa-md"
>
{{ t('noOrdersFound') }}
</div>
<QList v-if="orders?.length">
<VnList empty-message="noOrdersFound" :loading="loading" :rows="orders">
<CardList
v-for="order in orders"
:key="order.id"
@ -115,7 +110,7 @@ const onConfirmPay = async () => {
<QItemLabel>{{ order.agency }}</QItemLabel>
</template>
</CardList>
</QList>
</VnList>
<QPageSticky>
<QBtn
fab
@ -127,7 +122,7 @@ const onConfirmPay = async () => {
</QPageSticky>
<VnConfirm
v-model="showAmountToPayDialog"
:message="t('amountToPay')"
message=" "
:promise="onConfirmPay"
>
<template #customHTML>
@ -138,7 +133,9 @@ const onConfirmPay = async () => {
type="number"
min="0"
:max="debt * -1"
/>
>
<template #append></template>
</VnInput>
</template>
</VnConfirm>
</QPage>
@ -172,7 +169,6 @@ const onConfirmPay = async () => {
<i18n lang="yaml">
en-US:
startOrder: Start order
noOrdersFound: No orders found
makePayment: Make payment
balance: 'Balance:'
paymentInfo: >-
@ -184,7 +180,6 @@ en-US:
amountError: The amount must be a positive number less than or equal to the outstanding amount
es-ES:
startOrder: Empezar pedido
noOrdersFound: No se encontrado pedidos
makePayment: Realizar pago
balance: 'Saldo:'
paymentInfo: >-
@ -197,7 +192,6 @@ es-ES:
amountError: La cantidad debe ser un número positivo e inferior o igual al importe pendiente
ca-ES:
startOrder: Començar encàrrec
noOrdersFound: No s'han trobat comandes
makePayment: Realitzar pagament
balance: 'Saldo:'
paymentInfo: >-
@ -210,7 +204,6 @@ ca-ES:
amountError: La quantitat ha de ser un nombre positiu i inferior o igual a l'import pendent
fr-FR:
startOrder: Acheter
noOrdersFound: Aucune commande trouvée
makePayment: Effectuer un paiement
balance: 'Balance:'
paymentInfo: >-
@ -223,7 +216,6 @@ fr-FR:
amountError: La quantité doit être un neméro positif et inférieur ou égal à la somme restant à payer
pt-PT:
startOrder: Iniciar encomenda
noOrdersFound: Nenhum pedido encontrado
makePayment: Realizar pagamento
balance: 'Saldo:'
paymentInfo: >-

View File

@ -4,6 +4,8 @@ import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import CardList from 'src/components/ui/CardList.vue';
import VnList from 'src/components/ui/VnList.vue';
import { currency, formatDateTitle } from 'src/lib/filters.js';
import { useVnConfirm } from 'src/composables/useVnConfirm.js';
import useNotify from 'src/composables/useNotify.js';
@ -18,10 +20,12 @@ const appStore = useAppStore();
const { isHeaderMounted } = storeToRefs(appStore);
const router = useRouter();
const loading = ref(false);
const orders = ref([]);
const getOrders = async () => {
try {
loading.value = true;
orders.value = await jApi.query(
`SELECT o.id, o.sent, o.deliveryMethodFk, o.taxableBase,
a.nickname, am.description agency
@ -31,6 +35,7 @@ const getOrders = async () => {
WHERE NOT o.isConfirmed
ORDER BY o.sent DESC`
);
loading.value = false;
} catch (error) {
console.error('Error getting orders:', error);
}
@ -78,6 +83,7 @@ onMounted(async () => {
</QBtn>
</Teleport>
<QPage class="vn-w-sm">
<VnList :rows="orders" :loading="loading">
<CardList
v-for="(order, index) in orders"
:key="index"
@ -117,6 +123,7 @@ onMounted(async () => {
</QBtn>
</template>
</CardList>
</VnList>
</QPage>
</template>

View File

@ -63,9 +63,7 @@ const loginAsGuest = async () => {
<template>
<div class="main">
<div class="header">
<router-link to="/" class="block">
<img src="statics/logo.svg" alt="Verdnatura" class="block" />
</router-link>
</div>
<QForm @submit="login()" class="q-gutter-y-md">
<div class="q-gutter-y-sm">

View File

@ -41,7 +41,9 @@ export default route(function (/* { store, ssrContext } */) {
if (from.name === to.name) return;
const app = useAppStore();
app.$patch({
title: i18n.global.t(to.meta.title || 'home'),
title: i18n.global.t(
to.meta.title ? `titles.${to.meta.title}` : 'titles.Home'
),
subtitle: null,
useRightDrawer: false,
rightDrawerOpen: true

View File

@ -68,6 +68,7 @@ export const useAppStore = defineStore('hedera', {
},
async init() {
// this.router.push({ name: 'login' });
this.getBasketOrderId();
this.getLocaleDates();
},
@ -150,6 +151,14 @@ export const useAppStore = defineStore('hedera', {
isMobile() {
const $q = useQuasar();
return $q?.screen?.width <= 768;
},
isTablet() {
const $q = useQuasar();
return $q?.screen?.width <= 1024;
},
isDesktop() {
const $q = useQuasar();
return $q?.screen?.width > 1024;
}
}
});

View File

@ -37,6 +37,10 @@ export const useUserStore = defineStore('user', {
actions: {
async init() {
this.isGuest = localStorage.getItem('hederaGuest') || false;
const autoLoginStatus = await this.tryAutoLogin();
if (!autoLoginStatus) {
this.router.push({ name: 'login' });
}
await this.fetchUser();
await this.supplantInit();
this.updateSiteLocale();
@ -48,6 +52,21 @@ export const useUserStore = defineStore('user', {
localStorage.getItem('vnToken');
},
async tryAutoLogin() {
const guest = localStorage.getItem('hederaGuest');
if (this.isGuest || guest) {
localStorage.setItem('hederaGuest', true);
return true;
}
if (!this.token) this.getToken();
if (this.token) return true;
return false;
},
async login(user, password, remember) {
const params = { user, password };
const res = await api.post('Accounts/login', params);