Compare commits

...

3 Commits

Author SHA1 Message Date
Alex Moreno 1709795cf9 Merge branch 'master' into hotFix_orderCatalogFilter_refactor_fix
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-22 09:56:04 +00:00
Alex Moreno 9019d4ff90 Merge pull request 'fix: remove all try catch(err) (error) console.error' (!988) from hotFix_tryCatch_badPractice into master
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #988
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-11-22 09:47:32 +00:00
Alex Moreno bf29be1c5f fix: remove all try catch(err) (error) console.error
gitea/salix-front/pipeline/pr-master This commit looks good Details
2024-11-22 08:39:46 +01:00
76 changed files with 995 additions and 1617 deletions

View File

@ -156,7 +156,6 @@ const rotateRight = () => {
};
const onSubmit = () => {
try {
if (!newPhoto.files && !newPhoto.url) {
notify(t('Select an image'), 'negative');
return;
@ -173,9 +172,6 @@ const onSubmit = () => {
newPhoto.blob = file;
})
.then(() => makeRequest());
} catch (err) {
console.error('Error uploading image');
}
};
const makeRequest = async () => {

View File

@ -51,7 +51,6 @@ const onDataSaved = () => {
};
const onSubmit = async () => {
try {
isLoading.value = true;
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
const payload = {
@ -63,9 +62,6 @@ const onSubmit = async () => {
await axios.post($props.editUrl, payload);
onDataSaved();
isLoading.value = false;
} catch (err) {
console.error('Error submitting table cell edit');
}
};
const closeForm = () => {

View File

@ -84,7 +84,6 @@ const tableColumns = computed(() => [
]);
const onSubmit = async () => {
try {
let filter = itemFilter;
const params = itemFilterParams;
const where = {};
@ -109,9 +108,6 @@ const onSubmit = async () => {
params: { filter: JSON.stringify(filter) },
});
tableRows.value = data;
} catch (err) {
console.error('Error fetching entries items');
}
};
const closeForm = () => {

View File

@ -86,7 +86,6 @@ const tableColumns = computed(() => [
]);
const onSubmit = async () => {
try {
let filter = travelFilter;
const params = travelFilterParams;
const where = {};
@ -109,9 +108,6 @@ const onSubmit = async () => {
params: { filter: JSON.stringify(filter) },
});
tableRows.value = data;
} catch (err) {
console.error('Error fetching travels');
}
};
const closeForm = () => {

View File

@ -217,9 +217,6 @@ async function save() {
updateAndEmit('onDataSaved', formData.value, response?.data);
if ($props.reload) await arrayData.fetch({});
hasChanges.value = false;
} catch (err) {
console.error(err);
notify('errors.writeRequest', 'negative');
} finally {
isLoading.value = false;
}

View File

@ -88,7 +88,6 @@ const applyTags = (params, search) => {
};
const fetchItemTypes = async (id) => {
try {
const filter = {
fields: ['id', 'name', 'categoryFk'],
where: { categoryFk: id },
@ -99,9 +98,6 @@ const fetchItemTypes = async (id) => {
params: { filter: JSON.stringify(filter) },
});
itemTypesOptions.value = data;
} catch (err) {
console.error('Error fetching item types', err);
}
};
const getCategoryClass = (category, params) => {
@ -111,7 +107,6 @@ const getCategoryClass = (category, params) => {
};
const getSelectedTagValues = async (tag) => {
try {
if (!tag?.selectedTag?.id) return;
tag.value = null;
const filter = {
@ -125,9 +120,6 @@ const getSelectedTagValues = async (tag) => {
params,
});
tag.valueOptions = data;
} catch (err) {
console.error('Error getting selected tag values');
}
};
const removeTag = (index, params, search) => {

View File

@ -39,14 +39,10 @@ const refund = async () => {
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
};
try {
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
notify(t('Refunded invoice'), 'positive');
const [id] = data?.refundId || [];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
} catch (err) {
console.error('Error refunding invoice', err);
}
};
</script>

View File

@ -49,7 +49,6 @@ const makeInvoice = async () => {
makeInvoice: checked.value,
};
try {
if (checked.value && hasToInvoiceByAddress) {
const response = await new Promise((resolve) => {
quasar
@ -76,9 +75,6 @@ const makeInvoice = async () => {
notify(t('Transferred invoice'), 'positive');
const id = data?.[0];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
} catch (err) {
console.error('Error transfering invoice', err);
}
};
</script>

View File

@ -57,7 +57,6 @@ async function getConfig(url, filter) {
}
async function fetchViewConfigData() {
try {
const defaultFilter = {
where: { tableCode: $props.tableCode },
};
@ -80,9 +79,6 @@ async function fetchViewConfigData() {
setUserConfigViewData(defaultConfig.columns);
return;
}
} catch (err) {
console.error('Error fetching config view data', err);
}
}
async function saveConfig() {
@ -92,7 +88,6 @@ async function saveConfig() {
setUserConfigViewData(configuration, true);
if (!$props.tableCode) return popupProxyRef.value.hide();
try {
const params = {};
// Si existe una view config del usuario hacemos un update si no la creamos
if (initialUserConfigViewData.value) {
@ -123,10 +118,7 @@ async function saveConfig() {
}
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide();
} catch (err) {
console.error('Error saving user view config', err);
notify('errors.writeRequest', 'negative');
}
}
onMounted(async () => {

View File

@ -58,7 +58,6 @@ const getConfig = async (url, filter) => {
};
const fetchViewConfigData = async () => {
try {
const userConfigFilter = {
where: { tableCode: $props.tableCode, userFk: user.value.id },
};
@ -83,13 +82,9 @@ const fetchViewConfigData = async () => {
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
setUserConfigViewData(defaultColumns);
}
} catch (err) {
console.error('Error fetching config view data', err);
}
};
const saveConfig = async () => {
try {
const params = {};
const configuration = {};
@ -128,9 +123,6 @@ const saveConfig = async () => {
emitSavedConfig();
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide();
} catch (err) {
console.error('Error saving user view config', err);
}
};
const emitSavedConfig = () => {

View File

@ -11,21 +11,13 @@ const { t } = useI18n();
const { notify } = useNotify();
const onSynchronizeAll = async () => {
try {
notify(t('Synchronizing in the background'), 'positive');
await axios.patch(`Accounts/syncAll`);
} catch (error) {
console.error('Error synchronizing all accounts', error);
}
};
const onSynchronizeRoles = async () => {
try {
await axios.patch(`RoleInherits/sync`);
notify(t('Roles synchronized!'), 'positive');
} catch (error) {
console.error('Error synchronizing roles', error);
}
};
</script>

View File

@ -94,7 +94,6 @@ const columns = computed(() => [
},
]);
const deleteAcl = async ({ id }) => {
try {
await new Promise((resolve) => {
quasar
.dialog({
@ -114,9 +113,6 @@ const deleteAcl = async ({ id }) => {
await axios.delete(`ACLs/${id}`);
tableRef.value.reload();
notify('ACL removed', 'positive');
} catch (error) {
console.error('Error deleting Acl: ', error);
}
};
</script>

View File

@ -34,13 +34,9 @@ const refresh = () => paginateRef.value.fetch();
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
const killSession = async ({ userId, created }) => {
try {
await axios.post(`${urlPath}/killSession`, { userId, created });
paginateRef.value.fetch();
notify(t('Session killed'), 'positive');
} catch (error) {
console.error('Error killing session', error);
}
};
</script>

View File

@ -40,12 +40,8 @@ const formUrlCreate = ref(null);
const formUrlUpdate = ref(null);
const formCustomFn = ref(null);
const onTestConection = async () => {
try {
await axios.get(`LdapConfigs/test`);
notify(t('LDAP connection established!'), 'positive');
} catch (error) {
console.error('Error testing connection', error);
}
};
const getInitialLdapConfig = async () => {
try {
@ -72,14 +68,10 @@ const getInitialLdapConfig = async () => {
}
};
const deleteMailForward = async () => {
try {
await axios.delete(URL_UPDATE);
initialData.value = { ...DEFAULT_DATA };
hasData.value = false;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
};
onMounted(async () => await getInitialLdapConfig());

View File

@ -46,12 +46,8 @@ const formUrlUpdate = ref(null);
const formCustomFn = ref(null);
const onTestConection = async () => {
try {
await axios.get(`SambaConfigs/test`);
notify(t('Samba connection established!'), 'positive');
} catch (error) {
console.error('Error testing connection', error);
}
};
const getInitialSambaConfig = async () => {
@ -79,14 +75,10 @@ const getInitialSambaConfig = async () => {
};
const deleteMailForward = async () => {
try {
await axios.delete(URL_UPDATE);
initialData.value = { ...DEFAULT_DATA };
hasData.value = false;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
};
onMounted(async () => await getInitialSambaConfig());

View File

@ -44,13 +44,9 @@ const removeAlias = () => {
cancel: true,
})
.onOk(async () => {
try {
await axios.delete(`MailAliases/${entityId.value}`);
notify(t('Alias removed'), 'positive');
router.push({ name: 'AccountAlias' });
} catch (err) {
console.error('Error removing alias');
}
});
};
</script>

View File

@ -46,13 +46,9 @@ const columns = computed(() => [
]);
const deleteAlias = async (row) => {
try {
await axios.delete(`${urlPath.value}/${row.id}`);
notify(t('User removed'), 'positive');
fetchAliases();
} catch (error) {
console.error(error);
}
};
watch(

View File

@ -61,23 +61,15 @@ const fetchAccountExistence = async () => {
};
const deleteMailAlias = async (row) => {
try {
await axios.delete(`${urlPath}/${row.id}`);
fetchMailAliases();
notify(t('Unsubscribed from alias!'), 'positive');
} catch (error) {
console.error(error);
}
};
const createMailAlias = async (mailAliasFormData) => {
try {
await axios.post(urlPath, mailAliasFormData);
notify(t('Subscribed to alias!'), 'positive');
fetchMailAliases();
} catch (error) {
console.error(error);
}
};
const fetchMailAliases = async () => {

View File

@ -41,35 +41,22 @@ const fetchAccountExistence = async () => {
};
const fetchMailForwards = async () => {
try {
const response = await axios.get(`MailForwards/${route.params.id}`);
return response.data;
} catch (err) {
console.error('Error fetching mail forwards', err);
return null;
}
};
const deleteMailForward = async () => {
try {
await axios.delete(`MailForwards/${route.params.id}`);
formData.value.forwardTo = null;
initialData.value.forwardTo = null;
initialData.value.hasData = hasData.value;
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error deleting mail forward', err);
}
};
const updateMailForward = async () => {
try {
await axios.patch('MailForwards', formData.value);
initialData.value = { ...formData.value };
initialData.value.hasData = hasData.value;
} catch (err) {
console.error('Error creating mail forward', err);
}
};
const onSubmit = async () => {

View File

@ -32,12 +32,8 @@ const filter = {
where: { id: entityId },
};
const removeRole = async () => {
try {
await axios.delete(`VnRoles/${entityId.value}`);
notify(t('Role removed'), 'positive');
} catch (error) {
console.error('Error deleting role', error);
}
};
</script>

View File

@ -46,29 +46,19 @@ const columns = computed(() => [
]);
const deleteSubRole = async (row) => {
try {
await axios.delete(`${urlPath.value}/${row.id}`);
fetchSubRoles();
notify(
t('Role removed. Changes will take a while to fully propagate.'),
'positive'
);
} catch (error) {
console.error(error);
}
notify(t('Role removed. Changes will take a while to fully propagate.'), 'positive');
};
const createSubRole = async (subRoleFormData) => {
try {
await axios.post(urlPath.value, subRoleFormData);
notify(
t('Role added! Changes will take a while to fully propagate.'),
'positive'
);
fetchSubRoles();
} catch (error) {
console.error(error);
}
};
watch(

View File

@ -106,7 +106,6 @@ const setParams = (params) => {
};
const getPreview = async () => {
try {
const params = {
recipientId: entityId,
};
@ -125,9 +124,6 @@ const getPreview = async () => {
htmlContent: data,
},
});
} catch (err) {
notify('Errors getting preview', 'negative');
}
};
const onSubmit = async () => {

View File

@ -42,13 +42,9 @@ const setData = (entity) => {
};
const removeDepartment = async () => {
try {
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
router.push({ name: 'WorkerDepartment' });
notify('department.departmentRemoved', 'positive');
} catch (err) {
console.error('Error removing department');
}
};
const { openConfirmationModal } = useVnConfirm();

View File

@ -237,13 +237,9 @@ const copyOriginalRowsData = (rows) => {
};
const saveChange = async (field, { rowIndex, row }) => {
try {
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
await axios.patch(`Buys/${row.id}`, row);
originalRowDataCopy.value[rowIndex][field] = row[field];
} catch (err) {
console.error('Error saving changes', err);
}
};
const openRemoveDialog = async () => {
@ -261,15 +257,11 @@ const openRemoveDialog = async () => {
},
})
.onOk(async () => {
try {
await deleteBuys();
const notifyMessage = t(
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
);
notify(notifyMessage, 'positive');
} catch (err) {
console.error('Error deleting buys');
}
});
};
@ -283,7 +275,6 @@ const importBuys = () => {
};
const toggleGroupingMode = async (buy, mode) => {
try {
const groupingMode = mode === 'grouping' ? mode : 'packing';
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
const params = {
@ -291,9 +282,6 @@ const toggleGroupingMode = async (buy, mode) => {
};
await axios.patch(`Buys/${buy.id}`, params);
buy.groupingMode = newGroupingMode;
} catch (err) {
console.error('Error toggling grouping mode');
}
};
const lockIconType = (groupingMode, mode) => {

View File

@ -123,20 +123,15 @@ const fillData = async (rawData) => {
};
const fetchBuys = async (buys) => {
try {
const params = { buys };
const { data } = await axios.post(
`Entries/${route.params.id}/importBuysPreview`,
params
);
importData.value.buys = data;
} catch (err) {
console.error('Error fetching buys');
}
};
const onSubmit = async () => {
try {
const params = importData.value;
const hasAnyEmptyRow = params.buys.some((buy) => {
return buy.itemFk === null;
@ -150,9 +145,6 @@ const onSubmit = async () => {
await axios.post(`Entries/${route.params.id}/importBuys`, params);
notify('globals.dataSaved', 'positive');
redirectToBuysView();
} catch (err) {
console.error('Error importing buys', err);
}
};
const redirectToBuysView = () => {

View File

@ -147,12 +147,9 @@ async function setEntryData(data) {
}
const fetchEntryBuys = async () => {
try {
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
if (data) entryBuys.value = data;
} catch (err) {
console.error('Error fetching entry buys');
}
};
</script>

View File

@ -30,8 +30,6 @@ const recalc = async () => {
isLoading.value = true;
await axios.post('Applications/waste_addSales/execute-proc', params);
notify('wasteRecalc.recalcOk', 'positive');
} catch (err) {
console.error(err);
} finally {
isLoading.value = false;
}

View File

@ -61,7 +61,6 @@ const showSendInvoiceDialog = (type) => {
};
const sendEmailInvoice = async ({ address }) => {
try {
if (!address) notify(`The email can't be empty`, 'negative');
if (invoiceFormType.value === 'pdf') {
@ -70,16 +69,10 @@ const sendEmailInvoice = async ({ address }) => {
recipient: address,
});
} else {
return sendEmail(
`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`,
{
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, {
recipientId: $props.invoiceOutData.client.id,
recipient: address,
}
);
}
} catch (err) {
console.error('Error sending email', err);
});
}
};
@ -88,34 +81,21 @@ const redirectToInvoiceOutList = () => {
};
const deleteInvoice = async () => {
try {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
notify(t('InvoiceOut deleted'), 'positive');
} catch (err) {
console.error('Error deleting invoice out', err);
}
};
const bookInvoice = async () => {
try {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
notify(t('InvoiceOut booked'), 'positive');
} catch (err) {
console.error('Error booking invoice out', err);
}
};
const generateInvoicePdf = async () => {
try {
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
notify(t('The invoice PDF document has been regenerated'), 'positive');
} catch (err) {
console.error('Error generating invoice out pdf', err);
}
};
const refundInvoice = async (withWarehouse) => {
try {
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
const { data } = await axios.post('InvoiceOuts/refund', params);
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
@ -125,9 +105,6 @@ const refundInvoice = async (withWarehouse) => {
}),
'positive'
);
} catch (err) {
console.error('Error generating invoice out pdf', err);
}
};
const showTransferInvoiceForm = async () => {

View File

@ -143,15 +143,10 @@ onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false));
function openPdf(id) {
try {
openReport(`${MODEL}/${id}/download`);
} catch (err) {
console.error('Error opening PDF', err);
}
}
function downloadPdf() {
try {
if (selectedRows.value.size === 0) return;
const selectedCardsArray = Array.from(selectedRows.value.values());
@ -170,9 +165,7 @@ function downloadPdf() {
openReport(`${MODEL}/downloadZip`, params);
}
} catch (err) {
console.error('Error opening PDF');
}
}
watchEffect(selectedRows);

View File

@ -58,26 +58,17 @@ onMounted(async () => {
const data = ref(useCardDescription());
const setData = async (entity) => {
try {
if (!entity) return;
data.value = useCardDescription(entity.name, entity.id);
await updateStock();
} catch (err) {
console.error('Error item');
}
};
const getItemConfigs = async () => {
try {
const { data } = await axios.get('ItemConfigs/findOne');
if (!data) return;
return (warehouseConfig.value = data.warehouseFk);
} catch (err) {
console.error('Error item');
}
};
const updateStock = async () => {
try {
available.value = null;
visible.value = null;
@ -95,9 +86,6 @@ const updateStock = async () => {
});
available.value = data.available;
visible.value = data.visible;
} catch (err) {
console.error('Error updating stock');
}
};
const openRegularizeStockForm = () => {
@ -105,12 +93,8 @@ const openRegularizeStockForm = () => {
};
const cloneItem = async () => {
try {
const { data } = await axios.post(`Items/${entityId.value}/clone`);
router.push({ name: 'ItemTags', params: { id: data.id } });
} catch (err) {
console.error('Error cloning item');
}
};
const openCloneDialog = async () => {

View File

@ -45,13 +45,9 @@ const arrayData = useArrayData('ItemShelvings', {
const rows = computed(() => arrayData.store.data || []);
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await arrayData.addFilter({ filter: null, params });
} catch (err) {
console.error('Error applying column filter', err);
}
};
const getInputEvents = (col) => {
@ -173,15 +169,11 @@ const totalLabels = computed(() =>
);
const removeLines = async () => {
try {
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
rowsSelected.value = [];
notify('shelvings.shelvingsRemoved', 'positive');
await arrayData.fetch({ append: false });
} catch (err) {
console.error('Error removing lines', err);
}
};
onMounted(async () => {
await arrayData.fetch({ append: false });

View File

@ -19,7 +19,6 @@ const tagOptions = ref([]);
const valueOptionsMap = ref(new Map());
const getSelectedTagValues = async (tag) => {
try {
if (!tag.tagFk && tag.tag.isFree) return;
const filter = {
fields: ['value'],
@ -32,9 +31,6 @@ const getSelectedTagValues = async (tag) => {
params,
});
valueOptionsMap.value.set(tag.tagFk, data);
} catch (err) {
console.error('Error getting selected tag values');
}
};
const onItemTagsFetched = async (itemTags) => {

View File

@ -32,7 +32,6 @@ const ItemTaxRef = ref(null);
const taxesOptions = ref([]);
const submitTaxes = async (data) => {
try {
let payload = data.map((tax) => ({
id: tax.id,
taxClassFk: tax.taxClassFk,
@ -40,9 +39,6 @@ const submitTaxes = async (data) => {
await axios.post(`Items/updateTaxes`, payload);
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error saving taxes', err);
}
};
</script>
<template>

View File

@ -221,24 +221,16 @@ const updateMinPrice = async (value, props) => {
};
const upsertPrice = async (props, resetMinPrice = false) => {
try {
const { row } = props;
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
if (resetMinPrice) row.hasMinPrice = 0;
await upsertFixedPrice(row);
}
} catch (err) {
console.error('Error editing price', err);
}
};
async function upsertFixedPrice(row) {
try {
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
return data;
} catch (err) {
console.error('Error editing price', err);
}
}
async function saveOnRowChange(row) {
@ -321,14 +313,10 @@ const onEditCellDataSaved = async () => {
};
const removeFuturePrice = async () => {
try {
rowsSelected.value.forEach(({ id }) => {
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
removePrice(id, rowIndex);
});
} catch (err) {
console.error('Error removing price', err);
}
};
function confirmRemove(item, isFuture) {
@ -345,13 +333,9 @@ function confirmRemove(item, isFuture) {
}
const removePrice = async (id) => {
try {
await axios.delete(`FixedPrices/${id}`);
notify(t('globals.dataSaved'), 'positive');
tableRef.value.reload({});
} catch (err) {
console.error('Error removing price', err);
}
};
const dateStyle = (date) =>
date

View File

@ -73,13 +73,9 @@ const exprBuilder = (param, value) => {
const params = reactive({ isFloramondo: false, isActive: true });
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await paginateRef.value.addFilter(null, params);
} catch (err) {
console.error('Error applying column filter', err);
}
};
const getInputEvents = (col) => {
@ -379,13 +375,9 @@ const redirectToItemSummary = (id) => {
};
const cloneItem = async (itemFk) => {
try {
const { data } = await axios.post(`Items/${itemFk}/clone`);
if (!data) return;
router.push({ name: 'ItemTags', params: { id: data.id } });
} catch (err) {
console.error('Error cloning item', err);
}
};
onMounted(async () => {

View File

@ -55,7 +55,6 @@ const onCategoryChange = async (categoryFk, search) => {
};
const getSelectedTagValues = async (tag) => {
try {
if (!tag?.selectedTag?.id) return;
tag.value = null;
const filter = {
@ -68,9 +67,6 @@ const getSelectedTagValues = async (tag) => {
params,
});
tag.valueOptions = data;
} catch (err) {
console.error('Error getting selected tag values');
}
};
const applyTags = (params, search) => {

View File

@ -125,7 +125,6 @@ const columns = computed(() => [
]);
const changeQuantity = async (request) => {
try {
if (request.saleFk) {
const params = {
quantity: request.saleQuantity,
@ -135,13 +134,9 @@ const changeQuantity = async (request) => {
notify(t('globals.dataSaved'), 'positive');
confirmRequest(request);
} else confirmRequest(request);
} catch (error) {
console.error('Error changing quantity:: ', error);
}
};
const confirmRequest = async (request) => {
try {
if (request.itemFk && request.saleQuantity) {
const params = {
itemFk: request.itemFk,
@ -149,18 +144,12 @@ const confirmRequest = async (request) => {
attenderFk: request.attenderFk,
};
const { data } = await axios.post(
`TicketRequests/${request.id}/confirm`,
params
);
const { data } = await axios.post(`TicketRequests/${request.id}/confirm`, params);
request.itemDescription = data.concept;
request.isOk = true;
notify(t('globals.dataSaved'), 'positive');
}
} catch (error) {
console.error('Error confirming request:: ', error);
}
};
const getState = (isOk) => {

View File

@ -103,15 +103,11 @@ const getBadgeColor = (date) => {
};
const removeOrders = async () => {
try {
const selectedIds = selectedRows.value.map((row) => row.id);
const params = { deletes: selectedIds };
await axios.post('SalesMonitors/deleteOrders', params);
selectedRows.value = [];
await table.value.reload();
} catch (err) {
console.error('Error deleting orders', err);
}
};
const openTab = (id) =>

View File

@ -22,7 +22,6 @@ const agencyList = ref([]);
const addressList = ref([]);
const fetchAddressList = async (addressId) => {
try {
const { data } = await axios.get('addresses', {
params: {
filter: JSON.stringify({
@ -35,17 +34,12 @@ const fetchAddressList = async (addressId) => {
if (addressList.value?.length === 1) {
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) => {
if (!landed || !addressFk) {
return;
}
try {
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
addressFk,
@ -53,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
},
});
agencyList.value = data;
} catch (err) {
console.error(`Error fetching agencies`, err);
return err.response;
}
};
const fetchOrderDetails = (order) => {
@ -92,12 +82,8 @@ const orderFilter = {
};
const onClientChange = async (clientId) => {
try {
const { data } = await axios.get(`Clients/${clientId}`);
await fetchAddressList(data.defaultAddressFk);
} catch (error) {
console.error('Error al cambiar el cliente:', error);
}
};
</script>

View File

@ -22,7 +22,6 @@ const addressList = ref([]);
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
const fetchAddressList = async (addressId) => {
try {
const { data } = await axios.get('addresses', {
params: {
filter: JSON.stringify({
@ -35,17 +34,12 @@ const fetchAddressList = async (addressId) => {
if (addressList.value?.length === 1) {
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) => {
if (!landed || !addressFk) {
return;
}
try {
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
addressFk,
@ -53,10 +47,6 @@ const fetchAgencyList = async (landed, addressFk) => {
},
});
agencyList.value = data;
} catch (err) {
console.error(`Error fetching agencies`, err);
return err.response;
}
};
// const fetchOrderDetails = (order) => {
@ -109,12 +99,8 @@ const initialFormState = reactive({
// };
const onClientChange = async (clientId = $props.clientFk) => {
try {
const { data } = await axios.get(`Clients/${clientId}`);
await fetchAddressList(data.defaultAddressFk);
} catch (error) {
console.error('Error al cambiar el cliente:', error);
}
};
async function onDataSaved(_, id) {

View File

@ -47,7 +47,6 @@ const onChangesSaved = () => {
};
const setWireTransfer = async () => {
try {
const params = {
id: route.params.id,
payMethodFk: wireTransferFk.value,
@ -55,9 +54,6 @@ const setWireTransfer = async () => {
await axios.patch(`Suppliers/${route.params.id}`, params);
notify('globals.dataSaved', 'positive');
} catch (err) {
console.error('Error setting wire transfer', err);
}
};
</script>
<template>

View File

@ -34,10 +34,7 @@ const newTicketFormData = reactive({});
const date = new Date();
const createTicket = async () => {
try {
const expeditionIds = $props.selectedExpeditions.map(
(expedition) => expedition.id
);
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
const params = {
clientId: $props.ticket.clientFk,
landed: newTicketFormData.landed,
@ -51,9 +48,6 @@ const createTicket = async () => {
const { data } = await axios.post('Expeditions/moveExpeditions', params);
notify(t('globals.dataSaved'), 'positive');
router.push({ name: 'TicketSummary', params: { id: data.id } });
} catch (error) {
console.error(error);
}
};
</script>

View File

@ -150,31 +150,19 @@ const getTotal = computed(() => {
});
const getComponentsSum = async () => {
try {
const { data } = await axios.get(`Tickets/${route.params.id}/getComponentsSum`);
componentsList.value = data;
} catch (error) {
console.error(error);
}
};
const getTheoricalCost = async () => {
try {
const { data } = await axios.get(`Tickets/${route.params.id}/freightCost`);
theoricalCost.value = data;
} catch (error) {
console.error(error);
}
};
const getTicketVolume = async () => {
try {
if (!ticketData.value) return;
const { data } = await axios.get(`Tickets/${ticketData.value.id}/getVolume`);
ticketVolume.value = data[0].volume;
} catch (error) {
console.error(error);
}
};
onMounted(() => {

View File

@ -163,16 +163,13 @@ const showNewTicketDialog = (withRoute = false) => {
};
const deleteExpedition = async () => {
try {
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
const params = { expeditionIds };
await axios.post('Expeditions/deleteExpeditions', params);
vnTableRef.value.reload();
selectedExpeditions.value = [];
notify(t('expedition.expeditionRemoved'), 'positive');
} catch (error) {
console.error(error);
}
};
const showLog = async (expedition) => {
@ -181,7 +178,6 @@ const showLog = async (expedition) => {
};
const getExpeditionState = async (expedition) => {
try {
const filter = {
where: { expeditionFk: expedition.id },
order: ['created DESC'],
@ -195,9 +191,7 @@ const getExpeditionState = async (expedition) => {
...state,
isScanned: !!state.isScanned,
}));
} catch (error) {
console.error(error);
}
};
onMounted(async () => {

View File

@ -172,13 +172,9 @@ const getRequestState = (state) => {
const isEditable = (isOk) => isOk !== null;
async function removeLine(id) {
try {
await axios.delete(`TicketRequests/${id}`);
notify(t('globals.dataSaved'), 'positive');
location.reload();
} catch (err) {
console.error('Error ', err);
}
}
onMounted(() => (stateStore.rightDrawer = false));

View File

@ -152,15 +152,11 @@ const columns = computed(() => [
]);
const getConfig = async () => {
try {
let filter = {
fields: ['daysForWarningClaim'],
};
const { data } = await axios.get(`TicketConfigs`, { filter });
ticketConfig.value = data;
} catch (err) {
console.error('Error getting ticket config', err);
}
};
const onSalesFetched = (salesData) => {
@ -183,17 +179,12 @@ const resetChanges = async () => {
};
const updateQuantity = async (sale) => {
try {
const payload = { quantity: sale.quantity };
await axios.post(`Sales/${sale.id}/updateQuantity`, payload);
notify('globals.dataSaved', 'positive');
} catch (err) {
console.error('Error updating quantity', err);
}
};
const addSale = async (sale) => {
try {
const payload = {
barcode: sale.itemFk,
quantity: sale.quantity,
@ -215,9 +206,6 @@ const addSale = async (sale) => {
notify('globals.dataSaved', 'positive');
window.location.reload();
} catch (err) {
console.error('Error adding sale', err);
}
};
const changeQuantity = (sale) => {
@ -232,13 +220,9 @@ const changeQuantity = (sale) => {
};
const updateConcept = async (sale) => {
try {
const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data);
notify('globals.dataSaved', 'positive');
} catch (err) {
console.error('Error updating concept', err);
}
};
const DEFAULT_EDIT = {
@ -292,7 +276,6 @@ const onOpenEditDiscountPopover = async (sale) => {
};
const updatePrice = async (sale) => {
try {
const newPrice = edit.value.price;
if (newPrice != null && newPrice != sale.price) {
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
@ -301,9 +284,6 @@ const updatePrice = async (sale) => {
notify('globals.dataSaved', 'positive');
}
await getMana();
} catch (err) {
console.error('Error updating price', err);
}
};
const changeDiscount = (sale) => {
@ -344,15 +324,11 @@ const getNewPrice = computed(() => {
});
const newOrderFromTicket = async () => {
try {
const { data } = await axios.post(`Orders/newFromTicket`, {
ticketFk: Number(route.params.id),
});
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
window.open(routeData.href, '_blank');
} catch (err) {
console.error('Error creating new order', err);
}
};
const goToLog = (saleId) => {
@ -367,15 +343,11 @@ const goToLog = (saleId) => {
};
const changeTicketState = async (val) => {
try {
stateBtnDropdownRef.value.hide();
const params = { ticketFk: route.params.id, code: val };
await axios.post('Tickets/state', params);
notify('globals.dataSaved', 'positive');
await resetChanges();
} catch (err) {
console.error('Error changing ticket state', err);
}
};
const removeSelectedSales = () => {
@ -386,29 +358,22 @@ const removeSelectedSales = () => {
};
const removeSales = async () => {
try {
const params = {
sales: selectedRows.value.filter((sale) => sale.id),
ticketId: store.data.id,
};
selectedRows.value
.filter((sale) => !sale.id)
.forEach((sale) =>
tableRef.value.CrudModelRef.formData.splice(sale.$index, 1)
);
.forEach((sale) => tableRef.value.CrudModelRef.formData.splice(sale.$index, 1));
if (params.sales.length == 0) return;
await axios.post('Sales/deleteSales', params);
removeSelectedSales();
notify('globals.dataSaved', 'positive');
window.location.reload();
} catch (err) {
console.error('Error deleting sales', err);
}
};
const setTransferParams = async () => {
try {
selectedSales.value = selectedValidSales.value;
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
transfer.value = {
@ -417,16 +382,10 @@ const setTransferParams = async () => {
};
const params = { ticketId: store.data.id };
const { data } = await axios.get(
`clients/${store.data.clientFk}/lastActiveTickets`,
{
const { data } = await axios.get(`clients/${store.data.clientFk}/lastActiveTickets`, {
params,
}
);
});
transfer.value.lastActiveTickets = data;
} catch (err) {
console.error('Error setting transfer params', err);
}
};
onMounted(async () => {

View File

@ -140,13 +140,9 @@ const createClaim = () => {
};
const onCreateClaimAccepted = async () => {
try {
const params = { ticketId: ticket.value.id, sales: props.sales };
const { data } = await axios.post(`Claims/createFromSales`, params);
push({ name: 'ClaimBasicData', params: { id: data.id } });
} catch (error) {
console.error('Error creating claim: ', error);
}
};
const setReserved = async (reserved) => {
@ -166,14 +162,10 @@ const createRefund = async (withWarehouse) => {
negative: true,
};
try {
const { data } = await axios.post('Tickets/cloneAll', params);
const [refundTicket] = data;
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
push({ name: 'TicketSale', params: { id: refundTicket.id } });
} catch (error) {
console.error(error);
}
};
</script>

View File

@ -150,7 +150,6 @@ const shelvingsTableColumns = computed(() => [
]);
const getSaleTrackings = async (sale) => {
try {
const filter = {
where: { saleFk: sale.saleFk },
order: ['itemFk DESC'],
@ -159,9 +158,6 @@ const getSaleTrackings = async (sale) => {
params: { filter: JSON.stringify(filter) },
});
saleTrackings.value = data;
} catch (error) {
console.error(error);
}
};
const showLog = async (sale) => {
@ -170,7 +166,6 @@ const showLog = async (sale) => {
};
const getItemShelvingSales = async (sale) => {
try {
const filter = {
where: { saleFk: sale.saleFk },
};
@ -178,9 +173,6 @@ const getItemShelvingSales = async (sale) => {
params: { filter: JSON.stringify(filter) },
});
itemShelvingsSales.value = data;
} catch (error) {
console.error(error);
}
};
const showShelving = async (sale) => {
@ -189,20 +181,15 @@ const showShelving = async (sale) => {
};
const updateQuantity = async (sale) => {
try {
if (oldQuantity.value === sale.quantity) return;
const params = {
quantity: sale.quantity,
};
await axios.patch(`ItemShelvingSales/${sale.id}`, params);
oldQuantity.value = null;
} catch (error) {
console.error(error);
}
};
const updateParking = async (sale) => {
try {
const filter = {
fields: ['id'],
where: {
@ -216,9 +203,6 @@ const updateParking = async (sale) => {
parkingFk: sale.parkingFk,
};
await axios.patch(`Shelvings/${data.id}`, params);
} catch (error) {
console.error(error);
}
};
const updateShelving = async (sale) => {
@ -241,7 +225,6 @@ const updateShelving = async (sale) => {
};
const saleTrackingNew = async (sale, stateCode, isChecked) => {
try {
const params = {
saleFk: sale.saleFk,
isChecked,
@ -250,52 +233,33 @@ const saleTrackingNew = async (sale, stateCode, isChecked) => {
};
await axios.post(`SaleTrackings/new`, params);
notify(t('globals.dataSaved'), 'positive');
} catch (error) {
console.error(error);
}
};
const saleTrackingDel = async ({ saleFk }, stateCode) => {
try {
const params = {
saleFk,
stateCodes: [stateCode],
};
await axios.post(`SaleTrackings/delete`, params);
notify(t('globals.dataSaved'), 'positive');
} catch (error) {
console.error(error);
}
};
const clickSaleGroupDetail = async (sale) => {
try {
if (!sale.saleGroupDetailFk) return;
await axios.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`);
sale.hasSaleGroupDetail = false;
notify(t('globals.dataSaved'), 'positive');
} catch (error) {
console.error(error);
}
};
const clickPreviousSelected = (sale) => {
try {
qCheckBoxController(sale, 'isPreviousSelected');
if (!sale.isPreviousSelected) sale.isPrevious = false;
} catch (error) {
console.error(error);
}
};
const clickPrevious = (sale) => {
try {
qCheckBoxController(sale, 'isPrevious');
if (sale.isPrevious) sale.isPreviousSelected = true;
} catch (error) {
console.error(error);
}
};
const qCheckBoxController = (sale, action) => {
@ -306,7 +270,6 @@ const qCheckBoxController = (sale, action) => {
isPreviousSelected: 'PREVIOUS_PREPARATION',
};
const stateCode = STATE_CODES[action];
try {
if (!sale[action]) {
saleTrackingNew(sale, stateCode, true);
sale[action] = true;
@ -314,9 +277,6 @@ const qCheckBoxController = (sale, action) => {
saleTrackingDel(sale, stateCode);
sale[action] = false;
}
} catch (error) {
console.error(error);
}
};
</script>

View File

@ -46,7 +46,6 @@ watch(
onMounted(async () => await getDefaultTaxClass());
const createRefund = async () => {
try {
if (!selected.value.length) return;
const params = {
@ -63,13 +62,9 @@ const createRefund = async () => {
'positive'
);
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
} catch (error) {
console.error(error);
}
};
const getDefaultTaxClass = async () => {
try {
let filter = {
where: { code: 'G' },
};
@ -77,9 +72,6 @@ const getDefaultTaxClass = async () => {
params: { filter: JSON.stringify(filter) },
});
defaultTaxClass.value = data;
} catch (error) {
console.error(error);
}
};
const columns = computed(() => [

View File

@ -69,7 +69,6 @@ function isEditable() {
}
async function changeState(value) {
try {
stateBtnDropdownRef.value?.hide();
const formData = {
ticketFk: entityId.value,
@ -79,9 +78,6 @@ async function changeState(value) {
notify('globals.dataSaved', 'positive');
summaryRef.value?.fetch();
descriptorData.fetch({});
} catch (err) {
console.error('Error changing ticket state', err);
}
}
function toTicketUrl(section) {

View File

@ -75,7 +75,6 @@ const columns = computed(() => [
]);
const applyVolumes = async (salesData) => {
try {
if (!salesData.length) return;
sales.value = salesData;
@ -88,9 +87,6 @@ const applyVolumes = async (salesData) => {
});
packingTypeVolume.value = data.packingTypeVolume;
} catch (error) {
console.error(error);
}
};
onMounted(() => (stateStore.rightDrawer = true));

View File

@ -27,7 +27,6 @@ const warehousesOptions = ref([]);
const itemPackingTypes = ref([]);
const getItemPackingTypes = async () => {
try {
const filter = {
where: { isActive: true },
};
@ -38,9 +37,6 @@ const getItemPackingTypes = async () => {
description: t(ipt.description),
code: ipt.code,
}));
} catch (error) {
console.error(error);
}
};
const getLocale = (val) => {

View File

@ -37,7 +37,6 @@ onBeforeMount(async () => {
});
const fetchClient = async (formData) => {
try {
const filter = {
include: {
relation: 'defaultAddress',
@ -51,13 +50,9 @@ const fetchClient = async (formData) => {
const { data } = await axios.get('Clients', { params });
const [client] = data;
selectedClient.value = client;
} catch (err) {
console.error('Error fetching client');
}
};
const fetchAddresses = async (formData) => {
try {
if (!formData.clientId) return;
const filter = {
@ -73,10 +68,6 @@ const fetchAddresses = async (formData) => {
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
} catch (err) {
console.error(`Error fetching addresses`, err);
return err.response;
}
};
const onClientSelected = async (formData) => {

View File

@ -37,7 +37,6 @@ onBeforeMount(async () => {
});
const fetchClient = async (formData) => {
try {
const filter = {
include: {
relation: 'defaultAddress',
@ -51,13 +50,9 @@ const fetchClient = async (formData) => {
const { data } = await axios.get('Clients', { params });
const [client] = data;
selectedClient.value = client;
} catch (err) {
console.error('Error fetching client');
}
};
const fetchAddresses = async (formData) => {
try {
if (!formData.clientId) return;
const filter = {
@ -73,10 +68,6 @@ const fetchAddresses = async (formData) => {
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
} catch (err) {
console.error(`Error fetching addresses`, err);
return err.response;
}
};
const onClientSelected = async (formData) => {

View File

@ -68,13 +68,9 @@ const params = reactive({
});
const applyColumnFilter = async (col) => {
try {
const paramKey = col.columnFilter?.filterParamKey || col.field;
params[paramKey] = col.columnFilter.filterValue;
await arrayData.addFilter({ params });
} catch (err) {
console.error('Error applying column filter', err);
}
};
const getInputEvents = (col) => {
@ -248,7 +244,6 @@ const totalPriceColor = (totalWithVat) =>
isLessThan50(totalWithVat) ? 'warning' : 'transparent';
const moveTicketsFuture = async () => {
try {
const ticketsToMove = selectedTickets.value.map((ticket) => ({
originId: ticket.id,
destinationId: ticket.futureId,
@ -262,9 +257,6 @@ const moveTicketsFuture = async () => {
notify(t('futureTickets.moveTicketSuccess'), 'positive');
selectedTickets.value = [];
arrayData.fetch({ append: false });
} catch (error) {
console.error('Error moving tickets to future', error);
}
};
onMounted(async () => {
await arrayData.fetch({ append: false });

View File

@ -24,7 +24,6 @@ const itemPackingTypes = ref([]);
const stateOptions = ref([]);
const getItemPackingTypes = async () => {
try {
const filter = {
where: { isActive: true },
};
@ -35,22 +34,15 @@ const getItemPackingTypes = async () => {
description: t(ipt.description),
code: ipt.code,
}));
} catch (error) {
console.error(error);
}
};
const getGroupedStates = async () => {
try {
const { data } = await axios.get('AlertLevels');
stateOptions.value = data.map((state) => ({
id: state.id,
name: t(`futureTickets.${state.code}`),
code: state.code,
}));
} catch (error) {
console.error(error);
}
};
onMounted(async () => {

View File

@ -254,7 +254,6 @@ const fetchAvailableAgencies = async (formData) => {
};
const fetchClient = async (formData) => {
try {
const filter = {
include: {
relation: 'defaultAddress',
@ -268,13 +267,9 @@ const fetchClient = async (formData) => {
const { data } = await axios.get('Clients', { params });
const [client] = data;
selectedClient.value = client;
} catch (err) {
console.error('Error fetching client');
}
};
const fetchAddresses = async (formData) => {
try {
if (!formData.clientId) return;
const filter = {
@ -290,10 +285,6 @@ const fetchAddresses = async (formData) => {
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
} catch (err) {
console.error(`Error fetching addresses`, err);
return err.response;
}
};
const getColor = (row) => {
if (row.alertLevelCode === 'OK') return 'bg-success';

View File

@ -153,24 +153,16 @@ const columns = computed(() => [
]);
const deleteWeekly = async (ticketFk) => {
try {
await axios.delete(`TicketWeeklies/${ticketFk}`);
notify(t('globals.dataSaved'), 'positive');
const ticketIndex = store.data.findIndex((e) => e.ticketFk == ticketFk);
store.data.splice(ticketIndex, 1);
location.reload();
} catch (err) {
console.error('Error deleting weekly', err);
}
};
const onUpdate = async (ticketFk, field, value) => {
try {
const params = { ticketFk, [field]: value };
await axios.patch('TicketWeeklies', params);
} catch (err) {
console.error('Error updating weekly', err);
}
};
onMounted(async () => {

View File

@ -32,16 +32,12 @@ const cloneTravel = () => {
};
const cloneTravelWithEntries = async () => {
try {
const { data } = await axios.post(`Travels/${$props.travel.id}/cloneWithEntries`);
notify('globals.dataSaved', 'positive');
router.push({ name: 'TravelBasicData', params: { id: data.id } });
} catch (err) {
console.error('Error cloning travel with entries');
}
};
const canDelete = computed(() => useAcl().hasAny('Travel','*','WRITE'));
const canDelete = computed(() => useAcl().hasAny('Travel', '*', 'WRITE'));
const openDeleteEntryDialog = (id) => {
quasar
@ -58,13 +54,9 @@ const openDeleteEntryDialog = (id) => {
};
const deleteTravel = async (id) => {
try {
await axios.delete(`Travels/${id}`);
router.push({ name: 'TravelList' });
notify('globals.dataDeleted', 'positive');
} catch (err) {
console.error('Error deleting travel');
}
};
</script>

View File

@ -193,16 +193,11 @@ const entriesTotalM3 = computed(() =>
);
const getTravelEntries = async (id) => {
try {
const { data } = await axios.get(`Travels/${id}/getEntries`);
entries.value = data;
} catch (err) {
console.error('Error fetching travel entries');
}
};
const getTravelThermographs = async (id) => {
try {
const filter = {
include: {
relation: 'warehouse',
@ -217,21 +212,14 @@ const getTravelThermographs = async (id) => {
params: { filter: JSON.parse(JSON.stringify(filter)) },
});
thermographs.value = data;
} catch (err) {
console.error('Error fetching travel thermographs');
}
};
async function setTravelData(travelData) {
try {
if (travelData) {
travel.value = travelData;
await getTravelEntries(travel.value.id);
await getTravelThermographs(travel.value.id);
}
} catch (err) {
console.error(`Error setting travel data`, err);
}
}
const getLink = (param) => `#/travel/${entityId.value}/${param}`;

View File

@ -122,13 +122,9 @@ const redirectToThermographForm = (action, id) => {
};
const removeThermograph = async (id) => {
try {
await axios.delete(`Travels/deleteThermograph?id=${id}`);
await thermographPaginateRef.value.fetch();
notify(t('Thermograph removed'), 'positive');
} catch (err) {
console.error('Error removing termograph');
}
};
</script>

View File

@ -56,7 +56,6 @@ onBeforeMount(async () => {
});
const fetchDmsTypes = async () => {
try {
const params = {
filter: {
where: { code: 'thermograph' },
@ -64,9 +63,6 @@ const fetchDmsTypes = async () => {
};
const { data } = await axios.get('DmsTypes/findOne', { params });
return data;
} catch (err) {
console.error('Error fetching Dms Types');
}
};
const setCreateDefaultParams = async () => {

View File

@ -293,7 +293,6 @@ const openReportPdf = () => {
};
const saveFieldValue = async (val, field, index) => {
try {
// Evitar la solicitud de guardado si el valor no ha cambiado
if (originalRowDataCopy.value[index][field] == val) return;
@ -304,9 +303,6 @@ const saveFieldValue = async (val, field, index) => {
originalRowDataCopy.value[index][field] = val;
await arrayData.fetch({ append: false });
} catch (err) {
console.error('Error updating travel');
}
};
const stopEventPropagation = (event, col) => {

View File

@ -19,16 +19,10 @@ const createTrayFormDialogRef = ref();
const selectedEntityId = ref();
async function loadTrays() {
try {
const res = await axios.get('WagonTypeTrays');
const filteredTrays = res.data.filter(
(tray) => tray.wagonTypeFk === entityId.value
);
const filteredTrays = res.data.filter((tray) => tray.wagonTypeFk === entityId.value);
wagonTrays.value = filteredTrays;
return;
} catch (err) {
console.error('Error loading trays:', err);
}
}
async function addTray(newTray) {

View File

@ -60,26 +60,18 @@ const updateSelectedDate = (year) => {
};
const createEvent = async (date) => {
try {
const params = {
dated: date,
absenceTypeId: props.absenceType.id,
businessFk: props.businessFk,
};
const { data } = await axios.post(
`Workers/${route.params.id}/createAbsence`,
params
);
const { data } = await axios.post(`Workers/${route.params.id}/createAbsence`, params);
if (data) emit('refresh');
} catch (error) {
console.error('error creating event:: ', error);
}
};
const editEvent = async (event) => {
try {
const absenceType = props.absenceType;
const params = {
absenceId: event.absenceId,
@ -91,9 +83,6 @@ const editEvent = async (event) => {
);
if (data) emit('refresh');
} catch (error) {
console.error('error editing event:: ', error);
}
};
const deleteEvent = async (event, date) => {

View File

@ -39,15 +39,9 @@ const entityId = computed(() => {
const workerExcluded = ref(false);
const getIsExcluded = async () => {
try {
const { data } = await axios.get(
`WorkerDisableExcludeds/${entityId.value}/exists`
);
const { data } = await axios.get(`WorkerDisableExcludeds/${entityId.value}/exists`);
if (!data) return;
workerExcluded.value = data.exists;
} catch (err) {
console.error('Error getting worker excluded: ', err);
}
};
const handleExcluded = async () => {

View File

@ -32,14 +32,11 @@ const initialData = computed(() => {
});
const deallocatePDA = async (deviceProductionFk) => {
try {
await axios.post(`Workers/${route.params.id}/deallocatePDA`, {
pda: deviceProductionFk,
});
notify(t('PDA deallocated'), 'positive');
} catch (err) {
console.error('Error deallocating PDA');
}
paginate.value.fetch();
};

View File

@ -251,13 +251,9 @@ const addEvents = (data) => {
};
const fetchHours = async () => {
try {
await workerHoursRef.value.fetch();
await getWorkedHours(startOfWeek.value, endOfWeek.value);
await getAbsences();
} catch (err) {
console.error('Error fetching worker hours');
}
};
const fetchWeekData = async () => {
@ -265,7 +261,6 @@ const fetchWeekData = async () => {
year: selectedDate.value.getFullYear(),
week: selectedWeekNumber.value,
};
try {
const mail = (
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
params: { filter: { where } },
@ -281,9 +276,6 @@ const fetchWeekData = async () => {
canResend.value = !!(
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
).data.count;
} catch (err) {
console.error('Error fetching week data');
}
};
const setHours = (data) => {
@ -357,7 +349,6 @@ const showReasonForm = () => {
};
const updateWorkerTimeControlMail = async (state, reason) => {
try {
const params = {
year: selectedDate.value.getFullYear(),
week: selectedWeekNumber.value,
@ -371,9 +362,6 @@ const updateWorkerTimeControlMail = async (state, reason) => {
await getMailStates(selectedDate.value);
await fetchWeekData();
notify(t('globals.dataSaved'), 'positive');
} catch (err) {
console.error('Error updating worker time control mail');
}
};
const isSatisfied = async () => {
@ -389,7 +377,6 @@ const isUnsatisfied = async (reason) => {
};
const resendEmail = async () => {
try {
const params = {
recipient: worker.value?.user?.email,
week: selectedWeekNumber.value,
@ -400,9 +387,6 @@ const resendEmail = async () => {
await axios.post('WorkerTimeControls/weekly-hour-record-email', params);
await getMailStates(selectedDate.value);
notify(t('Email sended'), 'positive');
} catch (err) {
console.error('Error sending email');
}
};
onBeforeMount(() => {

View File

@ -50,17 +50,11 @@ const directionIconName = computed(() => {
});
const deleteHourEntry = async () => {
try {
const { data } = await axios.post(
`WorkerTimeControls/${$props.id}/deleteTimeEntry`
);
const { data } = await axios.post(`WorkerTimeControls/${$props.id}/deleteTimeEntry`);
if (!data) return;
emit('onHourEntryDeleted');
notify('Entry removed', 'positive');
} catch (err) {
console.error('Error deleting hour entry');
}
};
const showWorkerTimeForm = () => emit('showWorkerTimeForm');

View File

@ -33,7 +33,6 @@ const onNodeExpanded = (nodeKeysArray) => {
};
const fetchNodeLeaves = async (nodeKey) => {
try {
const node = treeRef.value?.getNodeByKey(nodeKey);
if (!node || node.sons === 0) return;
@ -51,10 +50,6 @@ const fetchNodeLeaves = async (nodeKey) => {
}
state.set('Tree', node);
} catch (err) {
console.error('Error fetching department leaves', err);
throw new Error();
}
};
const removeNode = (node) => {
@ -72,15 +67,11 @@ const removeNode = (node) => {
};
async function remove(id) {
try {
await axios.post(`/Departments/${id}/removeChild`, { id });
quasar.notify({
message: t('department.departmentRemoved'),
type: 'positive',
});
} catch (err) {
console.error('Error removing department');
}
}
const showCreateNodeForm = (nodeId) => {

View File

@ -57,7 +57,6 @@ const excludeType = computed({
const arrayData = useArrayData('ZoneEvents');
const exclusionGeoCreate = async () => {
try {
const params = {
zoneFk: parseInt(route.params.id),
date: dated.value,
@ -65,26 +64,17 @@ const exclusionGeoCreate = async () => {
};
await axios.post('Zones/exclusionGeo', params);
await refetchEvents();
} catch (err) {
console.error('Error creating exclusion geo: ', err);
}
};
const exclusionCreate = async () => {
try {
if (isNew.value)
await axios.post(`Zones/${route.params.id}/exclusions`, [
{ dated: dated.value },
]);
await axios.post(`Zones/${route.params.id}/exclusions`, [{ dated: dated.value }]);
else
await axios.post(`Zones/${route.params.id}/exclusions`, {
dated: dated.value,
});
await refetchEvents();
} catch (err) {
console.error('Error creating exclusion: ', err);
}
};
const onSubmit = async () => {
@ -93,13 +83,9 @@ const onSubmit = async () => {
};
const deleteEvent = async () => {
try {
if (!props.event) return;
await axios.delete(`Zones/${route.params.id}/exclusions`);
await refetchEvents();
} catch (err) {
console.error('Error deleting event: ', err);
}
};
const closeForm = () => emit('closeForm');

View File

@ -57,7 +57,6 @@ const inclusionType = computed({
const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
try {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
);
@ -71,10 +70,7 @@ const createEvent = async () => {
}
if (isNew.value)
await axios.post(
`Zones/${route.params.id}/events`,
eventInclusionFormData.value
);
await axios.post(`Zones/${route.params.id}/events`, eventInclusionFormData.value);
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
@ -83,19 +79,12 @@ const createEvent = async () => {
await refetchEvents();
emit('onSubmit');
} catch (err) {
console.error('Error creating event', err);
}
};
const deleteEvent = async () => {
try {
if (!props.event) return;
await axios.delete(`Zones/${route.params.id}/events/${props.event?.id}`);
await refetchEvents();
} catch (err) {
console.error('Error deleting event: ', err);
}
};
const closeForm = () => {

View File

@ -57,15 +57,11 @@ const arrayData = useArrayData('ZoneEvents', {
});
const fetchData = async () => {
try {
if (!params.value.zoneFk || !params.value.started || !params.value.ended) return;
await arrayData.applyFilter({
params: params.value,
});
} catch (err) {
console.error('Error fetching events: ', err);
}
};
watch(
@ -87,13 +83,9 @@ const formatWdays = (event) => {
};
const deleteEvent = async (id) => {
try {
if (!id) return;
await axios.delete(`Zones/${route.params.id}/events/${id}`);
await fetchData();
} catch (err) {
console.error('Error deleting event: ', err);
}
};
const openInclusionForm = (event) => {

View File

@ -10,13 +10,9 @@ const { t } = useI18n();
const route = useRoute();
const onSelected = async (val, node) => {
try {
if (val === null) val = undefined;
const params = { geoId: node.id, isIncluded: val };
await axios.post(`Zones/${route.params.id}/toggleIsIncluded`, params);
} catch (err) {
console.error('Error updating included', err);
}
};
</script>

View File

@ -34,21 +34,13 @@ const columns = computed(() => [
]);
const deleteWarehouse = async (row) => {
try {
await axios.delete(`${urlPath.value}/${row.id}`);
fetchWarehouses();
} catch (error) {
console.error(error);
}
};
const createZoneWarehouse = async (ZoneWarehouseFormData) => {
try {
await axios.post(urlPath.value, ZoneWarehouseFormData);
fetchWarehouses();
} catch (error) {
console.error(error);
}
};
watch(

View File

@ -21,7 +21,6 @@ const arrayData = useArrayData('ZoneDeliveryDays', {
const deliveryMethodsConfig = { pickUp: ['PICKUP'], delivery: ['AGENCY', 'DELIVERY'] };
const fetchData = async (params) => {
try {
const { data } = params
? await arrayData.applyFilter({
params,
@ -29,9 +28,6 @@ const fetchData = async (params) => {
: await arrayData.fetch({ append: false });
if (!data.events || !data.events.length)
notify(t('deliveryPanel.noEventsWarning'), 'warning');
} catch (err) {
console.error('Error fetching events: ', err);
}
};
const onSubmit = async () => {