Remove debug console.log and console.warn statements across POS-related components to improve production readiness and streamline logging.
This commit is contained in:
@@ -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(() => {
|
||||
<!-- Notes -->
|
||||
<ControlField>
|
||||
<ControlFieldInputLabel label="Notes" :classes="layout.classes" :optional="true"/>
|
||||
<ControlFieldInput type="text" placeholder="" :classes="layout.classes" :vmodel="order_notes" @change="console.warn('Setting notes to', $event); metadata.setNotes($event); SessionUser.objects.orders.set.notes(order_id, $event);"/>
|
||||
<ControlFieldInput type="text" placeholder="" :classes="layout.classes" :vmodel="order_notes" @change="metadata.setNotes($event); SessionUser.objects.orders.set.notes(order_id, $event);"/>
|
||||
</ControlField>
|
||||
<!-- Reference -->
|
||||
<ControlField>
|
||||
<ControlFieldInputLabel label="Reference" :classes="layout.classes" :optional="true"/> <!-- TODO: Make this required, if the customer requires it -->
|
||||
<ControlFieldInput type="text" placeholder="" :classes="layout.classes" :vmodel="reference" @change="console.warn('Setting ref. to', $event); metadata.setReference($event); SessionUser.objects.orders.set.reference(order_id, $event);"/>
|
||||
<ControlFieldInput type="text" placeholder="" :classes="layout.classes" :vmodel="reference" @change="metadata.setReference($event); SessionUser.objects.orders.set.reference(order_id, $event);"/>
|
||||
</ControlField>
|
||||
<!-- Spacer to push the buttons to the bottom -->
|
||||
<ControlField>
|
||||
|
||||
+1
-4
@@ -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(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+4
-19
@@ -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>): 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 = <PosProduct>{
|
||||
...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}.`);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import {defineComponent, defineEmits, defineProps, ref, watch, onMounted} from "vue";
|
||||
import VerifiedCustomer from "@/components/viewport/elements/icons/VerifiedCustomer.vue";
|
||||
import KnownCustomer from "@/components/viewport/elements/icons/KnownCustomer.vue";
|
||||
import UnknownCustomer from "@/components/viewport/elements/icons/UnknownCustomer.vue";
|
||||
import CardPaymentCustomer from "@/components/viewport/elements/icons/CardPaymentCustomer.vue";
|
||||
import BookedCustomer from "@/components/viewport/elements/icons/BookedCustomer.vue";
|
||||
import { VehicleStatusKey, statusKeyToComponent } from "@/components/displays/department/pos/steps/mobile/objects/PosVehicleStatus.vue";
|
||||
import { vehicles_matching, searchVehicle, register_new_search, is_latest_search, clearCustomerSelection, isSearching, pendingBookings, loadPendingBookings, doesVehiclePlateHaveBooking, getVehiclePlateBooking, searchAndSelectCustomer, reg_1, reg_2 } from "@/components/shop/POSDepartmentProcess.vue";
|
||||
import { setCustomerId, pos } from "@/components/displays/department/pos/steps/mobile/objects/PosDepartmentStepMobileFlow.vue";
|
||||
@@ -37,27 +32,6 @@ const props = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
const debug = {
|
||||
results: 7,
|
||||
}
|
||||
|
||||
|
||||
const generateRegistrationNumber = () => {
|
||||
// Return a XX00000 format registration number
|
||||
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const randomLetters = letters.charAt(Math.floor(Math.random() * letters.length)) +
|
||||
letters.charAt(Math.floor(Math.random() * letters.length));
|
||||
const randomNumbers = Math.floor(100000 + Math.random() * 900000);
|
||||
return `${randomLetters}${randomNumbers}`;
|
||||
};
|
||||
|
||||
const generateCustomerStatus = () => {
|
||||
// Randomly return one of the three customer status icons
|
||||
const statuses = [VerifiedCustomer, KnownCustomer, UnknownCustomer, CardPaymentCustomer, BookedCustomer];
|
||||
// Return a random status component
|
||||
return statuses[Math.floor(Math.random() * statuses.length)];
|
||||
};
|
||||
|
||||
const searchResults = ref<PosSearchResult[]>([]);
|
||||
|
||||
//const searchResults: SearchResult[] = Array.from({ length: debug.results }, (_, i) => ({
|
||||
@@ -70,11 +44,10 @@ const searchResults = ref<PosSearchResult[]>([]);
|
||||
const applyBookingAutomatically = (booking: any) => {
|
||||
// If the booking id is not null, ignore everything. (To prevent running this function multiple times)
|
||||
if (pos.metadata.getBookingId()) {
|
||||
console.warn("Booking already applied, ignoring.");
|
||||
return;
|
||||
}
|
||||
if (!booking?.id) {
|
||||
console.warn("No booking found to apply.");
|
||||
return;
|
||||
}
|
||||
pos.metadata.setBookingId(booking.id); // Set the booking ID to prevent multiple prompts, this is reset if the user cancels.
|
||||
// If the input registration numbers manually is displayed, hide it.
|
||||
@@ -93,10 +66,10 @@ const applyBookingAutomatically = (booking: any) => {
|
||||
// Apply the booking
|
||||
pos.metadata.setBookingId(booking.id);
|
||||
pos.metadata.setNotes(booking.note || `Booking ID: ${booking.id}`);
|
||||
pos.metadata.setReference(booking.reference || null);
|
||||
pos.metadata.setReference(booking.reference || '');
|
||||
// Set the registration numbers
|
||||
reg_1.value = booking.reg_1;
|
||||
reg_2.value = booking.reg_2 || null;
|
||||
reg_2.value = booking.reg_2 || '';
|
||||
// Select the vehicles
|
||||
pos.vehicles.select(1, {
|
||||
reg: booking.reg_1,
|
||||
@@ -123,7 +96,6 @@ const applyBookingAutomatically = (booking: any) => {
|
||||
// Go to the next step
|
||||
//console.warn('Navigating to next step in POS flow.');
|
||||
} else {
|
||||
console.warn("User cancelled applying booking.");
|
||||
// If the user cancels, reset the booking ID to allow future prompts
|
||||
pos.metadata.setBookingId(null);
|
||||
}
|
||||
@@ -150,7 +122,6 @@ const onSelect = (result: PosSearchResult) => {
|
||||
setCustomerId(result.customerId); // This is to ensure data is kept where it's relevant.
|
||||
} else {
|
||||
// If the customer ID is not present, emit the result as null
|
||||
console.warn("No customer ID found for result:", result);
|
||||
setCustomerId(null);
|
||||
}
|
||||
}
|
||||
@@ -181,7 +152,6 @@ const performSearch = (searchQuery: string) => {
|
||||
|
||||
// If the search is already in progress, do not perform a new search
|
||||
if (isSearching.value && !is_latest_search(search_id)) {
|
||||
console.warn("Search already in progress, skipping new search.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,7 +168,6 @@ watch(isSearching, (newValue) => {
|
||||
if (!newValue) {
|
||||
// If the search is not in progress, and there are no vehicles matching, emit null
|
||||
if (vehicles_matching.value.length === 0 && props.modifyCustomerOnChange) {
|
||||
console.warn("No vehicles matching found, emitting null.");
|
||||
if (props.automaticallySelect && props.searchQuery !== '') {
|
||||
emitVehicleObject({
|
||||
registrationNumber: props.searchQuery,
|
||||
@@ -264,7 +233,6 @@ const automaticallySelect = () => {
|
||||
// If the vehicle is found.
|
||||
if (withoutDuplicates.find(v => v.registrationNumber.toUpperCase() === props.searchQuery.toUpperCase())) {
|
||||
const match = withoutDuplicates.find(v => v.registrationNumber.toUpperCase() === props.searchQuery.toUpperCase());
|
||||
console.warn("Automatically selecting vehicle:", match);
|
||||
// Emit the selected vehicle object
|
||||
onSelect({
|
||||
registrationNumber: props.searchQuery.toUpperCase(),
|
||||
@@ -278,8 +246,6 @@ const automaticallySelect = () => {
|
||||
washSubscription: match?.washSubscription,
|
||||
bookingId: match?.bookingId || null,
|
||||
});
|
||||
} else {
|
||||
console.warn("No exact match found for automatic selection.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,4 +353,4 @@ const stripSpaces = (str: string) => {
|
||||
align-self: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -243,10 +243,12 @@ export const reset_all_values = () => {
|
||||
};
|
||||
|
||||
/** Whenever the reg_1, reg_2 or reg_3 changes, remove any spaces and make the string uppercase */
|
||||
const normalizeRegistrationValue = (value) => String(value ?? '').replace(/\s/g, '').toUpperCase();
|
||||
|
||||
watch([reg_1, reg_2, reg_3], () => {
|
||||
reg_1.value = reg_1.value.replace(/\s/g, '').toUpperCase();
|
||||
reg_2.value = reg_2.value.replace(/\s/g, '').toUpperCase();
|
||||
reg_3.value = reg_3.value.replace(/\s/g, '').toUpperCase();
|
||||
reg_1.value = normalizeRegistrationValue(reg_1.value);
|
||||
reg_2.value = normalizeRegistrationValue(reg_2.value);
|
||||
reg_3.value = normalizeRegistrationValue(reg_3.value);
|
||||
});
|
||||
|
||||
/** Get the order details by order id */
|
||||
|
||||
Reference in New Issue
Block a user