Merge pull request 'Remove unused things' (!152) from wbuezas/hedera-web-mindshore:feature/remove-unused-things into beta
gitea/hedera-web/pipeline/head There was a failure building this commit Details

Reviewed-on: #152
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
Javier Segarra 2025-04-23 18:28:29 +00:00
commit aa66c086f2
5 changed files with 32 additions and 221 deletions

View File

@ -1,107 +0,0 @@
<script setup>
import { onMounted, ref, inject } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
searchFn: {
type: Function,
default: null
},
placeholder: {
type: String,
default: ''
},
sqlQuery: {
type: String,
default: null
},
searchField: {
type: String,
default: 'search'
}
});
const emit = defineEmits(['onSearch', 'onSearchError']);
const jApi = inject('jApi');
const { t } = useI18n();
const router = useRouter();
const route = useRoute();
const searchTerm = ref('');
const search = async () => {
try {
let data = null;
router.replace({
query: searchTerm.value ? { search: searchTerm.value } : {}
});
if (!searchTerm.value) {
emit('onSearchError');
return;
}
if (props.sqlQuery) {
data = await jApi.query(props.sqlQuery, {
[props.searchField]: searchTerm.value
});
} else if (props.searchFn) {
data = props.searchFn(searchTerm.value);
}
emit('onSearch', data);
} catch (error) {
console.error('Error searching:', error);
emit('onSearchError');
}
};
onMounted(() => {
if (route.query.search) {
searchTerm.value = route.query.search;
search();
}
});
</script>
<template>
<VnInput
v-model="searchTerm"
@keyup.enter="search()"
:placeholder="props.placeholder || t('search')"
bg-color="white"
is-outlined
:clearable="false"
class="searchbar"
data-cy="searchBar"
>
<template #prepend>
<QIcon name="search" class="cursor-pointer" @click="search()" />
</template>
</VnInput>
</template>
<style lang="scss" scoped>
@import 'src/css/responsive';
.searchbar {
@include mobile {
max-width: 120px;
}
}
</style>
<i18n lang="yaml">
en-US:
search: Search
es-ES:
search: Buscar
ca-ES:
search: Cercar
fr-FR:
search: Rechercher
pt-PT:
search: Pesquisar
</i18n>

View File

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import VnImg from 'src/components/ui/VnImg.vue';
import VnForm from 'src/components/common/VnForm.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'src/components/common/FormModel.vue';

View File

@ -1,78 +0,0 @@
<template>
<div style="padding: 0">
<div class="q-pa-sm row items-start">
<div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
<QCard>
<QImg :src="`${$app.imageUrl}/news/full/${myNew.image}`">
</QImg>
<QCardSection>
<div class="text-h5">{{ myNew.title }}</div>
</QCardSection>
<QCardSection class="new-body">
<div v-html="myNew.text" />
</QCardSection>
</QCard>
</div>
</div>
<QPageSticky>
<QBtn
fab
icon="add_shopping_cart"
color="accent"
to="/ecomerce/catalog"
>
<QTooltip>{{ $t('startOrder') }}</QTooltip></QBtn
>
</QPageSticky>
</div>
</template>
<style lang="scss" scoped>
.new-card {
width: 100%;
@media screen and (min-width: 800px) and (max-width: 1400px) {
width: 50%;
}
@media screen and (min-width: 1401px) and (max-width: 1920px) {
width: 33.33%;
}
@media screen and (min-width: 19021) {
width: 25%;
}
}
.new-body {
font-family: 'Open Sans';
}
</style>
<script>
export default {
name: 'PageIndex',
data() {
return {
news: []
};
},
async mounted() {
this.news = await this.$jApi.query(
`SELECT title, text, image, id
FROM news
ORDER BY priority, created DESC`
);
}
};
</script>
<i18n lang="yaml">
en-US:
startOrder: Start order
es-ES:
startOrder: Empezar pedido
ca-ES:
startOrder: Començar comanda
fr-FR:
startOrder: Lancer une commande
pt-PT:
startOrder: Comece uma encomenda
</i18n>

View File

@ -1,15 +1,14 @@
<script setup>
import { ref, onMounted, inject } from 'vue';
const jApi = inject('jApi');
const api = inject('api');
const news = ref([]);
const showPreview = ref(false);
const selectedImageSrc = ref('');
const fetchData = async () => {
const newsResponse = await api.get('News');
const newsResponse = await api.get('News');
news.value = newsResponse.data;
news.value = newsResponse.data;
};
const showImagePreview = src => {

View File

@ -13,7 +13,6 @@ import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia';
import { onUserId } from 'src/utils/onUserId';
const jApi = inject('jApi');
const api = inject('api');
const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
@ -25,44 +24,44 @@ const router = useRouter();
const loading = ref(false);
const orders = ref([]);
const getOrders = async (clientFk) => {
const getOrders = async clientFk => {
try {
loading.value = true;
const filter = {
where: {
clientFk,
isConfirmed: false,
source_app: 'WEB',
},
include: [
{
relation: 'address',
scope: {
fields: ['nickname', 'city'],
}
where: {
clientFk,
isConfirmed: false,
source_app: 'WEB'
},
{
relation: 'agencyMode',
scope: {
fields: ['description'],
}
},
],
fields: [
'id',
'landed',
'delivery_method_id',
'taxableBase',
'addressFk',
'agencyModeFk'
]
include: [
{
relation: 'address',
scope: {
fields: ['nickname', 'city']
}
},
{
relation: 'agencyMode',
scope: {
fields: ['description']
}
}
],
fields: [
'id',
'landed',
'delivery_method_id',
'taxableBase',
'addressFk',
'agencyModeFk'
]
};
const { data: salixOrders } = await api.get('Orders', {
params: {
filter: JSON.stringify(filter)
}
params: {
filter: JSON.stringify(filter)
}
});
orders.value = salixOrders;
@ -89,7 +88,6 @@ const loadOrder = orderId => {
};
onUserId(getOrders);
</script>
<template>