0
0
Fork 0

refactor: refs #7553 requested changes

This commit is contained in:
Jon Elias 2024-09-09 13:52:41 +02:00
parent 0b961050a0
commit 6248a4117d
10 changed files with 150 additions and 92 deletions

View File

@ -234,6 +234,8 @@ async function remove(data) {
newData = newData.filter((form) => !ids.some((id) => id == form[pk])); newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
fetch(newData); fetch(newData);
}); });
} else {
reset();
} }
emit('update:selected', []); emit('update:selected', []);
} }

View File

@ -114,7 +114,7 @@ const totalNewPrice = computed(() => {
const totalDifference = computed(() => { const totalDifference = computed(() => {
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0); return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
}); });
const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : [])); const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences); const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
const ticketHaveNegatives = () => { const ticketHaveNegatives = () => {
let _haveNegatives = false; let _haveNegatives = false;
@ -156,18 +156,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
{{ t('basicData.total') }} {{ t('basicData.total') }}
</span> </span>
</QCardSection> </QCardSection>
<QCardSection class="column items-center" horizontal> <QCardSection class="column items-left" horizontal>
<span> <span>
{{ t('basicData.price') }}: {{ t('basicData.price') }}:
{{ toCurrency(totalPrice) }} {{ toCurrency(totalPrice) }}
</span> </span>
</QCardSection> </QCardSection>
<QCardSection class="column items-center" horizontal> <QCardSection class="column items-left" horizontal>
<span> <span>
{{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }} {{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }}
</span> </span>
</QCardSection> </QCardSection>
<QCardSection class="column items-center" horizontal> <QCardSection class="column items-left" horizontal>
<span> <span>
{{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }} {{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }}
</span> </span>
@ -220,7 +220,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QCard> </QCard>
</QDrawer> </QDrawer>
<QTable <QTable
:visible-columns="showMovablecolumn" :visible-columns="showMovableColumn"
:rows="rows" :rows="rows"
:columns="columns" :columns="columns"
row-key="id" row-key="id"
@ -238,7 +238,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</template> </template>
<template #body-cell-description="{ row }"> <template #body-cell-description="{ row }">
<QTd> <QTd style="display: contents">
<div class="column"> <div class="column">
<span>{{ row.item.name }}</span> <span>{{ row.item.name }}</span>
<span class="color-vn-label">{{ row.item.subName }}</span> <span class="color-vn-label">{{ row.item.subName }}</span>

View File

@ -51,18 +51,18 @@ const agencyByWarehouseFilter = computed(() => ({
}, },
})); }));
const zonesFilter = computed(() => ({ function zoneWhere() {
fields: ['id', 'name'], if (formData?.value?.agencyModeFk) {
order: 'name ASC', return formData.value?.agencyModeFk
where: formData.value?.agencyModeFk
? { ? {
shipped: formData.value?.shipped, shipped: formData.value?.shipped,
addressFk: formData.value?.addressFk, addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk, agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk, warehouseFk: formData.value?.warehouseFk,
} }
: {}, : {};
})); }
}
const getLanded = async (params) => { const getLanded = async (params) => {
try { try {
@ -293,13 +293,6 @@ onMounted(() => onFormModelInit());
@on-fetch="(data) => (agenciesOptions = data)" @on-fetch="(data) => (agenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
ref="zonesFetchRef"
url="Zones/includingExpired"
:filter="zonesFilter"
@on-fetch="(data) => (zonesOptions = data)"
auto-load
/>
<QForm> <QForm>
<VnRow> <VnRow>
<VnSelect <VnSelect
@ -420,7 +413,10 @@ onMounted(() => onFormModelInit());
v-model="zoneId" v-model="zoneId"
option-value="id" option-value="id"
option-label="name" option-label="name"
:options="zonesOptions" url="Zones/includingExpired"
:fields="['id', 'name']"
sort-by="id"
:where="zoneWhere"
hide-selected hide-selected
map-options map-options
:required="true" :required="true"

View File

@ -158,7 +158,10 @@ onBeforeMount(async () => await getTicketData());
color="primary" color="primary"
animated animated
keep-alive keep-alive
style="max-width: 800px; margin: auto" style="margin: auto"
:style="{
'max-width': step > 1 ? 'none' : '800px',
}"
> >
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1"> <QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
<TicketBasicDataForm <TicketBasicDataForm

View File

@ -2,13 +2,13 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue'; import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { toDateTimeFormat } from 'src/filters/date';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -36,7 +36,18 @@ const filter = {
{ {
relation: 'client', relation: 'client',
scope: { scope: {
fields: ['id', 'name', 'salesPersonFk', 'phone', 'mobile', 'email'], fields: [
'id',
'name',
'salesPersonFk',
'phone',
'mobile',
'email',
'isActive',
'isFreezed',
'isTaxDataChecked',
'hasElectronicInvoice',
],
include: [ include: [
{ {
relation: 'user', relation: 'user',
@ -132,7 +143,10 @@ function ticketFilter(ticket) {
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" /> <VnLv
:label="t('ticket.card.shipped')"
:value="toDateTimeFormat(entity.shipped)"
/>
<VnLv <VnLv
v-if="entity.agencyMode" v-if="entity.agencyMode"
:label="t('ticket.card.agency')" :label="t('ticket.card.agency')"
@ -143,6 +157,38 @@ function ticketFilter(ticket) {
</template> </template>
<template #icons="{ entity }"> <template #icons="{ entity }">
<QCardActions> <QCardActions>
<QIcon
v-if="entity.client.isActive == false"
name="vn:disabled"
size="xs"
color="primary"
>
<QTooltip>{{ t('Client inactive') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity.client.isFreezed == true"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity.problem.includes('hasRisk')"
name="vn:risk"
size="xs"
color="primary"
>
<QTooltip>{{ t('Client has debt') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity.client.isTaxDataChecked == false"
name="vn:no036"
size="xs"
color="primary"
>
<QTooltip>{{ t('Client not checked') }}</QTooltip>
</QIcon>
<QIcon <QIcon
v-if="entity.isDeleted == true" v-if="entity.isDeleted == true"
name="vn:deletedTicket" name="vn:deletedTicket"
@ -188,4 +234,8 @@ function ticketFilter(ticket) {
es: es:
This ticket is deleted: Este ticket está eliminado This ticket is deleted: Este ticket está eliminado
Go to module index: Ir al índice del modulo Go to module index: Ir al índice del modulo
Client inactive: Cliente inactivo
Client not checked: Cliente no verificado
Client has debt: Cliente con deuda
Client Frozen: Cliente congelado
</i18n> </i18n>

View File

@ -33,6 +33,9 @@ watch(
await ticketNotesCrudRef.value.reload(); await ticketNotesCrudRef.value.reload();
} }
); );
function handleDelete(row) {
ticketNotesCrudRef.value.remove([row]);
}
</script> </script>
<template> <template>
@ -74,12 +77,14 @@ watch(
v-model="row.description" v-model="row.description"
class="col" class="col"
/> />
{{ index }},
{{ row }}
<QIcon <QIcon
name="delete" name="delete"
size="sm" size="sm"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
@click="ticketNotesCrudRef.remove([row])" @click="handleDelete(row)"
> >
<QTooltip> <QTooltip>
{{ t('ticketNotes.removeNote') }} {{ t('ticketNotes.removeNote') }}

View File

@ -10,6 +10,7 @@ import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import VnRow from 'src/components/ui/VnRow.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -114,6 +115,7 @@ watch(
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</div> </div>
<VnRow>
<QIcon <QIcon
name="add_circle" name="add_circle"
class="fill-icon-on-hover q-ml-md" class="fill-icon-on-hover q-ml-md"
@ -125,6 +127,7 @@ watch(
{{ t('package.addPackage') }} {{ t('package.addPackage') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</VnRow>
</QCard> </QCard>
</template> </template>
</CrudModel> </CrudModel>

View File

@ -100,7 +100,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('ticketSale.quantity'), label: t('ticketSale.quantity'),
name: 'quantity', name: 'quantity',
cardVisible: true,
format: (row) => toCurrency(row.quantity), format: (row) => toCurrency(row.quantity),
}, },
{ {
@ -109,20 +108,17 @@ const columns = computed(() => [
name: 'item', name: 'item',
format: (row) => row?.item?.name, format: (row) => row?.item?.name,
columnClass: 'expand', columnClass: 'expand',
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
label: t('ticketSale.price'), label: t('ticketSale.price'),
name: 'price', name: 'price',
cardVisible: true,
format: (row) => toCurrency(row.price), format: (row) => toCurrency(row.price),
}, },
{ {
align: 'left', align: 'left',
label: t('ticketSale.discount'), label: t('ticketSale.discount'),
name: 'discount', name: 'discount',
cardVisible: true,
format: (row) => toPercentage(row.discount), format: (row) => toPercentage(row.discount),
}, },
{ {
@ -135,7 +131,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('ticketSale.packaging'), label: t('ticketSale.packaging'),
name: 'itemPackingTypeFk', name: 'itemPackingTypeFk',
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row?.item?.itemPackingTypeFk), format: (row, dashIfEmpty) => dashIfEmpty(row?.item?.itemPackingTypeFk),
}, },
{ {
@ -569,6 +564,7 @@ async function save(item) {
}" }"
:right-search="false" :right-search="false"
:column-search="false" :column-search="false"
:disable-option="{ card: true }"
auto-load auto-load
> >
<template #column-statusIcons="{ row }"> <template #column-statusIcons="{ row }">

View File

@ -25,7 +25,7 @@ const saleTrackingFetchDataRef = ref(null);
const sales = ref([]); const sales = ref([]);
const saleTrackings = ref([]); const saleTrackings = ref([]);
const itemShelvignsSales = ref([]); const itemShelvingsSales = ref([]);
const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`); const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`);
const oldQuantity = ref(null); const oldQuantity = ref(null);
@ -88,7 +88,7 @@ const logTableColumns = computed(() => [
label: t('ticketSaleTracking.original'), label: t('ticketSaleTracking.original'),
name: 'original', name: 'original',
field: 'originalQuantity', field: 'originalQuantity',
align: 'original', align: 'left',
sortable: true, sortable: true,
}, },
{ {
@ -177,7 +177,7 @@ const getItemShelvingSales = async (sale) => {
const { data } = await axios.get(`ItemShelvingSales/filter`, { const { data } = await axios.get(`ItemShelvingSales/filter`, {
params: { filter: JSON.stringify(filter) }, params: { filter: JSON.stringify(filter) },
}); });
itemShelvignsSales.value = data; itemShelvingsSales.value = data;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -464,12 +464,14 @@ const qCheckBoxController = (sale, action) => {
data-key="saleTrackingLog" data-key="saleTrackingLog"
:rows="saleTrackings" :rows="saleTrackings"
:columns="logTableColumns" :columns="logTableColumns"
class="q-pa-sm" class="q-pa-sm full-width"
> >
<template #body-cell-worker="{ row }"> <template #body-cell-worker="{ row }">
<QTd auto-width> <QTd>
<QBtn flat dense color="primary">{{ row.name }}</QBtn> <QBtn flat class="link">
{{ row.name }}
<WorkerDescriptorProxy :id="row.workerFk" /> <WorkerDescriptorProxy :id="row.workerFk" />
</QBtn>
</QTd> </QTd>
</template> </template>
</QTable> </QTable>
@ -481,12 +483,12 @@ const qCheckBoxController = (sale, action) => {
> >
<QTable <QTable
data-key="itemShelvingsSales" data-key="itemShelvingsSales"
:rows="itemShelvignsSales" :rows="itemShelvingsSales"
:columns="shelvingsTableColumns" :columns="shelvingsTableColumns"
class="q-pa-sm" class="q-pa-sm full-width"
> >
<template #body-cell-quantity="{ row }"> <template #body-cell-quantity="{ row }">
<QTd auto-width> <QTd>
<VnInput <VnInput
v-model.number="row.quantity" v-model.number="row.quantity"
@keyup.enter="updateQuantity(row)" @keyup.enter="updateQuantity(row)"
@ -496,13 +498,15 @@ const qCheckBoxController = (sale, action) => {
</QTd> </QTd>
</template> </template>
<template #body-cell-worker="{ row }"> <template #body-cell-worker="{ row }">
<QTd auto-width> <QTd>
<QBtn flat dense color="primary">{{ row.name }}</QBtn> <QBtn flat class="link">
{{ row.name }}
<WorkerDescriptorProxy :id="row.userFk" /> <WorkerDescriptorProxy :id="row.userFk" />
</QBtn>
</QTd> </QTd>
</template> </template>
<template #body-cell-shelving="{ row }"> <template #body-cell-shelving="{ row }">
<QTd auto-width> <QTd>
<VnSelect <VnSelect
url="Shelvings" url="Shelvings"
hide-selected hide-selected
@ -515,7 +519,7 @@ const qCheckBoxController = (sale, action) => {
</QTd> </QTd>
</template> </template>
<template #body-cell-parking="{ row }"> <template #body-cell-parking="{ row }">
<QTd auto-width> <QTd>
<VnSelect <VnSelect
url="Parkings" url="Parkings"
hide-selected hide-selected
@ -550,4 +554,10 @@ $estados: (
} }
} }
} }
@media (min-width: 560px) {
.q-dialog__inner--minimized > div {
max-width: 900px;
}
}
</style> </style>

View File

@ -16,6 +16,7 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; 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';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -103,13 +104,18 @@ function getNoteValue(description) {
return t('Sustitución'); return t('Sustitución');
} }
} }
function toTicketUrl(section) {
return '#/ticket/' + entityId.value + '/' + section;
}
</script> </script>
<template> <template>
<FetchData <FetchData
url="States/editableStates" url="States/editableStates"
@on-fetch="(data) => (editableStates = data)" :filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
auto-load auto-load
@on-fetch="(data) => (editableStates = data)"
/> />
<CardSummary <CardSummary
ref="summaryRef" ref="summaryRef"
@ -127,39 +133,26 @@ function getNoteValue(description) {
</template> </template>
<template #header-right> <template #header-right>
<QBtnDropdown <QBtnDropdown
side
top
color="black" color="black"
text-color="white" text-color="white"
:label="t('ticket.summary.changeState')" :label="t('ticket.summary.changeState')"
:disable="!isEditable()" :disable="!isEditable()"
> >
<QList> <VnSelect
<QVirtualScroll :options="editableStates"
style="max-height: 300px" hide-selected
:items="editableStates" option-label="name"
separator option-value="code"
v-slot="{ item, index }" hide-dropdown-icon
> focus-on-mount
<QItem @update:model-value="changeState(item.code)"
:key="index" />
dense
clickable
v-close-popup
@click="changeState(item.code)"
>
<QItemSection>
<QItemLabel>{{ item.name }}</QItemLabel>
</QItemSection>
</QItem>
</QVirtualScroll>
</QList>
</QBtnDropdown> </QBtnDropdown>
</template> </template>
<template #body> <template #body>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle <VnTitle
:url="ticketUrl + 'basic-data/step-one'" :url="toTicketUrl('basic-data')"
:text="t('globals.summary.basicData')" :text="t('globals.summary.basicData')"
/> />
<VnLv v-if="ticket.ticketState" :label="t('ticket.summary.state')"> <VnLv v-if="ticket.ticketState" :label="t('ticket.summary.state')">
@ -236,7 +229,7 @@ function getNoteValue(description) {
</QCard> </QCard>
<QCard class="vn-one" style="flex: 2 1"> <QCard class="vn-one" style="flex: 2 1">
<VnTitle <VnTitle
:url="ticketUrl + 'basic-data/step-one'" :url="toTicketUrl('basic-data')"
:text="t('globals.summary.basicData')" :text="t('globals.summary.basicData')"
/> />
<VnLv <VnLv
@ -288,7 +281,7 @@ function getNoteValue(description) {
</QCard> </QCard>
<QCard class="vn-one" v-if="ticket.notes.length"> <QCard class="vn-one" v-if="ticket.notes.length">
<VnTitle <VnTitle
:url="ticketUrl + 'observation'" :url="toTicketUrl('observation')"
:text="t('ticket.pageTitles.notes')" :text="t('ticket.pageTitles.notes')"
/> />
<VnLv <VnLv
@ -328,7 +321,7 @@ function getNoteValue(description) {
</QCard> </QCard>
<QCard class="vn-max"> <QCard class="vn-max">
<VnTitle <VnTitle
:url="ticketUrl + 'sale'" :url="toTicketUrl('sale')"
:text="t('ticket.summary.saleLines')" :text="t('ticket.summary.saleLines')"
/> />
<QTable :rows="ticket.sales" style="text-align: center"> <QTable :rows="ticket.sales" style="text-align: center">
@ -488,7 +481,7 @@ function getNoteValue(description) {
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-max" v-if="ticket.packagings.length != 0"> <QCard class="vn-max" v-if="ticket.packagings.length != 0">
<VnTitle :url="ticketUrl + 'package'" :text="t('globals.packages')" /> <VnTitle :url="toTicketUrl('package')" :text="t('globals.packages')" />
<QTable :rows="ticket.packagings" flat style="text-align: center"> <QTable :rows="ticket.packagings" flat style="text-align: center">
<template #header="props"> <template #header="props">
<QTr class="tr-header" :props="props"> <QTr class="tr-header" :props="props">
@ -508,7 +501,7 @@ function getNoteValue(description) {
</QCard> </QCard>
<QCard class="vn-max" v-if="ticket.services.length != 0"> <QCard class="vn-max" v-if="ticket.services.length != 0">
<VnTitle <VnTitle
:url="ticketUrl + 'service'" :url="toTicketUrl('service')"
:text="t('ticket.summary.service')" :text="t('ticket.summary.service')"
/> />
<QTable :rows="ticket.services" flat style="text-align: center"> <QTable :rows="ticket.services" flat style="text-align: center">
@ -536,7 +529,7 @@ function getNoteValue(description) {
</QCard> </QCard>
<QCard class="vn-max" v-if="ticket.requests.length != 0"> <QCard class="vn-max" v-if="ticket.requests.length != 0">
<VnTitle <VnTitle
:url="ticketUrl + 'request'" :url="toTicketUrl('request')"
:text="t('ticket.summary.purchaseRequest')" :text="t('ticket.summary.purchaseRequest')"
/> />
<QTable :rows="ticket.requests" flat style="text-align: center"> <QTable :rows="ticket.requests" flat style="text-align: center">