#6896 fix Order module problems #817

Merged
jon merged 18 commits from Fix_OrderModuleProblems into dev 2024-10-29 11:20:14 +00:00
9 changed files with 68 additions and 25 deletions

View File

@ -705,6 +705,8 @@ order:
quantity: Quantity
price: Price
amount: Amount
confirm: Confirm
confirmLines: Confirm lines
department:
pageTitles:
basicData: Basic data

View File

@ -681,13 +681,15 @@ order:
vat: IVA
state: Estado
alias: Alias
items: Items
items: Artículos
orderTicketList: Tickets del pedido
details: Detalles
item: Item
quantity: Cantidad
price: Precio
amount: Monto
confirm: Confirmar
confirmLines: Confirmar lineas
shelving:
list:
parking: Parking

View File

@ -102,6 +102,7 @@ function extractValueTags(items) {
:key="row.id"
:item="row"
is-catalog
class="fill-icon"
/>
</div>
</template>

View File

@ -71,10 +71,6 @@ const getConfirmationValue = (isConfirmed) => {
};
const total = ref(null);
function ticketFilter(order) {
return JSON.stringify({ id: order.id });
}
</script>
<template>
@ -126,7 +122,11 @@ function ticketFilter(order) {
color="primary"
:to="{
name: 'TicketList',
query: { table: ticketFilter(entity) },
query: {
table: JSON.stringify({
orderFk: entity.id,
}),
},
}"
>
<QTooltip>{{ t('order.summary.orderTicketList') }}</QTooltip>

View File

@ -23,8 +23,8 @@ function confirmRemove() {
.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.confirmDeletion'),
message: t('confirmDeletionMessage'),
title: t('You are going to delete this order'),
message: t('Continue anyway?'),
promise: remove,
},
})
@ -57,5 +57,6 @@ en:
es:
deleteOrder: Eliminar pedido
confirmDeletionMessage: Seguro que quieres eliminar este pedido?
You are going to delete this order: El pedido se eliminará
Continue anyway?: ¿Continuar de todos modos?
</i18n>

View File

@ -6,6 +6,7 @@ import { useQuasar } from 'quasar';
import axios from 'axios';
import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData';
import { confirm } from 'src/pages/Order/composables/confirmOrder';
import { toCurrency, toDate } from 'src/filters';
import VnConfirm from 'components/ui/VnConfirm.vue';
@ -31,7 +32,6 @@ const orderSummary = ref({
});
const getTotalRef = ref();
const getVATRef = ref();
const lineFilter = ref({
include: [
{
@ -168,7 +168,7 @@ const columns = computed(() => [
name: 'tableActions',
actions: [
{
title: t('Delete'),
title: t('Remove item'),
icon: 'delete',
show: (row) => !row.order.isConfirmed,
action: (row) => confirmRemove(row),
@ -204,10 +204,11 @@ async function remove(item) {
getVATRef.value.fetch();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
async function handleConfirm() {
const result = await confirm(route.params.id);
if (result) {
quasar.notify({
message: t('globals.confirm'),
message: t('globals.dataSaved'),
type: 'positive',
});
router.push({
@ -217,7 +218,7 @@ async function confirmOrder() {
},
});
}
}
watch(
() => router.currentRoute.value.params.id,
() => {
@ -314,7 +315,7 @@ watch(
</template>
</VnTable>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QBtn fab icon="check" color="primary" @click="handleConfirm()" />
<QTooltip>
{{ t('confirm') }}
</QTooltip>
@ -401,4 +402,5 @@ es:
confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar este artículo?
confirm: Confirmar
Remove item: Eliminar artículo
</i18n>

View File

@ -2,7 +2,10 @@
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { dashIfEmpty, toCurrency, toDateHourMinSec } from 'src/filters';
import { useArrayData } from 'composables/useArrayData';
import { confirm } from 'src/pages/Order/composables/confirmOrder';
import VnLv from 'components/ui/VnLv.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -21,6 +24,9 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
const summary = ref();
const quasar = useQuasar();
const descriptorData = useArrayData('orderData');
const detailsColumns = ref([
{
name: 'item',
@ -49,6 +55,18 @@ const detailsColumns = ref([
field: (row) => toCurrency(row?.quantity * row?.price),
},
]);
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);
if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
summary.value.fetch({});
descriptorData.fetch({});
}
}
</script>
<template>
@ -62,6 +80,17 @@ const detailsColumns = ref([
{{ t('order.summary.basket') }} #{{ entity?.id }} -
{{ entity?.client?.name }} ({{ entity?.clientFk }})
</template>
<template #header-right>
<QBtn
flat
text-color="white"
:disabled="isConfirmed"
:label="t('order.summary.confirm')"
@click="handleConfirm()"
>
<QTooltip>{{ t('order.summary.confirmLines') }}</QTooltip>
</QBtn>
</template>
<template #body="{ entity }">
<QCard class="vn-one">
<VnTitle

View File

@ -0,0 +1,5 @@
import axios from 'axios';
export async function confirm(routeId) {
return await axios.post(`Orders/${routeId}/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

View File

@ -56,6 +56,7 @@ const attendersOptions = ref([]);
v-model="data.price"
:label="t('purchaseRequest.price')"
type="number"
step="0.01"
min="0"
/>
</VnRow>