diff --git a/src/components/displays/department/pos/steps/mobile/PosDepartmentStepMobile2.vue b/src/components/displays/department/pos/steps/mobile/PosDepartmentStepMobile2.vue
index 08b2709f..5211b5d7 100644
--- a/src/components/displays/department/pos/steps/mobile/PosDepartmentStepMobile2.vue
+++ b/src/components/displays/department/pos/steps/mobile/PosDepartmentStepMobile2.vue
@@ -41,12 +41,10 @@ onMounted(() => {
// Set the reference to the vehicle 1 reference if it's not already set
if (vehicles?.vehicle_1?.value?.reference && !reference.value) {
reference.value = vehicles.vehicle_1.value.reference;
- console.warn('Setting reference to vehicle 1 reference:', reference.value);
}
// Set the notes to the order notes if it's not already set
if (order_notes.value && !notes.value) {
notes.value = order_notes.value;
- console.warn('Setting notes to order notes:', notes.value);
}
// Check for potential customer number changes
const initialCustomerId = Number.parseInt(String(customer_id.value), 10);
@@ -68,7 +66,6 @@ onMounted(() => {
const applyPotentialCustomerNumberChange = (oldId, newId) => {
const parsedCustomerId = Number.parseInt(String(newId), 10);
metadata.customerId.value = Number.isNaN(parsedCustomerId) ? null : parsedCustomerId;
- console.warn('Customer ID changed from', oldId, 'to', metadata.customerId.value)
}
// Watch the customer id, and if it changes, update it in the metadata
@@ -180,7 +177,6 @@ const applyPendingBookingFromSelection = async () => {
if (booking.po && typeof booking.po === 'string' && booking.po.trim() !== '') {
try {
await SessionUser.objects.orders.set.po(order_id.value, booking.po);
- console.warn('Applied PO from booking:', booking.po);
} catch (e) {
console.error('Failed to set PO on order from booking', e);
}
@@ -200,7 +196,6 @@ const applyPendingBookingFromSelection = async () => {
if (fullBookingData.reference && fullBookingData.reference.trim() !== '') {
try {
await SessionUser.objects.orders.set.reference(order_id.value, fullBookingData.reference);
- console.log('Applied reference from booking:', fullBookingData.reference);
} catch (setRefError) {
console.error('Failed to set reference on order from booking:', setRefError);
}
@@ -208,7 +203,6 @@ const applyPendingBookingFromSelection = async () => {
if (fullBookingData.notes !== undefined && fullBookingData.notes !== null && fullBookingData.notes.trim() !== '') {
try {
await SessionUser.objects.orders.set.notes(order_id.value, fullBookingData.notes);
- console.log('Applied notes from booking:', fullBookingData.notes);
} catch (setNotesError) {
console.error('Failed to set notes on order from booking:', setNotesError);
}
@@ -219,7 +213,6 @@ const applyPendingBookingFromSelection = async () => {
return false;
}
if (!items.length) {
- console.warn('Full booking fetched but no items found.');
lastAppliedBookingId.value = booking.id;
return false;
}
@@ -271,7 +264,9 @@ const applyPendingBookingFromSelection = async () => {
lastFetchedPrimaryItemProduct.value = primaryProduct; // Update last fetched primary item
// Set vehicle type for consistency
- vehicles.vehicle_1.value.type = primaryProduct.id;
+ if (vehicles.vehicle_1.value) {
+ vehicles.vehicle_1.value.type = primaryProduct.id;
+ }
// Override with first wash if primary not wash
if (!primaryProduct.is_wash) {
@@ -280,7 +275,9 @@ const applyPendingBookingFromSelection = async () => {
firstWash.addons = primaryProduct.addons;
transactionItems.setPrimaryItem(firstWash as any);
lastFetchedPrimaryItemProduct.value = firstWash;
- vehicles.vehicle_1.value.type = firstWash.id;
+ if (vehicles.vehicle_1.value) {
+ vehicles.vehicle_1.value.type = firstWash.id;
+ }
}
}
@@ -323,7 +320,6 @@ const fetchPrimaryItemProduct = () => {
.then(product => {
// If the product is found, set it as the primary item
lastFetchedPrimaryItemProduct.value = product; // Store the last fetched primary item product
- console.warn('Setting primary item to vehicle type product:', product);
// If the primary item is already set, simply update the product
if (transactionItems.primaryItem.value) {
transactionItems.primaryItem.value = {
@@ -349,10 +345,8 @@ const fetchLastOrder = (vehicleIndex: number) => {
// This function fetches the last order for a given vehicle ID (Provided it has a last_order_id
const tmp_order_id = vehicles[`vehicle_${vehicleIndex}`]?.value?.last_order_id || 0;
if (!tmp_order_id) {
- console.warn(`No last order ID found for vehicle ${vehicleIndex}`);
return; // If no last order ID is found, do not proceed.
}
- console.log('Fetching last order details for vehicle', vehicleIndex, tmp_order_id);
SessionUser.objects.orders.get.single(tmp_order_id)
.then(order => lastOrders.set(vehicleIndex, {...order}))
.catch(error => console.error('Error fetching last order:', error));
@@ -371,7 +365,6 @@ const updateLastOrderItemPrices = (items: PosOrderItem[]) => {
// Update the prices of the last order items to reflect any changes in the product prices
return items.map(item => {
SessionUser.objects.products.get.single(item.product_id, {category_id: null, department_id: department_id.value, customer_id: customer_id.value, final_price: true}).then(product => {
- console.warn('Fetched product for last order item:', product);
transactionItems.updateTransactionPrices([product]); // Update the transaction prices with the fetched product
}).catch(error => {
console.error('Error fetching product for last order item:', error);
@@ -439,7 +432,6 @@ onUnmounted(() => {
const onBeforeComplete = () => {
// This function is called before the step is completed
- console.log('On before complete called');
return new Promise((resolve, reject) => {
// Check if the primary item is set
if (!transactionItems.primaryItem.value) {
@@ -530,7 +522,6 @@ watch(
() => transactionItems.primaryItem.value,
(nextPrimary, prevPrimary) => {
if (!nextPrimary) {
- console.warn('Primary item is not set, cannot proceed with the transaction.');
fetchPrimaryItemProduct();
return;
}
@@ -541,7 +532,6 @@ watch(
if (isNewPrimary) {
lastFetchedPrimaryItemProduct.value = nextPrimary;
- console.log('Primary item changed from:', prevPrimary ?? null, 'to:', nextPrimary);
fetchPrimaryItemProduct();
if (Array.isArray(nextPrimary.addons) && nextPrimary.addons.length > 0) {
@@ -556,12 +546,6 @@ watch(
// Same product as last fetched: merge/normalize addons from last fetched into the current primary item
const sourceAddons = lastFetched?.addons ?? [];
if (sourceAddons.length > 0) {
- console.log(
- 'Merging addons from last fetched primary item product:',
- sourceAddons,
- 'into primary item:',
- transactionItems.primaryItem.value
- );
transactionItems.primaryItem.value.addons = mapAddonsWithQuantity(
sourceAddons,
transactionItems.primaryItem.value.addons ?? []
@@ -574,38 +558,33 @@ watch(
// Watch for changes in the last orders and fetch the order items when they change
watch(() => lastOrders.get(1), (newValue, oldValue) => {
if (newValue && newValue.id !== oldValue?.id) {
- console.log('Last order 1 changed:', newValue);
fetchLastOrderItems(1); // Fetch the order items for the last order 1
}
}, { immediate: true });
watch(() => lastOrders.get(2), (newValue, oldValue) => {
if (newValue && newValue.id !== oldValue?.id) {
- console.log('Last order 2 changed:', newValue);
fetchLastOrderItems(2); // Fetch the order items for the last order 2
}
}, { immediate: true });
watch(() => lastOrders.get(3), (newValue, oldValue) => {
if (newValue && newValue.id !== oldValue?.id) {
- console.log('Last order 3 changed:', newValue);
fetchLastOrderItems(3); // Fetch the order items for the last order 3
}
}, { immediate: true });
// Watch for changes in the vehicle 1 last_order_id and fetch the last order when it changes
-watch(() => vehicles.vehicle_1.value.last_order_id, (newValue, oldValue) => {
+watch(() => vehicles.vehicle_1.value?.last_order_id, (newValue, oldValue) => {
if (newValue && newValue !== oldValue) {
- console.log('Vehicle 1 last_order_id changed:', newValue);
fetchLastOrder(1); // Fetch the last order for vehicle 1
} else {
lastOrders.set(1, null); // Clear the last order if the last_order_id is removed
}
});
// Watch for changes in the vehicle 1 reference and update the reference field when it changes
-watch(() => vehicles.vehicle_1.value.reference, (newValue, oldValue) => {
+watch(() => vehicles.vehicle_1.value?.reference, (newValue, oldValue) => {
if (newValue && newValue !== oldValue) {
- console.log('Vehicle 1 reference changed:', newValue);
reference.value = newValue; // Update the reference field
}
});
@@ -670,12 +649,12 @@ const filteredAddons = computed(() => {
-
+
-
+
diff --git a/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2Products.vue b/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2Products.vue
index 981d4013..3a2b4b21 100644
--- a/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2Products.vue
+++ b/src/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2Products.vue
@@ -34,7 +34,6 @@ const slots = defineSlots();
const fetchProducts = async (category: PosCategory, departmentId: number) => {
await SessionUser.objects.products.get.category(category.id, departmentId, (customer_id.value ? parseInt(customer_id.value) : null), true)
.then((response) => {
- console.log("Products fetched for category:", category.name, response);
pos.productList.clear();
orderProducts(response).forEach((result: PosProduct) => {
pos.productList.add(result);
@@ -57,14 +56,12 @@ const fetchSuggestedProducts = async () => {
reg_3: pos.vehicles.vehicle_3?.value?.reg || null,
}
).then((response) => {
- console.log("Suggested products fetched:", response);
});
};
// Watch for changes in the selected category
watch(() => pos.categories.selection(), (newCategory) => {
if (newCategory) {
- console.log("Selected category changed:", newCategory);
// If the category id is -1, get the suggested products
if (newCategory.id === -1) {
fetchSuggestedProducts();
@@ -136,4 +133,4 @@ const filteredProducts = computed(() => {
\ No newline at end of file
+
diff --git a/src/components/displays/department/pos/steps/mobile/objects/PosDepartmentStepMobileFlow.vue b/src/components/displays/department/pos/steps/mobile/objects/PosDepartmentStepMobileFlow.vue
index d833ca62..02816f0b 100644
--- a/src/components/displays/department/pos/steps/mobile/objects/PosDepartmentStepMobileFlow.vue
+++ b/src/components/displays/department/pos/steps/mobile/objects/PosDepartmentStepMobileFlow.vue
@@ -154,7 +154,6 @@ const defaultActionButtons = computed<{ [key: string]: PosActionButton }>(() =>
label: t('admin.pos.action_buttons.select_customer'),
description: t('admin.pos.action_buttons.select_customer_desc'),
onClick: () => {
- console.warn('Select Customer button clicked');
// Open the select customer popup
popups.select('select_customer');
},
@@ -164,7 +163,6 @@ const defaultActionButtons = computed<{ [key: string]: PosActionButton }>(() =>
label: t('admin.pos.action_buttons.add_customer'),
description: t('admin.pos.action_buttons.add_customer_desc'),
onClick: () => {
- console.warn('Add Customer button clicked');
// Open the add customer popup
popups.select('add_customer', { props: { error: null, canCreate: true } });
},
@@ -174,10 +172,8 @@ const defaultActionButtons = computed<{ [key: string]: PosActionButton }>(() =>
label: t('admin.pos.action_buttons.edit_reference'),
description: t('admin.pos.action_buttons.edit_reference_desc'),
onClick: () => {
- console.warn('Edit Reference button clicked');
// Open the edit reference popup
//popups.select('edit_reference');
- console.warn('Edit Reference button not yet implemented.');
},
color: 'primary'
},
@@ -185,7 +181,6 @@ const defaultActionButtons = computed<{ [key: string]: PosActionButton }>(() =>
label: t('admin.pos.action_buttons.add_note'),
description: t('admin.pos.action_buttons.add_note_desc'),
onClick: () => {
- console.warn('Add Note button clicked');
// Open the add note popup
popups.select('customer_notes', { props: { showInput: true, showNotes: false } });
},
@@ -205,10 +200,8 @@ const isPopupSet = computed(() => {
// Function to get the current popup
const getPopup = () => {
if (popup.value) {
- console.log('Current popup:', popup.value);
return popup.value;
}
- console.warn('No popup is currently set.');
return null;
}
// Function to set the popup
@@ -355,7 +348,6 @@ const getPopupByKey = (key: string): PosPopup | null => {
const removePopupByKey = (key: string): boolean => {
if (popupsList.value[key]) {
delete popupsList.value[key];
- console.log(`Removed popup with key: ${key}`);
return true;
}
console.warn(`Popup with key "${key}" not found.`);
@@ -364,13 +356,11 @@ const removePopupByKey = (key: string): boolean => {
// Function to clear the popups list
const clearPopupsList = () => {
popupsList.value = {};
- console.log('Cleared popups list');
}
// Function to select a popup by its ID
const selectPopupById = (id: string, modifications?: Partial): PosPopup | null => {
const popupItem = popupsList.value[id];
if (popupItem) {
- console.log(`Selected popup with id: ${id}`);
setPopup({
...popupItem.value,
...modifications, // Apply any modifications if provided
@@ -419,7 +409,6 @@ const setActiveVehicleIndex = (index: number): void => {
// Function to select a vehicle
const selectVehicle = (index: number, vehicle: PosVehicle | null) => {
- console.log(`Selecting vehicle at index ${index}:`, vehicle);
switch (index) {
case 1:
vehicle_1.value = vehicle;
@@ -632,7 +621,6 @@ const removeWashCertificateIfPresent = (item: PosProduct | null): PosProduct | n
}
// Function to set the primary item for the transaction
const setPrimaryItem = (item: PosProduct | null) => {
- console.warn('Setting primary item:', item);
// Check if the attachments include a wash certificate and if the item requires it
if (hasWashCertificate()) {
item = applyWashCertificateIfPresent(item)
@@ -1160,16 +1148,16 @@ const getCustomerId = () => {
return customerId.value;
}
// Function to set notes
-const setNotes = (newNotes: string) => {
- notes.value = newNotes;
+const setNotes = (newNotes: string | null | undefined) => {
+ notes.value = newNotes ?? '';
}
// Function to get notes
const getNotes = () => {
return notes.value;
}
// Function to set reference
-const setReference = (newReference: string) => {
- reference.value = newReference;
+const setReference = (newReference: string | null | undefined) => {
+ reference.value = newReference ?? '';
}
// Function to get reference
const getReference = () => {
@@ -1304,17 +1292,14 @@ const selectLastVehicleOrder = (vehicleIndex: number) => {
product: item.product,
} as Addon;
});
- console.log(`addons for last order:`, addons);
const primaryItem = {
...lastOrder.items[0].product,
addons: addons,
}; // Assuming the first item is the primary item for the transaction.
- console.log(`primary item for last order:`, primaryItem);
// If the last order exists, set it as the primary item for the transaction.
vehicles.select(vehicleIndex, {...vehicles.get(vehicleIndex), type: primaryItem.id});
transactionItems.setPrimaryItem({...primaryItem}); // Clear addons for the primary item
transactionItems.setPrimaryItem({...primaryItem}); // Set the primary item for the transaction
- console.log(`Selected last vehicle order for vehicle ${vehicleIndex}:`, lastOrder);
} else {
console.warn(`No last vehicle order found for vehicle ${vehicleIndex}.`);
}
diff --git a/src/components/models/pos/step1/RegistrationNumberSearchResult.vue b/src/components/models/pos/step1/RegistrationNumberSearchResult.vue
index 88b7ddbe..dd4b62c5 100644
--- a/src/components/models/pos/step1/RegistrationNumberSearchResult.vue
+++ b/src/components/models/pos/step1/RegistrationNumberSearchResult.vue
@@ -1,11 +1,6 @@