some quick updates to get cconvert up and working again

This commit is contained in:
admin 2025-08-03 13:50:07 -06:00
parent 532286217e
commit 3231a4973c
3 changed files with 53 additions and 8 deletions

View File

@ -53,6 +53,8 @@ document.addEventListener('DOMContentLoaded', () => {
if (hash === '#walk-sheet') {
showSection('walk-sheet');
checkAndLoadWalkSheetConfig();
} else if (hash === '#convert-data') {
showSection('convert-data');
} else {
// Default to dashboard
showSection('dashboard');
@ -390,6 +392,16 @@ function setupNavigation() {
loadAdminShifts();
} else if (targetId === 'users') {
loadUsers();
} else if (targetId === 'convert-data') {
// Initialize data convert event listeners when section is shown
setTimeout(() => {
if (typeof window.setupDataConvertEventListeners === 'function') {
console.log('Setting up data convert event listeners...');
window.setupDataConvertEventListeners();
} else {
console.error('setupDataConvertEventListeners not found');
}
}, 100);
}
// Close mobile menu if open
@ -430,6 +442,19 @@ function showSection(sectionId) {
const linkTarget = link.getAttribute('href').substring(1);
link.classList.toggle('active', linkTarget === sectionId);
});
// Special handling for convert-data section
if (sectionId === 'convert-data') {
// Initialize data convert event listeners when section is shown
setTimeout(() => {
if (typeof window.setupDataConvertEventListeners === 'function') {
console.log('Setting up data convert event listeners from showSection...');
window.setupDataConvertEventListeners();
} else {
console.error('setupDataConvertEventListeners not found in showSection');
}
}, 100);
}
}
// Update map from input fields

View File

@ -1,6 +1,7 @@
let processingData = [];
let resultsMap = null;
let markers = [];
let eventListenersInitialized = false;
// Utility function to show status messages
function showDataConvertStatus(message, type = 'info') {
@ -41,6 +42,12 @@ document.addEventListener('DOMContentLoaded', () => {
function setupDataConvertEventListeners() {
console.log('Setting up data convert event listeners...');
// Prevent duplicate event listeners
if (eventListenersInitialized) {
console.log('Event listeners already initialized, skipping...');
return;
}
const fileInput = document.getElementById('csv-file-input');
const browseBtn = document.getElementById('browse-btn');
const uploadArea = document.getElementById('upload-area');
@ -100,6 +107,10 @@ function setupDataConvertEventListeners() {
if (newUploadBtn) {
newUploadBtn.addEventListener('click', resetToUpload);
}
// Mark as initialized
eventListenersInitialized = true;
console.log('Data convert event listeners initialized successfully');
}
function handleFileSelect(e) {

View File

@ -3,17 +3,16 @@ const config = require('../config');
const logger = winston.createLogger({
level: config.isProduction ? 'info' : 'debug',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.json()
),
defaultMeta: { service: 'bnkops-map' },
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
winston.format.errors({ stack: true }),
winston.format.colorize(),
winston.format.simple()
winston.format.printf(({ timestamp, level, message, service }) => {
return `${timestamp} [${service}] ${level}: ${message}`;
})
)
})
]
@ -23,10 +22,20 @@ const logger = winston.createLogger({
if (config.isProduction) {
logger.add(new winston.transports.File({
filename: 'error.log',
level: 'error'
level: 'error',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.json()
)
}));
logger.add(new winston.transports.File({
filename: 'combined.log'
filename: 'combined.log',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.json()
)
}));
}