Merge pull request 'solveConflicts_test_to_dev' (!957) from solveConflicts_test_to_dev into dev
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #957 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
09be2d4d41
|
@ -77,7 +77,7 @@ const isLoading = ref(false);
|
|||
const hasChanges = ref(false);
|
||||
const originalData = ref();
|
||||
const vnPaginateRef = ref();
|
||||
const formData = ref();
|
||||
const formData = ref([]);
|
||||
const saveButtonRef = ref(null);
|
||||
const watchChanges = ref();
|
||||
const formUrl = computed(() => $props.url);
|
||||
|
|
|
@ -25,7 +25,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -49,7 +49,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
redirect: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -44,7 +44,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
default: 20,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
const store = arrayData.store;
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.autoLoad) await fetch();
|
||||
if (props.autoLoad && !store.data?.length) await fetch();
|
||||
mounted.value = true;
|
||||
});
|
||||
|
||||
|
@ -115,7 +115,11 @@ watch(
|
|||
|
||||
watch(
|
||||
() => store.data,
|
||||
(data) => emit('onChange', data)
|
||||
(data) => {
|
||||
if (!mounted.value) return;
|
||||
emit('onChange', data);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
|
@ -45,7 +45,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
default: 20,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
|
|
@ -271,7 +271,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const pushUrl = { path: to };
|
||||
if (to.endsWith('/list') || to.endsWith('/'))
|
||||
pushUrl.query = newUrl.query;
|
||||
destroy();
|
||||
else destroy();
|
||||
return router.push(pushUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountUsers"
|
||||
data-key="AccountList"
|
||||
:expr-builder="exprBuilder"
|
||||
:label="t('account.search')"
|
||||
:info="t('account.searchInfo')"
|
||||
|
@ -112,12 +112,12 @@ const exprBuilder = (param, value) => {
|
|||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<AccountFilter data-key="AccountUsers" />
|
||||
<AccountFilter data-key="AccountList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AccountUsers"
|
||||
data-key="AccountList"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
|
|
|
@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="Roles"
|
||||
data-key="AccountRolesList"
|
||||
:expr-builder="exprBuilder"
|
||||
:label="t('role.searchRoles')"
|
||||
:info="t('role.searchInfo')"
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Roles"
|
||||
data-key="AccountRolesList"
|
||||
:url="`VnRoles`"
|
||||
:create="{
|
||||
urlCreate: 'VnRoles',
|
||||
|
|
|
@ -9,7 +9,7 @@ const { t } = useI18n();
|
|||
<VnCard
|
||||
data-key="Role"
|
||||
:descriptor="RoleDescriptor"
|
||||
search-data-key="AccountRoles"
|
||||
search-data-key="AccountRolesList"
|
||||
:searchbar-props="{
|
||||
url: 'VnRoles',
|
||||
label: t('role.searchRoles'),
|
||||
|
|
|
@ -23,7 +23,7 @@ defineExpose({ states });
|
|||
|
||||
<template>
|
||||
<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 }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -37,6 +37,9 @@ const entityId = computed(() => {
|
|||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
||||
const debtWarning = computed(() => {
|
||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -117,7 +120,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
|||
v-if="customer.debt > customer.credit"
|
||||
name="vn:risk"
|
||||
size="xs"
|
||||
color="primary"
|
||||
:color="debtWarning"
|
||||
>
|
||||
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
||||
</QIcon>
|
||||
|
|
|
@ -11,10 +11,24 @@ defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const handleSalesModelValue = (val) => ({
|
||||
or: [
|
||||
{ id: val },
|
||||
{ name: val },
|
||||
{ nickname: { like: '%' + val + '%' } },
|
||||
{ code: { like: `${val}%` } },
|
||||
],
|
||||
});
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
return {
|
||||
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table">
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
@ -52,14 +66,18 @@ defineProps({
|
|||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
url="Workers/activeWithInheritedRole"
|
||||
:where="{ role: 'salesPerson' }"
|
||||
url="Workers/search"
|
||||
:params="{
|
||||
departmentCodes: ['VT'],
|
||||
}"
|
||||
auto-load
|
||||
:label="t('Salesperson')"
|
||||
:expr-builder="exprBuilder"
|
||||
v-model="params.salesPersonFk"
|
||||
@update:model-value="searchFn()"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
sort-by="nickname ASC"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
@ -67,7 +85,19 @@ defineProps({
|
|||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
:input-debounce="0"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }},{{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template></VnSelect
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
|
|
|
@ -394,16 +394,16 @@ function handleLocation(data, location) {
|
|||
<VnSearchbar
|
||||
:info="t('You can search by customer id or name')"
|
||||
:label="t('Search customer')"
|
||||
data-key="Customer"
|
||||
data-key="CustomerList"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<CustomerFilter data-key="Customer" />
|
||||
<CustomerFilter data-key="CustomerList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Customer"
|
||||
data-key="CustomerList"
|
||||
url="Clients/filter"
|
||||
:create="{
|
||||
urlCreate: 'Clients/createWithUser',
|
||||
|
|
|
@ -23,6 +23,7 @@ const incoterms = ref([]);
|
|||
const customsAgents = ref([]);
|
||||
const observationTypes = ref([]);
|
||||
const notes = ref([]);
|
||||
let originalNotes = [];
|
||||
const deletes = ref([]);
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
@ -42,7 +43,8 @@ const getData = async (observations) => {
|
|||
});
|
||||
|
||||
if (data.length) {
|
||||
notes.value = data
|
||||
originalNotes = data;
|
||||
notes.value = originalNotes
|
||||
.map((observation) => {
|
||||
const type = observationTypes.value.find(
|
||||
(type) => type.id === observation.observationTypeFk
|
||||
|
@ -81,14 +83,24 @@ const deleteNote = (id, index) => {
|
|||
};
|
||||
|
||||
const onDataSaved = async () => {
|
||||
let payload = {};
|
||||
const creates = notes.value.filter((note) => note.$isNew);
|
||||
if (creates.length) {
|
||||
payload.creates = creates;
|
||||
}
|
||||
if (deletes.value.length) {
|
||||
payload.deletes = deletes.value;
|
||||
}
|
||||
let payload = {
|
||||
creates: notes.value.filter((note) => note.$isNew),
|
||||
deletes: deletes.value,
|
||||
updates: notes.value
|
||||
.filter((note) =>
|
||||
originalNotes.some(
|
||||
(oNote) =>
|
||||
oNote.id === note.id &&
|
||||
(note.description !== oNote.description ||
|
||||
note.observationTypeFk !== oNote.observationTypeFk)
|
||||
)
|
||||
)
|
||||
.map((note) => ({
|
||||
data: note,
|
||||
where: { id: note.id },
|
||||
})),
|
||||
};
|
||||
|
||||
await axios.post('AddressObservations/crud', payload);
|
||||
notes.value = [];
|
||||
deletes.value = [];
|
||||
|
|
|
@ -122,7 +122,7 @@ const cols = computed(() => [
|
|||
:columns="cols"
|
||||
:right-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
:auto-load="!!$route.query.params"
|
||||
:auto-load="!!$route.query.table"
|
||||
>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
|
|
@ -182,11 +182,11 @@ watchEffect(selectedRows);
|
|||
<VnSearchbar
|
||||
:info="t('youCanSearchByInvoiceReference')"
|
||||
:label="t('searchInvoice')"
|
||||
data-key="invoiceOut"
|
||||
data-key="invoiceOutList"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<InvoiceOutFilter data-key="invoiceOut" />
|
||||
<InvoiceOutFilter data-key="invoiceOutList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnSubToolbar>
|
||||
|
@ -203,7 +203,7 @@ watchEffect(selectedRows);
|
|||
</VnSubToolbar>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="invoiceOut"
|
||||
data-key="invoiceOutList"
|
||||
:url="`${MODEL}/filter`"
|
||||
:create="{
|
||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||
|
|
|
@ -64,8 +64,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('globals.name'),
|
||||
field: 'name',
|
||||
name: 'description',
|
||||
name: 'name',
|
||||
...defaultColumnAttrs,
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
|
@ -426,7 +425,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
:default-save="false"
|
||||
data-key="ItemFixedPrices"
|
||||
url="FixedPrices/filter"
|
||||
:order="['description DESC']"
|
||||
:order="['itemFk DESC', 'name DESC']"
|
||||
save-url="FixedPrices/crud"
|
||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||
ref="tableRef"
|
||||
|
@ -480,7 +479,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
<template #column-name="{ row }">
|
||||
<span class="link">
|
||||
{{ row.name }}
|
||||
</span>
|
||||
|
|
|
@ -17,21 +17,6 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const itemTypeWorkersOptions = ref([]);
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
return { 'i.name': { like: `%${value}%` } };
|
||||
case 'itemFk':
|
||||
case 'warehouseFk':
|
||||
case 'rate2':
|
||||
case 'rate3':
|
||||
param = `fp.${param}`;
|
||||
return { [param]: value };
|
||||
case 'minPrice':
|
||||
param = `i.${param}`;
|
||||
return { [param]: value };
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -66,7 +51,7 @@ const exprBuilder = (param, value) => {
|
|||
url="Warehouses"
|
||||
auto-load
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
:label="t('components.itemsFilterPanel.warehouseFk')"
|
||||
:label="t('globals.warehouse')"
|
||||
v-model="params.warehouseFk"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
|
@ -14,7 +14,6 @@ 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();
|
||||
|
@ -142,8 +141,13 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
async function fetchClientAddress(id, formData) {
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk);
|
||||
});
|
||||
async function fetchClientAddress(id, formData = {}) {
|
||||
const { data } = await axios.get(`Clients/${id}`, {
|
||||
params: { filter: { include: { relation: 'addresses' } } },
|
||||
});
|
||||
|
@ -170,13 +174,6 @@ 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 />
|
||||
|
@ -194,7 +191,7 @@ onMounted(() => {
|
|||
urlCreate: 'Orders/new',
|
||||
title: t('module.cerateOrder'),
|
||||
onDataSaved: (url) => {
|
||||
tableRef.redirect(url);
|
||||
tableRef.redirect(`${url}/catalog`);
|
||||
},
|
||||
formInitialData: {
|
||||
active: true,
|
||||
|
|
|
@ -16,12 +16,9 @@ import { useAcl } from 'src/composables/useAcl';
|
|||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
const formData = defineModel({
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
@ -40,7 +37,6 @@ const agenciesOptions = ref([]);
|
|||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const zoneSelectRef = ref();
|
||||
const formData = ref($props.formData);
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
|
@ -69,47 +65,28 @@ const zoneWhere = computed(() => {
|
|||
: {};
|
||||
});
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
async function getLanded(params) {
|
||||
getDate(`Agencies/getLanded`, params);
|
||||
}
|
||||
|
||||
async function getShipped(params) {
|
||||
getDate(`Agencies/getShipped`, params);
|
||||
}
|
||||
|
||||
async function getDate(query, params) {
|
||||
for (const param in params) {
|
||||
if (!params[param]) return;
|
||||
}
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
||||
if (data) {
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
formData.value.landed = data.landed;
|
||||
formData.value.shipped = params.shipped;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
};
|
||||
const { data } = await axios.get(query, { params });
|
||||
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
|
||||
const getShipped = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
||||
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');
|
||||
}
|
||||
};
|
||||
if (data.landed) formData.value.landed = data.landed;
|
||||
if (data.shipped) formData.value.shipped = data.shipped;
|
||||
}
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
formData.value.agencyModeFk = null;
|
||||
|
@ -177,18 +154,26 @@ const clientId = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const landed = computed({
|
||||
get: () => formData.value?.landed,
|
||||
set: (val) => {
|
||||
formData.value.landed = val;
|
||||
getShipped({
|
||||
landed: val,
|
||||
function addDateParams(obj) {
|
||||
return {
|
||||
...obj,
|
||||
...{
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
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({
|
||||
get: () => formData.value.agencyModeFk,
|
||||
|
@ -236,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 = () => {
|
||||
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||
};
|
||||
|
@ -451,18 +421,21 @@ async function getZone(options) {
|
|||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('ticketList.shipped')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shippedHour')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
:required="true"
|
||||
:rules="validate('basicData.landed')"
|
||||
@update:model-value="setLanded"
|
||||
/>
|
||||
</VnRow>
|
||||
</QForm>
|
||||
|
|
|
@ -158,7 +158,7 @@ onBeforeMount(async () => await getTicketData());
|
|||
<TicketBasicDataForm
|
||||
v-if="initialDataLoaded"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
:form-data="formData"
|
||||
v-model="formData"
|
||||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
|
|
|
@ -47,7 +47,7 @@ const getGroupedStates = (data) => {
|
|||
/>
|
||||
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = 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 }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -18,12 +18,13 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
|||
import TicketFilter from './TicketFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import { toTimeFormat } from 'src/filters/date';
|
||||
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
|
@ -40,23 +41,18 @@ from.setDate(from.getDate() - 7);
|
|||
const to = Date.vnNew();
|
||||
to.setHours(23, 59, 0, 0);
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
||||
const userParams = {
|
||||
from: null,
|
||||
to: null,
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initializeFromQuery();
|
||||
stateStore.rightDrawer = true;
|
||||
if (!route.query.createForm) return;
|
||||
onClientSelected(JSON.parse(route.query.createForm));
|
||||
});
|
||||
// Método para inicializar las variables desde la query string
|
||||
const initializeFromQuery = () => {
|
||||
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
||||
|
||||
// Asigna los valores a las variables correspondientes
|
||||
from.value = query.from || from.toISOString();
|
||||
to.value = query.to || to.toISOString();
|
||||
Object.assign(userParams, { from, to });
|
||||
|
@ -213,13 +209,19 @@ const columns = computed(() => [
|
|||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, TicketSummary),
|
||||
action: (row, evt) => {
|
||||
if (evt && evt.ctrlKey) {
|
||||
const url = router.resolve({
|
||||
params: { id: row.id },
|
||||
name: 'TicketCard',
|
||||
}).href;
|
||||
window.open(url, '_blank');
|
||||
} else viewSummary(row.id, TicketSummary);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function redirectToLines(id) {
|
||||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
|
@ -456,24 +458,24 @@ function setReference(data) {
|
|||
auto-load
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="Ticket"
|
||||
data-key="TicketList"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketFilter data-key="Ticket" />
|
||||
<TicketFilter data-key="TicketList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Ticket"
|
||||
data-key="TicketList"
|
||||
url="Tickets/filter"
|
||||
:create="{
|
||||
urlCreate: 'Tickets/new',
|
||||
title: t('ticketList.createTicket'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
formInitialData: { clientId: null },
|
||||
}"
|
||||
default-mode="table"
|
||||
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
||||
|
@ -575,17 +577,17 @@ function setReference(data) {
|
|||
</span>
|
||||
</template>
|
||||
<template #column-stateFk="{ row }">
|
||||
<span v-if="getColor(row)">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</span>
|
||||
<span v-else-if="row.state === 'Entregado'">
|
||||
<span v-if="row.refFk">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.refFk }}
|
||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||
</span>
|
||||
</span>
|
||||
<span v-else-if="getColor(row)">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ row.state }}
|
||||
</span>
|
||||
|
@ -617,6 +619,7 @@ function setReference(data) {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
required
|
||||
@update:model-value="(client) => onClientSelected(data)"
|
||||
:sort-by="'id ASC'"
|
||||
>
|
||||
|
@ -643,6 +646,7 @@ function setReference(data) {
|
|||
option-label="nickname"
|
||||
hide-selected
|
||||
map-options
|
||||
required
|
||||
:disable="!data.clientId"
|
||||
:sort-by="'isActive DESC'"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
|
@ -693,6 +697,7 @@ function setReference(data) {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
required
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
|
@ -706,7 +711,6 @@ function setReference(data) {
|
|||
option-value="agencyModeFk"
|
||||
option-label="agencyMode"
|
||||
hide-selected
|
||||
:disable="!data.clientId || !data.landed || !data.warehouseId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
@ -842,7 +846,14 @@ function setReference(data) {
|
|||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.disabled,
|
||||
.disabled *,
|
||||
[disabled],
|
||||
[disabled] * {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Search ticket: Buscar ticket
|
||||
|
|
|
@ -205,6 +205,7 @@ const onThermographCreated = async (data) => {
|
|||
}"
|
||||
sort-by="thermographFk ASC"
|
||||
option-label="thermographFk"
|
||||
option-filter-value="thermographFk"
|
||||
:disable="viewAction === 'edit'"
|
||||
:tooltip="t('New thermograph')"
|
||||
:roles-allowed-to-create="['logistic']"
|
||||
|
|
|
@ -24,7 +24,7 @@ defineExpose({ states });
|
|||
|
||||
<template>
|
||||
<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 }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -14,6 +14,7 @@ import WorkerFilter from '../WorkerFilter.vue';
|
|||
url: 'Workers/filter',
|
||||
label: 'Search worker',
|
||||
info: 'You can search by worker id or name',
|
||||
order: 'id DESC',
|
||||
}"
|
||||
:redirect-on-error="true"
|
||||
/>
|
||||
|
|
|
@ -70,7 +70,7 @@ function setNotifications(data) {
|
|||
:default-reset="false"
|
||||
:default-remove="false"
|
||||
:default-save="false"
|
||||
@on-fetch="setNotifications"
|
||||
@on-fetch="(data) => data && setNotifications(data)"
|
||||
search-url="notifications"
|
||||
>
|
||||
<template #body>
|
||||
|
|
|
@ -20,12 +20,13 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="zone"
|
||||
base-url="Zones"
|
||||
:base-url="notIsLocations('Zones', undefined)"
|
||||
:descriptor="ZoneDescriptor"
|
||||
:filter-panel="ZoneFilterPanel"
|
||||
:search-data-key="notIsLocations('ZoneList', 'ZoneLocations')"
|
||||
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
|
||||
:search-data-key="notIsLocations('ZoneList', undefined)"
|
||||
:custom-url="`Zones/${route.params?.id}/getLeaves`"
|
||||
:searchbar-props="{
|
||||
url: 'Zones',
|
||||
url: notIsLocations('Zones', 'ZoneLocations'),
|
||||
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
|
||||
info: t('list.searchInfo'),
|
||||
whereFilter: notIsLocations((value) => {
|
||||
|
|
|
@ -5,6 +5,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
const props = defineProps({
|
||||
rootLabel: {
|
||||
|
@ -33,22 +34,23 @@ const state = useState();
|
|||
const treeRef = ref();
|
||||
const expanded = ref([]);
|
||||
|
||||
const arrayData = useArrayData('ZoneLocations', {
|
||||
url: `Zones/${route.params.id}/getLeaves`,
|
||||
const datakey = 'ZoneLocations';
|
||||
const url = computed(() => `Zones/${route.params.id}/getLeaves`);
|
||||
const arrayData = useArrayData(datakey, {
|
||||
url: url.value,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const storeData = computed(() => store.data);
|
||||
|
||||
const nodes = ref([
|
||||
{
|
||||
const defaultNode = {
|
||||
id: null,
|
||||
name: props.rootLabel,
|
||||
sons: true,
|
||||
tickable: false,
|
||||
noTick: true,
|
||||
children: [{}],
|
||||
},
|
||||
]);
|
||||
};
|
||||
const nodes = ref([defaultNode]);
|
||||
|
||||
const _tickedNodes = computed({
|
||||
get: () => props.tickedNodes,
|
||||
|
@ -128,6 +130,7 @@ function getNodeIds(node) {
|
|||
|
||||
watch(storeData, async (val) => {
|
||||
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
|
||||
if (!nodes.value[0]) nodes.value = [defaultNode];
|
||||
nodes.value[0].childs = [...val];
|
||||
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
||||
state.set('Tree', [...fetchedNodeKeys]);
|
||||
|
@ -193,6 +196,7 @@ onUnmounted(() => {
|
|||
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
||||
</template>
|
||||
</VnInput>
|
||||
<VnSearchbar :data-key="datakey" :url="url" :redirect="false" />
|
||||
<QTree
|
||||
ref="treeRef"
|
||||
:nodes="nodes"
|
||||
|
|
|
@ -26,7 +26,7 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="Zones"
|
||||
data-key="ZonesList"
|
||||
url="Zones"
|
||||
:filter="{
|
||||
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
|
|
|
@ -32,7 +32,6 @@ const agencies = ref([]);
|
|||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:hidden-tags="['search']"
|
||||
search-url="table"
|
||||
>
|
||||
<template #tags="{ tag }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
|
|
@ -139,12 +139,12 @@ onMounted(() => (stateStore.rightDrawer = true));
|
|||
<ZoneSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<ZoneFilterPanel data-key="Zones" />
|
||||
<ZoneFilterPanel data-key="ZonesList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Zones"
|
||||
data-key="ZonesList"
|
||||
url="Zones"
|
||||
:create="{
|
||||
urlCreate: 'Zones',
|
||||
|
|
|
@ -8,7 +8,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
|||
userFilter: {},
|
||||
userParams: {},
|
||||
url: '',
|
||||
limit: 10,
|
||||
limit: 20,
|
||||
skip: 0,
|
||||
order: '',
|
||||
isLoading: false,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
|
|||
import * as vueRouter from 'vue-router';
|
||||
|
||||
describe('useArrayData', () => {
|
||||
const filter = '{"limit":10,"skip":0}';
|
||||
const filter = '{"limit":20,"skip":0}';
|
||||
const params = { supplierFk: 2 };
|
||||
beforeEach(() => {
|
||||
vi.spyOn(useRouter(), 'replace');
|
||||
|
|
Loading…
Reference in New Issue