0
0
Fork 0

Merge branch 'master' into hotfix_itemFixedPrice

This commit is contained in:
Javier Segarra 2024-11-20 09:43:21 +01:00
commit cb2aa2845d
47 changed files with 214 additions and 236 deletions

View File

@ -77,7 +77,7 @@ const isLoading = ref(false);
const hasChanges = ref(false); const hasChanges = ref(false);
const originalData = ref(); const originalData = ref();
const vnPaginateRef = ref(); const vnPaginateRef = ref();
const formData = ref(); const formData = ref([]);
const saveButtonRef = ref(null); const saveButtonRef = ref(null);
const watchChanges = ref(); const watchChanges = ref();
const formUrl = computed(() => $props.url); const formUrl = computed(() => $props.url);

View File

@ -25,7 +25,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'params', default: 'table',
}, },
}); });

View File

@ -17,7 +17,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'params', default: 'table',
}, },
vertical: { vertical: {
type: Boolean, type: Boolean,

View File

@ -325,6 +325,8 @@ function handleOnDataSaved(_) {
} }
function handleScroll() { function handleScroll() {
if ($props.crudModel.disableInfiniteScroll) return;
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle'); const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
const { scrollHeight, scrollTop, clientHeight } = tMiddle; const { scrollHeight, scrollTop, clientHeight } = tMiddle;
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40; const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;

View File

@ -98,7 +98,7 @@ function existSummary(routes) {
<slot name="header" :entity="entity" dense> <slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" /> <VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot> </slot>
<slot name="header-right"> <slot name="header-right" :entity="entity">
<span></span> <span></span>
</slot> </slot>
</div> </div>

View File

@ -49,7 +49,7 @@ const $props = defineProps({
}, },
searchUrl: { searchUrl: {
type: String, type: String,
default: 'params', default: 'table',
}, },
redirect: { redirect: {
type: Boolean, type: Boolean,

View File

@ -44,7 +44,7 @@ const props = defineProps({
}, },
limit: { limit: {
type: Number, type: Number,
default: 10, default: 20,
}, },
userParams: { userParams: {
type: Object, type: Object,
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
const store = arrayData.store; const store = arrayData.store;
onMounted(async () => { onMounted(async () => {
if (props.autoLoad) await fetch(); if (props.autoLoad && !store.data?.length) await fetch();
mounted.value = true; mounted.value = true;
}); });
@ -115,7 +115,11 @@ watch(
watch( watch(
() => store.data, () => store.data,
(data) => emit('onChange', data) (data) => {
if (!mounted.value) return;
emit('onChange', data);
},
{ immediate: true }
); );
watch( watch(

View File

@ -45,7 +45,7 @@ const props = defineProps({
}, },
limit: { limit: {
type: Number, type: Number,
default: 10, default: 20,
}, },
userParams: { userParams: {
type: Object, type: Object,

View File

@ -270,7 +270,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const pushUrl = { path: to }; const pushUrl = { path: to };
if (to.endsWith('/list') || to.endsWith('/')) if (to.endsWith('/list') || to.endsWith('/'))
pushUrl.query = newUrl.query; pushUrl.query = newUrl.query;
destroy(); else destroy();
return router.push(pushUrl); return router.push(pushUrl);
} }
} }

View File

@ -940,7 +940,7 @@ supplier:
basicData: basicData:
alias: Alias alias: Alias
workerFk: Responsible workerFk: Responsible
isSerious: Verified isReal: Verified
isActive: Active isActive: Active
isPayMethodChecked: PayMethod checked isPayMethodChecked: PayMethod checked
note: Notes note: Notes

View File

@ -938,7 +938,7 @@ supplier:
basicData: basicData:
alias: Alias alias: Alias
workerFk: Responsable workerFk: Responsable
isSerious: Verificado isReal: Verificado
isActive: Activo isActive: Activo
isPayMethodChecked: Método de pago validado isPayMethodChecked: Método de pago validado
note: Notas note: Notas

View File

@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="AccountUsers" data-key="AccountList"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('account.search')" :label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
@ -112,12 +112,12 @@ const exprBuilder = (param, value) => {
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<AccountFilter data-key="AccountUsers" /> <AccountFilter data-key="AccountList" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountUsers" data-key="AccountList"
url="VnUsers/preview" url="VnUsers/preview"
:filter="filter" :filter="filter"
order="id DESC" order="id DESC"

View File

@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="Roles" data-key="AccountRolesList"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:label="t('role.searchRoles')" :label="t('role.searchRoles')"
:info="t('role.searchInfo')" :info="t('role.searchInfo')"
/> />
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Roles" data-key="AccountRolesList"
:url="`VnRoles`" :url="`VnRoles`"
:create="{ :create="{
urlCreate: 'VnRoles', urlCreate: 'VnRoles',

View File

@ -9,7 +9,7 @@ const { t } = useI18n();
<VnCard <VnCard
data-key="Role" data-key="Role"
:descriptor="RoleDescriptor" :descriptor="RoleDescriptor"
search-data-key="AccountRoles" search-data-key="AccountRolesList"
:searchbar-props="{ :searchbar-props="{
url: 'VnRoles', url: 'VnRoles',
label: t('role.searchRoles'), label: t('role.searchRoles'),

View File

@ -23,7 +23,7 @@ defineExpose({ states });
<template> <template>
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { toCurrency, toPercentage, toDate } from 'src/filters'; import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
@ -25,16 +25,16 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const customer = computed(() => summary.value.entity); const customer = computed(() => summary.value.entity);
const summary = ref(); const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
const balanceDue = computed(() => { const balanceDue = computed(() => {
return ( const amount = defaulterAmount.value;
customer.value && if (!amount || amount < 0) {
customer.value.defaulters.length && return null;
customer.value.defaulters[0].amount }
); return amount;
}); });
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : '')); const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
const claimRate = computed(() => { const claimRate = computed(() => {
return customer.value.claimsRatio?.claimingRate ?? 0; return customer.value.claimsRatio?.claimingRate ?? 0;
@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {
<VnLv <VnLv
v-if="entity.defaulters" v-if="entity.defaulters"
:label="t('customer.summary.balanceDue')" :label="t('customer.summary.balanceDue')"
:value="toCurrency(balanceDue)" :value="dashOrCurrency(balanceDue)()"
:class="balanceDueWarning" :class="balanceDueWarning"
:info="t('customer.summary.balanceDueInfo')" :info="t('customer.summary.balanceDueInfo')"
/> />

View File

@ -28,7 +28,7 @@ const exprBuilder = (param, value) => {
</script> </script>
<template> <template>
<VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table"> <VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -394,16 +394,16 @@ function handleLocation(data, location) {
<VnSearchbar <VnSearchbar
:info="t('You can search by customer id or name')" :info="t('You can search by customer id or name')"
:label="t('Search customer')" :label="t('Search customer')"
data-key="Customer" data-key="CustomerList"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<CustomerFilter data-key="Customer" /> <CustomerFilter data-key="CustomerList" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Customer" data-key="CustomerList"
url="Clients/filter" url="Clients/filter"
:create="{ :create="{
urlCreate: 'Clients/createWithUser', urlCreate: 'Clients/createWithUser',

View File

@ -122,7 +122,7 @@ const cols = computed(() => [
:columns="cols" :columns="cols"
:right-search="false" :right-search="false"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:auto-load="!!$route.query.params" :auto-load="!!$route.query.table"
> >
<template #column-supplierFk="{ row }"> <template #column-supplierFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>

View File

@ -182,11 +182,11 @@ watchEffect(selectedRows);
<VnSearchbar <VnSearchbar
:info="t('youCanSearchByInvoiceReference')" :info="t('youCanSearchByInvoiceReference')"
:label="t('searchInvoice')" :label="t('searchInvoice')"
data-key="invoiceOut" data-key="invoiceOutList"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<InvoiceOutFilter data-key="invoiceOut" /> <InvoiceOutFilter data-key="invoiceOutList" />
</template> </template>
</RightMenu> </RightMenu>
<VnSubToolbar> <VnSubToolbar>
@ -203,7 +203,7 @@ watchEffect(selectedRows);
</VnSubToolbar> </VnSubToolbar>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="invoiceOut" data-key="invoiceOutList"
:url="`${MODEL}/filter`" :url="`${MODEL}/filter`"
:create="{ :create="{
urlCreate: 'InvoiceOuts/createManualInvoice', urlCreate: 'InvoiceOuts/createManualInvoice',

View File

@ -431,7 +431,7 @@ function handleOnDataSave({ CrudModelRef }) {
selection: 'multiple', selection: 'multiple',
}" }"
:crud-model="{ :crud-model="{
paginate: false, disableInfiniteScroll: true,
}" }"
v-model:selected="rowsSelected" v-model:selected="rowsSelected"
:create-as-dialog="false" :create-as-dialog="false"

View File

@ -27,7 +27,7 @@ function exprBuilder(param, value) {
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('salesOrdersTable.dateSend'), label: t('globals.landed'),
name: 'dateSend', name: 'dateSend',
field: 'dateSend', field: 'dateSend',
align: 'left', align: 'left',

View File

@ -11,7 +11,6 @@ salesClientsTable:
client: Client client: Client
salesOrdersTable: salesOrdersTable:
delete: Delete delete: Delete
dateSend: Send date
dateMake: Make date dateMake: Make date
client: Client client: Client
salesPerson: Salesperson salesPerson: Salesperson

View File

@ -11,7 +11,6 @@ salesClientsTable:
client: Cliente client: Cliente
salesOrdersTable: salesOrdersTable:
delete: Eliminar delete: Eliminar
dateSend: Fecha de envío
dateMake: Fecha de realización dateMake: Fecha de realización
client: Cliente client: Cliente
salesPerson: Comercial salesPerson: Comercial

View File

@ -184,6 +184,7 @@ function addOrder(value, field, params) {
:custom-tags="['tagGroups']" :custom-tags="['tagGroups']"
@remove="clearFilter" @remove="clearFilter"
:redirect="false" :redirect="false"
search-url="params"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'categoryFk'"> <strong v-if="tag.label === 'categoryFk'">

View File

@ -111,6 +111,7 @@ const columns = computed(() => [
component: 'select', component: 'select',
attrs: { attrs: {
url: 'Items', url: 'Items',
sortBy: 'name ASC ',
fields: ['id', 'name', 'subName'], fields: ['id', 'name', 'subName'],
}, },
columnField: { columnField: {

View File

@ -61,8 +61,8 @@ const workersOptions = ref([]);
</VnRow> </VnRow>
<VnRow> <VnRow>
<QCheckbox <QCheckbox
v-model="data.isSerious" v-model="data.isReal"
:label="t('supplier.basicData.isSerious')" :label="t('supplier.basicData.isReal')"
/> />
<QCheckbox <QCheckbox
v-model="data.isActive" v-model="data.isActive"

View File

@ -38,7 +38,7 @@ const filter = {
'payDemFk', 'payDemFk',
'payDay', 'payDay',
'isActive', 'isActive',
'isSerious', 'isReal',
'isTrucker', 'isTrucker',
'account', 'account',
], ],
@ -137,7 +137,7 @@ const getEntryQueryParams = (supplier) => {
<QTooltip>{{ t('Inactive supplier') }}</QTooltip> <QTooltip>{{ t('Inactive supplier') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="!supplier.isSerious" v-if="!supplier.isReal"
name="vn:supplierfalse" name="vn:supplierfalse"
color="primary" color="primary"
size="xs" size="xs"

View File

@ -67,7 +67,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
</VnLv> </VnLv>
<QCheckbox <QCheckbox
:label="t('supplier.summary.verified')" :label="t('supplier.summary.verified')"
v-model="supplier.isSerious" v-model="supplier.isReal"
:disable="true" :disable="true"
/> />
<QCheckbox <QCheckbox

View File

@ -16,12 +16,9 @@ import { useAcl } from 'src/composables/useAcl';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
import { toTimeFormat } from 'filters/date.js'; import { toTimeFormat } from 'filters/date.js';
const $props = defineProps({ const formData = defineModel({
formData: { type: Object,
type: Object, required: true,
required: true,
default: () => ({}),
},
}); });
const emit = defineEmits(['updateForm']); const emit = defineEmits(['updateForm']);
@ -40,7 +37,6 @@ const agenciesOptions = ref([]);
const zonesOptions = ref([]); const zonesOptions = ref([]);
const addresses = ref([]); const addresses = ref([]);
const zoneSelectRef = ref(); const zoneSelectRef = ref();
const formData = ref($props.formData);
watch( watch(
() => formData.value, () => formData.value,
@ -69,75 +65,44 @@ const zoneWhere = computed(() => {
: {}; : {};
}); });
const getLanded = async (params) => { async function getLanded(params) {
try { getDate(`Agencies/getLanded`, params);
const validParams = }
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
if (!validParams) return;
formData.value.zoneFk = null; async function getShipped(params) {
zonesOptions.value = []; getDate(`Agencies/getShipped`, params);
const { data } = await axios.get(`Agencies/getLanded`, { params }); }
if (data) {
formData.value.zoneFk = data.zoneFk; async function getDate(query, params) {
formData.value.landed = data.landed; for (const param in params) {
formData.value.shipped = params.shipped; if (!params[param]) return;
}
} catch (error) {
console.error(error);
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
} }
};
const getShipped = async (params) => { formData.value.zoneFk = null;
try { zonesOptions.value = [];
const validParams = const { data } = await axios.get(query, { params });
landed.value && addressId.value && agencyModeId.value && warehouseId.value; if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
if (!validParams) return;
formData.value.zoneFk = null; formData.value.zoneFk = data.zoneFk;
zonesOptions.value = []; if (data.landed) formData.value.landed = data.landed;
const { data } = await axios.get(`Agencies/getShipped`, { params }); if (data.shipped) formData.value.shipped = data.shipped;
if (data) { }
formData.value.zoneFk = data.zoneFk;
formData.value.landed = params.landed;
formData.value.shipped = data.shipped;
} else {
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
}
} catch (error) {
console.error(error);
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
}
};
const onChangeZone = async (zoneId) => { const onChangeZone = async (zoneId) => {
try { formData.value.agencyModeFk = null;
formData.value.agencyModeFk = null; const { data } = await axios.get(`Zones/${zoneId}`);
const { data } = await axios.get(`Zones/${zoneId}`); formData.value.agencyModeFk = data.agencyModeFk;
formData.value.agencyModeFk = data.agencyModeFk;
} catch (error) {
console.error(error);
}
}; };
const onChangeAddress = async (addressId) => { const onChangeAddress = async (addressId) => {
try { formData.value.nickname = null;
formData.value.nickname = null; const { data } = await axios.get(`Addresses/${addressId}`);
const { data } = await axios.get(`Addresses/${addressId}`); formData.value.nickname = data.nickname;
formData.value.nickname = data.nickname;
} catch (error) {
console.error(error);
}
}; };
const getClientDefaultAddress = async (clientId) => { const getClientDefaultAddress = async (clientId) => {
try { const { data } = await axios.get(`Clients/${clientId}`);
const { data } = await axios.get(`Clients/${clientId}`); if (data) addressId.value = data.defaultAddressFk;
if (data) addressId.value = data.defaultAddressFk;
} catch (error) {
console.error(error);
}
}; };
const clientAddressesList = async (value) => { const clientAddressesList = async (value) => {
@ -189,18 +154,26 @@ const clientId = computed({
}, },
}); });
const landed = computed({ function addDateParams(obj) {
get: () => formData.value?.landed, return {
set: (val) => { ...obj,
formData.value.landed = val; ...{
getShipped({
landed: val,
addressFk: formData.value?.addressFk, addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk, agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk, warehouseFk: formData.value?.warehouseFk,
}); },
}, };
}); }
async function setLanded(landed) {
if (!landed) return;
getShipped(addDateParams({ landed }));
}
async function setShipped(shipped) {
if (!shipped) return;
getLanded(addDateParams({ shipped }));
}
const agencyModeId = computed({ const agencyModeId = computed({
get: () => formData.value.agencyModeFk, get: () => formData.value.agencyModeFk,
@ -248,21 +221,6 @@ const warehouseId = computed({
}, },
}); });
const shipped = computed({
get: () => formData.value?.shipped,
set: (val) => {
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
val.setHours(0, 0, 0, 0);
formData.value.shipped = val;
getLanded({
shipped: val,
addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk,
});
},
});
const onFormModelInit = () => { const onFormModelInit = () => {
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk); if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
}; };
@ -463,18 +421,21 @@ async function getZone(options) {
v-model="formData.shipped" v-model="formData.shipped"
:required="true" :required="true"
:rules="validate('basicData.shipped')" :rules="validate('basicData.shipped')"
@update:model-value="setShipped"
/> />
<VnInputTime <VnInputTime
:label="t('basicData.shippedHour')" :label="t('basicData.shippedHour')"
v-model="formData.shipped" v-model="formData.shipped"
:required="true" :required="true"
:rules="validate('basicData.shippedHour')" :rules="validate('basicData.shippedHour')"
@update:model-value="setShipped"
/> />
<VnInputDate <VnInputDate
:label="t('basicData.landed')" :label="t('basicData.landed')"
v-model="formData.landed" v-model="formData.landed"
:required="true" :required="true"
:rules="validate('basicData.landed')" :rules="validate('basicData.landed')"
@update:model-value="setLanded"
/> />
</VnRow> </VnRow>
</QForm> </QForm>

View File

@ -70,60 +70,51 @@ const isFormInvalid = () => {
}; };
const getPriceDifference = async () => { const getPriceDifference = async () => {
try { const params = {
const params = { landed: formData.value.landed,
landed: formData.value.landed, addressId: formData.value.addressFk,
addressId: formData.value.addressFk, agencyModeId: formData.value.agencyModeFk,
agencyModeId: formData.value.agencyModeFk, zoneId: formData.value.zoneFk,
zoneId: formData.value.zoneFk, warehouseId: formData.value.warehouseFk,
warehouseId: formData.value.warehouseFk, shipped: formData.value.shipped,
shipped: formData.value.shipped, };
}; const { data } = await axios.post(
const { data } = await axios.post( `tickets/${formData.value.id}/priceDifference`,
`tickets/${formData.value.id}/priceDifference`, params
params );
); formData.value.sale = data;
formData.value.sale = data;
} catch (error) {
console.error(error);
}
}; };
const submit = async () => { const submit = async () => {
try { if (!formData.value.option) return notify(t('basicData.chooseAnOption'), 'negative');
if (!formData.value.option)
return notify(t('basicData.chooseAnOption'), 'negative');
const params = { const params = {
clientFk: formData.value.clientFk, clientFk: formData.value.clientFk,
nickname: formData.value.nickname, nickname: formData.value.nickname,
agencyModeFk: formData.value.agencyModeFk, agencyModeFk: formData.value.agencyModeFk,
addressFk: formData.value.addressFk, addressFk: formData.value.addressFk,
zoneFk: formData.value.zoneFk, zoneFk: formData.value.zoneFk,
warehouseFk: formData.value.warehouseFk, warehouseFk: formData.value.warehouseFk,
companyFk: formData.value.companyFk, companyFk: formData.value.companyFk,
shipped: formData.value.shipped, shipped: formData.value.shipped,
landed: formData.value.landed, landed: formData.value.landed,
isDeleted: formData.value.isDeleted, isDeleted: formData.value.isDeleted,
option: formData.value.option, option: formData.value.option,
isWithoutNegatives: formData.value.withoutNegatives, isWithoutNegatives: formData.value.withoutNegatives,
withWarningAccept: formData.value.withWarningAccept, withWarningAccept: formData.value.withWarningAccept,
keepPrice: false, keepPrice: false,
}; };
const { data } = await axios.post( const { data } = await axios.post(
`tickets/${formData.value.id}/componentUpdate`, `tickets/${formData.value.id}/componentUpdate`,
params params
); );
if (!data) return; if (!data) return;
const ticketToMove = data.id; const ticketToMove = data.id;
notify(t('basicData.unroutedTicket'), 'positive'); notify(t('basicData.unroutedTicket'), 'positive');
router.push({ name: 'TicketSummary', params: { id: ticketToMove } }); router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
} catch (error) {
console.error(error);
}
}; };
const submitWithNegatives = async () => { const submitWithNegatives = async () => {
@ -167,7 +158,7 @@ onBeforeMount(async () => await getTicketData());
<TicketBasicDataForm <TicketBasicDataForm
v-if="initialDataLoaded" v-if="initialDataLoaded"
@update-form="($event) => (formData = $event)" @update-form="($event) => (formData = $event)"
:form-data="formData" v-model="formData"
/> />
</QStep> </QStep>
<QStep :name="2" :title="t('basicData.priceDifference')"> <QStep :name="2" :title="t('basicData.priceDifference')">

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref, toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
@ -23,7 +23,6 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const route = useRoute();
const { push, currentRoute } = useRouter(); const { push, currentRoute } = useRouter();
const { dialog, notify } = useQuasar(); const { dialog, notify } = useQuasar();
@ -31,7 +30,7 @@ const { t } = useI18n();
const { openReport, sendEmail } = usePrintService(); const { openReport, sendEmail } = usePrintService();
const ticketSummary = useArrayData('TicketSummary'); const ticketSummary = useArrayData('TicketSummary');
const { ticket } = toRefs(props); const { ticket } = toRefs(props);
const ticketId = currentRoute.value.params.id; const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
const client = ref(); const client = ref();
const showTransferDialog = ref(false); const showTransferDialog = ref(false);
const showTurnDialog = ref(false); const showTurnDialog = ref(false);
@ -68,7 +67,7 @@ const actions = {
setWeight: async () => { setWeight: async () => {
try { try {
const invoiceIds = ( const invoiceIds = (
await axios.post(`Tickets/${ticketId}/setWeight`, { await axios.post(`Tickets/${ticketId.value}/setWeight`, {
weight: weight.value, weight: weight.value,
}) })
).data; ).data;
@ -86,7 +85,7 @@ const actions = {
}, },
remove: async () => { remove: async () => {
try { try {
await axios.post(`Tickets/${ticketId}/setDeleted`); await axios.post(`Tickets/${ticketId.value}/setDeleted`);
notify({ message: t('Ticket deleted'), type: 'positive' }); notify({ message: t('Ticket deleted'), type: 'positive' });
notify({ notify({
@ -176,14 +175,14 @@ function showSmsDialog(template, customData) {
} }
async function showSmsDialogWithChanges() { async function showSmsDialogWithChanges() {
const query = `TicketLogs/${ticketId}/getChanges`; const query = `TicketLogs/${ticketId.value}/getChanges`;
const response = await axios.get(query); const response = await axios.get(query);
showSmsDialog('orderChanges', { changes: response.data }); showSmsDialog('orderChanges', { changes: response.data });
} }
async function sendSms(body) { async function sendSms(body) {
await axios.post(`Tickets/${ticketId}/sendSms`, body); await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
notify({ notify({
message: 'Notification sent', message: 'Notification sent',
type: 'positive', type: 'positive',
@ -256,7 +255,10 @@ async function transferClient(client) {
clientFk: client, clientFk: client,
}; };
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params); const { data } = await axios.patch(
`Tickets/${ticketId.value}/transferClient`,
params
);
if (data) window.location.reload(); if (data) window.location.reload();
} }
@ -296,7 +298,10 @@ async function changeShippedHour(time) {
shipped: time, shipped: time,
}; };
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params); const { data } = await axios.post(
`Tickets/${ticketId.value}/updateEditableTicket`,
params
);
if (data) window.location.reload(); if (data) window.location.reload();
} }
@ -313,7 +318,7 @@ function openRecalculateDialog() {
} }
async function recalculateComponents() { async function recalculateComponents() {
await axios.post(`Tickets/${ticketId}/recalculateComponents`); await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
notify({ notify({
message: t('Data saved'), message: t('Data saved'),
type: 'positive', type: 'positive',
@ -336,11 +341,11 @@ async function handleInvoiceOutData() {
} }
async function docuwareDownload() { async function docuwareDownload() {
await axios.get(`Tickets/${ticketId}/docuwareDownload`); await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
} }
async function hasDocuware() { async function hasDocuware() {
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, { const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
fileCabinet: 'deliveryNote', fileCabinet: 'deliveryNote',
signed: true, signed: true,
}); });
@ -348,7 +353,6 @@ async function hasDocuware() {
} }
async function uploadDocuware(force) { async function uploadDocuware(force) {
console.log('force: ', force);
if (!force) if (!force)
return quasar return quasar
.dialog({ .dialog({
@ -372,11 +376,7 @@ async function uploadDocuware(force) {
</script> </script>
<template> <template>
<FetchData <FetchData
:url=" :url="`Tickets/${ticketId}/isEditable`"
route.path.startsWith('/ticket')
? `Tickets/${ticketId}/isEditable`
: `Tickets/${ticket}/isEditable`
"
auto-load auto-load
@on-fetch="handleFetchData" @on-fetch="handleFetchData"
/> />
@ -397,8 +397,6 @@ async function uploadDocuware(force) {
<VnSelect <VnSelect
url="Clients" url="Clients"
:fields="['id', 'name']" :fields="['id', 'name']"
option-label="name"
option-value="id"
v-model="client" v-model="client"
:label="t('Client')" :label="t('Client')"
auto-load auto-load

View File

@ -106,6 +106,13 @@ const columns = computed(() => [
format: (row) => row?.item?.name, format: (row) => row?.item?.name,
columnClass: 'expand', columnClass: 'expand',
}, },
{
align: 'left',
label: t('ticketSale.size'),
name: 'size',
format: (row) => row?.item?.size,
columnClass: 'expand',
},
{ {
align: 'left', align: 'left',
label: t('ticketSale.price'), label: t('ticketSale.price'),
@ -614,7 +621,7 @@ watch(
}" }"
:create-as-dialog="false" :create-as-dialog="false"
:crud-model="{ :crud-model="{
paginate: false, disableInfiniteScroll: true,
}" }"
:default-remove="false" :default-remove="false"
:default-reset="false" :default-reset="false"

View File

@ -20,6 +20,7 @@ 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 VnToSummary from 'src/components/ui/VnToSummary.vue'; import VnToSummary from 'src/components/ui/VnToSummary.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
const route = useRoute(); const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
@ -116,24 +117,36 @@ function toTicketUrl(section) {
{{ entity.nickname }} {{ entity.nickname }}
</div> </div>
</template> </template>
<template #header-right> <template #header-right="{ entity }">
<QBtnDropdown <div>
ref="stateBtnDropdownRef" <QBtnDropdown
color="black" ref="stateBtnDropdownRef"
text-color="white" color="black"
:label="t('globals.changeState')" text-color="white"
:disable="!isEditable()" :label="t('globals.changeState')"
> :disable="!isEditable()"
<VnSelect >
:options="editableStates" <VnSelect
hide-selected :options="editableStates"
option-label="name" hide-selected
option-value="code" option-label="name"
hide-dropdown-icon option-value="code"
focus-on-mount hide-dropdown-icon
@update:model-value="changeState" focus-on-mount
/> @update:model-value="changeState"
</QBtnDropdown> />
</QBtnDropdown>
<QBtn color="white" dense flat icon="more_vert" round size="md">
<QTooltip>
{{ t('components.cardDescriptor.moreOptions') }}
</QTooltip>
<QMenu>
<QList>
<TicketDescriptorMenu :ticket="entity" />
</QList>
</QMenu>
</QBtn>
</div>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">

View File

@ -47,7 +47,7 @@ const getGroupedStates = (data) => {
/> />
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load /> <FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load />
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load /> <FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -460,18 +460,18 @@ function setReference(data) {
auto-load auto-load
/> />
<VnSearchbar <VnSearchbar
data-key="Ticket" data-key="TicketList"
:label="t('Search ticket')" :label="t('Search ticket')"
:info="t('You can search by ticket id or alias')" :info="t('You can search by ticket id or alias')"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<TicketFilter data-key="Ticket" /> <TicketFilter data-key="TicketList" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Ticket" data-key="TicketList"
url="Tickets/filter" url="Tickets/filter"
:create="{ :create="{
urlCreate: 'Tickets/new', urlCreate: 'Tickets/new',

View File

@ -48,6 +48,7 @@ ticketSale:
shipped: Shipped shipped: Shipped
agency: Agency agency: Agency
address: Address address: Address
size: Size
advanceTickets: advanceTickets:
preparation: Preparation preparation: Preparation
origin: Origin origin: Origin

View File

@ -184,6 +184,7 @@ ticketSale:
shipped: F. Envío shipped: F. Envío
agency: Agencia agency: Agencia
address: Consignatario address: Consignatario
size: Medida
ticketComponents: ticketComponents:
item: Artículo item: Artículo
description: Descripción description: Descripción

View File

@ -24,7 +24,7 @@ defineExpose({ states });
<template> <template>
<FetchData url="warehouses" @on-fetch="(data) => (states = data)" auto-load /> <FetchData url="warehouses" @on-fetch="(data) => (states = data)" auto-load />
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`params.${tag.label}`) }}: </strong>

View File

@ -14,6 +14,7 @@ import WorkerFilter from '../WorkerFilter.vue';
url: 'Workers/filter', url: 'Workers/filter',
label: 'Search worker', label: 'Search worker',
info: 'You can search by worker id or name', info: 'You can search by worker id or name',
order: 'id DESC',
}" }"
:redirect-on-error="true" :redirect-on-error="true"
/> />

View File

@ -69,7 +69,7 @@ function setNotifications(data) {
:default-reset="false" :default-reset="false"
:default-remove="false" :default-remove="false"
:default-save="false" :default-save="false"
@on-fetch="setNotifications" @on-fetch="(data) => data && setNotifications(data)"
search-url="notifications" search-url="notifications"
> >
<template #body> <template #body>

View File

@ -169,7 +169,7 @@ async function autofillBic(worker) {
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="Worker" data-key="WorkerList"
:label="t('Search worker')" :label="t('Search worker')"
:info="t('You can search by worker id or name')" :info="t('You can search by worker id or name')"
/> />
@ -191,13 +191,13 @@ async function autofillBic(worker) {
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<WorkerFilter data-key="Worker" /> <WorkerFilter data-key="WorkerList" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
v-if="defaultPayMethod" v-if="defaultPayMethod"
ref="tableRef" ref="tableRef"
data-key="Worker" data-key="WorkerList"
url="Workers/filter" url="Workers/filter"
:create="{ :create="{
urlCreate: 'Workers/new', urlCreate: 'Workers/new',

View File

@ -26,7 +26,7 @@ const exprBuilder = (param, value) => {
<template> <template>
<VnSearchbar <VnSearchbar
data-key="Zones" data-key="ZonesList"
url="Zones" url="Zones"
:filter="{ :filter="{
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, include: { relation: 'agencyMode', scope: { fields: ['name'] } },

View File

@ -32,7 +32,6 @@ const agencies = ref([]);
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:hidden-tags="['search']" :hidden-tags="['search']"
search-url="table"
> >
<template #tags="{ tag }"> <template #tags="{ tag }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">

View File

@ -139,12 +139,12 @@ onMounted(() => (stateStore.rightDrawer = true));
<ZoneSearchbar /> <ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneFilterPanel data-key="Zones" /> <ZoneFilterPanel data-key="ZonesList" />
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="Zones" data-key="ZonesList"
url="Zones" url="Zones"
:create="{ :create="{
urlCreate: 'Zones', urlCreate: 'Zones',

View File

@ -8,7 +8,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
userFilter: {}, userFilter: {},
userParams: {}, userParams: {},
url: '', url: '',
limit: 10, limit: 20,
skip: 0, skip: 0,
order: '', order: '',
isLoading: false, isLoading: false,

View File

@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
import * as vueRouter from 'vue-router'; import * as vueRouter from 'vue-router';
describe('useArrayData', () => { describe('useArrayData', () => {
const filter = '{"limit":10,"skip":0}'; const filter = '{"limit":20,"skip":0}';
const params = { supplierFk: 2 }; const params = { supplierFk: 2 };
beforeEach(() => { beforeEach(() => {
vi.spyOn(useRouter(), 'replace'); vi.spyOn(useRouter(), 'replace');