refactor: use Salix for the pending orders
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
This commit is contained in:
parent
30dca813b6
commit
0f0717f382
|
@ -1,2 +1,5 @@
|
|||
debian
|
||||
node_modules
|
||||
node_modules
|
||||
.quasar
|
||||
build
|
||||
.vscode
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
// Configuration for your app
|
||||
// https://v2.quasar.dev/quasar-cli-webpack/quasar-config-js
|
||||
|
||||
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
const { configure } = require('quasar/wrappers');
|
||||
|
@ -68,11 +67,7 @@ module.exports = configure(function (ctx) {
|
|||
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
|
||||
|
||||
chainWebpack(chain) {
|
||||
chain
|
||||
.plugin('eslint-webpack-plugin')
|
||||
.use(ESLintPlugin, [{ extensions: ['js', 'vue'] }]);
|
||||
chain.resolve.alias
|
||||
.set('@', path.resolve(__dirname, 'src'));
|
||||
chain.resolve.alias.set('@', path.resolve(__dirname, 'src'));
|
||||
chain.module
|
||||
.rule('i18n-resource')
|
||||
.test(/\.(json5?|ya?ml)$/)
|
||||
|
@ -96,7 +91,7 @@ module.exports = configure(function (ctx) {
|
|||
type: 'http'
|
||||
},
|
||||
port: 8080,
|
||||
open: false,
|
||||
open: true,
|
||||
// static: __dirname,
|
||||
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||
// stats: { chunks: false },
|
||||
|
@ -144,12 +139,6 @@ module.exports = configure(function (ctx) {
|
|||
maxAge: 1000 * 60 * 60 * 24 * 30,
|
||||
// Tell browser when a file from the server should expire from cache (in ms)
|
||||
|
||||
chainWebpackWebserver(chain) {
|
||||
chain
|
||||
.plugin('eslint-webpack-plugin')
|
||||
.use(ESLintPlugin, [{ extensions: ['js'] }]);
|
||||
},
|
||||
|
||||
middlewares: [
|
||||
ctx.prod ? 'compression' : '',
|
||||
'render' // keep this as last one
|
||||
|
@ -164,11 +153,7 @@ module.exports = configure(function (ctx) {
|
|||
// for the custom service worker ONLY (/src-pwa/custom-service-worker.[js|ts])
|
||||
// if using workbox in InjectManifest mode
|
||||
|
||||
chainWebpackCustomSW(chain) {
|
||||
chain
|
||||
.plugin('eslint-webpack-plugin')
|
||||
.use(ESLintPlugin, [{ extensions: ['js'] }]);
|
||||
},
|
||||
chainWebpackCustomSW(chain) {},
|
||||
|
||||
manifest: {
|
||||
name: 'Hedera',
|
||||
|
@ -237,21 +222,9 @@ module.exports = configure(function (ctx) {
|
|||
// https://www.electron.build/configuration/configuration
|
||||
|
||||
appId: 'hedera-web'
|
||||
},
|
||||
}
|
||||
|
||||
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
|
||||
|
||||
chainWebpackMain(chain) {
|
||||
chain
|
||||
.plugin('eslint-webpack-plugin')
|
||||
.use(ESLintPlugin, [{ extensions: ['js'] }]);
|
||||
},
|
||||
|
||||
chainWebpackPreload(chain) {
|
||||
chain
|
||||
.plugin('eslint-webpack-plugin')
|
||||
.use(ESLintPlugin, [{ extensions: ['js'] }]);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, inject, onMounted } from 'vue';
|
||||
import { ref, inject, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
|
@ -10,13 +10,16 @@ import { currency, formatDateTitle } from 'src/lib/filters.js';
|
|||
import { useVnConfirm } from 'src/composables/useVnConfirm.js';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useAppStore } from 'stores/app';
|
||||
import { useUserStore } from 'stores/user';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
const jApi = inject('jApi');
|
||||
const api = inject('api');
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
const appStore = useAppStore();
|
||||
const userStore = useUserStore();
|
||||
const { isHeaderMounted } = storeToRefs(appStore);
|
||||
const router = useRouter();
|
||||
|
||||
|
@ -26,15 +29,48 @@ 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
|
||||
FROM myOrder o
|
||||
JOIN myAddress a ON a.id = o.addressFk
|
||||
JOIN vn.agencyMode am ON am.id = o.agencyModeFk
|
||||
WHERE NOT o.isConfirmed
|
||||
ORDER BY o.sent DESC`
|
||||
);
|
||||
|
||||
const clientFk = userStore?.user?.id;
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
clientFk,
|
||||
'address.clientFk': clientFk,
|
||||
isConfirmed: 0,
|
||||
source_app: 'WEB',
|
||||
},
|
||||
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;
|
||||
} catch (error) {
|
||||
console.error('Error getting orders:', error);
|
||||
|
@ -63,9 +99,16 @@ const loadOrder = orderId => {
|
|||
router.push({ name: 'catalog' });
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
getOrders();
|
||||
});
|
||||
watch(
|
||||
() => userStore?.user?.id,
|
||||
async userId => {
|
||||
if (userId) {
|
||||
getOrders();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -93,11 +136,11 @@ onMounted(async () => {
|
|||
>
|
||||
<template #content>
|
||||
<QItemLabel class="text-bold q-mb-sm">
|
||||
{{ formatDateTitle(order.sent) }}
|
||||
{{ formatDateTitle(order.landed) }}
|
||||
</QItemLabel>
|
||||
<QItemLabel> #{{ order.id }} </QItemLabel>
|
||||
<QItemLabel>{{ order.nickname }}</QItemLabel>
|
||||
<QItemLabel>{{ order.agency }}</QItemLabel>
|
||||
<QItemLabel>{{ order.address.nickname }}</QItemLabel>
|
||||
<QItemLabel>{{ order.agencyMode.description }}</QItemLabel>
|
||||
<QItemLabel>{{ currency(order.taxableBase) }}</QItemLabel>
|
||||
</template>
|
||||
<template #actions>
|
||||
|
|
Loading…
Reference in New Issue