Changeset 3814533
- Timestamp:
- 11/20/2026 09:40:08 PM (14 hours ago)
- Location:
- bookingfacil-reservas/trunk
- Files:
-
- 5 edited
-
assets/css/admin/admin-common.css (modified) (1 diff)
-
assets/js/admin/admin-reservations.js (modified) (15 diffs)
-
booking-facil.php (modified) (2 diffs)
-
includes/admin-pages/reservations.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bookingfacil-reservas/trunk/assets/css/admin/admin-common.css
r3741551 r3814533 4927 4927 font-weight: 600; 4928 4928 } 4929 4930 /* ========================================================================== 4931 FILTROS DE FECHA Y PAGINACIÓN DE RESERVAS 4932 ========================================================================== */ 4933 .wp-booking-date-filter-wrap { 4934 display: inline-flex; 4935 align-items: center; 4936 gap: 6px; 4937 } 4938 4939 .wp-booking-date-filter-label { 4940 font-size: 12px; 4941 font-weight: 600; 4942 color: #a1a1aa; 4943 white-space: nowrap; 4944 } 4945 4946 .wp-booking-date-filter-input { 4947 height: 35px !important; 4948 line-height: 33px !important; 4949 background-color: rgba(255, 255, 255, 0.03) !important; 4950 color: #fff !important; 4951 border: 1px solid rgba(255, 255, 255, 0.08) !important; 4952 border-radius: 6px !important; 4953 padding: 0 10px !important; 4954 box-sizing: border-box !important; 4955 color-scheme: dark; 4956 } 4957 4958 .wp-booking-date-filter-input:focus { 4959 border-color: #00b4b9 !important; 4960 outline: none !important; 4961 } 4962 4963 .wp-booking-reservations-pagination { 4964 display: flex; 4965 align-items: center; 4966 justify-content: space-between; 4967 gap: 12px; 4968 flex-wrap: wrap; 4969 margin-top: 14px; 4970 padding: 10px 4px 2px; 4971 } 4972 4973 .wp-booking-res-pager-info { 4974 font-size: 12.5px; 4975 font-weight: 600; 4976 color: #a1a1aa; 4977 } 4978 4979 .wp-booking-res-pager-controls { 4980 display: flex; 4981 align-items: center; 4982 gap: 6px; 4983 flex-wrap: wrap; 4984 } 4985 4986 .wp-booking-res-page-btn { 4987 background: rgba(255, 255, 255, 0.05) !important; 4988 border: 1px solid rgba(255, 255, 255, 0.12) !important; 4989 color: #d4d4d8 !important; 4990 border-radius: 6px !important; 4991 min-width: 34px; 4992 height: 32px !important; 4993 line-height: 30px !important; 4994 padding: 0 10px !important; 4995 font-size: 12.5px !important; 4996 font-weight: 600 !important; 4997 cursor: pointer; 4998 } 4999 5000 .wp-booking-res-page-btn:hover:not(:disabled) { 5001 background: rgba(255, 255, 255, 0.12) !important; 5002 border-color: #00b4b9 !important; 5003 color: #ffffff !important; 5004 } 5005 5006 .wp-booking-res-page-btn.active { 5007 background: #00b4b9 !important; 5008 border-color: #00b4b9 !important; 5009 color: #04191c !important; 5010 font-weight: 700 !important; 5011 } 5012 5013 .wp-booking-res-page-btn:disabled { 5014 opacity: 0.4 !important; 5015 cursor: not-allowed !important; 5016 } 5017 5018 .wp-booking-res-pager-dots { 5019 color: #71717a; 5020 padding: 0 4px; 5021 font-weight: 700; 5022 } -
bookingfacil-reservas/trunk/assets/js/admin/admin-reservations.js
r3789780 r3814533 20 20 const filterStatusSelect = document.getElementById('wp-booking-filter-status-select'); 21 21 const filterUnitSelect = document.getElementById('wp-booking-filter-unit-select'); 22 const filterDateFromInput = document.getElementById('wp-booking-filter-date-from'); 23 const filterDateToInput = document.getElementById('wp-booking-filter-date-to'); 22 24 const viewSelect = document.getElementById('wp-booking-view-select'); 23 25 const clearFiltersBtn = document.getElementById('wp-booking-clear-filters-btn'); 26 const paginationContainer = document.getElementById('wp-booking-reservations-pagination'); 24 27 const calPrevBtn = document.getElementById('wp-booking-cal-prev-btn'); 25 28 const calNextBtn = document.getElementById('wp-booking-cal-next-btn'); … … 100 103 let currentMonth = new Date().getMonth(); 101 104 let currentKpiFilter = 'all'; 102 let currentViewFilter = 'all'; 105 let currentViewFilter = 'important'; 106 let currentPage = 1; 107 const BOOKINGS_PAGE_SIZE = 12; 103 108 104 109 // Variable global local del módulo para el folio actual … … 173 178 if (activeCard) activeCard.classList.add('active-kpi-card'); 174 179 currentKpiFilter = filterName; 175 filterBookings( );180 filterBookings(true); 176 181 } 177 182 function setViewFilter(viewName) { … … 183 188 } 184 189 if (kpiAll) kpiAll.addEventListener('click', function () { 185 if (viewSelect) viewSelect.value = 'all'; 186 setViewFilter('all'); 190 if (filterDateFromInput) filterDateFromInput.value = ''; 191 if (filterDateToInput) filterDateToInput.value = ''; 192 if (viewSelect) viewSelect.value = 'important'; 193 setViewFilter('important'); 187 194 }); 188 195 if (kpiUnassigned) kpiUnassigned.addEventListener('click', function () { … … 207 214 setViewFilter(viewSelect.value); 208 215 }); 209 if (searchInput) searchInput.addEventListener('input', filterBookings); 210 if (filterStatusSelect) filterStatusSelect.addEventListener('change', filterBookings); 211 if (filterUnitSelect) filterUnitSelect.addEventListener('change', filterBookings); 216 if (searchInput) searchInput.addEventListener('input', () => filterBookings(true)); 217 if (filterStatusSelect) filterStatusSelect.addEventListener('change', () => filterBookings(true)); 218 if (filterUnitSelect) filterUnitSelect.addEventListener('change', () => filterBookings(true)); 219 if (filterDateFromInput) filterDateFromInput.addEventListener('change', () => filterBookings(true)); 220 if (filterDateToInput) filterDateToInput.addEventListener('change', () => filterBookings(true)); 212 221 if (clearFiltersBtn) { 213 222 clearFiltersBtn.addEventListener('click', function () { … … 215 224 if (filterStatusSelect) filterStatusSelect.value = ''; 216 225 if (filterUnitSelect) filterUnitSelect.value = ''; 226 if (filterDateFromInput) filterDateFromInput.value = ''; 227 if (filterDateToInput) filterDateToInput.value = ''; 217 228 if (viewSelect) viewSelect.value = 'important'; 218 229 setViewFilter('important'); … … 1356 1367 const statusFilter = filterStatusSelect ? filterStatusSelect.value : ''; 1357 1368 const unitFilter = filterUnitSelect ? filterUnitSelect.value : ''; 1369 const dateFrom = filterDateFromInput ? filterDateFromInput.value : ''; 1370 const dateTo = filterDateToInput ? filterDateToInput.value : ''; 1371 const hasExplicitBypass = Boolean(query) || Boolean(dateFrom) || Boolean(dateTo) || statusFilter === 'cancelled' || statusFilter === 'blocked' || currentKpiFilter === 'blocked'; 1372 1358 1373 const filtered = allBookings.filter(b => { 1359 1374 const matchesQuery = !query || ( … … 1364 1379 ); 1365 1380 1381 const cleanCheckin = b.checkin ? String(b.checkin).substring(0, 10) : ''; 1382 if (dateFrom && (!cleanCheckin || cleanCheckin < dateFrom)) return false; 1383 if (dateTo && (!cleanCheckin || cleanCheckin > dateTo)) return false; 1384 1366 1385 // Si el operador selecciona un estado en el desplegable (ej. 'cancelled' o 'confirmed'), se respeta. 1367 // Si el operador realiza una búsqueda por texto (ej. busca a un huésped cancelado), se incluye.1386 // Si el operador realiza una búsqueda por texto o fechas, se incluye el histórico/canceladas según corresponda. 1368 1387 // Por defecto en cualquier vista normal, las canceladas se excluyen automáticamente para evitar ruido operativo. 1369 1388 let matchesStatus = true; 1370 1389 if (statusFilter) { 1371 1390 matchesStatus = b.status === statusFilter; 1372 } else if (!query ) {1391 } else if (!query && !dateFrom && !dateTo) { 1373 1392 matchesStatus = b.status !== 'cancelled'; 1374 1393 } … … 1385 1404 let matchesView = true; 1386 1405 if (currentViewFilter === 'important') { 1387 matchesView = b.needs_attention;1406 matchesView = hasExplicitBypass ? true : b.needs_attention; 1388 1407 } else if (currentViewFilter === 'future') { 1389 1408 matchesView = b.time_category === 'future'; … … 1472 1491 return filtered; 1473 1492 } 1474 function filterBookings() { 1493 function filterBookings(resetPage = true) { 1494 if (resetPage === true) { 1495 currentPage = 1; 1496 } 1475 1497 renderBookingsTable(getFilteredBookings()); 1476 1498 if (calendarView && calendarView.style.display === 'block') { … … 1482 1504 function printBookingsList() { 1483 1505 const statusFilter = filterStatusSelect ? filterStatusSelect.value : ''; 1506 const dateFrom = filterDateFromInput ? filterDateFromInput.value : ''; 1507 const dateTo = filterDateToInput ? filterDateToInput.value : ''; 1484 1508 const showBlocks = statusFilter === 'blocked' || currentKpiFilter === 'blocked'; 1485 1509 // Los bloqueos (manuales y de mantenimiento) no forman parte del parte impreso salvo que se filtren explícitamente … … 1494 1518 1495 1519 const filtersDesc = [ 1496 `Vista: ${selText(viewSelect) || ' Todas'}`,1520 `Vista: ${selText(viewSelect) || 'Activas'}`, 1497 1521 `Estado: ${selText(filterStatusSelect) || 'Todos los Estados'}`, 1498 1522 `Unidad: ${selText(filterUnitSelect) || 'Todas las Unidades'}`, 1523 dateFrom ? `Ingreso desde: ${bookingFacilFormatDate(dateFrom)}` : '', 1524 dateTo ? `Ingreso hasta: ${bookingFacilFormatDate(dateTo)}` : '', 1499 1525 currentKpiFilter && currentKpiFilter !== 'all' ? `Indicador: ${kpiLabels[currentKpiFilter] || currentKpiFilter}` : '', 1500 1526 searchInput && searchInput.value.trim() ? `Búsqueda: "${searchInput.value.trim()}"` : '' … … 1584 1610 const printListBtn = document.getElementById('wp-booking-print-list-btn'); 1585 1611 if (printListBtn) printListBtn.addEventListener('click', printBookingsList); 1612 if (paginationContainer) { 1613 paginationContainer.addEventListener('click', function (e) { 1614 const btn = e.target.closest('.wp-booking-res-page-btn'); 1615 if (!btn || btn.disabled || !btn.dataset.page) return; 1616 currentPage = Number(btn.dataset.page) || 1; 1617 filterBookings(false); 1618 }); 1619 } 1620 1621 function renderBookingsPagination(total, totalPages, fromRow, toRow) { 1622 if (!paginationContainer) return; 1623 if (total === 0) { 1624 paginationContainer.innerHTML = ''; 1625 return; 1626 } 1627 const infoHtml = `<span class="wp-booking-res-pager-info">Mostrando ${fromRow}–${toRow} de ${total} reserva${total !== 1 ? 's' : ''}</span>`; 1628 if (totalPages <= 1) { 1629 paginationContainer.innerHTML = infoHtml; 1630 return; 1631 } 1632 const pages = []; 1633 if (totalPages <= 7) { 1634 for (let i = 1; i <= totalPages; i++) pages.push(i); 1635 } else { 1636 pages.push(1); 1637 if (currentPage > 3) pages.push('dots'); 1638 for (let p = Math.max(2, currentPage - 1); p <= Math.min(totalPages - 1, currentPage + 1); p++) pages.push(p); 1639 if (currentPage < totalPages - 2) pages.push('dots'); 1640 pages.push(totalPages); 1641 } 1642 let btnsHtml = `<button type="button" class="button wp-booking-res-page-btn" data-page="${currentPage - 1}" ${currentPage <= 1 ? 'disabled' : ''}>« Anterior</button>`; 1643 pages.forEach(item => { 1644 if (item === 'dots') { 1645 btnsHtml += `<span class="wp-booking-res-pager-dots">…</span>`; 1646 } else { 1647 btnsHtml += `<button type="button" class="button wp-booking-res-page-btn${item === currentPage ? ' active' : ''}" data-page="${item}">${item}</button>`; 1648 } 1649 }); 1650 btnsHtml += `<button type="button" class="button wp-booking-res-page-btn" data-page="${currentPage + 1}" ${currentPage >= totalPages ? 'disabled' : ''}>Siguiente »</button>`; 1651 paginationContainer.innerHTML = `${infoHtml}<div class="wp-booking-res-pager-controls">${btnsHtml}</div>`; 1652 } 1653 1586 1654 function renderBookingsTable(bookings) { 1587 1655 const container = document.getElementById('wp-booking-bookings-list'); … … 1589 1657 if (bookings.length === 0) { 1590 1658 container.innerHTML = '<tr><td colspan="7">No se encontraron reservas con los filtros aplicados.</td></tr>'; 1659 renderBookingsPagination(0, 1, 0, 0); 1591 1660 return; 1592 1661 } 1662 const total = bookings.length; 1663 const totalPages = Math.max(1, Math.ceil(total / BOOKINGS_PAGE_SIZE)); 1664 if (currentPage > totalPages) currentPage = totalPages; 1665 if (currentPage < 1) currentPage = 1; 1666 const startIdx = (currentPage - 1) * BOOKINGS_PAGE_SIZE; 1667 const endIdx = Math.min(startIdx + BOOKINGS_PAGE_SIZE, total); 1668 const pageRows = bookings.slice(startIdx, endIdx); 1669 1593 1670 container.innerHTML = ''; 1594 bookings.forEach(b => {1671 pageRows.forEach(b => { 1595 1672 let badgeClass = 'pending_payment'; 1596 1673 let statusLabel = 'Pendiente Seña'; … … 1668 1745 }); 1669 1746 registerBookingActions(); 1747 renderBookingsPagination(total, totalPages, startIdx + 1, endIdx); 1670 1748 } 1671 1749 function registerBookingActions() { -
bookingfacil-reservas/trunk/booking-facil.php
r3814213 r3814533 3 3 * Plugin Name: BookingFacil Reservations for Accommodations 4 4 * Description: Accept online reservations for accommodations, campsites, and events. Manage rates, parcel occupancy, event tickets with QR check-in, payments, and confirmations from WordPress. 5 * Version: 2.1. 05 * Version: 2.1.1 6 6 * Requires at least: 5.8 7 7 * Requires PHP: 7.4 … … 20 20 21 21 // Definir constantes del plugin 22 define( 'BOOKING_FACIL_VERSION', '2.1. 0' );22 define( 'BOOKING_FACIL_VERSION', '2.1.1' ); 23 23 define( 'BOOKING_FACIL_PATH', plugin_dir_path( __FILE__ ) ); 24 24 define( 'BOOKING_FACIL_URL', plugin_dir_url( __FILE__ ) ); -
bookingfacil-reservas/trunk/includes/admin-pages/reservations.php
r3789780 r3814533 68 68 <div> 69 69 <select id="wp-booking-view-select" class="wbf-style-1f4a39a5"> 70 <option value=" all" selected class="wbf-style-8f8111c7"><?php esc_html_e( 'Todas', 'bookingfacil-reservas' ); ?></option>71 <option value=" important" class="wbf-style-8f8111c7"><?php esc_html_e( 'Importantes', 'bookingfacil-reservas' ); ?></option>70 <option value="important" selected class="wbf-style-8f8111c7"><?php esc_html_e( 'Activas (Próximas, en curso o con deuda)', 'bookingfacil-reservas' ); ?></option> 71 <option value="all" class="wbf-style-8f8111c7"><?php esc_html_e( 'Todas (incluye histórico)', 'bookingfacil-reservas' ); ?></option> 72 72 <option value="future" class="wbf-style-8f8111c7"><?php esc_html_e( 'Próximas', 'bookingfacil-reservas' ); ?></option> 73 73 <option value="current" class="wbf-style-8f8111c7"><?php esc_html_e( 'En curso', 'bookingfacil-reservas' ); ?></option> … … 89 89 <option value="" class="wbf-style-8f8111c7"><?php esc_html_e( 'Todas las Unidades', 'bookingfacil-reservas' ); ?></option> 90 90 </select> 91 </div> 92 <div class="wp-booking-date-filter-wrap"> 93 <label for="wp-booking-filter-date-from" class="wp-booking-date-filter-label"><?php esc_html_e( 'Desde:', 'bookingfacil-reservas' ); ?></label> 94 <input type="date" id="wp-booking-filter-date-from" class="wp-booking-date-filter-input" title="<?php esc_attr_e( 'Fecha de ingreso desde', 'bookingfacil-reservas' ); ?>" /> 95 </div> 96 <div class="wp-booking-date-filter-wrap"> 97 <label for="wp-booking-filter-date-to" class="wp-booking-date-filter-label"><?php esc_html_e( 'Hasta:', 'bookingfacil-reservas' ); ?></label> 98 <input type="date" id="wp-booking-filter-date-to" class="wp-booking-date-filter-input" title="<?php esc_attr_e( 'Fecha de ingreso hasta', 'bookingfacil-reservas' ); ?>" /> 91 99 </div> 92 100 <button type="button" class="button wbf-style-8fdc7fbe" id="wp-booking-clear-filters-btn"><?php esc_html_e( 'Limpiar', 'bookingfacil-reservas' ); ?></button> … … 114 122 </tbody> 115 123 </table> 124 <div id="wp-booking-reservations-pagination" class="wp-booking-reservations-pagination"></div> 116 125 </div> 117 126 -
bookingfacil-reservas/trunk/readme.txt
r3814213 r3814533 5 5 Tested up to: 7.1.3 6 6 Requires PHP: 7.4 7 Stable tag: 2.1. 07 Stable tag: 2.1.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 104 104 == Changelog == 105 105 106 = 2.1.1 = 107 * Active-First Reservations View (Hosted Parity): the Reservations & Blocks list now opens on "Activas (Próximas, en curso o con deuda)" — upcoming, in-house and balance-due bookings — hiding paid-out historical and cancelled reservations by default. Typing a search, picking a date range, or filtering by Cancelled/Blocked status automatically includes historical records so nothing is missed; "Todas (incluye histórico)" remains available. 108 * Check-in Date Range Filters: new "Ingreso desde / Ingreso hasta" date pickers filter the list by arrival date, are cleared by "Limpiar filtros", and are reflected in the printed report header. 109 * Pagination: reservation listings now paginate 12 records per page (desktop table and mobile cards) and reset to page 1 whenever a filter, search or KPI changes — keeping the KPI counters and calendar view in sync on the same filtered dataset. 110 * Print-Aware: the printed bookings report now includes the applied date range and prints the full filtered set (not just the visible page). 111 106 112 = 2.1.0 = 107 113 * Ticket Order Management & Confirmations (Hosted Parity): the event orders list now mirrors the hosted SaaS experience — 10-per-page pagination with « Anterior / Siguiente » controls and live-refresh of the selected order detail after reloads. … … 347 353 == Upgrade Notice == 348 354 355 = 2.1.1 = 356 * Recommended update: reservations list now defaults to active/upcoming/in-debt bookings, adds check-in date filters and 12-per-page pagination — same view rules as the hosted version. 357 349 358 = 2.1.0 = 350 359 * Recommended update: adds pending-order confirmation, order pagination, and explicit safety confirmations for door sales and ticket check-in — same state rules as the hosted version. Requires the updated Booking Fácil backend (events/orders/:id/confirm).
Note:
See TracChangeset
for help on using the changeset viewer.