Remove unused things
This commit is contained in:
parent
9c0ec3e29d
commit
9423bcb211
|
@ -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>
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, inject } from 'vue';
|
import { ref, onMounted, inject } from 'vue';
|
||||||
const jApi = inject('jApi');
|
|
||||||
const api = inject('api');
|
const api = inject('api');
|
||||||
const news = ref([]);
|
const news = ref([]);
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { useAppStore } from 'stores/app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { onUserId } from 'src/utils/onUserId';
|
import { onUserId } from 'src/utils/onUserId';
|
||||||
|
|
||||||
const jApi = inject('jApi');
|
|
||||||
const api = inject('api');
|
const api = inject('api');
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
@ -25,7 +24,7 @@ const router = useRouter();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orders = ref([]);
|
const orders = ref([]);
|
||||||
|
|
||||||
const getOrders = async (clientFk) => {
|
const getOrders = async clientFk => {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
|
|
||||||
|
@ -33,21 +32,21 @@ const getOrders = async (clientFk) => {
|
||||||
where: {
|
where: {
|
||||||
clientFk,
|
clientFk,
|
||||||
isConfirmed: false,
|
isConfirmed: false,
|
||||||
source_app: 'WEB',
|
source_app: 'WEB'
|
||||||
},
|
},
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'address',
|
relation: 'address',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['nickname', 'city'],
|
fields: ['nickname', 'city']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
relation: 'agencyMode',
|
relation: 'agencyMode',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['description'],
|
fields: ['description']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
],
|
],
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
|
@ -89,7 +88,6 @@ const loadOrder = orderId => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onUserId(getOrders);
|
onUserId(getOrders);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue