Merge branch 'dev' of https: refs #8078//gitea.verdnatura.es/verdnatura/salix-front into 8078-enableMultiSelection

This commit is contained in:
Jorge Penadés 2024-11-05 10:02:09 +01:00
commit a542f69b0f
17 changed files with 121 additions and 48 deletions

View File

@ -31,9 +31,10 @@ const props = defineProps({
}); });
const emit = defineEmits(['confirm', 'cancel', ...useDialogPluginComponent.emits]); const emit = defineEmits(['confirm', 'cancel', ...useDialogPluginComponent.emits]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
useDialogPluginComponent(); useDialogPluginComponent();
defineExpose({ dialogRef });
const title = props.title || t('Confirm'); const title = props.title || t('Confirm');
const message = const message =

View File

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

View File

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

View File

@ -63,7 +63,7 @@ const columns = computed(() => [
}, },
{ {
align: 'left', align: 'left',
format: (row) => row.agencyMode.name, format: (row, dashIfEmpty) => dashIfEmpty(row.agencyMode?.name),
columnClass: 'expand', columnClass: 'expand',
label: t('Agency'), label: t('Agency'),
}, },

View File

@ -215,7 +215,7 @@ const columns = computed(() => [
columnFilter: { columnFilter: {
name: 'workerFk', name: 'workerFk',
attrs: { attrs: {
url: 'VnUsers/preview', url: 'TicketRequests/getItemTypeWorker',
optionValue: 'id', optionValue: 'id',
optionLabel: 'nickname', optionLabel: 'nickname',
}, },

View File

@ -104,7 +104,7 @@ const columns = computed(() => [
columnFilter: { columnFilter: {
name: 'attenderFk', name: 'attenderFk',
attrs: { attrs: {
url: 'VnUsers/preview', url: 'TicketRequests/getItemTypeWorker',
optionValue: 'id', optionValue: 'id',
optionLabel: 'nickname', optionLabel: 'nickname',
}, },

View File

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

View File

@ -10,7 +10,6 @@ import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import { reactive } from 'vue'; import { reactive } from 'vue';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
const state = useState(); const state = useState();

View File

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

View File

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

View File

@ -6,6 +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 { 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';
@ -31,7 +32,6 @@ const orderSummary = ref({
}); });
const getTotalRef = ref(); const getTotalRef = ref();
const getVATRef = ref(); const getVATRef = ref();
const lineFilter = ref({ const lineFilter = ref({
include: [ include: [
{ {
@ -168,7 +168,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Delete'), title: t('Remove item'),
icon: 'delete', icon: 'delete',
show: (row) => !row.order.isConfirmed, show: (row) => !row.order.isConfirmed,
action: (row) => confirmRemove(row), action: (row) => confirmRemove(row),
@ -204,20 +204,21 @@ async function remove(item) {
getVATRef.value.fetch(); getVATRef.value.fetch();
} }
async function confirmOrder() { async function handleConfirm() {
await axios.post(`Orders/${route.params.id}/confirm`); const result = await confirm(route.params.id);
quasar.notify({ if (result) {
message: t('globals.confirm'), quasar.notify({
type: 'positive', message: t('globals.dataSaved'),
}); type: 'positive',
router.push({ });
name: 'TicketList', router.push({
query: { name: 'TicketList',
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }), query: {
}, table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
}); },
});
}
} }
watch( watch(
() => router.currentRoute.value.params.id, () => router.currentRoute.value.params.id,
() => { () => {
@ -314,7 +315,7 @@ watch(
</template> </template>
</VnTable> </VnTable>
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2"> <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> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}
</QTooltip> </QTooltip>
@ -401,4 +402,5 @@ es:
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar este artículo? confirmDeletionMessage: Seguro que quieres eliminar este artículo?
confirm: Confirmar confirm: Confirmar
Remove item: Eliminar artículo
</i18n> </i18n>

View File

@ -2,7 +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 { 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';
@ -21,6 +24,9 @@ const $props = defineProps({
}); });
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const summary = ref();
const quasar = useQuasar();
const descriptorData = useArrayData('orderData');
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -49,6 +55,18 @@ const detailsColumns = ref([
field: (row) => toCurrency(row?.quantity * row?.price), field: (row) => toCurrency(row?.quantity * row?.price),
}, },
]); ]);
async function handleConfirm() {
const result = await confirm(route.params.id);
if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
summary.value.fetch({});
descriptorData.fetch({});
}
}
</script> </script>
<template> <template>
@ -62,6 +80,17 @@ const detailsColumns = ref([
{{ t('order.summary.basket') }} #{{ entity?.id }} - {{ t('order.summary.basket') }} #{{ entity?.id }} -
{{ entity?.client?.name }} ({{ entity?.clientFk }}) {{ entity?.client?.name }} ({{ entity?.clientFk }})
</template> </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 }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle <VnTitle

View File

@ -233,7 +233,20 @@ onMounted(() => {
v-model="data.clientFk" v-model="data.clientFk"
:label="t('module.customer')" :label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)" @update:model-value="(id) => fetchClientAddress(id, data)"
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt.name }}
</QItemLabel>
<QItemLabel caption>
{{ `#${scope.opt.id}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect <VnSelect
v-model="data.addressId" v-model="data.addressId"
:options="addressesList" :options="addressesList"
@ -245,10 +258,21 @@ onMounted(() => {
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
<QItemSection> <QItemSection>
<QItemLabel> <QItemLabel
{{ scope.opt?.nickname }}: {{ scope.opt?.street }}, :class="{
{{ scope.opt?.city }}</QItemLabel 'color-vn-label': !scope.opt?.isActive,
}"
> >
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>

View File

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

View File

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

View File

@ -19,7 +19,6 @@ import VnTitle from 'src/components/common/VnTitle.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue'; import VnToSummary from 'src/components/ui/VnToSummary.vue';
const route = useRoute(); const route = useRoute();
@ -87,10 +86,6 @@ async function changeState(value) {
function toTicketUrl(section) { function toTicketUrl(section) {
return '#/ticket/' + entityId.value + '/' + section; return '#/ticket/' + entityId.value + '/' + section;
} }
function isOnTicketCard() {
const currentPath = route.path;
return currentPath.startsWith('/ticket');
}
</script> </script>
<template> <template>

View File

@ -268,8 +268,7 @@ const fetchAddresses = async (formData) => {
if (!formData.clientId) return; if (!formData.clientId) return;
const filter = { const filter = {
fields: ['nickname', 'street', 'city', 'id'], fields: ['nickname', 'street', 'city', 'id', 'isActive'],
where: { isActive: true },
order: 'nickname ASC', order: 'nickname ASC',
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
@ -635,24 +634,36 @@ function setReference(data) {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
url="Addresses" :label="t('basicData.address')"
:label="t('ticket.create.address')"
v-model="data.addressId" v-model="data.addressId"
:options="addressesOptions" :options="addressesOptions"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
hide-selected hide-selected
map-options
:disable="!data.clientId" :disable="!data.clientId"
:sort-by="'isActive DESC'"
@update:model-value="() => fetchAvailableAgencies(data)" @update:model-value="() => fetchAvailableAgencies(data)"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
<QItemSection> <QItemSection>
<QItemLabel> <QItemLabel
{{ scope.opt.nickname }} :class="{
</QItemLabel> 'color-vn-label': !scope.opt?.isActive,
<QItemLabel caption> }"
{{ `${scope.opt.street}, ${scope.opt.city}` }} >
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
<span>
{{ scope.opt?.nickname }}:
{{ scope.opt?.street }}, {{ scope.opt?.city }}
</span>
</QItemLabel> </QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>