Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into xxxx-addSupportService

This commit is contained in:
Jorge Penadés 2024-11-05 09:22:46 +01:00
commit 3ca26a97dc
17 changed files with 120 additions and 48 deletions

View File

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

View File

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

View File

@ -684,13 +684,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

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

View File

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

View File

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

View File

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

View File

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

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,20 +204,21 @@ async function remove(item) {
getVATRef.value.fetch();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
router.push({
name: 'TicketList',
query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
},
});
async function handleConfirm() {
const result = await confirm(route.params.id);
if (result) {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
router.push({
name: 'TicketList',
query: {
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
},
});
}
}
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() {
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

@ -233,7 +233,20 @@ onMounted(() => {
v-model="data.clientFk"
:label="t('module.customer')"
@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
v-model="data.addressId"
:options="addressesList"
@ -245,10 +258,21 @@ onMounted(() => {
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}</QItemLabel
<QItemLabel
:class="{
'color-vn-label': !scope.opt?.isActive,
}"
>
{{
`${
!scope.opt?.isActive
? t('basicData.inactive')
: ''
} `
}}
{{ scope.opt?.nickname }}: {{ scope.opt?.street }},
{{ scope.opt?.city }}
</QItemLabel>
</QItemSection>
</QItem>
</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"
:label="t('purchaseRequest.price')"
type="number"
step="0.01"
min="0"
/>
</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 ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
const route = useRoute();
@ -87,10 +86,6 @@ async function changeState(value) {
function toTicketUrl(section) {
return '#/ticket/' + entityId.value + '/' + section;
}
function isOnTicketCard() {
const currentPath = route.path;
return currentPath.startsWith('/ticket');
}
</script>
<template>

View File

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