diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 2163d54d4..ab522cfde 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue'; import FetchData from '../FetchData.vue'; import VnSelect from './VnSelect.vue'; import VnUserLink from '../ui/VnUserLink.vue'; +import VnPaginate from '../ui/VnPaginate.vue'; const stateStore = useStateStore(); const validationsStore = useValidator(); @@ -66,9 +67,10 @@ const filter = { }, }, ], + where: { and: [{ originFk: route.params.id }] }, }; -const workers = ref(); +const paginate = ref(); const actions = ref(); const changeInput = ref(); const searchInput = ref(); @@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) { const locale = validations[modelLog.model]?.locale || {}; pointRecord.value = parseProps(propNames, locale, data); } -async function setLogTree() { - filter.where = { and: [{ originFk: route.params.id }] }; - const { data } = await getLogs(filter); +async function setLogTree(data) { logTree.value = getLogTree(data); } @@ -266,15 +266,7 @@ async function applyFilter() { filter.where.and.push(selectedFilters.value); } - const { data } = await getLogs(filter); - - logTree.value = getLogTree(data); -} - -async function getLogs(filter) { - return axios.get(props.url ?? `${props.model}Logs`, { - params: { filter: JSON.stringify(filter) }, - }); + paginate.value.fetch(filter); } function setDate(type) { @@ -377,8 +369,6 @@ async function clearFilter() { await applyFilter(); } -setLogTree(); - onUnmounted(() => { stateStore.rightDrawer = false; }); @@ -391,16 +381,6 @@ watch( ); - (workers = data)" - auto-load - /> - - - - {{ useCapitalize(validations[props.model].locale.name) }} - #{{ originLog.originFk }} - - - - - - - - - - - - - - - - - + + + + {{ useCapitalize(validations[props.model].locale.name) }} + #{{ originLog.originFk }} + + + + - - - - {{ t(modelLog.modelI18n) }} - - - - - - - - - + + + + + + + + + + + + - - - + - {{ toRelativeDate(log.creationDate) }} - - - - - - - {{ modelLog.modelI18n }} - #{{ modelLog.id }} - - - - - {{ value.nameI18n }}: - - - - - - - - - - - - - - - - - - {{ prop.nameI18n }}: - - - , - - - + {{ t(modelLog.modelI18n) }} + + - + + + + + + + + - - {{ prop.nameI18n }}: - - - - #{{ prop.val.id }} - - - ← - - - #{{ prop.old.id }} + + {{ toRelativeDate(log.creationDate) }} + + + + + + + {{ modelLog.modelI18n }} + #{{ + modelLog.id + }} + + + + + {{ + value.nameI18n + }}: + + + + + + + + + + + + + + + + + + {{ prop.nameI18n }}: + + + , + - - - - - {{ log.description }} - - - - - - - - + + + + {{ prop.nameI18n }}: + + + + #{{ prop.val.id }} + + + ← + + + #{{ prop.old.id }} + + + + + + + {{ log.description }} + + + + + + + + + + @@ -691,17 +723,16 @@ watch( - - - - + diff --git a/src/pages/Customer/components/CustomerSamplesCreate.vue b/src/pages/Customer/components/CustomerSamplesCreate.vue index 0470dc176..79f4fe449 100644 --- a/src/pages/Customer/components/CustomerSamplesCreate.vue +++ b/src/pages/Customer/components/CustomerSamplesCreate.vue @@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'; import { useRoute, useRouter } from 'vue-router'; import axios from 'axios'; +import { usePrintService } from 'composables/usePrintService'; import { useQuasar } from 'quasar'; import { useState } from 'src/composables/useState'; @@ -27,7 +28,7 @@ const router = useRouter(); const state = useState(); const user = state.getUser(); const stateStore = useStateStore(); - +const { sendEmail } = usePrintService(); const client = ref({}); const hasChanged = ref(false); const isLoading = ref(false); @@ -156,22 +157,33 @@ const onSubmit = async () => { } }; -const onDataSaved = async ({ - addressId, - companyFk, - companyId, - from, - recipient, - replyTo, -}) => { - await axios.post(`Clients/${route.params.id}/incoterms-authorization-email`, { - addressId, - companyFk, - companyId, - from, - recipient, - replyTo, - }); +const getSamples = async () => { + try { + const filter = { where: { id: initialData.typeFk } }; + let { data } = await axios.get('Samples', { + params: { filter: JSON.stringify(filter) }, + }); + return data[0]; + } catch (error) { + notify('errors.create', 'negative'); + } +}; + +getSamples(); +const onDataSaved = async () => { + try { + const params = { + recipientId: initialData.recipientId, + recipient: initialData.recipient, + replyTo: initialData.replyTo, + }; + setParams(params); + const samplesData = await getSamples(); + const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`; + await sendEmail(path, params); + } catch (error) { + notify('errors.create', 'negative'); + } toCustomerSamples(); }; diff --git a/src/pages/Entry/Card/EntryBuys.vue b/src/pages/Entry/Card/EntryBuys.vue index 6e66f4ce7..903b691b0 100644 --- a/src/pages/Entry/Card/EntryBuys.vue +++ b/src/pages/Entry/Card/EntryBuys.vue @@ -26,7 +26,6 @@ const { notify } = useNotify(); const rowsSelected = ref([]); const entryBuysPaginateRef = ref(null); -const packagingsOptions = ref(null); const originalRowDataCopy = ref(null); const getInputEvents = (colField, props) => { @@ -66,7 +65,10 @@ const tableColumnComponents = computed(() => ({ 'map-options': true, 'use-input': true, 'hide-selected': true, - options: packagingsOptions.value, + url: 'Packagings', + fields: ['id'], + where: { freightItemFk: true }, + 'sort-by': 'id ASC', dense: true, }, event: getInputEvents, @@ -304,13 +306,6 @@ const lockIconType = (groupingMode, mode) => { - (packagingsOptions = data)" - />