#6896 fix Order module problems #817

Merged
jon merged 18 commits from Fix_OrderModuleProblems into dev 2024-10-29 11:20:14 +00:00
3 changed files with 14 additions and 23 deletions
Showing only changes of commit 5663064dd8 - Show all commits

View File

@ -6,7 +6,7 @@ import { useQuasar } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { confirmOrder } from 'composables/confirmOrder'; import { confirm } from 'src/pages/Order/composables/confirmOrder';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency, toDate } from 'src/filters';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
@ -32,7 +32,6 @@ const orderSummary = ref({
}); });
const getTotalRef = ref(); const getTotalRef = ref();
const getVATRef = ref(); const getVATRef = ref();
const { confirm } = confirmOrder();
const lineFilter = ref({ const lineFilter = ref({
include: [ include: [
{ {
@ -208,6 +207,10 @@ async function remove(item) {
async function handleConfirm() { async function handleConfirm() {
const result = await confirm(route.params.id); const result = await confirm(route.params.id);
if (result) { if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
router.push({ router.push({
name: 'TicketList', name: 'TicketList',
query: { query: {

View File

@ -2,9 +2,10 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { dashIfEmpty, toCurrency, toDateHourMinSec } from 'src/filters'; import { dashIfEmpty, toCurrency, toDateHourMinSec } from 'src/filters';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { confirmOrder } from 'composables/confirmOrder'; import { confirm } from 'src/pages/Order/composables/confirmOrder';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -24,8 +25,8 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const summary = ref(); const summary = ref();
const quasar = useQuasar();
const descriptorData = useArrayData('orderData'); const descriptorData = useArrayData('orderData');
const { confirm } = confirmOrder();
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -58,6 +59,10 @@ const detailsColumns = ref([
async function handleConfirm() { async function handleConfirm() {

Tenemos duplicidad al usar este axios.post, lo movemos un archivo global.
si tienes dudas, puedes revisar setRectificative

Tenemos duplicidad al usar este axios.post, lo movemos un archivo global. si tienes dudas, puedes revisar setRectificative
const result = await confirm(route.params.id); const result = await confirm(route.params.id);
if (result) { if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
summary.value.fetch({}); summary.value.fetch({});
descriptorData.fetch({}); descriptorData.fetch({});
} }

View File

@ -1,22 +1,5 @@
import axios from 'axios'; import axios from 'axios';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
export function confirmOrder() { export async function confirm(routeId) {
const quasar = useQuasar(); return await axios.post(`Orders/${routeId}/confirm`);
const { t } = useI18n();
async function confirm(route) {
const { data } = await axios.post(`Orders/${route}/confirm`);
if (data) {
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
return data;
}
return null;
}
return { confirm };
} }
Review

No me acaba de convencer este archivo porque solo tenemos una función dentro, y a futuro no creo que escale
Yo lo he enfocado de esta manera
987c28e745/src/pages/Customer/composables/getClientRisk.js

No me acaba de convencer este archivo porque solo tenemos una función dentro, y a futuro no creo que escale Yo lo he enfocado de esta manera https://gitea.verdnatura.es/verdnatura/salix-front/src/commit/987c28e745fde447edb45b0223bc9e6a6c9f47e4/src/pages/Customer/composables/getClientRisk.js