Remove debug console.log and console.warn statements across multiple components to clean up logging and improve production readiness.

This commit is contained in:
Jeppe Bundgaard
2026-03-19 12:09:52 +01:00
parent 87b8814bcf
commit 79e6ec61c2
4 changed files with 10 additions and 52 deletions
@@ -104,7 +104,6 @@ onMounted(() => {
const onChanged = () => {
scansInfinityScroll.value = null;
highestPage.value = 0;
console.log('Changed', 'total items: ' + metaTotalItems.value, 'items per page: ' + metaItemsPerPage.value, 'current page: ' + metaCurrentPage.value, 'search: ' + metaSearch.value, 'limit reached: ' + limitReached.value);
};
/** Whenever the tab changes, update the items per page, and reset the search */
@@ -290,7 +289,6 @@ const getPlateScanners = async () => {
'GET')
.then((response) => {
plate_scanners.value = response.data.data;
console.log(plate_scanners.value);
}
);
}
@@ -317,17 +315,9 @@ const endOfList = useTemplateRef('endOfList');
const endOfListVisibility = useElementVisibility(endOfList);
watch(endOfListVisibility, (isVisible) => {
console.log('Checking visibility');
console.log(isVisible);
if (isVisible) {
// If the current page is the highest page, then return
console.log('Current page: ' + metaCurrentPage.value);
console.log('Highest page: ' + highestPage.value);
console.log('Total items: ' + metaTotalItems.value);
console.log('Items per page: ' + metaItemsPerPage.value);
// Calculate the total pages
const totalPages = Math.ceil(metaTotalItems.value / metaItemsPerPage.value);
console.log('Total pages: ' + totalPages);
// If the current page is the highest page, then return
if (metaCurrentPage.value === totalPages) {
limitReached.value = true;
@@ -422,8 +412,6 @@ const loadDropdownContent = (scan) => {
// Load the dropdown content
SessionUser.superUser.modules.motorapi.functions.lookup(scan.plate).then((response) => {
const motorapi_data = response.data.data;
console.log(motorapi_data, 'MotorAPI data');
console.log(scan, 'Scan');
// Set the dropdown content to loaded
dropdownContents.value[scan.plate] = {
isLoading: false,
@@ -554,7 +542,6 @@ const onHoverDropdownContent = (scan) => {
};
// Load the dropdown content
loadDropdownContent(scan);
console.log('onHoverDropdownContent', scan);
};
const getDropdownContent = (scan) => {
@@ -45,7 +45,6 @@ const right_tabs = ref([
const forceActiveTab = ref('license_plates'); // Force the active tab to be license plates
const setTab = (tab) => {
console.log("Tab changed to: " + tab);
forceActiveTab.value = tab;
};
@@ -89,15 +88,12 @@ onMounted(() => {
if (getDepartmentVersion() === 1) {
document.getElementById("pos_select_customer_input").focus();
}
console.warn("Mounted POS Step 1, department version: " + department_version.value);
});
// Watch for changes in the reg_1 value
watch(() => reg_1.value, (newValue, oldValue) => {
// If the new value is different from the old value, check for duplicate orders
if (newValue === oldValue) {
} else {
console.warn("reg_1 changed from " + oldValue + " to " + newValue);
if (newValue !== oldValue) {
checkDuplicateOrders(newValue);
}
});
@@ -152,7 +148,6 @@ const checkDuplicateOrders = (reg) => {
label: t('admin.pos.show_details'),
action: () => {
// Action to show order details
console.log("Show details for order #" + order.id);
SessionUser.functions.redirectTo.department(department_id.value, '/modules/pos/orders/' + order.id);
},
},
@@ -161,9 +156,6 @@ const checkDuplicateOrders = (reg) => {
});
// Show the warning about duplicate orders
showDuplicateOrdersWarning();
} else {
// No duplicate orders found, do nothing
console.log("No duplicate orders found for reg_1:", reg);
}
}).catch(error => {
console.error("Error checking for duplicate orders:", error);
@@ -225,7 +217,6 @@ const showDuplicateOrdersDetails = () => {
label: t('admin.pos.show_details'),
action: () => {
// Action to show order details
console.log("Show details for order #" + id);
SessionUser.functions.redirectTo.department(department_id.value, 'modules/pos/orders/' + id, true);
},
},
@@ -252,7 +243,6 @@ const loadPotentialDuplicateOrdersContent = (id) => {
// Simulate loading content for each order
potentialDuplicateOrderObjects.value[id].loading = true;
SessionUser.objects.orders.get.single(id).then(order => {
console.log("Loaded order content for ID:", id, order);
// Update the content of the order in potentialDuplicateOrderObjects
potentialDuplicateOrderObjects.value[id] = order;
potentialDuplicateOrderObjects.value[id].loaded = true;
@@ -96,7 +96,6 @@ onMounted(() => {
if (getProductsCategory() === null) {
getProducts(department_id.value, !!props.isCustomerBooking, props.customer_number).then((response) => {
products.value = response.data.data;
console.log(products.value);
});
} else {
// Get the products by category
@@ -115,7 +114,6 @@ onMounted(() => {
}
}
}, 200);
console.log(products.value);
});
}
});
@@ -306,7 +304,6 @@ const setProductAddon = (productId, addonId, status, quantity = 1) => {
// Toggle product addon
const toggleProductAddon = (productId, addonId) => {
console.log(productId, addonId);
setProductAddon(productId, addonId, !isProductAddonTrue(productId, addonId));
};
@@ -319,7 +316,6 @@ const addAddonsToOrderMiddleware = async (product_id, quantity = 1, related_item
// If the product addons are set, add them to the order (If the product is added)
var product_addons = productAddons.value.filter((productAddon) => productAddon.product_id === product_id && productAddon.status === true);
for (let i = 0; i < product_addons.length; i++) {
console.log('Adding addon to order', product_addons[i]);
// Get the addons quantity (If the addon quantity is 0, use the product quantity, otherwise multiply the addon quantity with the product quantity)
let addon_quantity = product_addons[i].quantity === 0 ? quantity : product_addons[i].quantity * quantity;
// Get the products addon, and show the fake create order item
@@ -351,7 +347,6 @@ const getProductAddonQuantity = (productId, addonId) => {
};
const setProductAddonQuantity = (productId, addonId, quantity) => {
console.log(productId, addonId, quantity);
// If the quantity is 0, set the product addon status to false
if (quantity === 0 || quantity < 0) {
setProductAddon(productId, addonId, false, 0);
@@ -422,7 +417,6 @@ const addProductWithAddonsToOrder = async (product_id) => {
return;
}
// If the product requires a note, show the note input
console.log(product_id);
let quantity = 1;
// Show the fake create order item
showFakeCreateOrderItem(product_id, quantity, 0);
@@ -686,7 +680,6 @@ const scrollSelectedIntoCenter = async (isRetry = false) => {
// Watch for changes to the customer number
watch(() => props.customer_number, (newCustomerNumber) => {
console.warn('Customer number changed in SelectProductsFormPOS:', newCustomerNumber);
// Refetch products for the current category scope
if (getProductsCategory() === null) {
getProducts(department_id.value, !!props.isCustomerBooking, newCustomerNumber).then((response) => {
@@ -753,7 +746,6 @@ const setProductAddonNote = (productId, addonId, note) => {
if (productAddon !== undefined) {
productAddon.notes = note;
}
console.log(productAddons.value);
};
const subtractProductAddon = (productId, addonId) => {
+9 -20
View File
@@ -15,20 +15,18 @@ import 'buefy/dist/css/buefy.css'
import i18n from '@/i18n'
import { initializeAutoTableExports } from '@/services/AutoTableExportService.js';
import { API_URL, IS_DEV, POS_STEP_1_VERSION } from './config';
// export { API_URL, IS_DEV, POS_STEP_1_VERSION };
import { API_URL, IS_DEV } from './config';
const VITE_BUILD_DATE = import.meta.env.VITE_BUILD_DATE || '';
const VITE_COMMIT_HASH = import.meta.env.VITE_COMMIT_HASH || '';
const LAST_VERSION_CHECK_STORAGE_KEY = 'lastVersionCheck';
const TRUCK_WASH_ASCII = [
' _____ _ _ _ _ \n' +
'|_ _| | | | | | | | | \n' +
' | |_ __ _ _ ___| | __ | | | | __ _ ___| |__ \n' +
' | | \'__| | | |/ __| |/ / | |/\\| |/ _` / __| \'_ \\ \n' +
' | | | | |_| | (__| < \\ /\\ / (_| \\__ \\ | | |\n' +
' \\_/_| \\__,_|\\___|_|\\_\\ \\/ \\/ \\__,_|___/_| |_|'
' _____ _ _ _ _ \n' +
'|_ _| | | | | | | | | \n' +
' | |_ __ _ _ ___| | __ | | | | __ _ ___| |__ \n' +
' | | \'__| | | |/ __| |/ / | |/\\| |/ _` / __| \'_ \\ \n' +
' | | | | |_| | (__| < \\ /\\ / (_| \\__ \\ | | |\n' +
' \\_/_| \\__,_|\\___|_|\\_\\ \\/ \\/ \\__,_|___/_| |_|'
].join('\n');
const pad = (value) => String(value).padStart(2, '0');
@@ -63,8 +61,8 @@ const logBuildBanner = () => {
const lastVersionCheckRaw = Number.parseInt(localStorage.getItem(LAST_VERSION_CHECK_STORAGE_KEY) || '', 10);
const hasLastVersionCheck = Number.isFinite(lastVersionCheckRaw) && lastVersionCheckRaw > 0;
const lastVersionCheckDisplay = hasLastVersionCheck
? `${formatTimeAgo(lastVersionCheckRaw)} @ ${formatDateTime(lastVersionCheckRaw)}`
: 'never @ Unknown';
? `${formatTimeAgo(lastVersionCheckRaw)} @ ${formatDateTime(lastVersionCheckRaw)}`
: 'never @ Unknown';
console.log([
TRUCK_WASH_ASCII,
@@ -92,9 +90,6 @@ const unregisterDevServiceWorkers = async () => {
await Promise.all(staleCacheNames.map((cacheName) => caches.delete(cacheName)));
}
if (registrations.length > 0) {
console.log(`Removed ${registrations.length} service worker registration(s) for development mode.`);
}
};
if (import.meta.env.DEV && typeof window !== 'undefined') {
@@ -103,12 +98,6 @@ if (import.meta.env.DEV && typeof window !== 'undefined') {
});
}
// Service worker update handling
if ('serviceWorker' in navigator) {
navigator.serviceWorker.addEventListener('controllerchange', () => {
console.log('New service worker activated, reloading page...');
});
}
// If the route is empty, redirect to /redirect
// if (window.location.pathname === '/') {
// window.location.href = '/redirect';