mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Remove some debug logging statements.
This commit is contained in:
parent
57149cfc17
commit
ef46c84ce1
2 changed files with 4 additions and 27 deletions
|
|
@ -127,7 +127,6 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
exitAddVisitMode(button) {
|
exitAddVisitMode(button) {
|
||||||
console.log('exitAddVisitMode called');
|
|
||||||
this.isAddingVisit = false;
|
this.isAddingVisit = false;
|
||||||
|
|
||||||
// Reset button style to inactive state
|
// Reset button style to inactive state
|
||||||
|
|
@ -141,14 +140,12 @@ export default class extends Controller {
|
||||||
|
|
||||||
// Remove any existing marker
|
// Remove any existing marker
|
||||||
if (this.addVisitMarker) {
|
if (this.addVisitMarker) {
|
||||||
console.log('Removing add visit marker');
|
|
||||||
this.map.removeLayer(this.addVisitMarker);
|
this.map.removeLayer(this.addVisitMarker);
|
||||||
this.addVisitMarker = null;
|
this.addVisitMarker = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close any open popup
|
// Close any open popup
|
||||||
if (this.currentPopup) {
|
if (this.currentPopup) {
|
||||||
console.log('Closing current popup');
|
|
||||||
this.map.closePopup(this.currentPopup);
|
this.map.closePopup(this.currentPopup);
|
||||||
this.currentPopup = null;
|
this.currentPopup = null;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -273,7 +270,7 @@ export default class extends Controller {
|
||||||
cancelButton.addEventListener('click', (e) => {
|
cancelButton.addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
console.log('Cancel button clicked - exiting add visit mode');
|
|
||||||
this.exitAddVisitMode(this.addVisitButton);
|
this.exitAddVisitMode(this.addVisitButton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -356,8 +353,6 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
addCreatedVisitToMap(visitData, latitude, longitude) {
|
addCreatedVisitToMap(visitData, latitude, longitude) {
|
||||||
console.log('Adding newly created visit to map immediately', { latitude, longitude, visitData });
|
|
||||||
|
|
||||||
const mapsController = document.querySelector('[data-controller*="maps"]');
|
const mapsController = document.querySelector('[data-controller*="maps"]');
|
||||||
if (!mapsController) {
|
if (!mapsController) {
|
||||||
console.log('Could not find maps controller element');
|
console.log('Could not find maps controller element');
|
||||||
|
|
@ -367,6 +362,7 @@ export default class extends Controller {
|
||||||
const stimulusController = this.application.getControllerForElementAndIdentifier(mapsController, 'maps');
|
const stimulusController = this.application.getControllerForElementAndIdentifier(mapsController, 'maps');
|
||||||
if (!stimulusController || !stimulusController.visitsManager) {
|
if (!stimulusController || !stimulusController.visitsManager) {
|
||||||
console.log('Could not find maps controller or visits manager');
|
console.log('Could not find maps controller or visits manager');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,16 +382,10 @@ export default class extends Controller {
|
||||||
|
|
||||||
// Add the circle to the confirmed visits layer
|
// Add the circle to the confirmed visits layer
|
||||||
visitsManager.confirmedVisitCircles.addLayer(circle);
|
visitsManager.confirmedVisitCircles.addLayer(circle);
|
||||||
console.log('✅ Added newly created confirmed visit circle to layer');
|
|
||||||
console.log('Confirmed visits layer info:', {
|
|
||||||
layerCount: visitsManager.confirmedVisitCircles.getLayers().length,
|
|
||||||
isOnMap: this.map.hasLayer(visitsManager.confirmedVisitCircles)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Make sure the layer is visible on the map
|
// Make sure the layer is visible on the map
|
||||||
if (!this.map.hasLayer(visitsManager.confirmedVisitCircles)) {
|
if (!this.map.hasLayer(visitsManager.confirmedVisitCircles)) {
|
||||||
this.map.addLayer(visitsManager.confirmedVisitCircles);
|
this.map.addLayer(visitsManager.confirmedVisitCircles);
|
||||||
console.log('✅ Added confirmed visits layer to map');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the layer control has the confirmed visits layer enabled
|
// Check if the layer control has the confirmed visits layer enabled
|
||||||
|
|
@ -421,9 +411,7 @@ export default class extends Controller {
|
||||||
inputs.forEach(input => {
|
inputs.forEach(input => {
|
||||||
const label = input.nextElementSibling;
|
const label = input.nextElementSibling;
|
||||||
if (label && label.textContent.trim().includes('Confirmed Visits')) {
|
if (label && label.textContent.trim().includes('Confirmed Visits')) {
|
||||||
console.log('Found Confirmed Visits checkbox, current state:', input.checked);
|
|
||||||
if (!input.checked) {
|
if (!input.checked) {
|
||||||
console.log('Enabling Confirmed Visits layer via checkbox');
|
|
||||||
input.checked = true;
|
input.checked = true;
|
||||||
input.dispatchEvent(new Event('change', { bubbles: true }));
|
input.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export default class extends Controller {
|
||||||
if (this.isUploading) {
|
if (this.isUploading) {
|
||||||
// If still uploading, prevent submission
|
// If still uploading, prevent submission
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
console.log("Form submission prevented during upload")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ export default class extends Controller {
|
||||||
const signedIds = this.element.querySelectorAll('input[name="import[files][]"][type="hidden"]')
|
const signedIds = this.element.querySelectorAll('input[name="import[files][]"][type="hidden"]')
|
||||||
if (signedIds.length === 0) {
|
if (signedIds.length === 0) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
console.log("No files uploaded yet")
|
|
||||||
alert("Please select and upload files first")
|
alert("Please select and upload files first")
|
||||||
} else {
|
} else {
|
||||||
console.log(`Submitting form with ${signedIds.length} uploaded files`)
|
console.log(`Submitting form with ${signedIds.length} uploaded files`)
|
||||||
|
|
@ -78,7 +78,6 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Uploading ${files.length} files`)
|
|
||||||
this.isUploading = true
|
this.isUploading = true
|
||||||
|
|
||||||
// Disable submit button during upload
|
// Disable submit button during upload
|
||||||
|
|
@ -124,8 +123,6 @@ export default class extends Controller {
|
||||||
// Add the progress wrapper AFTER the file input field but BEFORE the submit button
|
// Add the progress wrapper AFTER the file input field but BEFORE the submit button
|
||||||
this.submitTarget.parentNode.insertBefore(progressWrapper, this.submitTarget)
|
this.submitTarget.parentNode.insertBefore(progressWrapper, this.submitTarget)
|
||||||
|
|
||||||
console.log("Progress bar created and inserted before submit button")
|
|
||||||
|
|
||||||
let uploadCount = 0
|
let uploadCount = 0
|
||||||
const totalFiles = files.length
|
const totalFiles = files.length
|
||||||
|
|
||||||
|
|
@ -137,17 +134,13 @@ export default class extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
Array.from(files).forEach(file => {
|
Array.from(files).forEach(file => {
|
||||||
console.log(`Starting upload for ${file.name}`)
|
|
||||||
const upload = new DirectUpload(file, this.urlValue, this)
|
const upload = new DirectUpload(file, this.urlValue, this)
|
||||||
upload.create((error, blob) => {
|
upload.create((error, blob) => {
|
||||||
uploadCount++
|
uploadCount++
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("Error uploading file:", error)
|
|
||||||
// Show error to user using flash
|
|
||||||
showFlashMessage('error', `Error uploading ${file.name}: ${error.message || 'Unknown error'}`)
|
showFlashMessage('error', `Error uploading ${file.name}: ${error.message || 'Unknown error'}`)
|
||||||
} else {
|
} else {
|
||||||
console.log(`Successfully uploaded ${file.name} with ID: ${blob.signed_id}`)
|
|
||||||
|
|
||||||
// Create a hidden field with the correct name
|
// Create a hidden field with the correct name
|
||||||
const hiddenField = document.createElement("input")
|
const hiddenField = document.createElement("input")
|
||||||
|
|
@ -155,8 +148,6 @@ export default class extends Controller {
|
||||||
hiddenField.setAttribute("name", "import[files][]")
|
hiddenField.setAttribute("name", "import[files][]")
|
||||||
hiddenField.setAttribute("value", blob.signed_id)
|
hiddenField.setAttribute("value", blob.signed_id)
|
||||||
this.element.appendChild(hiddenField)
|
this.element.appendChild(hiddenField)
|
||||||
|
|
||||||
console.log("Added hidden field with signed ID:", blob.signed_id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable submit button when all uploads are complete
|
// Enable submit button when all uploads are complete
|
||||||
|
|
@ -186,8 +177,6 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.isUploading = false
|
this.isUploading = false
|
||||||
console.log("All uploads completed")
|
|
||||||
console.log(`Ready to submit with ${successfulUploads} files`)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue