0
0
Fork 0

refactor: refs #7553 last requested changes

This commit is contained in:
Jon Elias 2024-09-23 10:21:30 +02:00
parent edea17340d
commit f025b4361e
9 changed files with 47 additions and 31 deletions

View File

@ -106,6 +106,10 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
disabledAttr: {
type: Boolean,
default: false,
},
}); });
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -529,18 +533,21 @@ function handleOnDataSaved(_) {
</template> </template>
<template #bottom v-if="bottom"> <template #bottom v-if="bottom">
<slot name="bottom-table"> <slot name="bottom-table">
<QIcon <QBtn
@click=" @click="
() => () =>
createAsDialog createAsDialog
? (showForm = !showForm) ? (showForm = !showForm)
: handleOnDataSaved(create) : handleOnDataSaved(create)
" "
class="fill-icon-on-hover" class="cursor-pointer fill-icon"
color="primary" color="primary"
name="add_circle" icon="add_circle"
size="sm" size="md"
round
flat
shortcut="+" shortcut="+"
:disabled="!disabledAttr"
/> />
<QTooltip> <QTooltip>
{{ createForm.title }} {{ createForm.title }}

View File

@ -559,7 +559,7 @@ ticket:
purchaseRequest: Petición de compra purchaseRequest: Petición de compra
service: Servicio service: Servicio
description: Descripción description: Descripción
attender: Comprador attender: Consignatario
create: create:
client: Cliente client: Cliente
address: Dirección address: Dirección

View File

@ -14,13 +14,15 @@ import OrderFilter from './Card/OrderFilter.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date'; import { toDateTimeFormat } from 'src/filters/date';
import { onMounted } from 'vue';
import { useRoute } from 'vue-router';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref(); const tableRef = ref();
const agencyList = ref([]); const agencyList = ref([]);
const addressesList = ref([]); const addressesList = ref([]);
const route = useRoute();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -168,6 +170,13 @@ const getDateColor = (date) => {
if (comparation == 0) return 'bg-warning'; if (comparation == 0) return 'bg-warning';
if (comparation < 0) return 'bg-success'; if (comparation < 0) return 'bg-success';
}; };
onMounted(() => {
if (!route.query.createForm) return;
const clientId = route.query.createForm;
const id = JSON.parse(clientId);
fetchClientAddress(id.clientFk, id);
});
</script> </script>
<template> <template>
<OrderSearchbar /> <OrderSearchbar />

View File

@ -156,7 +156,7 @@ function ticketFilter(ticket) {
<VnLv :label="t('ticket.card.alias')" :value="entity.nickname" /> <VnLv :label="t('ticket.card.alias')" :value="entity.nickname" />
</template> </template>
<template #icons="{ entity }"> <template #icons="{ entity }">
<QCardActions> <QCardActions class="q-gutter-x-xs">
<QIcon <QIcon
v-if="entity.client.isActive == false" v-if="entity.client.isActive == false"
name="vn:disabled" name="vn:disabled"
@ -224,7 +224,7 @@ function ticketFilter(ticket) {
:to="{ :to="{
name: 'OrderList', name: 'OrderList',
query: { query: {
createForm: JSON.stringify({}), createForm: JSON.stringify({ clientFk: entity.clientFk }),
}, },
}" }"
> >

View File

@ -89,6 +89,7 @@ const actions = {
notify({ notify({
message: t('You can undo this action within the first hour'), message: t('You can undo this action within the first hour'),
icon: 'info', icon: 'info',
type: 'warning',
}); });
push({ name: 'TicketList' }); push({ name: 'TicketList' });
@ -190,6 +191,8 @@ function openConfirmDialog(callback) {
dialog({ dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t('This ticket will be removed from current route! Continue anyway?'),
message: t('You are going to delete this ticket'),
promise: actions[callback], promise: actions[callback],
}, },
}); });
@ -689,4 +692,6 @@ es:
Weight set: Peso establecido Weight set: Peso establecido
This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar? This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar?
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}" invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
You are going to delete this ticket: Vas a eliminar este ticket
</i18n> </i18n>

View File

@ -388,8 +388,17 @@ const removeSelectedSales = () => {
}; };
const removeSales = async () => { const removeSales = async () => {
let paramsOk = true;
try { try {
const params = { sales: selectedRows.value, ticketId: store.data.id }; const params = { sales: selectedRows.value, ticketId: store.data.id };
params.sales.forEach((sale) => {
if (!sale.itemFk) {
tableRef.value.reload();
paramsOk = false;
}
});
if (!paramsOk) return;
await axios.post('Sales/deleteSales', params); await axios.post('Sales/deleteSales', params);
removeSelectedSales(); removeSelectedSales();
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
@ -623,6 +632,7 @@ watch(
:default-remove="false" :default-remove="false"
:default-reset="false" :default-reset="false"
:default-save="false" :default-save="false"
:disabled-attr="isTicketEditable"
> >
<template #column-statusIcons="{ row }"> <template #column-statusIcons="{ row }">
<router-link <router-link
@ -779,23 +789,6 @@ watch(
<template #column-amount="{ row }"> <template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }} {{ toCurrency(row.quantity * row.price) }}
</template> </template>
<template #bottom-row>
<QBtn
class="cursor-pointer fill-icon q-ml-md q-my-lg"
color="primary"
icon="add_circle"
size="md"
round
flat
shortcut="+"
:disable="!isTicketEditable"
@click="insertRow()"
>
<QTooltip>
{{ t('Add item') }}
</QTooltip>
</QBtn>
</template>
</VnTable> </VnTable>
<QPageSticky :offset="[20, 20]" style="z-index: 2"> <QPageSticky :offset="[20, 20]" style="z-index: 2">

View File

@ -114,10 +114,12 @@ const columns = computed(() => [
async function deleteService(row) { async function deleteService(row) {
const serviceId = row.id; const serviceId = row.id;
if (!row.id) ticketServiceCrudRef.value.reset();
const { data } = await axios.delete(`TicketServices/${serviceId}`); else {
if (data) notify('Service deleted successfully', 'positive'); const { data } = await axios.delete(`TicketServices/${serviceId}`);
ticketServiceCrudRef.value.reload(); if (data) notify('Service deleted successfully', 'positive');
ticketServiceCrudRef.value.reload();
}
} }
</script> </script>

View File

@ -59,7 +59,6 @@ const arrayData = useArrayData('AdvanceTickets', {
exprBuilder: exprBuilder, exprBuilder: exprBuilder,
limit: 0, limit: 0,
}); });
console.log('arrayData: ', arrayData);
const { store } = arrayData; const { store } = arrayData;
const tickets = computed(() => const tickets = computed(() =>
(store.data || []).map((ticket, index) => ({ ...ticket, index: index })) (store.data || []).map((ticket, index) => ({ ...ticket, index: index }))

View File

@ -555,7 +555,7 @@ function setReference(data) {
<template #column-shippedDate="{ row }"> <template #column-shippedDate="{ row }">
<span v-if="getDateColor(row.shipped)"> <span v-if="getDateColor(row.shipped)">
<QChip :class="getDateColor(row.shipped)" dense square> <QChip :class="getDateColor(row.shipped)" dense square>
{{ row.shippedDate }} {{ toDate(row.shippedDate) }}
</QChip> </QChip>
</span> </span>
</template> </template>
@ -615,6 +615,7 @@ function setReference(data) {
option-label="name" option-label="name"
hide-selected hide-selected
@update:model-value="(client) => onClientSelected(data)" @update:model-value="(client) => onClientSelected(data)"
:sort-by="'id ASC'"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">