Merge branch 'dev' into 8061_newCP
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
fb4de9cda9
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.44.0",
|
"version": "24.50.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -9,8 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
|
@ -18,17 +16,16 @@ const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
|
const countriesFilter = {
|
||||||
|
fields: ['id', 'name', 'code'],
|
||||||
|
};
|
||||||
|
|
||||||
const bankEntityFormData = reactive({
|
const bankEntityFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
bic: null,
|
bic: null,
|
||||||
countryFk: customer.value?.countryFk,
|
countryFk: customer.value?.countryFk,
|
||||||
id: null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const countriesFilter = {
|
|
||||||
fields: ['id', 'name', 'code'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (...args) => {
|
const onDataSaved = (...args) => {
|
||||||
|
@ -44,7 +41,6 @@ onMounted(async () => {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Countries"
|
url="Countries"
|
||||||
:filter="countriesFilter"
|
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
@on-fetch="(data) => (countriesOptions = data)"
|
||||||
/>
|
/>
|
||||||
|
@ -54,6 +50,7 @@ onMounted(async () => {
|
||||||
:title="t('title')"
|
:title="t('title')"
|
||||||
:subtitle="t('subtitle')"
|
:subtitle="t('subtitle')"
|
||||||
:form-initial-data="bankEntityFormData"
|
:form-initial-data="bankEntityFormData"
|
||||||
|
:filter="countriesFilter"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
|
@ -85,7 +82,13 @@ onMounted(async () => {
|
||||||
:rules="validate('bankEntity.countryFk')"
|
:rules="validate('bankEntity.countryFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showEntityField" class="col">
|
<div
|
||||||
|
v-if="
|
||||||
|
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
|
||||||
|
'ES'
|
||||||
|
"
|
||||||
|
class="col"
|
||||||
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('id')"
|
:label="t('id')"
|
||||||
v-model="data.id"
|
v-model="data.id"
|
||||||
|
|
|
@ -1,155 +0,0 @@
|
||||||
<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 hasChanges = ref(false);
|
||||||
const originalData = ref();
|
const originalData = ref();
|
||||||
const vnPaginateRef = ref();
|
const vnPaginateRef = ref();
|
||||||
const formData = ref();
|
const formData = ref([]);
|
||||||
const saveButtonRef = ref(null);
|
const saveButtonRef = ref(null);
|
||||||
const watchChanges = ref();
|
const watchChanges = ref();
|
||||||
const formUrl = computed(() => $props.url);
|
const formUrl = computed(() => $props.url);
|
||||||
|
@ -394,6 +394,7 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
|
data-cy="crudModelDefaultSaveBtn"
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
|
|
|
@ -156,7 +156,6 @@ const rotateRight = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
try {
|
|
||||||
if (!newPhoto.files && !newPhoto.url) {
|
if (!newPhoto.files && !newPhoto.url) {
|
||||||
notify(t('Select an image'), 'negative');
|
notify(t('Select an image'), 'negative');
|
||||||
return;
|
return;
|
||||||
|
@ -173,9 +172,6 @@ const onSubmit = () => {
|
||||||
newPhoto.blob = file;
|
newPhoto.blob = file;
|
||||||
})
|
})
|
||||||
.then(() => makeRequest());
|
.then(() => makeRequest());
|
||||||
} catch (err) {
|
|
||||||
console.error('Error uploading image');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeRequest = async () => {
|
const makeRequest = async () => {
|
||||||
|
|
|
@ -51,7 +51,6 @@ const onDataSaved = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||||
const payload = {
|
const payload = {
|
||||||
|
@ -63,9 +62,6 @@ const onSubmit = async () => {
|
||||||
await axios.post($props.editUrl, payload);
|
await axios.post($props.editUrl, payload);
|
||||||
onDataSaved();
|
onDataSaved();
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error submitting table cell edit');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -84,7 +84,6 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
let filter = itemFilter;
|
let filter = itemFilter;
|
||||||
const params = itemFilterParams;
|
const params = itemFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -109,9 +108,6 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching entries items');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -86,7 +86,6 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
let filter = travelFilter;
|
let filter = travelFilter;
|
||||||
const params = travelFilterParams;
|
const params = travelFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -109,9 +108,6 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching travels');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -88,7 +88,6 @@ const applyTags = (params, search) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchItemTypes = async (id) => {
|
const fetchItemTypes = async (id) => {
|
||||||
try {
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
fields: ['id', 'name', 'categoryFk'],
|
||||||
where: { categoryFk: id },
|
where: { categoryFk: id },
|
||||||
|
@ -99,9 +98,6 @@ const fetchItemTypes = async (id) => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
itemTypesOptions.value = data;
|
itemTypesOptions.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching item types', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryClass = (category, params) => {
|
const getCategoryClass = (category, params) => {
|
||||||
|
@ -111,7 +107,6 @@ const getCategoryClass = (category, params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag?.selectedTag?.id) return;
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -125,9 +120,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tag.valueOptions = data;
|
tag.valueOptions = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTag = (index, params, search) => {
|
const removeTag = (index, params, search) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ const props = defineProps({
|
||||||
default: 'main',
|
default: 'main',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const initialized = ref(false);
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
const expansionItemElements = reactive({});
|
const expansionItemElements = reactive({});
|
||||||
const pinnedModules = computed(() => {
|
const pinnedModules = computed(() => {
|
||||||
|
@ -61,11 +61,13 @@ const filteredPinnedModules = computed(() => {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await navigation.fetchPinned();
|
await navigation.fetchPinned();
|
||||||
getRoutes();
|
getRoutes();
|
||||||
|
initialized.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.matched,
|
() => route.matched,
|
||||||
() => {
|
() => {
|
||||||
|
if (!initialized.value) return;
|
||||||
items.value = [];
|
items.value = [];
|
||||||
getRoutes();
|
getRoutes();
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,14 +39,10 @@ const refund = async () => {
|
||||||
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
||||||
notify(t('Refunded invoice'), 'positive');
|
notify(t('Refunded invoice'), 'positive');
|
||||||
const [id] = data?.refundId || [];
|
const [id] = data?.refundId || [];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error refunding invoice', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<script setup>
|
||||||
|
defineProps({ row: { type: Object, required: true } });
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<span>
|
||||||
|
<QIcon
|
||||||
|
v-if="row.isTaxDataChecked === 0"
|
||||||
|
name="vn:no036"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row.risk"
|
||||||
|
name="vn:risk"
|
||||||
|
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</span>
|
||||||
|
</template>
|
|
@ -49,7 +49,6 @@ const makeInvoice = async () => {
|
||||||
makeInvoice: checked.value,
|
makeInvoice: checked.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
|
||||||
if (checked.value && hasToInvoiceByAddress) {
|
if (checked.value && hasToInvoiceByAddress) {
|
||||||
const response = await new Promise((resolve) => {
|
const response = await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
|
@ -76,9 +75,6 @@ const makeInvoice = async () => {
|
||||||
notify(t('Transferred invoice'), 'positive');
|
notify(t('Transferred invoice'), 'positive');
|
||||||
const id = data?.[0];
|
const id = data?.[0];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error transfering invoice', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
searchUrl: {
|
searchUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'params',
|
default: 'table',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -143,6 +143,10 @@ function alignRow() {
|
||||||
const showFilter = computed(
|
const showFilter = computed(
|
||||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onTabPressed = async () => {
|
||||||
|
if (model.value) enterEvent['keyup.enter']();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
@ -157,6 +161,7 @@ const showFilter = computed(
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:components="components"
|
:components="components"
|
||||||
component-prop="columnFilter"
|
component-prop="columnFilter"
|
||||||
|
@keydown.tab="onTabPressed"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -17,7 +17,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
searchUrl: {
|
searchUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'params',
|
default: 'table',
|
||||||
},
|
},
|
||||||
vertical: {
|
vertical: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|
|
@ -162,9 +162,7 @@ onMounted(() => {
|
||||||
: $props.defaultMode;
|
: $props.defaultMode;
|
||||||
stateStore.rightDrawer = quasar.screen.gt.xs;
|
stateStore.rightDrawer = quasar.screen.gt.xs;
|
||||||
columnsVisibilitySkipped.value = [
|
columnsVisibilitySkipped.value = [
|
||||||
...splittedColumns.value.columns
|
...splittedColumns.value.columns.filter((c) => !c.visible).map((c) => c.name),
|
||||||
.filter((c) => c.visible == false)
|
|
||||||
.map((c) => c.name),
|
|
||||||
...['tableActions'],
|
...['tableActions'],
|
||||||
];
|
];
|
||||||
createForm.value = $props.create;
|
createForm.value = $props.create;
|
||||||
|
@ -237,7 +235,7 @@ function splitColumns(columns) {
|
||||||
if (col.create) splittedColumns.value.create.push(col);
|
if (col.create) splittedColumns.value.create.push(col);
|
||||||
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
||||||
if ($props.isEditable && col.disable == null) col.disable = false;
|
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 };
|
col.columnFilter = { inWhere: true, ...col.columnFilter };
|
||||||
splittedColumns.value.columns.push(col);
|
splittedColumns.value.columns.push(col);
|
||||||
}
|
}
|
||||||
|
@ -326,6 +324,8 @@ function handleOnDataSaved(_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleScroll() {
|
function handleScroll() {
|
||||||
|
if ($props.crudModel.disableInfiniteScroll) return;
|
||||||
|
|
||||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||||
|
@ -394,7 +394,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:vertical="true"
|
:vertical="false"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
|
@ -737,6 +737,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
|
data-cy="vnTableCreateBtn"
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
|
|
|
@ -58,7 +58,6 @@ const getConfig = async (url, filter) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchViewConfigData = async () => {
|
const fetchViewConfigData = async () => {
|
||||||
try {
|
|
||||||
const userConfigFilter = {
|
const userConfigFilter = {
|
||||||
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
||||||
};
|
};
|
||||||
|
@ -83,13 +82,9 @@ const fetchViewConfigData = async () => {
|
||||||
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
||||||
setUserConfigViewData(defaultColumns);
|
setUserConfigViewData(defaultColumns);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching config view data', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveConfig = async () => {
|
const saveConfig = async () => {
|
||||||
try {
|
|
||||||
const params = {};
|
const params = {};
|
||||||
const configuration = {};
|
const configuration = {};
|
||||||
|
|
||||||
|
@ -128,9 +123,6 @@ const saveConfig = async () => {
|
||||||
emitSavedConfig();
|
emitSavedConfig();
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
popupProxyRef.value.hide();
|
popupProxyRef.value.hide();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving user view config', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const emitSavedConfig = () => {
|
const emitSavedConfig = () => {
|
||||||
|
|
|
@ -101,7 +101,13 @@ const mixinRules = [
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
v-if="
|
||||||
|
hover &&
|
||||||
|
value &&
|
||||||
|
!$attrs.disabled &&
|
||||||
|
!$attrs.readonly &&
|
||||||
|
$props.clearable
|
||||||
|
"
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
value = null;
|
value = null;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, watch, computed, ref } from 'vue';
|
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useAttrs } from 'vue';
|
|
||||||
import VnDate from './VnDate.vue';
|
import VnDate from './VnDate.vue';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,12 @@
|
||||||
const model = defineModel({ type: Boolean, required: true });
|
const model = defineModel({ type: Boolean, required: true });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QRadio v-model="model" v-bind="$attrs" dense :dark="true" class="q-mr-sm" />
|
<QRadio
|
||||||
|
v-model="model"
|
||||||
|
v-bind="$attrs"
|
||||||
|
dense
|
||||||
|
:dark="true"
|
||||||
|
class="q-mr-sm"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -138,8 +138,6 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ opts: myOptions });
|
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
|
@ -202,7 +200,10 @@ async function fetchFilter(val) {
|
||||||
if (fields) fetchOptions.fields = fields;
|
if (fields) fetchOptions.fields = fields;
|
||||||
if (sortBy) fetchOptions.order = sortBy;
|
if (sortBy) fetchOptions.order = sortBy;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||||
return (await arrayData.applyFilter({ filter: fetchOptions }))?.data;
|
|
||||||
|
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
||||||
|
setOptions(data);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function filterHandler(val, update) {
|
async function filterHandler(val, update) {
|
||||||
|
@ -256,6 +257,30 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
|
function handleKeyDown(event) {
|
||||||
|
if (event.key === 'Tab') {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const inputValue = vnSelectRef.value?.inputValue;
|
||||||
|
|
||||||
|
if (inputValue) {
|
||||||
|
const matchingOption = myOptions.value.find(
|
||||||
|
(option) =>
|
||||||
|
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchingOption) {
|
||||||
|
emit('update:modelValue', matchingOption[optionValue.value]);
|
||||||
|
} else {
|
||||||
|
emit('update:modelValue', inputValue);
|
||||||
|
}
|
||||||
|
vnSelectRef.value?.hidePopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -266,6 +291,7 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
|
@keydown="handleKeyDown"
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="nullishToTrue($attrs['use-input'])"
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||||
<QCard class="q-pa-sm">
|
<QCard class="q-pa-sm">
|
||||||
<QCardSection class="row items-center q-pb-none">
|
<QCardSection class="row items-center q-pb-none">
|
||||||
<span class="text-h6 text-grey">
|
<span class="text-h6 text-grey">
|
||||||
|
@ -161,6 +161,7 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
|
data-cy="sendSmsBtn"
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -83,7 +83,7 @@ async function fetch() {
|
||||||
<slot name="header" :entity="entity" dense>
|
<slot name="header" :entity="entity" dense>
|
||||||
<VnLv :label="`${entity.id} -`" :value="entity.name" />
|
<VnLv :label="`${entity.id} -`" :value="entity.name" />
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="header-right">
|
<slot name="header-right" :entity="entity">
|
||||||
<span></span>
|
<span></span>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['filter', 'search', 'or', 'and'],
|
default: () => ['filter', 'or', 'and'],
|
||||||
},
|
},
|
||||||
customTags: {
|
customTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -49,7 +49,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
searchUrl: {
|
searchUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'params',
|
default: 'table',
|
||||||
},
|
},
|
||||||
redirect: {
|
redirect: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -61,7 +61,6 @@ const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
'clear',
|
'clear',
|
||||||
'search',
|
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
'setUserParams',
|
'setUserParams',
|
||||||
|
@ -75,6 +74,9 @@ const arrayData = useArrayData($props.dataKey, {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const userParams = ref({});
|
const userParams = ref({});
|
||||||
|
|
||||||
|
defineExpose({ search, sanitizer, params: userParams });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
userParams.value = $props.modelValue ?? {};
|
userParams.value = $props.modelValue ?? {};
|
||||||
emit('init', { params: userParams.value });
|
emit('init', { params: userParams.value });
|
||||||
|
@ -198,7 +200,7 @@ const customTags = computed(() =>
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
userParams.value[key] = undefined;
|
userParams.value[key] = undefined;
|
||||||
search();
|
await search();
|
||||||
emit('remove', key);
|
emit('remove', key);
|
||||||
emit('update:modelValue', userParams.value);
|
emit('update:modelValue', userParams.value);
|
||||||
}
|
}
|
||||||
|
@ -224,8 +226,6 @@ function sanitizer(params) {
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ search, sanitizer, userParams });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -44,7 +44,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 10,
|
default: 20,
|
||||||
},
|
},
|
||||||
userParams: {
|
userParams: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (props.autoLoad) await fetch();
|
if (props.autoLoad && !store.data?.length) await fetch();
|
||||||
mounted.value = true;
|
mounted.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,7 +115,11 @@ watch(
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.data,
|
() => store.data,
|
||||||
(data) => emit('onChange', data)
|
(data) => {
|
||||||
|
if (!mounted.value) return;
|
||||||
|
emit('onChange', data);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md">
|
<div class="vn-row q-gutter-md">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,6 +18,9 @@
|
||||||
&:not(.wrap) {
|
&:not(.wrap) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
&[fixed] {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -45,7 +45,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
limit: {
|
limit: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 10,
|
default: 20,
|
||||||
},
|
},
|
||||||
userParams: {
|
userParams: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -130,6 +130,7 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
|
data-cy="vnSearchBar"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { defineProps } from 'vue';
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
routeName: {
|
routeName: {
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { getUrl } from './getUrl';
|
import { getUrl } from './getUrl';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { exportFile } from 'quasar';
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
|
|
||||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||||
let appUrl = await getUrl('', 'lilium');
|
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
||||||
appUrl = appUrl.replace('/#/', '');
|
const response = await axios.get(
|
||||||
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
url ?? `${appUrl}/${model}/${id}${urlPath}?access_token=${token}`,
|
||||||
|
{ responseType: 'blob' }
|
||||||
|
);
|
||||||
|
|
||||||
|
const contentDisposition = response.headers['content-disposition'];
|
||||||
|
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
|
||||||
|
const filename =
|
||||||
|
matches != null && matches[1]
|
||||||
|
? matches[1].replace(/['"]/g, '')
|
||||||
|
: 'downloaded-file';
|
||||||
|
|
||||||
|
exportFile(filename, response.data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,18 +75,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
limit: store.limit,
|
limit: store.limit,
|
||||||
};
|
};
|
||||||
|
|
||||||
let exprFilter;
|
|
||||||
let userParams = { ...store.userParams };
|
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, exprFilter);
|
Object.assign(filter, store.userFilter);
|
||||||
|
|
||||||
let where;
|
let where;
|
||||||
if (filter?.where || store.filter?.where)
|
if (filter?.where || store.filter?.where)
|
||||||
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
|
||||||
|
@ -95,12 +87,29 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const params = { filter };
|
const params = { filter };
|
||||||
|
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
params.filter.skip = store.skip;
|
if (params.filter) params.filter.skip = store.skip;
|
||||||
if (store.order && store.order.length) params.filter.order = store.order;
|
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||||
|
if (store.order?.length) params.filter.order = [...store.order];
|
||||||
else delete params.filter.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);
|
params.filter = JSON.stringify(params.filter);
|
||||||
store.currentFilter = params;
|
|
||||||
store.isLoading = true;
|
store.isLoading = true;
|
||||||
const response = await axios.get(store.url, {
|
const response = await axios.get(store.url, {
|
||||||
signal: canceller.signal,
|
signal: canceller.signal,
|
||||||
|
@ -271,7 +280,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const pushUrl = { path: to };
|
const pushUrl = { path: to };
|
||||||
if (to.endsWith('/list') || to.endsWith('/'))
|
if (to.endsWith('/list') || to.endsWith('/'))
|
||||||
pushUrl.query = newUrl.query;
|
pushUrl.query = newUrl.query;
|
||||||
destroy();
|
else destroy();
|
||||||
return router.push(pushUrl);
|
return router.push(pushUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 1px 10px 1px 10px;
|
padding: 1px 10px 1px 10px;
|
||||||
max-width: 100px;
|
max-width: 130px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -9,7 +9,7 @@ function parseJSON(str, fallback) {
|
||||||
}
|
}
|
||||||
export default function (route, param) {
|
export default function (route, param) {
|
||||||
// catch route query params
|
// catch route query params
|
||||||
const params = parseJSON(route?.query?.params, {});
|
const params = parseJSON(route?.query?.table, {});
|
||||||
// extract and parse filter from params
|
// extract and parse filter from params
|
||||||
const { filter: filterStr = '{}' } = params;
|
const { filter: filterStr = '{}' } = params;
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,7 @@ invoiceOut:
|
||||||
invoiceWithFutureDate: Exists an invoice with a future date
|
invoiceWithFutureDate: Exists an invoice with a future date
|
||||||
noTicketsToInvoice: There are not tickets to invoice
|
noTicketsToInvoice: There are not tickets to invoice
|
||||||
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
criticalInvoiceError: 'Critical invoicing error, process stopped'
|
||||||
|
invalidSerialTypeForAll: The serial type must be global when invoicing all clients
|
||||||
table:
|
table:
|
||||||
addressId: Address id
|
addressId: Address id
|
||||||
streetAddress: Street
|
streetAddress: Street
|
||||||
|
@ -583,15 +584,15 @@ worker:
|
||||||
role: Role
|
role: Role
|
||||||
sipExtension: Extension
|
sipExtension: Extension
|
||||||
locker: Locker
|
locker: Locker
|
||||||
fiDueDate: Fecha de caducidad del DNI
|
fiDueDate: FI due date
|
||||||
sex: Sexo
|
sex: Sex
|
||||||
seniority: Antigüedad
|
seniority: Seniority
|
||||||
fi: DNI/NIE/NIF
|
fi: DNI/NIE/NIF
|
||||||
birth: Fecha de nacimiento
|
birth: Birth
|
||||||
isFreelance: Autónomo
|
isFreelance: Freelance
|
||||||
isSsDiscounted: Bonificación SS
|
isSsDiscounted: Bonificación SS
|
||||||
hasMachineryAuthorized: Autorizado para llevar maquinaria
|
hasMachineryAuthorized: Machinery authorized
|
||||||
isDisable: Trabajador desactivado
|
isDisable: Disable
|
||||||
notificationsManager:
|
notificationsManager:
|
||||||
activeNotifications: Active notifications
|
activeNotifications: Active notifications
|
||||||
availableNotifications: Available notifications
|
availableNotifications: Available notifications
|
||||||
|
@ -707,7 +708,7 @@ supplier:
|
||||||
supplierName: Supplier name
|
supplierName: Supplier name
|
||||||
basicData:
|
basicData:
|
||||||
workerFk: Responsible
|
workerFk: Responsible
|
||||||
isSerious: Verified
|
isReal: Verified
|
||||||
isActive: Active
|
isActive: Active
|
||||||
isPayMethodChecked: PayMethod checked
|
isPayMethodChecked: PayMethod checked
|
||||||
note: Notes
|
note: Notes
|
||||||
|
@ -767,6 +768,7 @@ travel:
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Days in forward
|
daysInForward: Days in forward
|
||||||
|
isRaid: Raid
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
destination: Destination
|
destination: Destination
|
||||||
|
@ -857,6 +859,7 @@ components:
|
||||||
downloadFile: Download file
|
downloadFile: Download file
|
||||||
openCard: View
|
openCard: View
|
||||||
openSummary: Summary
|
openSummary: Summary
|
||||||
|
viewSummary: Summary
|
||||||
cardDescriptor:
|
cardDescriptor:
|
||||||
mainList: Main list
|
mainList: Main list
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
|
|
@ -509,6 +509,7 @@ invoiceOut:
|
||||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||||
noTicketsToInvoice: No existen tickets para facturar
|
noTicketsToInvoice: No existen tickets para facturar
|
||||||
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
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:
|
table:
|
||||||
addressId: Id dirección
|
addressId: Id dirección
|
||||||
streetAddress: Dirección fiscal
|
streetAddress: Dirección fiscal
|
||||||
|
@ -579,9 +580,9 @@ worker:
|
||||||
newWorker: Nuevo trabajador
|
newWorker: Nuevo trabajador
|
||||||
summary:
|
summary:
|
||||||
boss: Jefe
|
boss: Jefe
|
||||||
phoneExtension: Extensión de teléfono
|
phoneExtension: Ext. de teléfono
|
||||||
entPhone: Teléfono de empresa
|
entPhone: Tel. de empresa
|
||||||
personalPhone: Teléfono personal
|
personalPhone: Tel. personal
|
||||||
noBoss: Sin jefe
|
noBoss: Sin jefe
|
||||||
userData: Datos de usuario
|
userData: Datos de usuario
|
||||||
userId: ID del usuario
|
userId: ID del usuario
|
||||||
|
@ -702,7 +703,7 @@ supplier:
|
||||||
supplierName: Nombre del proveedor
|
supplierName: Nombre del proveedor
|
||||||
basicData:
|
basicData:
|
||||||
workerFk: Responsable
|
workerFk: Responsable
|
||||||
isSerious: Verificado
|
isReal: Verificado
|
||||||
isActive: Activo
|
isActive: Activo
|
||||||
isPayMethodChecked: Método de pago validado
|
isPayMethodChecked: Método de pago validado
|
||||||
note: Notas
|
note: Notas
|
||||||
|
@ -761,6 +762,7 @@ travel:
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Días redada
|
daysInForward: Días redada
|
||||||
|
isRaid: Redada
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperatura
|
temperature: Temperatura
|
||||||
destination: Destino
|
destination: Destino
|
||||||
|
|
|
@ -11,21 +11,13 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const onSynchronizeAll = async () => {
|
const onSynchronizeAll = async () => {
|
||||||
try {
|
|
||||||
notify(t('Synchronizing in the background'), 'positive');
|
notify(t('Synchronizing in the background'), 'positive');
|
||||||
await axios.patch(`Accounts/syncAll`);
|
await axios.patch(`Accounts/syncAll`);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error synchronizing all accounts', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSynchronizeRoles = async () => {
|
const onSynchronizeRoles = async () => {
|
||||||
try {
|
|
||||||
await axios.patch(`RoleInherits/sync`);
|
await axios.patch(`RoleInherits/sync`);
|
||||||
notify(t('Roles synchronized!'), 'positive');
|
notify(t('Roles synchronized!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error synchronizing roles', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const deleteAcl = async ({ id }) => {
|
const deleteAcl = async ({ id }) => {
|
||||||
try {
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -131,9 +130,6 @@ const deleteAcl = async ({ id }) => {
|
||||||
await axios.delete(`ACLs/${id}`);
|
await axios.delete(`ACLs/${id}`);
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
notify('ACL removed', 'positive');
|
notify('ACL removed', 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error deleting Acl: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,9 @@ const refresh = () => paginateRef.value.fetch();
|
||||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||||
|
|
||||||
const killSession = async ({ userId, created }) => {
|
const killSession = async ({ userId, created }) => {
|
||||||
try {
|
|
||||||
await axios.post(`${urlPath}/killSession`, { userId, created });
|
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
notify(t('Session killed'), 'positive');
|
notify(t('Session killed'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error killing session', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,8 @@ const formUrlCreate = ref(null);
|
||||||
const formUrlUpdate = ref(null);
|
const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
|
||||||
await axios.get(`LdapConfigs/test`);
|
await axios.get(`LdapConfigs/test`);
|
||||||
notify(t('LDAP connection established!'), 'positive');
|
notify(t('LDAP connection established!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error testing connection', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const getInitialLdapConfig = async () => {
|
const getInitialLdapConfig = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -72,14 +68,10 @@ const getInitialLdapConfig = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialLdapConfig());
|
onMounted(async () => await getInitialLdapConfig());
|
||||||
|
|
|
@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="AccountUsers"
|
data-key="AccountList"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:label="t('account.search')"
|
:label="t('account.search')"
|
||||||
:info="t('account.searchInfo')"
|
:info="t('account.searchInfo')"
|
||||||
|
@ -112,12 +112,12 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<AccountFilter data-key="AccountUsers" />
|
<AccountFilter data-key="AccountList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="AccountUsers"
|
data-key="AccountList"
|
||||||
url="VnUsers/preview"
|
url="VnUsers/preview"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
|
|
|
@ -46,12 +46,8 @@ const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
|
||||||
await axios.get(`SambaConfigs/test`);
|
await axios.get(`SambaConfigs/test`);
|
||||||
notify(t('Samba connection established!'), 'positive');
|
notify(t('Samba connection established!'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error testing connection', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInitialSambaConfig = async () => {
|
const getInitialSambaConfig = async () => {
|
||||||
|
@ -79,14 +75,10 @@ const getInitialSambaConfig = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialSambaConfig());
|
onMounted(async () => await getInitialSambaConfig());
|
||||||
|
|
|
@ -44,13 +44,9 @@ const removeAlias = () => {
|
||||||
cancel: true,
|
cancel: true,
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`MailAliases/${entityId.value}`);
|
await axios.delete(`MailAliases/${entityId.value}`);
|
||||||
notify(t('Alias removed'), 'positive');
|
notify(t('Alias removed'), 'positive');
|
||||||
router.push({ name: 'AccountAlias' });
|
router.push({ name: 'AccountAlias' });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing alias');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -41,35 +41,22 @@ const fetchAccountExistence = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchMailForwards = async () => {
|
const fetchMailForwards = async () => {
|
||||||
try {
|
|
||||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching mail forwards', err);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`MailForwards/${route.params.id}`);
|
await axios.delete(`MailForwards/${route.params.id}`);
|
||||||
formData.value.forwardTo = null;
|
formData.value.forwardTo = null;
|
||||||
initialData.value.forwardTo = null;
|
initialData.value.forwardTo = null;
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMailForward = async () => {
|
const updateMailForward = async () => {
|
||||||
try {
|
|
||||||
await axios.patch('MailForwards', formData.value);
|
await axios.patch('MailForwards', formData.value);
|
||||||
initialData.value = { ...formData.value };
|
initialData.value = { ...formData.value };
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error creating mail forward', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="Roles"
|
data-key="AccountRolesList"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:label="t('role.searchRoles')"
|
:label="t('role.searchRoles')"
|
||||||
:info="t('role.searchInfo')"
|
:info="t('role.searchInfo')"
|
||||||
/>
|
/>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Roles"
|
data-key="AccountRolesList"
|
||||||
:url="`VnRoles`"
|
:url="`VnRoles`"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'VnRoles',
|
urlCreate: 'VnRoles',
|
||||||
|
|
|
@ -9,7 +9,7 @@ const { t } = useI18n();
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Role"
|
data-key="Role"
|
||||||
:descriptor="RoleDescriptor"
|
:descriptor="RoleDescriptor"
|
||||||
search-data-key="AccountRoles"
|
search-data-key="AccountRolesList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'VnRoles',
|
url: 'VnRoles',
|
||||||
label: t('role.searchRoles'),
|
label: t('role.searchRoles'),
|
||||||
|
|
|
@ -32,12 +32,8 @@ const filter = {
|
||||||
where: { id: entityId },
|
where: { id: entityId },
|
||||||
};
|
};
|
||||||
const removeRole = async () => {
|
const removeRole = async () => {
|
||||||
try {
|
|
||||||
await axios.delete(`VnRoles/${entityId.value}`);
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
notify(t('Role removed'), 'positive');
|
notify(t('Role removed'), 'positive');
|
||||||
} catch (error) {
|
|
||||||
console.error('Error deleting role', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -130,7 +130,7 @@ function cancel() {
|
||||||
<template #body-cell-description="{ row, value }">
|
<template #body-cell-description="{ row, value }">
|
||||||
<QTd auto-width align="right" class="link">
|
<QTd auto-width align="right" class="link">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
|
@ -25,7 +25,7 @@ const claimFilter = computed(() => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'nickname'],
|
fields: ['id', 'nickname', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,7 +23,7 @@ defineExpose({ states });
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
|
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -167,7 +167,7 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
<div>{{ item.street }}</div>
|
<div>{{ item.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
{{ item.province.name }}
|
{{ item.province?.name }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.phone }}
|
{{ item.phone }}
|
||||||
|
|
|
@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
|
||||||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<div class="link" v-if="row.isInvoice">
|
<span class="link" v-if="row.isInvoice" @click.stop>
|
||||||
{{ t('bill', { ref: row.description }) }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
<InvoiceOutDescriptorProxy :id="row.id" />
|
||||||
</div>
|
</span>
|
||||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
{{ row.description }}
|
{{ row.description }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -37,6 +37,9 @@ const entityId = computed(() => {
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
||||||
|
const debtWarning = computed(() => {
|
||||||
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -117,7 +120,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
v-if="customer.debt > customer.credit"
|
v-if="customer.debt > customer.credit"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
:color="debtWarning"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
|
|
||||||
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
@ -27,21 +27,16 @@ const $props = defineProps({
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const customer = computed(() => summary.value.entity);
|
const customer = computed(() => summary.value.entity);
|
||||||
const summary = ref();
|
const summary = ref();
|
||||||
const clientUrl = ref();
|
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
|
|
||||||
});
|
|
||||||
|
|
||||||
const balanceDue = computed(() => {
|
const balanceDue = computed(() => {
|
||||||
return (
|
const amount = defaulterAmount.value;
|
||||||
customer.value &&
|
if (!amount || amount < 0) {
|
||||||
customer.value.defaulters.length &&
|
return null;
|
||||||
customer.value.defaulters[0].amount
|
}
|
||||||
);
|
return amount;
|
||||||
});
|
});
|
||||||
|
|
||||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
|
||||||
|
|
||||||
const claimRate = computed(() => {
|
const claimRate = computed(() => {
|
||||||
return customer.value.claimsRatio?.claimingRate ?? 0;
|
return customer.value.claimsRatio?.claimingRate ?? 0;
|
||||||
|
@ -305,7 +300,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="entity.defaulters"
|
v-if="entity.defaulters"
|
||||||
:label="t('customer.summary.balanceDue')"
|
:label="t('customer.summary.balanceDue')"
|
||||||
:value="toCurrency(balanceDue)"
|
:value="dashOrCurrency(balanceDue)()"
|
||||||
:class="balanceDueWarning"
|
:class="balanceDueWarning"
|
||||||
:info="t('customer.summary.balanceDueInfo')"
|
:info="t('customer.summary.balanceDueInfo')"
|
||||||
/>
|
/>
|
||||||
|
@ -325,7 +320,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="entity.recommendedCredit"
|
:value="entity.recommendedCredit"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-max">
|
||||||
<VnTitle :text="t('Latest tickets')" />
|
<VnTitle :text="t('Latest tickets')" />
|
||||||
<CustomerSummaryTable />
|
<CustomerSummaryTable />
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -11,10 +11,24 @@ defineProps({
|
||||||
required: true,
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table">
|
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
@ -52,14 +66,18 @@ defineProps({
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/search"
|
||||||
:where="{ role: 'salesPerson' }"
|
:params="{
|
||||||
|
departmentCodes: ['VT'],
|
||||||
|
}"
|
||||||
auto-load
|
auto-load
|
||||||
:label="t('Salesperson')"
|
:label="t('Salesperson')"
|
||||||
|
:expr-builder="exprBuilder"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
sort-by="nickname ASC"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
use-input
|
use-input
|
||||||
|
@ -67,7 +85,19 @@ defineProps({
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
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>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
|
|
|
@ -394,16 +394,16 @@ function handleLocation(data, location) {
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
:info="t('You can search by customer id or name')"
|
:info="t('You can search by customer id or name')"
|
||||||
:label="t('Search customer')"
|
:label="t('Search customer')"
|
||||||
data-key="Customer"
|
data-key="CustomerList"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<CustomerFilter data-key="Customer" />
|
<CustomerFilter data-key="CustomerList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Customer"
|
data-key="CustomerList"
|
||||||
url="Clients/filter"
|
url="Clients/filter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Clients/createWithUser',
|
urlCreate: 'Clients/createWithUser',
|
||||||
|
|
|
@ -23,6 +23,7 @@ const incoterms = ref([]);
|
||||||
const customsAgents = ref([]);
|
const customsAgents = ref([]);
|
||||||
const observationTypes = ref([]);
|
const observationTypes = ref([]);
|
||||||
const notes = ref([]);
|
const notes = ref([]);
|
||||||
|
let originalNotes = [];
|
||||||
const deletes = ref([]);
|
const deletes = ref([]);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
@ -42,7 +43,8 @@ const getData = async (observations) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
notes.value = data
|
originalNotes = data;
|
||||||
|
notes.value = originalNotes
|
||||||
.map((observation) => {
|
.map((observation) => {
|
||||||
const type = observationTypes.value.find(
|
const type = observationTypes.value.find(
|
||||||
(type) => type.id === observation.observationTypeFk
|
(type) => type.id === observation.observationTypeFk
|
||||||
|
@ -81,14 +83,24 @@ const deleteNote = (id, index) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDataSaved = async () => {
|
const onDataSaved = async () => {
|
||||||
let payload = {};
|
let payload = {
|
||||||
const creates = notes.value.filter((note) => note.$isNew);
|
creates: notes.value.filter((note) => note.$isNew),
|
||||||
if (creates.length) {
|
deletes: deletes.value,
|
||||||
payload.creates = creates;
|
updates: notes.value
|
||||||
}
|
.filter((note) =>
|
||||||
if (deletes.value.length) {
|
originalNotes.some(
|
||||||
payload.deletes = deletes.value;
|
(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);
|
await axios.post('AddressObservations/crud', payload);
|
||||||
notes.value = [];
|
notes.value = [];
|
||||||
deletes.value = [];
|
deletes.value = [];
|
||||||
|
|
|
@ -106,7 +106,6 @@ const setParams = (params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: entityId,
|
recipientId: entityId,
|
||||||
};
|
};
|
||||||
|
@ -125,9 +124,6 @@ const getPreview = async () => {
|
||||||
htmlContent: data,
|
htmlContent: data,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
notify('Errors getting preview', 'negative');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -42,13 +42,9 @@ const setData = (entity) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDepartment = async () => {
|
const removeDepartment = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
||||||
router.push({ name: 'WorkerDepartment' });
|
router.push({ name: 'WorkerDepartment' });
|
||||||
notify('department.departmentRemoved', 'positive');
|
notify('department.departmentRemoved', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing department');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
|
|
@ -236,13 +236,9 @@ const copyOriginalRowsData = (rows) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveChange = async (field, { rowIndex, row }) => {
|
const saveChange = async (field, { rowIndex, row }) => {
|
||||||
try {
|
|
||||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||||
await axios.patch(`Buys/${row.id}`, row);
|
await axios.patch(`Buys/${row.id}`, row);
|
||||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving changes', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openRemoveDialog = async () => {
|
const openRemoveDialog = async () => {
|
||||||
|
@ -260,15 +256,11 @@ const openRemoveDialog = async () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
|
||||||
await deleteBuys();
|
await deleteBuys();
|
||||||
const notifyMessage = t(
|
const notifyMessage = t(
|
||||||
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
||||||
);
|
);
|
||||||
notify(notifyMessage, 'positive');
|
notify(notifyMessage, 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting buys');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -282,7 +274,6 @@ const importBuys = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleGroupingMode = async (buy, mode) => {
|
const toggleGroupingMode = async (buy, mode) => {
|
||||||
try {
|
|
||||||
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
||||||
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -290,9 +281,6 @@ const toggleGroupingMode = async (buy, mode) => {
|
||||||
};
|
};
|
||||||
await axios.patch(`Buys/${buy.id}`, params);
|
await axios.patch(`Buys/${buy.id}`, params);
|
||||||
buy.groupingMode = newGroupingMode;
|
buy.groupingMode = newGroupingMode;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error toggling grouping mode');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const lockIconType = (groupingMode, mode) => {
|
const lockIconType = (groupingMode, mode) => {
|
||||||
|
|
|
@ -123,20 +123,15 @@ const fillData = async (rawData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchBuys = async (buys) => {
|
const fetchBuys = async (buys) => {
|
||||||
try {
|
|
||||||
const params = { buys };
|
const params = { buys };
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
`Entries/${route.params.id}/importBuysPreview`,
|
`Entries/${route.params.id}/importBuysPreview`,
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
importData.value.buys = data;
|
importData.value.buys = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching buys');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
try {
|
|
||||||
const params = importData.value;
|
const params = importData.value;
|
||||||
const hasAnyEmptyRow = params.buys.some((buy) => {
|
const hasAnyEmptyRow = params.buys.some((buy) => {
|
||||||
return buy.itemFk === null;
|
return buy.itemFk === null;
|
||||||
|
@ -150,9 +145,6 @@ const onSubmit = async () => {
|
||||||
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
redirectToBuysView();
|
redirectToBuysView();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error importing buys', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const redirectToBuysView = () => {
|
const redirectToBuysView = () => {
|
||||||
|
|
|
@ -147,12 +147,9 @@ async function setEntryData(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchEntryBuys = async () => {
|
const fetchEntryBuys = async () => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||||
if (data) entryBuys.value = data;
|
if (data) entryBuys.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching entry buys');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const tableRef = ref();
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -234,7 +235,6 @@ const columns = [
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const tableRef = ref();
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
|
|
|
@ -221,7 +221,7 @@ onMounted(async () => {
|
||||||
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
|
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
t('globals.raid', { daysInForward: row.daysInForward })
|
t('globals.raid', { daysInForward: row.daysInForward })
|
||||||
|
|
|
@ -30,8 +30,6 @@ const recalc = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||||
notify('wasteRecalc.recalcOk', 'positive');
|
notify('wasteRecalc.recalcOk', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ const cols = computed(() => [
|
||||||
:columns="cols"
|
:columns="cols"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:auto-load="!!$route.query.params"
|
:auto-load="!!$route.query.table"
|
||||||
>
|
>
|
||||||
<template #column-supplierFk="{ row }">
|
<template #column-supplierFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
|
@ -61,7 +61,6 @@ const showSendInvoiceDialog = (type) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendEmailInvoice = async ({ address }) => {
|
const sendEmailInvoice = async ({ address }) => {
|
||||||
try {
|
|
||||||
if (!address) notify(`The email can't be empty`, 'negative');
|
if (!address) notify(`The email can't be empty`, 'negative');
|
||||||
|
|
||||||
if (invoiceFormType.value === 'pdf') {
|
if (invoiceFormType.value === 'pdf') {
|
||||||
|
@ -70,16 +69,10 @@ const sendEmailInvoice = async ({ address }) => {
|
||||||
recipient: address,
|
recipient: address,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return sendEmail(
|
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, {
|
||||||
`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`,
|
|
||||||
{
|
|
||||||
recipientId: $props.invoiceOutData.client.id,
|
recipientId: $props.invoiceOutData.client.id,
|
||||||
recipient: address,
|
recipient: address,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error sending email', err);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,34 +81,21 @@ const redirectToInvoiceOutList = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteInvoice = async () => {
|
const deleteInvoice = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
|
||||||
notify(t('InvoiceOut deleted'), 'positive');
|
notify(t('InvoiceOut deleted'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting invoice out', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const bookInvoice = async () => {
|
const bookInvoice = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
|
||||||
notify(t('InvoiceOut booked'), 'positive');
|
notify(t('InvoiceOut booked'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error booking invoice out', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateInvoicePdf = async () => {
|
const generateInvoicePdf = async () => {
|
||||||
try {
|
|
||||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
|
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
|
||||||
notify(t('The invoice PDF document has been regenerated'), 'positive');
|
notify(t('The invoice PDF document has been regenerated'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error generating invoice out pdf', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const refundInvoice = async (withWarehouse) => {
|
const refundInvoice = async (withWarehouse) => {
|
||||||
try {
|
|
||||||
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
|
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
|
||||||
const { data } = await axios.post('InvoiceOuts/refund', params);
|
const { data } = await axios.post('InvoiceOuts/refund', params);
|
||||||
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
|
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
|
||||||
|
@ -125,9 +105,6 @@ const refundInvoice = async (withWarehouse) => {
|
||||||
}),
|
}),
|
||||||
'positive'
|
'positive'
|
||||||
);
|
);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error generating invoice out pdf', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showTransferInvoiceForm = async () => {
|
const showTransferInvoiceForm = async () => {
|
||||||
|
|
|
@ -183,7 +183,7 @@ onMounted(async () => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
invoiceDate: Invoice date
|
invoiceDate: Invoice date
|
||||||
maxShipped: Max date
|
maxShipped: Max date ticket
|
||||||
allClients: All clients
|
allClients: All clients
|
||||||
oneClient: One client
|
oneClient: One client
|
||||||
company: Company
|
company: Company
|
||||||
|
@ -195,7 +195,7 @@ en:
|
||||||
|
|
||||||
es:
|
es:
|
||||||
invoiceDate: Fecha de factura
|
invoiceDate: Fecha de factura
|
||||||
maxShipped: Fecha límite
|
maxShipped: Fecha límite ticket
|
||||||
allClients: Todos los clientes
|
allClients: Todos los clientes
|
||||||
oneClient: Un solo cliente
|
oneClient: Un solo cliente
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
|
|
@ -6,15 +6,19 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
||||||
import { toCurrency, toDate } from 'src/filters/index';
|
import { toCurrency, toDate } from 'src/filters/index';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { QBtn } from 'quasar';
|
import { QBtn } from 'quasar';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import axios from 'axios';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import InvoiceOutFilter from './InvoiceOutFilter.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 { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -26,99 +30,86 @@ const selectedRows = ref([]);
|
||||||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
const MODEL = 'InvoiceOuts';
|
const MODEL = 'InvoiceOuts';
|
||||||
const { openReport } = usePrintService();
|
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(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||||
chip: {
|
chip: { condition: () => true },
|
||||||
condition: () => true,
|
|
||||||
},
|
|
||||||
isId: true,
|
isId: true,
|
||||||
columnFilter: {
|
columnFilter: { name: 'search' },
|
||||||
name: 'search',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'ref',
|
name: 'ref',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.ref'),
|
label: t('globals.reference'),
|
||||||
isTitle: true,
|
isTitle: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: { url: MODEL, optionLabel: 'ref', optionValue: 'id' },
|
||||||
url: MODEL,
|
columnField: { component: null },
|
||||||
optionLabel: 'ref',
|
|
||||||
optionValue: 'id',
|
|
||||||
},
|
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'Issued',
|
name: 'issued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.issued'),
|
label: t('invoiceOut.summary.issued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
format: (row) => toDate(row.issued),
|
format: (row) => toDate(row.issued),
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'clientFk',
|
name: 'clientFk',
|
||||||
label: t('invoiceOutModule.customer'),
|
label: t('globals.client'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: { url: 'Clients', fields: ['id', 'name'] },
|
||||||
url: 'Clients',
|
columnField: { component: null },
|
||||||
fields: ['id', 'name'],
|
|
||||||
},
|
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'companyCode',
|
name: 'companyCode',
|
||||||
label: t('invoiceOutModule.company'),
|
label: t('globals.company'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: { url: 'Companies', optionLabel: 'code', optionValue: 'id' },
|
||||||
url: 'Companies',
|
columnField: { component: null },
|
||||||
optionLabel: 'code',
|
|
||||||
optionValue: 'id',
|
|
||||||
},
|
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: t('invoiceOutModule.amount'),
|
label: t('globals.amount'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toCurrency(row.amount),
|
format: (row) => toCurrency(row.amount),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'created',
|
name: 'created',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.created'),
|
label: t('globals.created'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.created),
|
format: (row) => toDate(row.created),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'dued',
|
name: 'dued',
|
||||||
label: t('invoiceOutList.tableVisibleColumns.dueDate'),
|
label: t('invoiceOut.summary.dued'),
|
||||||
component: 'date',
|
component: 'date',
|
||||||
columnField: {
|
columnField: { component: null },
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
format: (row) => toDate(row.dued),
|
format: (row) => toDate(row.dued),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -128,11 +119,12 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
|
isPrimary: true,
|
||||||
action: (row) => viewSummary(row.id, InvoiceOutSummary),
|
action: (row) => viewSummary(row.id, InvoiceOutSummary),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('DownloadPdf'),
|
title: t('globals.downloadPdf'),
|
||||||
icon: 'vn:ticket',
|
icon: 'cloud_download',
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
action: (row) => openPdf(row.id),
|
action: (row) => openPdf(row.id),
|
||||||
},
|
},
|
||||||
|
@ -143,15 +135,10 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
function openPdf(id) {
|
function openPdf(id) {
|
||||||
try {
|
|
||||||
openReport(`${MODEL}/${id}/download`);
|
openReport(`${MODEL}/${id}/download`);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error opening PDF', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadPdf() {
|
function downloadPdf() {
|
||||||
try {
|
|
||||||
if (selectedRows.value.size === 0) return;
|
if (selectedRows.value.size === 0) return;
|
||||||
const selectedCardsArray = Array.from(selectedRows.value.values());
|
const selectedCardsArray = Array.from(selectedRows.value.values());
|
||||||
|
|
||||||
|
@ -170,9 +157,7 @@ function downloadPdf() {
|
||||||
|
|
||||||
openReport(`${MODEL}/downloadZip`, params);
|
openReport(`${MODEL}/downloadZip`, params);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error opening PDF');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watchEffect(selectedRows);
|
watchEffect(selectedRows);
|
||||||
|
@ -181,12 +166,12 @@ watchEffect(selectedRows);
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
:info="t('youCanSearchByInvoiceReference')"
|
:info="t('youCanSearchByInvoiceReference')"
|
||||||
:label="t('searchInvoice')"
|
:label="t('Search invoice')"
|
||||||
data-key="invoiceOut"
|
data-key="invoiceOutList"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<InvoiceOutFilter data-key="invoiceOut" />
|
<InvoiceOutFilter data-key="invoiceOutList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
|
@ -197,21 +182,19 @@ watchEffect(selectedRows);
|
||||||
@click="downloadPdf()"
|
@click="downloadPdf()"
|
||||||
:disable="!hasSelectedCards"
|
:disable="!hasSelectedCards"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
<QTooltip>{{ t('downloadPdf') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="invoiceOut"
|
data-key="invoiceOutList"
|
||||||
:url="`${MODEL}/filter`"
|
:url="`${MODEL}/filter`"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||||
title: t('Create manual invoice'),
|
title: t('createManualInvoice'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {
|
formInitialData: { active: true },
|
||||||
active: true,
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
@ -231,45 +214,154 @@ watchEffect(selectedRows);
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<div class="flex no-wrap flex-center">
|
<div class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<div class="col-12">
|
||||||
url="Tickets"
|
<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"
|
v-model="data.ticketFk"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ticket')"
|
:label="t('globals.ticket')"
|
||||||
option-label="id"
|
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"
|
option-value="id"
|
||||||
|
@update:model-value="fetchClientAddress"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
<QItemLabel>
|
||||||
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
|
#{{ scope.opt?.id }} -
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<span class="q-ml-md">O</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
v-model="data.addressFk"
|
||||||
v-model="data.clientFk"
|
:label="t('ticket.summary.consignee')"
|
||||||
:label="t('invoiceOutModule.customer')"
|
:options="addressOptions"
|
||||||
:options="customerOptions"
|
option-label="nickname"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
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
|
<VnSelect
|
||||||
url="InvoiceOutSerials"
|
url="InvoiceOutSerials"
|
||||||
v-model="data.serial"
|
v-model="data.serial"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.invoiceOutSerial')"
|
:label="t('invoiceIn.serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
:options="invoiceOutSerialsOptions"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
option-value="code"
|
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
|
<VnInputDate
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.dueDate')"
|
:label="t('invoiceOut.summary.dued')"
|
||||||
v-model="data.maxShipped"
|
v-model="data.maxShipped"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-col-gutter-xs">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="TaxAreas"
|
url="TaxAreas"
|
||||||
v-model="data.taxArea"
|
v-model="data.taxArea"
|
||||||
|
@ -278,27 +370,43 @@ watchEffect(selectedRows);
|
||||||
option-label="code"
|
option-label="code"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
/>
|
/>
|
||||||
<QInput
|
<VnInput
|
||||||
v-model="data.reference"
|
v-model="data.reference"
|
||||||
:label="t('invoiceOutList.tableVisibleColumns.ref')"
|
:label="t('globals.reference')"
|
||||||
/>
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</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>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
searchInvoice: Search issued invoice
|
invoiceId: Invoice ID
|
||||||
fileDenied: Browser denied file download...
|
|
||||||
fileAllowed: Successful download of CSV file
|
|
||||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||||
createInvoice: Make invoice
|
createManualInvoice: Create Manual Invoice
|
||||||
Create manual invoice: Create manual invoice
|
inactive: (Inactive)
|
||||||
es:
|
|
||||||
searchInvoice: Buscar factura emitida
|
es:
|
||||||
fileDenied: El navegador denegó la descarga de archivos...
|
invoiceId: ID de factura
|
||||||
fileAllowed: Descarga exitosa de archivo CSV
|
|
||||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||||
createInvoice: Crear factura
|
createManualInvoice: Crear factura manual
|
||||||
Create manual invoice: Crear factura manual
|
inactive: (Inactivo)
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -2,6 +2,7 @@ invoiceOutModule:
|
||||||
customer: Client
|
customer: Client
|
||||||
amount: Amount
|
amount: Amount
|
||||||
company: Company
|
company: Company
|
||||||
|
address: Address
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
|
|
|
@ -4,6 +4,7 @@ invoiceOutModule:
|
||||||
customer: Cliente
|
customer: Cliente
|
||||||
amount: Importe
|
amount: Importe
|
||||||
company: Empresa
|
company: Empresa
|
||||||
|
address: Consignatario
|
||||||
invoiceOutList:
|
invoiceOutList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: ID
|
id: ID
|
||||||
|
|
|
@ -170,7 +170,7 @@ onMounted(async () => {
|
||||||
from.value = getDate(_from, 'from');
|
from.value = getDate(_from, 'from');
|
||||||
const _to = Date.vnNew();
|
const _to = Date.vnNew();
|
||||||
_to.setDate(_to.getDate() + 10);
|
_to.setDate(_to.getDate() + 10);
|
||||||
to.value = getDate(Date.vnNew(), 'to');
|
to.value = getDate(_to, 'to');
|
||||||
|
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
|
||||||
|
|
|
@ -45,13 +45,9 @@ const arrayData = useArrayData('ItemShelvings', {
|
||||||
const rows = computed(() => arrayData.store.data || []);
|
const rows = computed(() => arrayData.store.data || []);
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
const applyColumnFilter = async (col) => {
|
||||||
try {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
params[paramKey] = col.columnFilter.filterValue;
|
||||||
await arrayData.addFilter({ filter: null, params });
|
await arrayData.addFilter({ filter: null, params });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error applying column filter', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInputEvents = (col) => {
|
const getInputEvents = (col) => {
|
||||||
|
@ -173,15 +169,11 @@ const totalLabels = computed(() =>
|
||||||
);
|
);
|
||||||
|
|
||||||
const removeLines = async () => {
|
const removeLines = async () => {
|
||||||
try {
|
|
||||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
||||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||||
rowsSelected.value = [];
|
rowsSelected.value = [];
|
||||||
notify('shelvings.shelvingsRemoved', 'positive');
|
notify('shelvings.shelvingsRemoved', 'positive');
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing lines', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
|
|
|
@ -19,7 +19,6 @@ const tagOptions = ref([]);
|
||||||
const valueOptionsMap = ref(new Map());
|
const valueOptionsMap = ref(new Map());
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag.tagFk && tag.tag.isFree) return;
|
if (!tag.tagFk && tag.tag.isFree) return;
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
|
@ -32,9 +31,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
valueOptionsMap.value.set(tag.tagFk, data);
|
valueOptionsMap.value.set(tag.tagFk, data);
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onItemTagsFetched = async (itemTags) => {
|
const onItemTagsFetched = async (itemTags) => {
|
||||||
|
|
|
@ -32,7 +32,6 @@ const ItemTaxRef = ref(null);
|
||||||
const taxesOptions = ref([]);
|
const taxesOptions = ref([]);
|
||||||
|
|
||||||
const submitTaxes = async (data) => {
|
const submitTaxes = async (data) => {
|
||||||
try {
|
|
||||||
let payload = data.map((tax) => ({
|
let payload = data.map((tax) => ({
|
||||||
id: tax.id,
|
id: tax.id,
|
||||||
taxClassFk: tax.taxClassFk,
|
taxClassFk: tax.taxClassFk,
|
||||||
|
@ -40,9 +39,6 @@ const submitTaxes = async (data) => {
|
||||||
|
|
||||||
await axios.post(`Items/updateTaxes`, payload);
|
await axios.post(`Items/updateTaxes`, payload);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error saving taxes', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -64,8 +64,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.name'),
|
label: t('globals.name'),
|
||||||
field: 'name',
|
name: 'name',
|
||||||
name: 'description',
|
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
create: true,
|
create: true,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
@ -222,24 +221,16 @@ const updateMinPrice = async (value, props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
try {
|
|
||||||
const { row } = props;
|
const { row } = props;
|
||||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
await upsertFixedPrice(row);
|
await upsertFixedPrice(row);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error('Error editing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
try {
|
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||||
return data;
|
return data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error editing price', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveOnRowChange(row) {
|
async function saveOnRowChange(row) {
|
||||||
|
@ -322,14 +313,10 @@ const onEditCellDataSaved = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFuturePrice = async () => {
|
const removeFuturePrice = async () => {
|
||||||
try {
|
|
||||||
rowsSelected.value.forEach(({ id }) => {
|
rowsSelected.value.forEach(({ id }) => {
|
||||||
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
||||||
removePrice(id, rowIndex);
|
removePrice(id, rowIndex);
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function confirmRemove(item, isFuture) {
|
function confirmRemove(item, isFuture) {
|
||||||
|
@ -346,13 +333,9 @@ function confirmRemove(item, isFuture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const removePrice = async (id) => {
|
const removePrice = async (id) => {
|
||||||
try {
|
|
||||||
await axios.delete(`FixedPrices/${id}`);
|
await axios.delete(`FixedPrices/${id}`);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
tableRef.value.reload({});
|
tableRef.value.reload({});
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing price', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const dateStyle = (date) =>
|
const dateStyle = (date) =>
|
||||||
date
|
date
|
||||||
|
@ -426,7 +409,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
data-key="ItemFixedPrices"
|
data-key="ItemFixedPrices"
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
:order="['description DESC']"
|
:order="['itemFk DESC', 'name DESC']"
|
||||||
save-url="FixedPrices/crud"
|
save-url="FixedPrices/crud"
|
||||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
|
@ -441,7 +424,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
:crud-model="{
|
:crud-model="{
|
||||||
paginate: false,
|
disableInfiniteScroll: true,
|
||||||
}"
|
}"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="rowsSelected"
|
||||||
:row-click="saveOnRowChange"
|
:row-click="saveOnRowChange"
|
||||||
|
@ -480,7 +463,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-name="{ row }">
|
||||||
<span class="link">
|
<span class="link">
|
||||||
{{ row.name }}
|
{{ row.name }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -17,21 +17,6 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemTypeWorkersOptions = ref([]);
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -66,7 +51,7 @@ const exprBuilder = (param, value) => {
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
auto-load
|
auto-load
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||||
:label="t('components.itemsFilterPanel.warehouseFk')"
|
:label="t('globals.warehouse')"
|
||||||
v-model="params.warehouseFk"
|
v-model="params.warehouseFk"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -55,7 +55,6 @@ const onCategoryChange = async (categoryFk, search) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag?.selectedTag?.id) return;
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -68,9 +67,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tag.valueOptions = data;
|
tag.valueOptions = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyTags = (params, search) => {
|
const applyTags = (params, search) => {
|
||||||
|
|
|
@ -173,7 +173,6 @@ const getBadgeColor = (date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeQuantity = async (request) => {
|
const changeQuantity = async (request) => {
|
||||||
try {
|
|
||||||
if (request.saleFk) {
|
if (request.saleFk) {
|
||||||
const params = {
|
const params = {
|
||||||
quantity: request.saleQuantity,
|
quantity: request.saleQuantity,
|
||||||
|
@ -183,13 +182,9 @@ const changeQuantity = async (request) => {
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
confirmRequest(request);
|
confirmRequest(request);
|
||||||
} else confirmRequest(request);
|
} else confirmRequest(request);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error changing quantity:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirmRequest = async (request) => {
|
const confirmRequest = async (request) => {
|
||||||
try {
|
|
||||||
if (request.itemFk && request.saleQuantity) {
|
if (request.itemFk && request.saleQuantity) {
|
||||||
const params = {
|
const params = {
|
||||||
itemFk: request.itemFk,
|
itemFk: request.itemFk,
|
||||||
|
@ -197,17 +192,11 @@ const confirmRequest = async (request) => {
|
||||||
attenderFk: request.attenderFk,
|
attenderFk: request.attenderFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(`TicketRequests/${request.id}/confirm`, params);
|
||||||
`TicketRequests/${request.id}/confirm`,
|
|
||||||
params
|
|
||||||
);
|
|
||||||
request.itemDescription = data.concept;
|
request.itemDescription = data.concept;
|
||||||
request.isOk = true;
|
request.isOk = true;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('Error confirming request:: ', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getState = (isOk) => {
|
const getState = (isOk) => {
|
||||||
|
|
|
@ -27,7 +27,7 @@ function exprBuilder(param, value) {
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('salesOrdersTable.dateSend'),
|
label: t('globals.landed'),
|
||||||
name: 'dateSend',
|
name: 'dateSend',
|
||||||
field: 'dateSend',
|
field: 'dateSend',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -103,15 +103,11 @@ const getBadgeColor = (date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeOrders = async () => {
|
const removeOrders = async () => {
|
||||||
try {
|
|
||||||
const selectedIds = selectedRows.value.map((row) => row.id);
|
const selectedIds = selectedRows.value.map((row) => row.id);
|
||||||
const params = { deletes: selectedIds };
|
const params = { deletes: selectedIds };
|
||||||
await axios.post('SalesMonitors/deleteOrders', params);
|
await axios.post('SalesMonitors/deleteOrders', params);
|
||||||
selectedRows.value = [];
|
selectedRows.value = [];
|
||||||
await table.value.reload();
|
await table.value.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error deleting orders', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) =>
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { toCurrency, dateRange, dashIfEmpty } from 'src/filters';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
|
||||||
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
import MonitorTicketFilter from './MonitorTicketFilter.vue';
|
||||||
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
|
|
||||||
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -23,13 +24,18 @@ const tableRef = ref(null);
|
||||||
const provinceOpts = ref([]);
|
const provinceOpts = ref([]);
|
||||||
const stateOpts = ref([]);
|
const stateOpts = ref([]);
|
||||||
const zoneOpts = ref([]);
|
const zoneOpts = ref([]);
|
||||||
const visibleColumns = ref([]);
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const from = Date.vnNew();
|
const from = Date.vnNew();
|
||||||
from.setHours(0, 0, 0, 0);
|
from.setHours(0, 0, 0, 0);
|
||||||
const to = new Date(from.getTime());
|
const to = new Date(from.getTime());
|
||||||
to.setDate(to.getDate() + 1);
|
to.setDate(to.getDate() + 1);
|
||||||
to.setHours(23, 59, 59, 999);
|
to.setHours(23, 59, 59, 999);
|
||||||
|
const stateColors = {
|
||||||
|
notice: 'info',
|
||||||
|
success: 'positive',
|
||||||
|
warning: 'warning',
|
||||||
|
alert: 'negative',
|
||||||
|
};
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -224,7 +230,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.goToLines'),
|
title: t('salesTicketsTable.goToLines'),
|
||||||
icon: 'vn:lines',
|
icon: 'vn:lines',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => openTab(row.id),
|
action: (row) => openTab(row.id),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -235,7 +241,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('salesTicketsTable.preview'),
|
title: t('salesTicketsTable.preview'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
color: 'priamry',
|
color: 'primary',
|
||||||
action: (row) => viewSummary(row.id, TicketSummary),
|
action: (row) => viewSummary(row.id, TicketSummary),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
|
@ -253,10 +259,10 @@ const getBadgeAttrs = (date) => {
|
||||||
let timeTicket = new Date(date);
|
let timeTicket = new Date(date);
|
||||||
timeTicket.setHours(0, 0, 0, 0);
|
timeTicket.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
let comparation = today - timeTicket;
|
let timeDiff = today - timeTicket;
|
||||||
|
|
||||||
if (comparation == 0) return { color: 'warning', 'text-color': 'black' };
|
if (timeDiff == 0) return { color: 'warning', 'text-color': 'black' };
|
||||||
if (comparation < 0) return { color: 'success', 'text-color': 'black' };
|
if (timeDiff < 0) return { color: 'success', 'text-color': 'black' };
|
||||||
return { color: 'transparent', 'text-color': 'white' };
|
return { color: 'transparent', 'text-color': 'white' };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,13 +277,6 @@ const autoRefreshHandler = (value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stateColors = {
|
|
||||||
notice: 'info',
|
|
||||||
success: 'positive',
|
|
||||||
warning: 'warning',
|
|
||||||
alert: 'negative',
|
|
||||||
};
|
|
||||||
|
|
||||||
const totalPriceColor = (ticket) => {
|
const totalPriceColor = (ticket) => {
|
||||||
const total = parseInt(ticket.totalWithVat);
|
const total = parseInt(ticket.totalWithVat);
|
||||||
if (total > 0 && total < 50) return 'warning';
|
if (total > 0 && total < 50) return 'warning';
|
||||||
|
@ -285,10 +284,10 @@ const totalPriceColor = (ticket) => {
|
||||||
|
|
||||||
const formatShippedDate = (date) => {
|
const formatShippedDate = (date) => {
|
||||||
if (!date) return '-';
|
if (!date) return '-';
|
||||||
const split1 = date.split('T');
|
const dateSplit = date.split('T');
|
||||||
const [year, month, day] = split1[0].split('-');
|
const [year, month, day] = dateSplit[0].split('-');
|
||||||
const _date = new Date(year, month - 1, day);
|
const newDate = new Date(year, month - 1, day);
|
||||||
return toDateFormat(_date);
|
return toDateFormat(newDate);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openTab = (id) =>
|
const openTab = (id) =>
|
||||||
|
@ -336,7 +335,6 @@ const openTab = (id) =>
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:offset="50"
|
:offset="50"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:visible-columns="visibleColumns"
|
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -366,61 +364,7 @@ const openTab = (id) =>
|
||||||
</QCheckbox>
|
</QCheckbox>
|
||||||
</template>
|
</template>
|
||||||
<template #column-totalProblems="{ row }">
|
<template #column-totalProblems="{ row }">
|
||||||
<span>
|
<TicketProblems :row="row" />
|
||||||
<QIcon
|
|
||||||
v-if="row.isTaxDataChecked === 0"
|
|
||||||
name="vn:no036"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasTicketRequest"
|
|
||||||
name="vn:buyrequest"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.itemShortage"
|
|
||||||
name="vn:unavailable"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.risk"
|
|
||||||
name="vn:risk"
|
|
||||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip
|
|
||||||
>{{ $t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip
|
|
||||||
>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.hasComponentLack"
|
|
||||||
name="vn:components"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.isTooLittle"
|
|
||||||
name="vn:isTooLittle"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
<template #column-id="{ row }">
|
<template #column-id="{ row }">
|
||||||
<span class="link" @click.stop.prevent>
|
<span class="link" @click.stop.prevent>
|
||||||
|
@ -475,7 +419,7 @@ const openTab = (id) =>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
<template #column-zoneFk="{ row }">
|
<template #column-zoneFk="{ row }">
|
||||||
<div @click.stop.prevent :title="row.zoneName">
|
<div v-if="row.zoneFk" @click.stop.prevent :title="row.zoneName">
|
||||||
<span class="link">{{ row.zoneName }}</span>
|
<span class="link">{{ row.zoneName }}</span>
|
||||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,6 @@ salesClientsTable:
|
||||||
client: Client
|
client: Client
|
||||||
salesOrdersTable:
|
salesOrdersTable:
|
||||||
delete: Delete
|
delete: Delete
|
||||||
dateSend: Send date
|
|
||||||
dateMake: Make date
|
dateMake: Make date
|
||||||
deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue?
|
deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue?
|
||||||
agency: Agency
|
agency: Agency
|
||||||
|
|
|
@ -11,7 +11,6 @@ salesClientsTable:
|
||||||
client: Cliente
|
client: Cliente
|
||||||
salesOrdersTable:
|
salesOrdersTable:
|
||||||
delete: Eliminar
|
delete: Eliminar
|
||||||
dateSend: Fecha de envío
|
|
||||||
dateMake: Fecha de realización
|
dateMake: Fecha de realización
|
||||||
deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
||||||
agency: Agencia
|
agency: Agencia
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -31,16 +31,7 @@ const applyTags = () => {
|
||||||
emit('applyTags', tagInfo);
|
emit('applyTags', tagInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTagGroupParam = (valIndex = null) => {
|
|
||||||
if (!valIndex) {
|
|
||||||
tagValues.value = [{}];
|
|
||||||
} else {
|
|
||||||
(tagValues.value || []).splice(valIndex, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
|
||||||
if (!tag?.id) return;
|
if (!tag?.id) return;
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
|
@ -54,24 +45,12 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tagOptions.value = data;
|
tagOptions.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error('Error getting selected tag values');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QForm @submit="applyTags(tagValues)" class="all-pointer-events">
|
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||||
<QCard class="q-pa-sm column q-pa-lg">
|
<QCard class="q-pa-sm column q-pa-lg">
|
||||||
<QBtn
|
|
||||||
round
|
|
||||||
color="primary"
|
|
||||||
style="position: absolute; z-index: 1; right: 0; top: 0"
|
|
||||||
icon="search"
|
|
||||||
type="submit"
|
|
||||||
>
|
|
||||||
</QBtn>
|
|
||||||
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.tag')"
|
:label="t('params.tag')"
|
||||||
v-model="selectedTag"
|
v-model="selectedTag"
|
||||||
|
@ -84,17 +63,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
rounded
|
rounded
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
use-input
|
use-input
|
||||||
@update:model-value="($event) => getSelectedTagValues($event)"
|
@update:model-value="getSelectedTagValues"
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
icon="add_circle"
|
|
||||||
shortcut="+"
|
|
||||||
flat
|
|
||||||
class="filter-icon q-mb-md"
|
|
||||||
size="md"
|
|
||||||
dense
|
|
||||||
:disabled="!selectedTag || !tagValues[0].value"
|
|
||||||
@click="tagValues.unshift({})"
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in tagValues"
|
v-for="(value, index) in tagValues"
|
||||||
|
@ -106,7 +75,7 @@ const getSelectedTagValues = async (tag) => {
|
||||||
v-if="!selectedTag?.isFree && tagOptions"
|
v-if="!selectedTag?.isFree && tagOptions"
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
v-model="value.value"
|
v-model="value.value"
|
||||||
:options="tagOptions || []"
|
:options="tagOptions"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="value"
|
option-label="value"
|
||||||
dense
|
dense
|
||||||
|
@ -124,7 +93,6 @@ const getSelectedTagValues = async (tag) => {
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
:disable="!value"
|
:disable="!value"
|
||||||
is-outlined
|
is-outlined
|
||||||
:is-clearable="false"
|
|
||||||
class="col"
|
class="col"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -135,11 +103,25 @@ const getSelectedTagValues = async (tag) => {
|
||||||
rounded
|
rounded
|
||||||
flat
|
flat
|
||||||
class="filter-icon col-2"
|
class="filter-icon col-2"
|
||||||
:disabled="!value.value"
|
@click="tagValues.splice(index, 1)"
|
||||||
@click="removeTagGroupParam(index)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<QBtn
|
||||||
|
icon="add_circle"
|
||||||
|
shortcut="+"
|
||||||
|
flat
|
||||||
|
class="filter-icon q-mb-md"
|
||||||
|
size="md"
|
||||||
|
dense
|
||||||
|
@click="tagValues.push({})"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
icon="search"
|
||||||
|
type="submit"
|
||||||
|
:label="$t('globals.search')"
|
||||||
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -22,7 +22,6 @@ const agencyList = ref([]);
|
||||||
const addressList = ref([]);
|
const addressList = ref([]);
|
||||||
|
|
||||||
const fetchAddressList = async (addressId) => {
|
const fetchAddressList = async (addressId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get('addresses', {
|
const { data } = await axios.get('addresses', {
|
||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify({
|
filter: JSON.stringify({
|
||||||
|
@ -35,17 +34,12 @@ const fetchAddressList = async (addressId) => {
|
||||||
if (addressList.value?.length === 1) {
|
if (addressList.value?.length === 1) {
|
||||||
state.get(ORDER_MODEL).addressFk = addressList.value[0].id;
|
state.get(ORDER_MODEL).addressFk = addressList.value[0].id;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAgencyList = async (landed, addressFk) => {
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
if (!landed || !addressFk) {
|
if (!landed || !addressFk) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: {
|
params: {
|
||||||
addressFk,
|
addressFk,
|
||||||
|
@ -53,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching agencies`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchOrderDetails = (order) => {
|
const fetchOrderDetails = (order) => {
|
||||||
|
@ -92,12 +82,8 @@ const orderFilter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClientChange = async (clientId) => {
|
const onClientChange = async (clientId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
await fetchAddressList(data.defaultAddressFk);
|
await fetchAddressList(data.defaultAddressFk);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error al cambiar el cliente:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
import { onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import CatalogItem from 'components/ui/CatalogItem.vue';
|
import CatalogItem from 'src/components/ui/CatalogItem.vue';
|
||||||
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
|
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import getParamWhere from 'src/filters/getParamWhere';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const arrayData = useArrayData('OrderCatalogList');
|
const dataKey = 'OrderCatalogList';
|
||||||
|
const arrayData = useArrayData(dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const showFilter = ref(null);
|
|
||||||
const tags = ref([]);
|
const tags = ref([]);
|
||||||
|
|
||||||
let catalogParams = {
|
let catalogParams = {
|
||||||
|
@ -25,27 +24,6 @@ let catalogParams = {
|
||||||
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
||||||
};
|
};
|
||||||
|
|
||||||
onBeforeMount(() => {
|
|
||||||
const whereParams = getParamWhere(route);
|
|
||||||
if (whereParams) {
|
|
||||||
const formattedWhereParams = {};
|
|
||||||
if (whereParams.and) {
|
|
||||||
whereParams.and.forEach((item) => {
|
|
||||||
Object.assign(formattedWhereParams, item);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Object.assign(formattedWhereParams, whereParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
catalogParams = {
|
|
||||||
...catalogParams,
|
|
||||||
...formattedWhereParams,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
showFilter.value = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
checkOrderConfirmation();
|
checkOrderConfirmation();
|
||||||
|
@ -89,7 +67,7 @@ function extractValueTags(items) {
|
||||||
);
|
);
|
||||||
tagValue.value = resultValueTags;
|
tagValue.value = resultValueTags;
|
||||||
}
|
}
|
||||||
const autoLoad = computed(() => !!catalogParams.categoryFk);
|
const autoLoad = computed(() => !!JSON.parse(route?.query.table ?? '{}')?.categoryFk);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => store.data,
|
() => store.data,
|
||||||
|
@ -102,7 +80,7 @@ watch(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
:user-params="catalogParams"
|
:user-params="catalogParams"
|
||||||
:static-params="['orderFk', 'orderBy']"
|
:static-params="['orderFk', 'orderBy']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
|
@ -111,9 +89,9 @@ watch(
|
||||||
:info="t('You can search items by name or id')"
|
:info="t('You can search items by name or id')"
|
||||||
/>
|
/>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea v-if="showFilter" class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<OrderCatalogFilter
|
<OrderCatalogFilter
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
:tag-value="tagValue"
|
:tag-value="tagValue"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
:initial-catalog-params="catalogParams"
|
:initial-catalog-params="catalogParams"
|
||||||
|
@ -123,12 +101,10 @@ watch(
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
data-key="OrderCatalogList"
|
:data-key="dataKey"
|
||||||
url="Orders/CatalogFilter"
|
url="Orders/CatalogFilter"
|
||||||
:limit="50"
|
:limit="50"
|
||||||
:user-params="catalogParams"
|
:user-params="catalogParams"
|
||||||
@on-fetch="showFilter = true"
|
|
||||||
:update-router="false"
|
|
||||||
:auto-load="autoLoad"
|
:auto-load="autoLoad"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -8,7 +8,6 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import getParamWhere from 'src/filters/getParamWhere';
|
|
||||||
import CatalogFilterValueDialog from 'src/pages/Order/Card/CatalogFilterValueDialog.vue';
|
import CatalogFilterValueDialog from 'src/pages/Order/Card/CatalogFilterValueDialog.vue';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
|
||||||
|
@ -33,10 +32,8 @@ const route = useRoute();
|
||||||
const arrayData = useArrayData(props.dataKey);
|
const arrayData = useArrayData(props.dataKey);
|
||||||
|
|
||||||
const categoryList = ref(null);
|
const categoryList = ref(null);
|
||||||
const selectedCategoryFk = ref(null);
|
|
||||||
const typeList = ref([]);
|
const typeList = ref([]);
|
||||||
const selectedTypeFk = ref(null);
|
const searchByTag = ref(null);
|
||||||
const generalSearchParam = ref(null);
|
|
||||||
|
|
||||||
const vnFilterPanelRef = ref();
|
const vnFilterPanelRef = ref();
|
||||||
const orderByList = ref([
|
const orderByList = ref([
|
||||||
|
@ -53,45 +50,31 @@ const orderBySelected = ref('relevancy DESC, name');
|
||||||
const orderWaySelected = ref('ASC');
|
const orderWaySelected = ref('ASC');
|
||||||
|
|
||||||
const resetCategory = (params, search) => {
|
const resetCategory = (params, search) => {
|
||||||
selectedCategoryFk.value = null;
|
|
||||||
typeList.value = null;
|
typeList.value = null;
|
||||||
params.categoryFk = null;
|
params.categoryFk = null;
|
||||||
params.typeFk = null;
|
params.typeFk = null;
|
||||||
arrayData.store.userFilter = null;
|
arrayData.store.userFilter = null;
|
||||||
removeTagGroupParam(params, search);
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectCategory = (params, category, search) => {
|
|
||||||
if (params.categoryFk === category?.id) {
|
|
||||||
resetCategory(params, search);
|
|
||||||
params.categoryFk = null;
|
|
||||||
} else {
|
|
||||||
selectedCategoryFk.value = category?.id;
|
|
||||||
params.categoryFk = category?.id;
|
|
||||||
params.typeFk = null;
|
|
||||||
selectedTypeFk.value = null;
|
|
||||||
loadTypes(category?.id);
|
|
||||||
}
|
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadTypes = async (categoryFk = selectedCategoryFk.value) => {
|
const selectCategory = async (params, category, search) => {
|
||||||
|
if (vnFilterPanelRef.value.params.categoryFk === category?.id) {
|
||||||
|
resetCategory(params, search);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
params.typeFk = null;
|
||||||
|
params.categoryFk = category.id;
|
||||||
|
await loadTypes(category?.id);
|
||||||
|
await search();
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadTypes = async (id) => {
|
||||||
const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, {
|
const { data } = await axios.get(`Orders/${route.params.id}/getItemTypeAvailable`, {
|
||||||
params: { itemCategoryId: categoryFk },
|
params: { itemCategoryId: id },
|
||||||
});
|
});
|
||||||
typeList.value = data;
|
typeList.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedCategory = computed(() => {
|
|
||||||
return (categoryList.value || []).find(
|
|
||||||
(category) => category?.id === selectedCategoryFk.value
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectedType = computed(() => {
|
|
||||||
return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'categoryFk':
|
case 'categoryFk':
|
||||||
|
@ -115,13 +98,23 @@ const applyTags = (tagInfo, params, search) => {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTagGroupParam = (params, search, valIndex = null) => {
|
async function onSearchByTag(value) {
|
||||||
if (!valIndex) {
|
if (!value.target.value) return;
|
||||||
|
if (!vnFilterPanelRef.value.params?.tagGroups) {
|
||||||
|
vnFilterPanelRef.value.params.tagGroups = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
vnFilterPanelRef.value.params.tagGroups.push({
|
||||||
|
values: [{ value: value.target.value }],
|
||||||
|
});
|
||||||
|
searchByTag.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeTagGroupParam = (params, search, valIndex) => {
|
||||||
|
if (!valIndex && valIndex !== 0) {
|
||||||
params.tagGroups = null;
|
params.tagGroups = null;
|
||||||
search();
|
|
||||||
} else {
|
} else {
|
||||||
params.tagGroups.splice(valIndex, 1);
|
params.tagGroups.splice(valIndex, 1);
|
||||||
search();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -133,7 +126,8 @@ const setCategoryList = (data) => {
|
||||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
selectedCategoryFk.value && loadTypes();
|
vnFilterPanelRef.value.params.categoryFk &&
|
||||||
|
loadTypes(vnFilterPanelRef.value.params.categoryFk);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryClass = (category, params) => {
|
const getCategoryClass = (category, params) => {
|
||||||
|
@ -149,34 +143,29 @@ function addOrder(value, field, params) {
|
||||||
params.orderBy = JSON.stringify(orderBy);
|
params.orderBy = JSON.stringify(orderBy);
|
||||||
vnFilterPanelRef.value.search();
|
vnFilterPanelRef.value.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
|
|
||||||
selectedTypeFk.value = getParamWhere(route, 'typeFk');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
<FetchData url="ItemCategories" auto-load @on-fetch="setCategoryList" />
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
ref="vnFilterPanelRef"
|
ref="vnFilterPanelRef"
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:hidden-tags="['orderFk', 'orderBy']"
|
:hidden-tags="['filter', 'orderFk', 'orderBy']"
|
||||||
:un-removable-params="['orderFk', 'orderBy']"
|
:unremovable-params="['orderFk', 'orderBy']"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:custom-tags="['tagGroups', 'categoryFk']"
|
:custom-tags="['tagGroups', 'categoryFk']"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'typeFk'">
|
<strong v-if="tag.label === 'typeFk' && typeList">
|
||||||
{{ t(selectedType?.name || '') }}
|
{{ t(typeList.find((t) => t.id == tag.value)?.name || '') }}
|
||||||
</strong>
|
</strong>
|
||||||
<div v-else class="q-gutter-x-xs">
|
<div v-else class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #customTags="{ tags: customTags, params, searchFn }">
|
<template #customTags="{ params, tags: customTags, searchFn }">
|
||||||
<template v-for="customTag in customTags" :key="customTag.label">
|
<template v-for="customTag in customTags" :key="customTag.label">
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-for="(tag, valIndex) in Array.isArray(customTag.value)
|
v-for="(tag, valIndex) in Array.isArray(customTag.value)
|
||||||
|
@ -190,8 +179,13 @@ onMounted(() => {
|
||||||
: removeTagGroupParam(params, searchFn, valIndex)
|
: removeTagGroupParam(params, searchFn, valIndex)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<strong v-if="customTag.label === 'categoryFk'">
|
<strong v-if="customTag.label === 'categoryFk' && categoryList">
|
||||||
{{ t(selectedCategory?.name || '') }}
|
{{
|
||||||
|
t(
|
||||||
|
categoryList.find((c) => c.id == customTag.value)?.name ||
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}}
|
||||||
</strong>
|
</strong>
|
||||||
<strong v-if="tag?.tagSelection?.name" class="q-mr-xs">
|
<strong v-if="tag?.tagSelection?.name" class="q-mr-xs">
|
||||||
{{ tag.tagSelection.name }}:
|
{{ tag.tagSelection.name }}:
|
||||||
|
@ -238,13 +232,8 @@ onMounted(() => {
|
||||||
emit-value
|
emit-value
|
||||||
use-input
|
use-input
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
:disable="!selectedCategoryFk"
|
:disable="!params.categoryFk"
|
||||||
@update:model-value="
|
@update:model-value="searchFn()"
|
||||||
(value) => {
|
|
||||||
selectedTypeFk = value;
|
|
||||||
searchFn();
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -287,34 +276,27 @@ onMounted(() => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
<QItem class="q-mt-lg q-pa-none">
|
||||||
<QItem class="q-mt-lg">
|
<VnInput
|
||||||
<VnSelect
|
|
||||||
:label="t('components.itemsFilterPanel.value')"
|
:label="t('components.itemsFilterPanel.value')"
|
||||||
:options="props.tagValue"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
:is-clearable="false"
|
:is-clearable="false"
|
||||||
v-model="generalSearchParam"
|
v-model="searchByTag"
|
||||||
@update:model-value="
|
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||||
applyTags(
|
|
||||||
{ values: [{ value: generalSearchParam }] },
|
|
||||||
params,
|
|
||||||
searchFn
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon name="search" />
|
<QIcon name="search" />
|
||||||
</template>
|
</template>
|
||||||
<template #after>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
flat
|
flat
|
||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
|
dense
|
||||||
/>
|
/>
|
||||||
<QPopupProxy>
|
<QPopupProxy>
|
||||||
<CatalogFilterValueDialog
|
<CatalogFilterValueDialog
|
||||||
|
@ -326,7 +308,7 @@ onMounted(() => {
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnInput>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { onMounted, ref } from 'vue';
|
import { reactive, onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
|
@ -9,7 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
import { reactive } from 'vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -21,7 +20,6 @@ const addressList = ref([]);
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
const fetchAddressList = async (addressId) => {
|
const fetchAddressList = async (addressId) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get('addresses', {
|
const { data } = await axios.get('addresses', {
|
||||||
params: {
|
params: {
|
||||||
filter: JSON.stringify({
|
filter: JSON.stringify({
|
||||||
|
@ -34,17 +32,12 @@ const fetchAddressList = async (addressId) => {
|
||||||
if (addressList.value?.length === 1) {
|
if (addressList.value?.length === 1) {
|
||||||
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching addresses`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAgencyList = async (landed, addressFk) => {
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
if (!landed || !addressFk) {
|
if (!landed || !addressFk) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const { data } = await axios.get('Agencies/landsThatDay', {
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
params: {
|
params: {
|
||||||
addressFk,
|
addressFk,
|
||||||
|
@ -52,16 +45,8 @@ const fetchAgencyList = async (landed, addressFk) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
agencyList.value = data;
|
agencyList.value = data;
|
||||||
} catch (err) {
|
|
||||||
console.error(`Error fetching agencies`, err);
|
|
||||||
return err.response;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// const fetchOrderDetails = (order) => {
|
|
||||||
// fetchAddressList(order?.addressFk);
|
|
||||||
// fetchAgencyList(order?.landed, order?.addressFk);
|
|
||||||
// };
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
clientFk: {
|
clientFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -73,47 +58,10 @@ const initialFormState = reactive({
|
||||||
addressId: null,
|
addressId: null,
|
||||||
clientFk: $props.clientFk,
|
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) => {
|
const onClientChange = async (clientId = $props.clientFk) => {
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Clients/${clientId}`);
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
await fetchAddressList(data.defaultAddressFk);
|
await fetchAddressList(data.defaultAddressFk);
|
||||||
} catch (error) {
|
|
||||||
console.error('Error al cambiar el cliente:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function onDataSaved(_, id) {
|
async function onDataSaved(_, id) {
|
||||||
|
|
|
@ -111,6 +111,7 @@ const columns = computed(() => [
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Items',
|
url: 'Items',
|
||||||
|
sortBy: 'name ASC ',
|
||||||
fields: ['id', 'name', 'subName'],
|
fields: ['id', 'name', 'subName'],
|
||||||
},
|
},
|
||||||
columnField: {
|
columnField: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
@ -14,7 +14,6 @@ import OrderFilter from './Card/OrderFilter.vue';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -142,8 +141,13 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
onMounted(() => {
|
||||||
async function fetchClientAddress(id, formData) {
|
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}`, {
|
const { data } = await axios.get(`Clients/${id}`, {
|
||||||
params: { filter: { include: { relation: 'addresses' } } },
|
params: { filter: { include: { relation: 'addresses' } } },
|
||||||
});
|
});
|
||||||
|
@ -170,13 +174,6 @@ const getDateColor = (date) => {
|
||||||
if (comparation == 0) return 'bg-warning';
|
if (comparation == 0) return 'bg-warning';
|
||||||
if (comparation < 0) return 'bg-success';
|
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>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<OrderSearchbar />
|
<OrderSearchbar />
|
||||||
|
@ -194,7 +191,7 @@ onMounted(() => {
|
||||||
urlCreate: 'Orders/new',
|
urlCreate: 'Orders/new',
|
||||||
title: t('module.cerateOrder'),
|
title: t('module.cerateOrder'),
|
||||||
onDataSaved: (url) => {
|
onDataSaved: (url) => {
|
||||||
tableRef.redirect(url);
|
tableRef.redirect(`${url}/catalog`);
|
||||||
},
|
},
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -47,7 +47,6 @@ const onChangesSaved = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const setWireTransfer = async () => {
|
const setWireTransfer = async () => {
|
||||||
try {
|
|
||||||
const params = {
|
const params = {
|
||||||
id: route.params.id,
|
id: route.params.id,
|
||||||
payMethodFk: wireTransferFk.value,
|
payMethodFk: wireTransferFk.value,
|
||||||
|
@ -55,9 +54,6 @@ const setWireTransfer = async () => {
|
||||||
|
|
||||||
await axios.patch(`Suppliers/${route.params.id}`, params);
|
await axios.patch(`Suppliers/${route.params.id}`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
} catch (err) {
|
|
||||||
console.error('Error setting wire transfer', err);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -126,7 +122,6 @@ const setWireTransfer = async () => {
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onBankEntityCreated(requestResponse, row)
|
onBankEntityCreated(requestResponse, row)
|
||||||
"
|
"
|
||||||
:show-entity-field="false"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
|
@ -76,8 +76,8 @@ const companySizes = [
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="data.isSerious"
|
v-model="data.isReal"
|
||||||
:label="t('supplier.basicData.isSerious')"
|
:label="t('supplier.basicData.isReal')"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="data.isActive"
|
v-model="data.isActive"
|
||||||
|
|
|
@ -38,7 +38,7 @@ const filter = {
|
||||||
'payDemFk',
|
'payDemFk',
|
||||||
'payDay',
|
'payDay',
|
||||||
'isActive',
|
'isActive',
|
||||||
'isSerious',
|
'isReal',
|
||||||
'isTrucker',
|
'isTrucker',
|
||||||
'account',
|
'account',
|
||||||
],
|
],
|
||||||
|
@ -137,7 +137,7 @@ const getEntryQueryParams = (supplier) => {
|
||||||
<QTooltip>{{ t('Inactive supplier') }}</QTooltip>
|
<QTooltip>{{ t('Inactive supplier') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!supplier.isSerious"
|
v-if="!supplier.isReal"
|
||||||
name="vn:supplierfalse"
|
name="vn:supplierfalse"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|
|
@ -83,7 +83,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('supplier.summary.verified')"
|
:label="t('supplier.summary.verified')"
|
||||||
v-model="supplier.isSerious"
|
v-model="supplier.isReal"
|
||||||
:disable="true"
|
:disable="true"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
|
|
|
@ -16,12 +16,9 @@ import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { toTimeFormat } from 'filters/date.js';
|
import { toTimeFormat } from 'filters/date.js';
|
||||||
|
|
||||||
const $props = defineProps({
|
const formData = defineModel({
|
||||||
formData: {
|
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['updateForm']);
|
const emit = defineEmits(['updateForm']);
|
||||||
|
@ -36,11 +33,11 @@ const canEditZone = useAcl().hasAny([
|
||||||
const agencyFetchRef = ref();
|
const agencyFetchRef = ref();
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
|
const currenciesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
const zoneSelectRef = ref();
|
const zoneSelectRef = ref();
|
||||||
const formData = ref($props.formData);
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => formData.value,
|
() => formData.value,
|
||||||
|
@ -69,47 +66,28 @@ const zoneWhere = computed(() => {
|
||||||
: {};
|
: {};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getLanded = async (params) => {
|
async function getLanded(params) {
|
||||||
try {
|
getDate(`Agencies/getLanded`, params);
|
||||||
const validParams =
|
}
|
||||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
|
||||||
if (!validParams) return;
|
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;
|
formData.value.zoneFk = null;
|
||||||
zonesOptions.value = [];
|
zonesOptions.value = [];
|
||||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
const { data } = await axios.get(query, { params });
|
||||||
if (data) {
|
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||||
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 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.zoneFk = data.zoneFk;
|
||||||
formData.value.landed = params.landed;
|
if (data.landed) formData.value.landed = data.landed;
|
||||||
formData.value.shipped = data.shipped;
|
if (data.shipped) formData.value.shipped = data.shipped;
|
||||||
} else {
|
}
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChangeZone = async (zoneId) => {
|
const onChangeZone = async (zoneId) => {
|
||||||
formData.value.agencyModeFk = null;
|
formData.value.agencyModeFk = null;
|
||||||
|
@ -177,18 +155,26 @@ const clientId = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const landed = computed({
|
function addDateParams(obj) {
|
||||||
get: () => formData.value?.landed,
|
return {
|
||||||
set: (val) => {
|
...obj,
|
||||||
formData.value.landed = val;
|
...{
|
||||||
getShipped({
|
|
||||||
landed: val,
|
|
||||||
addressFk: formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setLanded(landed) {
|
||||||
|
if (!landed) return;
|
||||||
|
getShipped(addDateParams({ landed }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setShipped(shipped) {
|
||||||
|
if (!shipped) return;
|
||||||
|
getLanded(addDateParams({ shipped }));
|
||||||
|
}
|
||||||
|
|
||||||
const agencyModeId = computed({
|
const agencyModeId = computed({
|
||||||
get: () => formData.value.agencyModeFk,
|
get: () => formData.value.agencyModeFk,
|
||||||
|
@ -236,21 +222,6 @@ const warehouseId = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const shipped = computed({
|
|
||||||
get: () => formData.value?.shipped,
|
|
||||||
set: (val) => {
|
|
||||||
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
|
|
||||||
val.setHours(0, 0, 0, 0);
|
|
||||||
formData.value.shipped = val;
|
|
||||||
getLanded({
|
|
||||||
shipped: val,
|
|
||||||
addressFk: formData.value?.addressFk,
|
|
||||||
agencyModeFk: formData.value?.agencyModeFk,
|
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const onFormModelInit = () => {
|
const onFormModelInit = () => {
|
||||||
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||||
};
|
};
|
||||||
|
@ -451,18 +422,21 @@ async function getZone(options) {
|
||||||
v-model="formData.shipped"
|
v-model="formData.shipped"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('ticketList.shipped')"
|
:rules="validate('ticketList.shipped')"
|
||||||
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputTime
|
<VnInputTime
|
||||||
:label="t('basicData.shippedHour')"
|
:label="t('basicData.shippedHour')"
|
||||||
v-model="formData.shipped"
|
v-model="formData.shipped"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('basicData.shippedHour')"
|
:rules="validate('basicData.shippedHour')"
|
||||||
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.landed')"
|
:label="t('basicData.landed')"
|
||||||
v-model="formData.landed"
|
v-model="formData.landed"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('basicData.landed')"
|
:rules="validate('basicData.landed')"
|
||||||
|
@update:model-value="setLanded"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</QForm>
|
||||||
|
|
|
@ -158,7 +158,7 @@ onBeforeMount(async () => await getTicketData());
|
||||||
<TicketBasicDataForm
|
<TicketBasicDataForm
|
||||||
v-if="initialDataLoaded"
|
v-if="initialDataLoaded"
|
||||||
@update-form="($event) => (formData = $event)"
|
@update-form="($event) => (formData = $event)"
|
||||||
:form-data="formData"
|
v-model="formData"
|
||||||
/>
|
/>
|
||||||
</QStep>
|
</QStep>
|
||||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||||
|
|
|
@ -130,6 +130,7 @@ function ticketFilter(ticket) {
|
||||||
<QBadge
|
<QBadge
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="entity.ticketState.state.classColor"
|
:color="entity.ticketState.state.classColor"
|
||||||
|
data-cy="ticketDescriptorStateBadge"
|
||||||
>
|
>
|
||||||
{{ entity.ticketState.state.name }}
|
{{ entity.ticketState.state.name }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
@ -174,7 +175,7 @@ function ticketFilter(ticket) {
|
||||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.problem.includes('hasRisk')"
|
v-if="entity?.problem?.includes('hasRisk')"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ref, toRefs } from 'vue';
|
import { computed, ref, toRefs } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
@ -23,7 +23,6 @@ const props = defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const { push, currentRoute } = useRouter();
|
const { push, currentRoute } = useRouter();
|
||||||
const { dialog, notify } = useQuasar();
|
const { dialog, notify } = useQuasar();
|
||||||
|
@ -31,7 +30,7 @@ const { t } = useI18n();
|
||||||
const { openReport, sendEmail } = usePrintService();
|
const { openReport, sendEmail } = usePrintService();
|
||||||
const ticketSummary = useArrayData('TicketSummary');
|
const ticketSummary = useArrayData('TicketSummary');
|
||||||
const { ticket } = toRefs(props);
|
const { ticket } = toRefs(props);
|
||||||
const ticketId = currentRoute.value.params.id;
|
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
|
||||||
const client = ref();
|
const client = ref();
|
||||||
const showTransferDialog = ref(false);
|
const showTransferDialog = ref(false);
|
||||||
const showTurnDialog = ref(false);
|
const showTurnDialog = ref(false);
|
||||||
|
@ -68,7 +67,7 @@ const actions = {
|
||||||
setWeight: async () => {
|
setWeight: async () => {
|
||||||
try {
|
try {
|
||||||
const invoiceIds = (
|
const invoiceIds = (
|
||||||
await axios.post(`Tickets/${ticketId}/setWeight`, {
|
await axios.post(`Tickets/${ticketId.value}/setWeight`, {
|
||||||
weight: weight.value,
|
weight: weight.value,
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
|
@ -86,7 +85,7 @@ const actions = {
|
||||||
},
|
},
|
||||||
remove: async () => {
|
remove: async () => {
|
||||||
try {
|
try {
|
||||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
await axios.post(`Tickets/${ticketId.value}/setDeleted`);
|
||||||
|
|
||||||
notify({ message: t('Ticket deleted'), type: 'positive' });
|
notify({ message: t('Ticket deleted'), type: 'positive' });
|
||||||
notify({
|
notify({
|
||||||
|
@ -176,14 +175,14 @@ function showSmsDialog(template, customData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showSmsDialogWithChanges() {
|
async function showSmsDialogWithChanges() {
|
||||||
const query = `TicketLogs/${ticketId}/getChanges`;
|
const query = `TicketLogs/${ticketId.value}/getChanges`;
|
||||||
const response = await axios.get(query);
|
const response = await axios.get(query);
|
||||||
|
|
||||||
showSmsDialog('orderChanges', { changes: response.data });
|
showSmsDialog('orderChanges', { changes: response.data });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendSms(body) {
|
async function sendSms(body) {
|
||||||
await axios.post(`Tickets/${ticketId}/sendSms`, body);
|
await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
|
||||||
notify({
|
notify({
|
||||||
message: 'Notification sent',
|
message: 'Notification sent',
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
@ -240,7 +239,7 @@ function makeInvoiceDialog() {
|
||||||
}
|
}
|
||||||
async function makeInvoice() {
|
async function makeInvoice() {
|
||||||
const params = {
|
const params = {
|
||||||
ticketsIds: [parseInt(ticketId)],
|
ticketsIds: [parseInt(ticketId.value)],
|
||||||
};
|
};
|
||||||
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||||
|
|
||||||
|
@ -256,14 +255,17 @@ async function transferClient(client) {
|
||||||
clientFk: client,
|
clientFk: client,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
|
const { data } = await axios.patch(
|
||||||
|
`Tickets/${ticketId.value}/transferClient`,
|
||||||
|
params
|
||||||
|
);
|
||||||
|
|
||||||
if (data) window.location.reload();
|
if (data) window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addTurn(day) {
|
async function addTurn(day) {
|
||||||
const params = {
|
const params = {
|
||||||
ticketFk: parseInt(ticketId),
|
ticketFk: parseInt(ticketId.value),
|
||||||
weekDay: day,
|
weekDay: day,
|
||||||
agencyModeFk: ticket.value.agencyModeFk,
|
agencyModeFk: ticket.value.agencyModeFk,
|
||||||
};
|
};
|
||||||
|
@ -278,7 +280,7 @@ async function addTurn(day) {
|
||||||
|
|
||||||
async function createRefund(withWarehouse) {
|
async function createRefund(withWarehouse) {
|
||||||
const params = {
|
const params = {
|
||||||
ticketsIds: [parseInt(ticketId)],
|
ticketsIds: [parseInt(ticketId.value)],
|
||||||
withWarehouse: withWarehouse,
|
withWarehouse: withWarehouse,
|
||||||
negative: true,
|
negative: true,
|
||||||
};
|
};
|
||||||
|
@ -296,7 +298,10 @@ async function changeShippedHour(time) {
|
||||||
shipped: time,
|
shipped: time,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
const { data } = await axios.post(
|
||||||
|
`Tickets/${ticketId.value}/updateEditableTicket`,
|
||||||
|
params
|
||||||
|
);
|
||||||
|
|
||||||
if (data) window.location.reload();
|
if (data) window.location.reload();
|
||||||
}
|
}
|
||||||
|
@ -313,7 +318,7 @@ function openRecalculateDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function recalculateComponents() {
|
async function recalculateComponents() {
|
||||||
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
|
||||||
notify({
|
notify({
|
||||||
message: t('Data saved'),
|
message: t('Data saved'),
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
@ -336,11 +341,11 @@ async function handleInvoiceOutData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function docuwareDownload() {
|
async function docuwareDownload() {
|
||||||
await axios.get(`Tickets/${ticketId}/docuwareDownload`);
|
await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hasDocuware() {
|
async function hasDocuware() {
|
||||||
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, {
|
const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
|
||||||
fileCabinet: 'deliveryNote',
|
fileCabinet: 'deliveryNote',
|
||||||
signed: true,
|
signed: true,
|
||||||
});
|
});
|
||||||
|
@ -363,7 +368,7 @@ async function uploadDocuware(force) {
|
||||||
|
|
||||||
const { data } = await axios.post(`Docuwares/upload`, {
|
const { data } = await axios.post(`Docuwares/upload`, {
|
||||||
fileCabinet: 'deliveryNote',
|
fileCabinet: 'deliveryNote',
|
||||||
ticketIds: [parseInt(ticketId)],
|
ticketIds: [parseInt(ticketId.value)],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
||||||
|
@ -371,11 +376,7 @@ async function uploadDocuware(force) {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
:url="
|
:url="`Tickets/${ticketId}/isEditable`"
|
||||||
route.path.startsWith('/ticket')
|
|
||||||
? `Tickets/${ticketId}/isEditable`
|
|
||||||
: `Tickets/${ticket}/isEditable`
|
|
||||||
"
|
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="handleFetchData"
|
@on-fetch="handleFetchData"
|
||||||
/>
|
/>
|
||||||
|
@ -396,8 +397,6 @@ async function uploadDocuware(force) {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="client"
|
v-model="client"
|
||||||
:label="t('Client')"
|
:label="t('Client')"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -75,6 +75,7 @@ const cancel = () => {
|
||||||
dense
|
dense
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="save()"
|
@click="save()"
|
||||||
|
data-cy="saveManaBtn"
|
||||||
>
|
>
|
||||||
{{ t('globals.save') }}
|
{{ t('globals.save') }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -49,13 +49,7 @@ async function handleSave() {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="
|
@on-fetch="(data) => (observationTypes = data)"
|
||||||
(data) =>
|
|
||||||
(observationTypes = data.map((type) => {
|
|
||||||
type.label = t(`ticketNotes.observationTypes.${type.description}`);
|
|
||||||
return type;
|
|
||||||
}))
|
|
||||||
"
|
|
||||||
auto-load
|
auto-load
|
||||||
url="ObservationTypes"
|
url="ObservationTypes"
|
||||||
/>
|
/>
|
||||||
|
@ -82,16 +76,18 @@ async function handleSave() {
|
||||||
:label="t('ticketNotes.observationType')"
|
:label="t('ticketNotes.observationType')"
|
||||||
:options="observationTypes"
|
:options="observationTypes"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="label"
|
option-label="description"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.observationTypeFk"
|
v-model="row.observationTypeFk"
|
||||||
:disable="!!row.id"
|
:disable="!!row.id"
|
||||||
|
data-cy="ticketNotesObservationType"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('basicData.description')"
|
:label="t('basicData.description')"
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
class="col"
|
class="col"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
|
data-cy="ticketNotesDescription"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
|
@ -99,6 +95,7 @@ async function handleSave() {
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="handleDelete(row)"
|
@click="handleDelete(row)"
|
||||||
|
data-cy="ticketNotesRemoveNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.removeNote') }}
|
{{ t('ticketNotes.removeNote') }}
|
||||||
|
@ -113,6 +110,7 @@ async function handleSave() {
|
||||||
class="fill-icon-on-hover q-ml-md"
|
class="fill-icon-on-hover q-ml-md"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="ticketNotesCrudRef.insert()"
|
@click="ticketNotesCrudRef.insert()"
|
||||||
|
data-cy="ticketNotesAddNoteBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ticketNotes.addNote') }}
|
{{ t('ticketNotes.addNote') }}
|
||||||
|
|
|
@ -172,13 +172,9 @@ const getRequestState = (state) => {
|
||||||
const isEditable = (isOk) => isOk !== null;
|
const isEditable = (isOk) => isOk !== null;
|
||||||
|
|
||||||
async function removeLine(id) {
|
async function removeLine(id) {
|
||||||
try {
|
|
||||||
await axios.delete(`TicketRequests/${id}`);
|
await axios.delete(`TicketRequests/${id}`);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
location.reload();
|
location.reload();
|
||||||
} catch (err) {
|
|
||||||
console.error('Error ', err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = false));
|
onMounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue