Compare commits
No commits in common. "7021c226b5e566c58aa44832bc42a69fe4c8265b" and "567ec689adcfcb79e698b63feeda9452f9369599" have entirely different histories.
7021c226b5
...
567ec689ad
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.50.0",
|
||||
"version": "24.44.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
@ -64,4 +64,4 @@
|
|||
"vite": "^5.1.4",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
<script setup>
|
||||
import { reactive, ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
import VnInputDate from './common/VnInputDate.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
const manualInvoiceFormData = reactive({
|
||||
maxShipped: Date.vnNew(),
|
||||
});
|
||||
|
||||
const formModelPopupRef = ref();
|
||||
const invoiceOutSerialsOptions = ref([]);
|
||||
const taxAreasOptions = ref([]);
|
||||
const ticketsOptions = ref([]);
|
||||
const clientsOptions = ref([]);
|
||||
const isLoading = computed(() => formModelPopupRef.value?.isLoading);
|
||||
|
||||
const onDataSaved = async (formData, requestResponse) => {
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
if (requestResponse && requestResponse.id)
|
||||
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="InvoiceOutSerials"
|
||||
:filter="{ where: { code: { neq: 'R' } }, order: ['code'] }"
|
||||
@on-fetch="(data) => (invoiceOutSerialsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="TaxAreas"
|
||||
:filter="{ order: ['code'] }"
|
||||
@on-fetch="(data) => (taxAreasOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModelPopup
|
||||
ref="formModelPopupRef"
|
||||
:title="t('Create manual invoice')"
|
||||
url-create="InvoiceOuts/createManualInvoice"
|
||||
model="invoiceOut"
|
||||
:form-initial-data="manualInvoiceFormData"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<span v-if="isLoading" class="text-primary invoicing-text">
|
||||
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
|
||||
{{ t('Invoicing in progress...') }}
|
||||
</span>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Ticket')"
|
||||
:options="ticketsOptions"
|
||||
hide-selected
|
||||
option-label="id"
|
||||
option-value="id"
|
||||
v-model="data.ticketFk"
|
||||
@update:model-value="data.clientFk = null"
|
||||
url="Tickets"
|
||||
:where="{ refFk: null }"
|
||||
:fields="['id', 'nickname']"
|
||||
:filter-options="{ order: 'shipped DESC' }"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<span class="row items-center" style="max-width: max-content">{{
|
||||
t('Or')
|
||||
}}</span>
|
||||
<VnSelect
|
||||
:label="t('Client')"
|
||||
:options="clientsOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.clientFk"
|
||||
@update:model-value="data.ticketFk = null"
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
:filter-options="{ order: 'name ASC' }"
|
||||
/>
|
||||
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Serial')"
|
||||
:options="invoiceOutSerialsOptions"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="code"
|
||||
v-model="data.serial"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('Area')"
|
||||
:options="taxAreasOptions"
|
||||
hide-selected
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
v-model="data.taxArea"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Reference')"
|
||||
type="textarea"
|
||||
v-model="data.reference"
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.invoicing-text {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: $primary;
|
||||
font-size: 24px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Create manual invoice: Crear factura manual
|
||||
Ticket: Ticket
|
||||
Client: Cliente
|
||||
Max date: Fecha límite
|
||||
Serial: Serie
|
||||
Area: Area
|
||||
Reference: Referencia
|
||||
Or: O
|
||||
Invoicing in progress...: Facturación en progreso...
|
||||
</i18n>
|
|
@ -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: 'table',
|
||||
default: 'params',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'table',
|
||||
default: 'params',
|
||||
},
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -162,7 +162,9 @@ onMounted(() => {
|
|||
: $props.defaultMode;
|
||||
stateStore.rightDrawer = quasar.screen.gt.xs;
|
||||
columnsVisibilitySkipped.value = [
|
||||
...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name),
|
||||
...splittedColumns.value.columns
|
||||
.filter((c) => c.visible == false)
|
||||
.map((c) => c.name),
|
||||
...['tableActions'],
|
||||
];
|
||||
createForm.value = $props.create;
|
||||
|
@ -235,7 +237,7 @@ function splitColumns(columns) {
|
|||
if (col.create) splittedColumns.value.create.push(col);
|
||||
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
||||
if ($props.isEditable && col.disable == null) col.disable = false;
|
||||
if ($props.useModel && col.columnFilter !== false)
|
||||
if ($props.useModel && col.columnFilter != false)
|
||||
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
||||
splittedColumns.value.columns.push(col);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<script setup>
|
||||
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
|
||||
import { onMounted, watch, computed, ref } from 'vue';
|
||||
import { date } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useAttrs } from 'vue';
|
||||
import VnDate from './VnDate.vue';
|
||||
import { useRequired } from 'src/composables/useRequired';
|
||||
|
||||
|
|
|
@ -2,12 +2,5 @@
|
|||
const model = defineModel({ type: Boolean, required: true });
|
||||
</script>
|
||||
<template>
|
||||
<QRadio
|
||||
v-model="model"
|
||||
v-bind="$attrs"
|
||||
dense
|
||||
:dark="true"
|
||||
class="q-mr-sm"
|
||||
size="xs"
|
||||
/>
|
||||
<QRadio v-model="model" v-bind="$attrs" dense :dark="true" class="q-mr-sm" />
|
||||
</template>
|
||||
|
|
|
@ -83,7 +83,7 @@ async function fetch() {
|
|||
<slot name="header" :entity="entity" dense>
|
||||
<VnLv :label="`${entity.id} -`" :value="entity.name" />
|
||||
</slot>
|
||||
<slot name="header-right" :entity="entity">
|
||||
<slot name="header-right">
|
||||
<span></span>
|
||||
</slot>
|
||||
</div>
|
||||
|
|
|
@ -37,7 +37,7 @@ const $props = defineProps({
|
|||
},
|
||||
hiddenTags: {
|
||||
type: Array,
|
||||
default: () => ['filter', 'or', 'and'],
|
||||
default: () => ['filter', 'search', 'or', 'and'],
|
||||
},
|
||||
customTags: {
|
||||
type: Array,
|
||||
|
@ -49,7 +49,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'table',
|
||||
default: 'params',
|
||||
},
|
||||
redirect: {
|
||||
type: Boolean,
|
||||
|
@ -61,6 +61,7 @@ const emit = defineEmits([
|
|||
'update:modelValue',
|
||||
'refresh',
|
||||
'clear',
|
||||
'search',
|
||||
'init',
|
||||
'remove',
|
||||
'setUserParams',
|
||||
|
|
|
@ -44,7 +44,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 20,
|
||||
default: 10,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
const store = arrayData.store;
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.autoLoad && !store.data?.length) await fetch();
|
||||
if (props.autoLoad) await fetch();
|
||||
mounted.value = true;
|
||||
});
|
||||
|
||||
|
@ -115,11 +115,7 @@ watch(
|
|||
|
||||
watch(
|
||||
() => store.data,
|
||||
(data) => {
|
||||
if (!mounted.value) return;
|
||||
emit('onChange', data);
|
||||
},
|
||||
{ immediate: true }
|
||||
(data) => emit('onChange', data)
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="vn-row q-gutter-md">
|
||||
<div class="vn-row q-gutter-md q-mb-md">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
@ -18,9 +18,6 @@
|
|||
&:not(.wrap) {
|
||||
flex-direction: column;
|
||||
}
|
||||
&[fixed] {
|
||||
flex-direction: row;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -45,7 +45,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 20,
|
||||
default: 10,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
|
|
@ -75,10 +75,18 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
limit: store.limit,
|
||||
};
|
||||
|
||||
let exprFilter;
|
||||
let userParams = { ...store.userParams };
|
||||
if (store?.exprBuilder) {
|
||||
const where = buildFilter(userParams, (param, value) => {
|
||||
const res = store.exprBuilder(param, value);
|
||||
if (res) delete userParams[param];
|
||||
return res;
|
||||
});
|
||||
exprFilter = where ? { where } : null;
|
||||
}
|
||||
|
||||
Object.assign(filter, store.userFilter);
|
||||
|
||||
Object.assign(filter, store.userFilter, exprFilter);
|
||||
let where;
|
||||
if (filter?.where || store.filter?.where)
|
||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||
|
@ -88,28 +96,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
Object.assign(params, userParams);
|
||||
params.filter.skip = store.skip;
|
||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||
if (store.order?.length) params.filter.order = [...store.order];
|
||||
if (store.order && store.order.length) params.filter.order = store.order;
|
||||
else delete params.filter.order;
|
||||
|
||||
store.currentFilter = JSON.parse(JSON.stringify(params));
|
||||
delete store.currentFilter.filter.include;
|
||||
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
|
||||
|
||||
let exprFilter;
|
||||
if (store?.exprBuilder) {
|
||||
exprFilter = buildFilter(params, (param, value) => {
|
||||
if (param == 'filter') return;
|
||||
const res = store.exprBuilder(param, value);
|
||||
if (res) delete params[param];
|
||||
return res;
|
||||
});
|
||||
}
|
||||
|
||||
if (params.filter.where || exprFilter)
|
||||
params.filter.where = { ...params.filter.where, ...exprFilter };
|
||||
params.filter = JSON.stringify(params.filter);
|
||||
|
||||
store.currentFilter = params;
|
||||
store.isLoading = true;
|
||||
const response = await axios.get(store.url, {
|
||||
signal: canceller.signal,
|
||||
|
@ -280,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;
|
||||
else destroy();
|
||||
destroy();
|
||||
return router.push(pushUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ function parseJSON(str, fallback) {
|
|||
}
|
||||
export default function (route, param) {
|
||||
// catch route query params
|
||||
const params = parseJSON(route?.query?.table, {});
|
||||
const params = parseJSON(route?.query?.params, {});
|
||||
// extract and parse filter from params
|
||||
const { filter: filterStr = '{}' } = params;
|
||||
|
||||
|
|
|
@ -506,7 +506,6 @@ invoiceOut:
|
|||
invoiceWithFutureDate: Exists an invoice with a future date
|
||||
noTicketsToInvoice: There are not tickets to invoice
|
||||
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
||||
invalidSerialTypeForAll: The serial type must be global when invoicing all clients
|
||||
table:
|
||||
addressId: Address id
|
||||
streetAddress: Street
|
||||
|
@ -858,7 +857,6 @@ components:
|
|||
downloadFile: Download file
|
||||
openCard: View
|
||||
openSummary: Summary
|
||||
viewSummary: Summary
|
||||
cardDescriptor:
|
||||
mainList: Main list
|
||||
summary: Summary
|
||||
|
|
|
@ -509,7 +509,6 @@ invoiceOut:
|
|||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||
noTicketsToInvoice: No existen tickets para facturar
|
||||
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
||||
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
|
||||
table:
|
||||
addressId: Id dirección
|
||||
streetAddress: Dirección fiscal
|
||||
|
|
|
@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountList"
|
||||
data-key="AccountUsers"
|
||||
: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="AccountList" />
|
||||
<AccountFilter data-key="AccountUsers" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AccountList"
|
||||
data-key="AccountUsers"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
|
|
|
@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountRolesList"
|
||||
data-key="Roles"
|
||||
:expr-builder="exprBuilder"
|
||||
:label="t('role.searchRoles')"
|
||||
:info="t('role.searchInfo')"
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AccountRolesList"
|
||||
data-key="Roles"
|
||||
:url="`VnRoles`"
|
||||
:create="{
|
||||
urlCreate: 'VnRoles',
|
||||
|
|
|
@ -9,7 +9,7 @@ const { t } = useI18n();
|
|||
<VnCard
|
||||
data-key="Role"
|
||||
:descriptor="RoleDescriptor"
|
||||
search-data-key="AccountRolesList"
|
||||
search-data-key="AccountRoles"
|
||||
: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">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -37,9 +37,6 @@ 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>
|
||||
|
@ -120,7 +117,7 @@ const debtWarning = computed(() => {
|
|||
v-if="customer.debt > customer.credit"
|
||||
name="vn:risk"
|
||||
size="xs"
|
||||
:color="debtWarning"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
||||
</QIcon>
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
||||
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
||||
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
@ -27,16 +27,21 @@ const $props = defineProps({
|
|||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const customer = computed(() => summary.value.entity);
|
||||
const summary = ref();
|
||||
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
|
||||
const balanceDue = computed(() => {
|
||||
const amount = defaulterAmount.value;
|
||||
if (!amount || amount < 0) {
|
||||
return null;
|
||||
}
|
||||
return amount;
|
||||
const clientUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
|
||||
});
|
||||
|
||||
const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
|
||||
const balanceDue = computed(() => {
|
||||
return (
|
||||
customer.value &&
|
||||
customer.value.defaulters.length &&
|
||||
customer.value.defaulters[0].amount
|
||||
);
|
||||
});
|
||||
|
||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||
|
||||
const claimRate = computed(() => {
|
||||
return customer.value.claimsRatio?.claimingRate ?? 0;
|
||||
|
@ -300,7 +305,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
<VnLv
|
||||
v-if="entity.defaulters"
|
||||
:label="t('customer.summary.balanceDue')"
|
||||
:value="dashOrCurrency(balanceDue)()"
|
||||
:value="toCurrency(balanceDue)"
|
||||
:class="balanceDueWarning"
|
||||
:info="t('customer.summary.balanceDueInfo')"
|
||||
/>
|
||||
|
|
|
@ -11,24 +11,10 @@ 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">
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
@ -66,18 +52,14 @@ const exprBuilder = (param, value) => {
|
|||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
:params="{
|
||||
departmentCodes: ['VT'],
|
||||
}"
|
||||
url="Workers/activeWithInheritedRole"
|
||||
:where="{ role: 'salesPerson' }"
|
||||
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
|
||||
|
@ -85,19 +67,7 @@ const exprBuilder = (param, value) => {
|
|||
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="CustomerList"
|
||||
data-key="Customer"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<CustomerFilter data-key="CustomerList" />
|
||||
<CustomerFilter data-key="Customer" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="CustomerList"
|
||||
data-key="Customer"
|
||||
url="Clients/filter"
|
||||
:create="{
|
||||
urlCreate: 'Clients/createWithUser',
|
||||
|
|
|
@ -23,7 +23,6 @@ const incoterms = ref([]);
|
|||
const customsAgents = ref([]);
|
||||
const observationTypes = ref([]);
|
||||
const notes = ref([]);
|
||||
let originalNotes = [];
|
||||
const deletes = ref([]);
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
@ -43,8 +42,7 @@ const getData = async (observations) => {
|
|||
});
|
||||
|
||||
if (data.length) {
|
||||
originalNotes = data;
|
||||
notes.value = originalNotes
|
||||
notes.value = data
|
||||
.map((observation) => {
|
||||
const type = observationTypes.value.find(
|
||||
(type) => type.id === observation.observationTypeFk
|
||||
|
@ -83,24 +81,14 @@ const deleteNote = (id, index) => {
|
|||
};
|
||||
|
||||
const onDataSaved = async () => {
|
||||
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 },
|
||||
})),
|
||||
};
|
||||
|
||||
let payload = {};
|
||||
const creates = notes.value.filter((note) => note.$isNew);
|
||||
if (creates.length) {
|
||||
payload.creates = creates;
|
||||
}
|
||||
if (deletes.value.length) {
|
||||
payload.deletes = deletes.value;
|
||||
}
|
||||
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.table"
|
||||
:auto-load="!!$route.query.params"
|
||||
>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
|
|
@ -183,7 +183,7 @@ onMounted(async () => {
|
|||
<i18n>
|
||||
en:
|
||||
invoiceDate: Invoice date
|
||||
maxShipped: Max date ticket
|
||||
maxShipped: Max date
|
||||
allClients: All clients
|
||||
oneClient: One client
|
||||
company: Company
|
||||
|
@ -195,7 +195,7 @@ en:
|
|||
|
||||
es:
|
||||
invoiceDate: Fecha de factura
|
||||
maxShipped: Fecha límite ticket
|
||||
maxShipped: Fecha límite
|
||||
allClients: Todos los clientes
|
||||
oneClient: Un solo cliente
|
||||
company: Empresa
|
||||
|
|
|
@ -6,19 +6,15 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
|||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
||||
import { toCurrency, toDate } from 'src/filters/index';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { QBtn } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
import VnRadio from 'src/components/common/VnRadio.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -30,86 +26,99 @@ const selectedRows = ref([]);
|
|||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||
const MODEL = 'InvoiceOuts';
|
||||
const { openReport } = usePrintService();
|
||||
const addressOptions = ref([]);
|
||||
const selectedOption = ref('ticket');
|
||||
async function fetchClientAddress(id) {
|
||||
const { data } = await axios.get(
|
||||
`Clients/${id}/addresses?filter[order]=isActive DESC`
|
||||
);
|
||||
addressOptions.value = data;
|
||||
}
|
||||
|
||||
const exprBuilder = (_, value) => {
|
||||
return {
|
||||
or: [{ code: value }, { description: { like: `%${value}%` } }],
|
||||
};
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'center',
|
||||
name: 'id',
|
||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||
chip: { condition: () => true },
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: { name: 'search' },
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'ref',
|
||||
label: t('globals.reference'),
|
||||
label: t('invoiceOutList.tableVisibleColumns.ref'),
|
||||
isTitle: true,
|
||||
component: 'select',
|
||||
attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' },
|
||||
columnField: { component: null },
|
||||
attrs: {
|
||||
url: MODEL,
|
||||
optionLabel: 'ref',
|
||||
optionValue: 'id',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'issued',
|
||||
label: t('invoiceOut.summary.issued'),
|
||||
name: 'Issued',
|
||||
label: t('invoiceOutList.tableVisibleColumns.issued'),
|
||||
component: 'date',
|
||||
format: (row) => toDate(row.issued),
|
||||
columnField: { component: null },
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'clientFk',
|
||||
label: t('globals.client'),
|
||||
label: t('invoiceOutModule.customer'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: { url: 'Clients', fields: ['id', 'name'] },
|
||||
columnField: { component: null },
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'companyCode',
|
||||
label: t('globals.company'),
|
||||
label: t('invoiceOutModule.company'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
|
||||
columnField: { component: null },
|
||||
attrs: {
|
||||
url: 'Companies',
|
||||
optionLabel: 'code',
|
||||
optionValue: 'id',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'amount',
|
||||
label: t('globals.amount'),
|
||||
label: t('invoiceOutModule.amount'),
|
||||
cardVisible: true,
|
||||
format: (row) => toCurrency(row.amount),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'created',
|
||||
label: t('globals.created'),
|
||||
label: t('invoiceOutList.tableVisibleColumns.created'),
|
||||
component: 'date',
|
||||
columnField: { component: null },
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row) => toDate(row.created),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'dued',
|
||||
label: t('invoiceOut.summary.dued'),
|
||||
label: t('invoiceOutList.tableVisibleColumns.dueDate'),
|
||||
component: 'date',
|
||||
columnField: { component: null },
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row) => toDate(row.dued),
|
||||
},
|
||||
{
|
||||
|
@ -119,12 +128,11 @@ const columns = computed(() => [
|
|||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, InvoiceOutSummary),
|
||||
},
|
||||
{
|
||||
title: t('globals.downloadPdf'),
|
||||
icon: 'cloud_download',
|
||||
title: t('DownloadPdf'),
|
||||
icon: 'vn:ticket',
|
||||
isPrimary: true,
|
||||
action: (row) => openPdf(row.id),
|
||||
},
|
||||
|
@ -173,12 +181,12 @@ watchEffect(selectedRows);
|
|||
<template>
|
||||
<VnSearchbar
|
||||
:info="t('youCanSearchByInvoiceReference')"
|
||||
:label="t('Search invoice')"
|
||||
data-key="invoiceOutList"
|
||||
:label="t('searchInvoice')"
|
||||
data-key="invoiceOut"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<InvoiceOutFilter data-key="invoiceOutList" />
|
||||
<InvoiceOutFilter data-key="invoiceOut" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnSubToolbar>
|
||||
|
@ -189,19 +197,21 @@ watchEffect(selectedRows);
|
|||
@click="downloadPdf()"
|
||||
:disable="!hasSelectedCards"
|
||||
>
|
||||
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
|
||||
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="invoiceOutList"
|
||||
data-key="invoiceOut"
|
||||
:url="`${MODEL}/filter`"
|
||||
:create="{
|
||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||
title: t('createManualInvoice'),
|
||||
title: t('Create manual invoice'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: { active: true },
|
||||
formInitialData: {
|
||||
active: true,
|
||||
},
|
||||
}"
|
||||
:right-search="false"
|
||||
v-model:selected="selectedRows"
|
||||
|
@ -221,203 +231,74 @@ watchEffect(selectedRows);
|
|||
</span>
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<div class="row q-col-gutter-xs">
|
||||
<div class="col-12">
|
||||
<div class="q-col-gutter-xs">
|
||||
<VnRow fixed>
|
||||
<VnRadio
|
||||
v-model="selectedOption"
|
||||
val="ticket"
|
||||
:label="t('globals.ticket')"
|
||||
class="q-my-none q-mr-md"
|
||||
/>
|
||||
|
||||
<VnInput
|
||||
v-show="selectedOption === 'ticket'"
|
||||
v-model="data.ticketFk"
|
||||
:label="t('globals.ticket')"
|
||||
style="flex: 1"
|
||||
/>
|
||||
|
||||
<div
|
||||
class="row q-col-gutter-xs q-ml-none"
|
||||
v-show="selectedOption !== 'ticket'"
|
||||
>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
v-model="data.clientFk"
|
||||
:label="t('globals.client')"
|
||||
url="Clients"
|
||||
:options="customerOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
@update:model-value="fetchClientAddress"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
@click="selectedClient(scope.opt)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
#{{ scope.opt?.id }} -
|
||||
{{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
v-model="data.addressFk"
|
||||
:label="t('ticket.summary.consignee')"
|
||||
:options="addressOptions"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
v-if="
|
||||
data.clientFk &&
|
||||
selectedOption === 'consignatario'
|
||||
"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
'color-vn-label':
|
||||
!scope.opt?.isActive,
|
||||
}"
|
||||
>
|
||||
{{
|
||||
`${
|
||||
!scope.opt?.isActive
|
||||
? t('inactive')
|
||||
: ''
|
||||
} `
|
||||
}}
|
||||
<span>
|
||||
{{
|
||||
scope.opt?.nickname
|
||||
}}</span
|
||||
>
|
||||
<span
|
||||
v-if="
|
||||
scope.opt?.province ||
|
||||
scope.opt?.city ||
|
||||
scope.opt?.street
|
||||
"
|
||||
>, {{ scope.opt?.street }},
|
||||
{{ scope.opt?.city }},
|
||||
{{
|
||||
scope.opt?.province?.name
|
||||
}}
|
||||
-
|
||||
{{
|
||||
scope.opt?.agencyMode
|
||||
?.name
|
||||
}}</span
|
||||
>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</div>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow fixed>
|
||||
<VnRadio
|
||||
v-model="selectedOption"
|
||||
val="cliente"
|
||||
:label="t('globals.client')"
|
||||
class="q-my-none q-mr-md"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow fixed>
|
||||
<VnRadio
|
||||
v-model="selectedOption"
|
||||
val="consignatario"
|
||||
:label="t('ticket.summary.consignee')"
|
||||
class="q-my-none q-mr-md"
|
||||
/>
|
||||
</VnRow>
|
||||
</div>
|
||||
</div>
|
||||
<div class="full-width">
|
||||
<VnRow class="row q-col-gutter-xs">
|
||||
<VnSelect
|
||||
url="InvoiceOutSerials"
|
||||
v-model="data.serial"
|
||||
:label="t('invoiceIn.serial')"
|
||||
:options="invoiceOutSerialsOptions"
|
||||
option-label="description"
|
||||
option-value="code"
|
||||
option-filter
|
||||
:expr-builder="exprBuilder"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.code }} -
|
||||
{{ scope.opt?.description }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnInputDate
|
||||
:label="t('invoiceOut.summary.dued')"
|
||||
v-model="data.maxShipped"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-col-gutter-xs">
|
||||
<VnSelect
|
||||
url="TaxAreas"
|
||||
v-model="data.taxArea"
|
||||
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
|
||||
:options="taxAreasOptions"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.reference"
|
||||
:label="t('globals.reference')"
|
||||
/>
|
||||
</VnRow>
|
||||
</div>
|
||||
<div class="flex no-wrap flex-center">
|
||||
<VnSelect
|
||||
url="Tickets"
|
||||
v-model="data.ticketFk"
|
||||
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
|
||||
option-label="id"
|
||||
option-value="id"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<span class="q-ml-md">O</span>
|
||||
</div>
|
||||
<VnSelect
|
||||
url="Clients"
|
||||
v-model="data.clientFk"
|
||||
:label="t('invoiceOutModule.customer')"
|
||||
:options="customerOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
/>
|
||||
<VnSelect
|
||||
url="InvoiceOutSerials"
|
||||
v-model="data.serial"
|
||||
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
|
||||
:options="invoiceOutSerialsOptions"
|
||||
option-label="description"
|
||||
option-value="code"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
|
||||
v-model="data.maxShipped"
|
||||
/>
|
||||
<VnSelect
|
||||
url="TaxAreas"
|
||||
v-model="data.taxArea"
|
||||
:label="t('invoiceOutList.tableVisibleColumns.taxArea')"
|
||||
:options="taxAreasOptions"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
/>
|
||||
<QInput
|
||||
v-model="data.reference"
|
||||
:label="t('invoiceOutList.tableVisibleColumns.ref')"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#formModel .vn-row {
|
||||
min-height: 45px;
|
||||
|
||||
.q-radio {
|
||||
align-self: flex-end;
|
||||
flex: 0.3;
|
||||
}
|
||||
|
||||
> .q-input,
|
||||
> .q-select {
|
||||
flex: 0.75;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
invoiceId: Invoice ID
|
||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||
createManualInvoice: Create Manual Invoice
|
||||
inactive: (Inactive)
|
||||
|
||||
es:
|
||||
invoiceId: ID de factura
|
||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||
createManualInvoice: Crear factura manual
|
||||
inactive: (Inactivo)
|
||||
en:
|
||||
searchInvoice: Search issued invoice
|
||||
fileDenied: Browser denied file download...
|
||||
fileAllowed: Successful download of CSV file
|
||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||
createInvoice: Make invoice
|
||||
Create manual invoice: Create manual invoice
|
||||
es:
|
||||
searchInvoice: Buscar factura emitida
|
||||
fileDenied: El navegador denegó la descarga de archivos...
|
||||
fileAllowed: Descarga exitosa de archivo CSV
|
||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||
createInvoice: Crear factura
|
||||
Create manual invoice: Crear factura manual
|
||||
</i18n>
|
||||
|
|
|
@ -2,7 +2,6 @@ invoiceOutModule:
|
|||
customer: Client
|
||||
amount: Amount
|
||||
company: Company
|
||||
address: Address
|
||||
invoiceOutList:
|
||||
tableVisibleColumns:
|
||||
id: ID
|
||||
|
@ -16,11 +15,11 @@ invoiceOutList:
|
|||
DownloadPdf: Download PDF
|
||||
InvoiceOutSummary: Summary
|
||||
negativeBases:
|
||||
country: Country
|
||||
clientId: Client ID
|
||||
base: Base
|
||||
ticketId: Ticket
|
||||
active: Active
|
||||
hasToInvoice: Has to invoice
|
||||
verifiedData: Verified data
|
||||
commercial: Commercial
|
||||
country: Country
|
||||
clientId: Client ID
|
||||
base: Base
|
||||
ticketId: Ticket
|
||||
active: Active
|
||||
hasToInvoice: Has to invoice
|
||||
verifiedData: Verified data
|
||||
commercial: Commercial
|
|
@ -4,7 +4,6 @@ invoiceOutModule:
|
|||
customer: Cliente
|
||||
amount: Importe
|
||||
company: Empresa
|
||||
address: Consignatario
|
||||
invoiceOutList:
|
||||
tableVisibleColumns:
|
||||
id: ID
|
||||
|
|
|
@ -64,7 +64,8 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('globals.name'),
|
||||
name: 'name',
|
||||
field: 'name',
|
||||
name: 'description',
|
||||
...defaultColumnAttrs,
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
|
@ -425,7 +426,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
:default-save="false"
|
||||
data-key="ItemFixedPrices"
|
||||
url="FixedPrices/filter"
|
||||
:order="['itemFk DESC', 'name DESC']"
|
||||
:order="['description DESC']"
|
||||
save-url="FixedPrices/crud"
|
||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||
ref="tableRef"
|
||||
|
@ -479,7 +480,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
<template #column-name="{ row }">
|
||||
<template #column-description="{ row }">
|
||||
<span class="link">
|
||||
{{ row.name }}
|
||||
</span>
|
||||
|
|
|
@ -17,6 +17,21 @@ 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>
|
||||
|
@ -51,7 +66,7 @@ const itemTypeWorkersOptions = ref([]);
|
|||
url="Warehouses"
|
||||
auto-load
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
:label="t('globals.warehouse')"
|
||||
:label="t('components.itemsFilterPanel.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
|
|
|
@ -166,7 +166,6 @@ onMounted(() => {
|
|||
:expr-builder="exprBuilder"
|
||||
:custom-tags="['tagGroups', 'categoryFk']"
|
||||
:redirect="false"
|
||||
search-url="params"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'typeFk'">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useRouter } from 'vue-router';
|
||||
import { reactive, onMounted, ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'composables/useState';
|
||||
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import { reactive } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
|
@ -57,6 +58,10 @@ const fetchAgencyList = async (landed, addressFk) => {
|
|||
}
|
||||
};
|
||||
|
||||
// const fetchOrderDetails = (order) => {
|
||||
// fetchAddressList(order?.addressFk);
|
||||
// fetchAgencyList(order?.landed, order?.addressFk);
|
||||
// };
|
||||
const $props = defineProps({
|
||||
clientFk: {
|
||||
type: Number,
|
||||
|
@ -68,6 +73,39 @@ const initialFormState = reactive({
|
|||
addressId: null,
|
||||
clientFk: $props.clientFk,
|
||||
});
|
||||
// const orderMapper = (order) => {
|
||||
// return {
|
||||
// addressId: order.addressFk,
|
||||
// agencyModeId: order.agencyModeFk,
|
||||
// landed: new Date(order.landed).toISOString(),
|
||||
// };
|
||||
// };
|
||||
// const orderFilter = {
|
||||
// include: [
|
||||
// { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
// {
|
||||
// relation: 'address',
|
||||
// scope: { fields: ['nickname'] },
|
||||
// },
|
||||
// { relation: 'rows', scope: { fields: ['id'] } },
|
||||
// {
|
||||
// relation: 'client',
|
||||
// scope: {
|
||||
// fields: [
|
||||
// 'salesPersonFk',
|
||||
// 'name',
|
||||
// 'isActive',
|
||||
// 'isFreezed',
|
||||
// 'isTaxDataChecked',
|
||||
// ],
|
||||
// include: {
|
||||
// relation: 'salesPersonUser',
|
||||
// scope: { fields: ['id', 'name'] },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// };
|
||||
|
||||
const onClientChange = async (clientId = $props.clientFk) => {
|
||||
try {
|
||||
|
|
|
@ -111,7 +111,6 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Items',
|
||||
sortBy: 'name ASC ',
|
||||
fields: ['id', 'name', 'subName'],
|
||||
},
|
||||
columnField: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, 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,6 +14,7 @@ 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();
|
||||
|
@ -141,13 +142,8 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk);
|
||||
});
|
||||
async function fetchClientAddress(id, formData = {}) {
|
||||
|
||||
async function fetchClientAddress(id, formData) {
|
||||
const { data } = await axios.get(`Clients/${id}`, {
|
||||
params: { filter: { include: { relation: 'addresses' } } },
|
||||
});
|
||||
|
@ -174,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 />
|
||||
|
@ -191,7 +194,7 @@ const getDateColor = (date) => {
|
|||
urlCreate: 'Orders/new',
|
||||
title: t('module.cerateOrder'),
|
||||
onDataSaved: (url) => {
|
||||
tableRef.redirect(`${url}/catalog`);
|
||||
tableRef.redirect(url);
|
||||
},
|
||||
formInitialData: {
|
||||
active: true,
|
||||
|
|
|
@ -16,9 +16,12 @@ import { useAcl } from 'src/composables/useAcl';
|
|||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const formData = defineModel({
|
||||
type: Object,
|
||||
required: true,
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
@ -37,6 +40,7 @@ const agenciesOptions = ref([]);
|
|||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const zoneSelectRef = ref();
|
||||
const formData = ref($props.formData);
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
|
@ -65,28 +69,47 @@ const zoneWhere = computed(() => {
|
|||
: {};
|
||||
});
|
||||
|
||||
async function getLanded(params) {
|
||||
getDate(`Agencies/getLanded`, params);
|
||||
}
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
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 = data.zoneFk;
|
||||
if (data.landed) formData.value.landed = data.landed;
|
||||
if (data.shipped) formData.value.shipped = data.shipped;
|
||||
}
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
formData.value.agencyModeFk = null;
|
||||
|
@ -154,26 +177,18 @@ const clientId = computed({
|
|||
},
|
||||
});
|
||||
|
||||
function addDateParams(obj) {
|
||||
return {
|
||||
...obj,
|
||||
...{
|
||||
const landed = computed({
|
||||
get: () => formData.value?.landed,
|
||||
set: (val) => {
|
||||
formData.value.landed = val;
|
||||
getShipped({
|
||||
landed: val,
|
||||
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,
|
||||
|
@ -221,6 +236,21 @@ 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);
|
||||
};
|
||||
|
@ -421,21 +451,18 @@ 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)"
|
||||
v-model="formData"
|
||||
:form-data="formData"
|
||||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
import { ref, toRefs } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
@ -23,6 +23,7 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const route = useRoute();
|
||||
|
||||
const { push, currentRoute } = useRouter();
|
||||
const { dialog, notify } = useQuasar();
|
||||
|
@ -30,7 +31,7 @@ const { t } = useI18n();
|
|||
const { openReport, sendEmail } = usePrintService();
|
||||
const ticketSummary = useArrayData('TicketSummary');
|
||||
const { ticket } = toRefs(props);
|
||||
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
|
||||
const ticketId = currentRoute.value.params.id;
|
||||
const client = ref();
|
||||
const showTransferDialog = ref(false);
|
||||
const showTurnDialog = ref(false);
|
||||
|
@ -67,7 +68,7 @@ const actions = {
|
|||
setWeight: async () => {
|
||||
try {
|
||||
const invoiceIds = (
|
||||
await axios.post(`Tickets/${ticketId.value}/setWeight`, {
|
||||
await axios.post(`Tickets/${ticketId}/setWeight`, {
|
||||
weight: weight.value,
|
||||
})
|
||||
).data;
|
||||
|
@ -85,7 +86,7 @@ const actions = {
|
|||
},
|
||||
remove: async () => {
|
||||
try {
|
||||
await axios.post(`Tickets/${ticketId.value}/setDeleted`);
|
||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
||||
|
||||
notify({ message: t('Ticket deleted'), type: 'positive' });
|
||||
notify({
|
||||
|
@ -175,14 +176,14 @@ function showSmsDialog(template, customData) {
|
|||
}
|
||||
|
||||
async function showSmsDialogWithChanges() {
|
||||
const query = `TicketLogs/${ticketId.value}/getChanges`;
|
||||
const query = `TicketLogs/${ticketId}/getChanges`;
|
||||
const response = await axios.get(query);
|
||||
|
||||
showSmsDialog('orderChanges', { changes: response.data });
|
||||
}
|
||||
|
||||
async function sendSms(body) {
|
||||
await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
|
||||
await axios.post(`Tickets/${ticketId}/sendSms`, body);
|
||||
notify({
|
||||
message: 'Notification sent',
|
||||
type: 'positive',
|
||||
|
@ -255,10 +256,7 @@ async function transferClient(client) {
|
|||
clientFk: client,
|
||||
};
|
||||
|
||||
const { data } = await axios.patch(
|
||||
`Tickets/${ticketId.value}/transferClient`,
|
||||
params
|
||||
);
|
||||
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
@ -298,10 +296,7 @@ async function changeShippedHour(time) {
|
|||
shipped: time,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
`Tickets/${ticketId.value}/updateEditableTicket`,
|
||||
params
|
||||
);
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
@ -318,7 +313,7 @@ function openRecalculateDialog() {
|
|||
}
|
||||
|
||||
async function recalculateComponents() {
|
||||
await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
|
||||
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
||||
notify({
|
||||
message: t('Data saved'),
|
||||
type: 'positive',
|
||||
|
@ -341,11 +336,11 @@ async function handleInvoiceOutData() {
|
|||
}
|
||||
|
||||
async function docuwareDownload() {
|
||||
await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
|
||||
await axios.get(`Tickets/${ticketId}/docuwareDownload`);
|
||||
}
|
||||
|
||||
async function hasDocuware() {
|
||||
const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
|
||||
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
signed: true,
|
||||
});
|
||||
|
@ -376,7 +371,11 @@ async function uploadDocuware(force) {
|
|||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`Tickets/${ticketId}/isEditable`"
|
||||
:url="
|
||||
route.path.startsWith('/ticket')
|
||||
? `Tickets/${ticketId}/isEditable`
|
||||
: `Tickets/${ticket}/isEditable`
|
||||
"
|
||||
auto-load
|
||||
@on-fetch="handleFetchData"
|
||||
/>
|
||||
|
@ -397,6 +396,8 @@ async function uploadDocuware(force) {
|
|||
<VnSelect
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="client"
|
||||
:label="t('Client')"
|
||||
auto-load
|
||||
|
|
|
@ -94,32 +94,25 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.id'),
|
||||
label: t('ticketList.id'),
|
||||
name: 'itemFk',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.quantity'),
|
||||
label: t('basicData.quantity'),
|
||||
name: 'quantity',
|
||||
format: (row) => toCurrency(row.quantity),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.item'),
|
||||
label: t('basicData.item'),
|
||||
name: 'item',
|
||||
format: (row) => row?.item?.name,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.size'),
|
||||
name: 'size',
|
||||
format: (row) => row?.item?.size,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.price'),
|
||||
label: t('basicData.price'),
|
||||
name: 'price',
|
||||
format: (row) => toCurrency(row.price),
|
||||
},
|
||||
|
@ -131,7 +124,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.amount'),
|
||||
label: t('ticketList.amount'),
|
||||
name: 'amount',
|
||||
format: (row) => parseInt(row.amount * row.quantity),
|
||||
},
|
||||
|
|
|
@ -20,7 +20,6 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
@ -117,36 +116,24 @@ function toTicketUrl(section) {
|
|||
{{ entity.nickname }}
|
||||
</div>
|
||||
</template>
|
||||
<template #header-right="{ entity }">
|
||||
<div>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
:disable="!isEditable()"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStates"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeState"
|
||||
/>
|
||||
</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 #header-right>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
:disable="!isEditable()"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStates"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeState"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
|
|
|
@ -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">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<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, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -18,13 +18,12 @@ 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 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import { toTimeFormat } from 'src/filters/date';
|
||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
|
@ -41,18 +40,23 @@ 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 });
|
||||
|
@ -209,19 +213,13 @@ const columns = computed(() => [
|
|||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
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);
|
||||
},
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, TicketSummary),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function redirectToLines(id) {
|
||||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
|
@ -458,24 +456,24 @@ function setReference(data) {
|
|||
auto-load
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="TicketList"
|
||||
data-key="Ticket"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketFilter data-key="TicketList" />
|
||||
<TicketFilter data-key="Ticket" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketList"
|
||||
data-key="Ticket"
|
||||
url="Tickets/filter"
|
||||
:create="{
|
||||
urlCreate: 'Tickets/new',
|
||||
title: t('ticketList.createTicket'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: { clientId: null },
|
||||
formInitialData: {},
|
||||
}"
|
||||
default-mode="table"
|
||||
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
||||
|
@ -577,17 +575,17 @@ function setReference(data) {
|
|||
</span>
|
||||
</template>
|
||||
<template #column-stateFk="{ row }">
|
||||
<span v-if="row.refFk">
|
||||
<span v-if="getColor(row)">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</span>
|
||||
<span v-else-if="row.state === 'Entregado'">
|
||||
<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>
|
||||
|
@ -619,7 +617,6 @@ function setReference(data) {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
required
|
||||
@update:model-value="(client) => onClientSelected(data)"
|
||||
:sort-by="'id ASC'"
|
||||
>
|
||||
|
@ -646,7 +643,6 @@ function setReference(data) {
|
|||
option-label="nickname"
|
||||
hide-selected
|
||||
map-options
|
||||
required
|
||||
:disable="!data.clientId"
|
||||
:sort-by="'isActive DESC'"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
|
@ -697,7 +693,6 @@ function setReference(data) {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
required
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
|
@ -711,6 +706,7 @@ function setReference(data) {
|
|||
option-value="agencyModeFk"
|
||||
option-label="agencyMode"
|
||||
hide-selected
|
||||
:disable="!data.clientId || !data.landed || !data.warehouseId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
@ -846,14 +842,7 @@ function setReference(data) {
|
|||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
<style scoped>
|
||||
.disabled,
|
||||
.disabled *,
|
||||
[disabled],
|
||||
[disabled] * {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search ticket: Buscar ticket
|
||||
|
|
|
@ -138,7 +138,6 @@ ticketSale:
|
|||
ok: Ok
|
||||
more: Más
|
||||
address: Consignatario
|
||||
size: Medida
|
||||
ticketComponents:
|
||||
serie: Serie
|
||||
components: Componentes
|
||||
|
|
|
@ -205,7 +205,6 @@ 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">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -14,7 +14,6 @@ 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="(data) => data && setNotifications(data)"
|
||||
@on-fetch="setNotifications"
|
||||
search-url="notifications"
|
||||
>
|
||||
<template #body>
|
||||
|
|
|
@ -20,13 +20,12 @@ function notIsLocations(ifIsFalse, ifIsTrue) {
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="zone"
|
||||
:base-url="notIsLocations('Zones', undefined)"
|
||||
base-url="Zones"
|
||||
:descriptor="ZoneDescriptor"
|
||||
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
|
||||
:search-data-key="notIsLocations('ZoneList', undefined)"
|
||||
:custom-url="`Zones/${route.params?.id}/getLeaves`"
|
||||
:filter-panel="ZoneFilterPanel"
|
||||
:search-data-key="notIsLocations('ZoneList', 'ZoneLocations')"
|
||||
:searchbar-props="{
|
||||
url: notIsLocations('Zones', 'ZoneLocations'),
|
||||
url: 'Zones',
|
||||
label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
|
||||
info: t('list.searchInfo'),
|
||||
whereFilter: notIsLocations((value) => {
|
||||
|
|
|
@ -5,7 +5,6 @@ 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: {
|
||||
|
@ -34,23 +33,22 @@ const state = useState();
|
|||
const treeRef = ref();
|
||||
const expanded = ref([]);
|
||||
|
||||
const datakey = 'ZoneLocations';
|
||||
const url = computed(() => `Zones/${route.params.id}/getLeaves`);
|
||||
const arrayData = useArrayData(datakey, {
|
||||
url: url.value,
|
||||
const arrayData = useArrayData('ZoneLocations', {
|
||||
url: `Zones/${route.params.id}/getLeaves`,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const storeData = computed(() => store.data);
|
||||
|
||||
const defaultNode = {
|
||||
id: null,
|
||||
name: props.rootLabel,
|
||||
sons: true,
|
||||
tickable: false,
|
||||
noTick: true,
|
||||
children: [{}],
|
||||
};
|
||||
const nodes = ref([defaultNode]);
|
||||
const nodes = ref([
|
||||
{
|
||||
id: null,
|
||||
name: props.rootLabel,
|
||||
sons: true,
|
||||
tickable: false,
|
||||
noTick: true,
|
||||
children: [{}],
|
||||
},
|
||||
]);
|
||||
|
||||
const _tickedNodes = computed({
|
||||
get: () => props.tickedNodes,
|
||||
|
@ -130,7 +128,6 @@ 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]);
|
||||
|
@ -196,7 +193,6 @@ 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="ZonesList"
|
||||
data-key="Zones"
|
||||
url="Zones"
|
||||
:filter="{
|
||||
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
|
|
|
@ -32,6 +32,7 @@ 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="ZonesList" />
|
||||
<ZoneFilterPanel data-key="Zones" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="ZonesList"
|
||||
data-key="Zones"
|
||||
url="Zones"
|
||||
:create="{
|
||||
urlCreate: 'Zones',
|
||||
|
|
|
@ -113,7 +113,7 @@ export default {
|
|||
name: 'SupplierAccounts',
|
||||
meta: {
|
||||
title: 'accounts',
|
||||
icon: 'vn:credit',
|
||||
icon: 'vn:account',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Supplier/Card/SupplierAccounts.vue'),
|
||||
|
|
|
@ -162,15 +162,6 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
);
|
||||
throw new Error('Invalid Serial Type');
|
||||
}
|
||||
|
||||
if (clientsToInvoice === 'all' && params.serialType !== 'global') {
|
||||
notify(
|
||||
'invoiceOut.globalInvoices.errors.invalidSerialTypeForAll',
|
||||
'negative'
|
||||
);
|
||||
throw new Error('For "all" clients, the serialType must be "global"');
|
||||
}
|
||||
|
||||
if (!params.companyFk) {
|
||||
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
||||
throw new Error('Invalid company');
|
||||
|
|
|
@ -8,7 +8,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
|||
userFilter: {},
|
||||
userParams: {},
|
||||
url: '',
|
||||
limit: 20,
|
||||
limit: 10,
|
||||
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":20,"skip":0}';
|
||||
const filter = '{"limit":10,"skip":0}';
|
||||
const params = { supplierFk: 2 };
|
||||
beforeEach(() => {
|
||||
vi.spyOn(useRouter(), 'replace');
|
||||
|
|
Loading…
Reference in New Issue