some quick updates to get cconvert up and working again
This commit is contained in:
parent
532286217e
commit
3231a4973c
@ -53,6 +53,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
if (hash === '#walk-sheet') {
|
if (hash === '#walk-sheet') {
|
||||||
showSection('walk-sheet');
|
showSection('walk-sheet');
|
||||||
checkAndLoadWalkSheetConfig();
|
checkAndLoadWalkSheetConfig();
|
||||||
|
} else if (hash === '#convert-data') {
|
||||||
|
showSection('convert-data');
|
||||||
} else {
|
} else {
|
||||||
// Default to dashboard
|
// Default to dashboard
|
||||||
showSection('dashboard');
|
showSection('dashboard');
|
||||||
@ -390,6 +392,16 @@ function setupNavigation() {
|
|||||||
loadAdminShifts();
|
loadAdminShifts();
|
||||||
} else if (targetId === 'users') {
|
} else if (targetId === 'users') {
|
||||||
loadUsers();
|
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
|
// Close mobile menu if open
|
||||||
@ -430,6 +442,19 @@ function showSection(sectionId) {
|
|||||||
const linkTarget = link.getAttribute('href').substring(1);
|
const linkTarget = link.getAttribute('href').substring(1);
|
||||||
link.classList.toggle('active', linkTarget === sectionId);
|
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
|
// Update map from input fields
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
let processingData = [];
|
let processingData = [];
|
||||||
let resultsMap = null;
|
let resultsMap = null;
|
||||||
let markers = [];
|
let markers = [];
|
||||||
|
let eventListenersInitialized = false;
|
||||||
|
|
||||||
// Utility function to show status messages
|
// Utility function to show status messages
|
||||||
function showDataConvertStatus(message, type = 'info') {
|
function showDataConvertStatus(message, type = 'info') {
|
||||||
@ -41,6 +42,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
function setupDataConvertEventListeners() {
|
function setupDataConvertEventListeners() {
|
||||||
console.log('Setting up data convert event listeners...');
|
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 fileInput = document.getElementById('csv-file-input');
|
||||||
const browseBtn = document.getElementById('browse-btn');
|
const browseBtn = document.getElementById('browse-btn');
|
||||||
const uploadArea = document.getElementById('upload-area');
|
const uploadArea = document.getElementById('upload-area');
|
||||||
@ -100,6 +107,10 @@ function setupDataConvertEventListeners() {
|
|||||||
if (newUploadBtn) {
|
if (newUploadBtn) {
|
||||||
newUploadBtn.addEventListener('click', resetToUpload);
|
newUploadBtn.addEventListener('click', resetToUpload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark as initialized
|
||||||
|
eventListenersInitialized = true;
|
||||||
|
console.log('Data convert event listeners initialized successfully');
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFileSelect(e) {
|
function handleFileSelect(e) {
|
||||||
|
|||||||
@ -3,17 +3,16 @@ const config = require('../config');
|
|||||||
|
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
level: config.isProduction ? 'info' : 'debug',
|
level: config.isProduction ? 'info' : 'debug',
|
||||||
format: winston.format.combine(
|
|
||||||
winston.format.timestamp(),
|
|
||||||
winston.format.errors({ stack: true }),
|
|
||||||
winston.format.json()
|
|
||||||
),
|
|
||||||
defaultMeta: { service: 'bnkops-map' },
|
defaultMeta: { service: 'bnkops-map' },
|
||||||
transports: [
|
transports: [
|
||||||
new winston.transports.Console({
|
new winston.transports.Console({
|
||||||
format: winston.format.combine(
|
format: winston.format.combine(
|
||||||
|
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
|
||||||
|
winston.format.errors({ stack: true }),
|
||||||
winston.format.colorize(),
|
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) {
|
if (config.isProduction) {
|
||||||
logger.add(new winston.transports.File({
|
logger.add(new winston.transports.File({
|
||||||
filename: 'error.log',
|
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({
|
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()
|
||||||
|
)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user