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

View File

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

View File

@ -14,13 +14,15 @@ import OrderFilter from './Card/OrderFilter.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date';
import { onMounted } from 'vue';
import { useRoute } from 'vue-router';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const tableRef = ref();
const agencyList = ref([]);
const addressesList = ref([]);
const route = useRoute();
const columns = computed(() => [
{
align: 'left',
@ -168,6 +170,13 @@ const getDateColor = (date) => {
if (comparation == 0) return 'bg-warning';
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>
<template>
<OrderSearchbar />

View File

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

View File

@ -89,6 +89,7 @@ const actions = {
notify({
message: t('You can undo this action within the first hour'),
icon: 'info',
type: 'warning',
});
push({ name: 'TicketList' });
@ -190,6 +191,8 @@ function openConfirmDialog(callback) {
dialog({
component: VnConfirm,
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],
},
});
@ -689,4 +692,6 @@ es:
Weight set: Peso establecido
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}"
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>

View File

@ -388,8 +388,17 @@ const removeSelectedSales = () => {
};
const removeSales = async () => {
let paramsOk = true;
try {
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);
removeSelectedSales();
notify('globals.dataSaved', 'positive');
@ -623,6 +632,7 @@ watch(
:default-remove="false"
:default-reset="false"
:default-save="false"
:disabled-attr="isTicketEditable"
>
<template #column-statusIcons="{ row }">
<router-link
@ -779,23 +789,6 @@ watch(
<template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }}
</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>
<QPageSticky :offset="[20, 20]" style="z-index: 2">

View File

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

View File

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

View File

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