@@ -221,16 +222,16 @@ async function handleNewMovement(e) {
cumpleaños: '',
consentimiento: false
};
- await saveClient(newClient); // This now works correctly
+ await saveClient(newClient);
client = newClient;
} else {
- return; // Do not create movement if client is not created
+ return;
}
}
const newMovement = {
id: crypto.randomUUID(),
- folio: await getNextFolio(),
+ folio: generateFolio(),
fechaISO: new Date().toISOString(),
clienteId: client.id,
tipo: document.getElementById('m-tipo').value,
@@ -239,13 +240,15 @@ async function handleNewMovement(e) {
concepto: document.getElementById('m-concepto').value,
staff: document.getElementById('m-staff').value,
notas: document.getElementById('m-notas').value,
+ fechaCita: document.getElementById('m-fecha-cita').value,
+ horaCita: document.getElementById('m-hora-cita').value,
};
await addMovement(newMovement);
const movementForTicket = { ...newMovement, cliente: client.nombre };
renderTicketAndPrint(movementForTicket, settings);
form.reset();
- document.getElementById('m-cliente').focus(); // Poner el foco en el campo de cliente
+ document.getElementById('m-cliente').focus();
}
function handleTableClick(e) {
@@ -289,15 +292,13 @@ async function handleClientForm(e) {
function handleTabChange(e) {
const tabButton = e.target.closest('.tab-link');
- if (!tabButton) return; // Si el clic no fue en un botón de pestaña, no hacer nada.
+ if (!tabButton) return;
e.preventDefault();
- // Quitar la clase 'active' de todas las pestañas y contenidos.
document.querySelectorAll('.tab-link').forEach(tab => tab.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
- // Activar la pestaña correcta y su contenido.
const tabId = tabButton.dataset.tab;
tabButton.classList.add('active');
document.getElementById(tabId)?.classList.add('active');
@@ -324,7 +325,6 @@ function handleTestTicket() {
function initializeApp() {
const tabs = document.querySelector('.tabs');
- // Conectar eventos
formSettings?.addEventListener('submit', handleSaveSettings);
formMove?.addEventListener('submit', handleNewMovement);
tblMovesBody?.addEventListener('click', handleTableClick);
@@ -338,7 +338,6 @@ function initializeApp() {
document.getElementById('c-id').value = '';
});
- // Cargar datos y renderizar
Promise.all([
load(KEY_SETTINGS, DEFAULT_SETTINGS),
load(KEY_DATA, []),
@@ -355,5 +354,4 @@ function initializeApp() {
});
}
-// Esperar a que el DOM esté completamente cargado para iniciar la app
-document.addEventListener('DOMContentLoaded', initializeApp);
+document.addEventListener('DOMContentLoaded', initializeApp);
\ No newline at end of file
diff --git a/ap-pos/index.html b/ap-pos/index.html
index f2b2dd1..2ccad83 100644
--- a/ap-pos/index.html
+++ b/ap-pos/index.html
@@ -29,11 +29,16 @@
-
+
+
+
+
+