Merge branch 'beta' into feature/connections-view
This commit is contained in:
commit
8690f89e4d
|
@ -1,2 +1,5 @@
|
||||||
debian
|
debian
|
||||||
node_modules
|
node_modules
|
||||||
|
.quasar
|
||||||
|
build
|
||||||
|
.vscode
|
||||||
|
|
12523
pnpm-lock.yaml
12523
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,7 @@ const props = defineProps({
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
filter: {
|
filter: {
|
||||||
type: String,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
searchField: {
|
searchField: {
|
||||||
|
@ -64,7 +64,6 @@ const search = async () => {
|
||||||
params,
|
params,
|
||||||
exprBuilder: props.exprBuilder
|
exprBuilder: props.exprBuilder
|
||||||
});
|
});
|
||||||
|
|
||||||
emit('onSearch', data);
|
emit('onSearch', data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -83,7 +82,7 @@ onMounted(() => {
|
||||||
<template>
|
<template>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="searchTerm"
|
v-model="searchTerm"
|
||||||
@keyup.enter="search()"
|
@keyup.enter.stop="search()"
|
||||||
:placeholder="props.placeholder || t('search')"
|
:placeholder="props.placeholder || t('search')"
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
|
|
@ -3,28 +3,46 @@ import { ref } from 'vue';
|
||||||
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
import CardList from 'src/components/ui/CardList.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.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 VnList from 'src/components/ui/VnList.vue';
|
||||||
|
import VnSearchBar from 'src/components/ui/NewVnSearchBar.vue';
|
||||||
|
|
||||||
import { useAppStore } from 'stores/app';
|
import { useAppStore } from 'stores/app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const { isHeaderMounted } = storeToRefs(appStore);
|
const { isHeaderMounted } = storeToRefs(appStore);
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
|
const itemFilterProps = {
|
||||||
const query = `SELECT i.id, i.longName, i.size, i.category,
|
include: [
|
||||||
i.value5, i.value6, i.value7,
|
{
|
||||||
i.image, im.updated
|
relation: 'itemType',
|
||||||
FROM vn.item i
|
scope: {
|
||||||
LEFT JOIN image im
|
fields: ['id', 'name']
|
||||||
ON im.collectionFk = 'catalog'
|
}
|
||||||
AND im.name = i.image
|
},
|
||||||
WHERE (i.longName LIKE CONCAT('%', #search, '%')
|
{
|
||||||
OR i.id = #search) AND i.isActive
|
relation: 'intrastat',
|
||||||
ORDER BY i.longName LIMIT 50`;
|
scope: {
|
||||||
|
fields: ['id', 'description']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'origin',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'production',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
isActive: true,
|
||||||
|
order: 'name ASC'
|
||||||
|
};
|
||||||
|
|
||||||
const onSearch = data => (items.value = data || []);
|
const onSearch = data => (items.value = data || []);
|
||||||
</script>
|
</script>
|
||||||
|
@ -32,9 +50,10 @@ const onSearch = data => (items.value = data || []);
|
||||||
<template>
|
<template>
|
||||||
<Teleport v-if="isHeaderMounted" to="#actions">
|
<Teleport v-if="isHeaderMounted" to="#actions">
|
||||||
<VnSearchBar
|
<VnSearchBar
|
||||||
:sql-query="query"
|
url="Items/filter"
|
||||||
@on-search="onSearch"
|
@on-search="onSearch"
|
||||||
@on-search-error="items = []"
|
@on-search-error="items = []"
|
||||||
|
:filter="itemFilterProps"
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<QPage class="vn-w-xs">
|
<QPage class="vn-w-xs">
|
||||||
|
@ -68,7 +87,7 @@ const onSearch = data => (items.value = data || []);
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<span class="text-bold q-mb-sm">
|
<span class="text-bold q-mb-sm">
|
||||||
{{ item.longName }}
|
{{ item.name }}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{{ item.value5 }} {{ item.value6 }}
|
{{ item.value5 }} {{ item.value6 }}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnTable from 'src/components/ui/VnTable.vue';
|
import VnTable from 'src/components/ui/VnTable.vue';
|
||||||
|
|
||||||
const jApi = inject('jApi');
|
const api = inject('api');
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const packages = ref([]);
|
const packages = ref([]);
|
||||||
|
@ -43,7 +43,12 @@ const columns = computed(() => [
|
||||||
|
|
||||||
const getPackages = async () => {
|
const getPackages = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await jApi.query('CALL vn.agencyVolume()');
|
const { data } = await api.post(
|
||||||
|
'applications/agencyVolume/execute-proc',
|
||||||
|
{
|
||||||
|
schema: 'vn'
|
||||||
|
}
|
||||||
|
);
|
||||||
packages.value = data;
|
packages.value = data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, inject, onMounted } from 'vue';
|
import { ref, inject } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -11,8 +11,10 @@ import { useVnConfirm } from 'src/composables/useVnConfirm.js';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useAppStore } from 'stores/app';
|
import { useAppStore } from 'stores/app';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { onUserId } from 'src/utils/onUserId';
|
||||||
|
|
||||||
const jApi = inject('jApi');
|
const jApi = inject('jApi');
|
||||||
|
const api = inject('api');
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
@ -23,18 +25,48 @@ const router = useRouter();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orders = ref([]);
|
const orders = ref([]);
|
||||||
|
|
||||||
const getOrders = async () => {
|
const getOrders = async (clientFk) => {
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
orders.value = await jApi.query(
|
|
||||||
`SELECT o.id, o.sent, o.deliveryMethodFk, o.taxableBase,
|
const filter = {
|
||||||
a.nickname, am.description agency
|
where: {
|
||||||
FROM myOrder o
|
clientFk,
|
||||||
JOIN myAddress a ON a.id = o.addressFk
|
isConfirmed: false,
|
||||||
JOIN vn.agencyMode am ON am.id = o.agencyModeFk
|
source_app: 'WEB',
|
||||||
WHERE NOT o.isConfirmed
|
},
|
||||||
ORDER BY o.sent DESC`
|
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)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
orders.value = salixOrders;
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting orders:', error);
|
console.error('Error getting orders:', error);
|
||||||
|
@ -43,14 +75,7 @@ const getOrders = async () => {
|
||||||
|
|
||||||
const removeOrder = async (id, index) => {
|
const removeOrder = async (id, index) => {
|
||||||
try {
|
try {
|
||||||
await jApi.execQuery(
|
await api.delete(`Orders/${id}`);
|
||||||
`START TRANSACTION;
|
|
||||||
DELETE FROM hedera.myOrder WHERE ((id = #id));
|
|
||||||
COMMIT`,
|
|
||||||
{
|
|
||||||
id
|
|
||||||
}
|
|
||||||
);
|
|
||||||
orders.value.splice(index, 1);
|
orders.value.splice(index, 1);
|
||||||
notify(t('dataSaved'), 'positive');
|
notify(t('dataSaved'), 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -63,9 +88,8 @@ const loadOrder = orderId => {
|
||||||
router.push({ name: 'catalog' });
|
router.push({ name: 'catalog' });
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onUserId(getOrders);
|
||||||
getOrders();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -93,11 +117,11 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
<QItemLabel class="text-bold q-mb-sm">
|
<QItemLabel class="text-bold q-mb-sm">
|
||||||
{{ formatDateTitle(order.sent) }}
|
{{ formatDateTitle(order.landed) }}
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
<QItemLabel> #{{ order.id }} </QItemLabel>
|
<QItemLabel> #{{ order.id }} </QItemLabel>
|
||||||
<QItemLabel>{{ order.nickname }}</QItemLabel>
|
<QItemLabel>{{ order.address.nickname }}</QItemLabel>
|
||||||
<QItemLabel>{{ order.agency }}</QItemLabel>
|
<QItemLabel>{{ order.agencyMode.description }}</QItemLabel>
|
||||||
<QItemLabel>{{ currency(order.taxableBase) }}</QItemLabel>
|
<QItemLabel>{{ currency(order.taxableBase) }}</QItemLabel>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
import { useUserStore } from 'stores/user';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
export const onUserId = (cb) => watch(
|
||||||
|
() => userStore?.user?.id,
|
||||||
|
async userId => {
|
||||||
|
if (!userId) return;
|
||||||
|
try {
|
||||||
|
await cb(userId);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
Loading…
Reference in New Issue