<?php
/**
 * Inicio — control de tareas y recordatorios del usuario.
 *
 * @package Logistica
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

require_once LOGISTICA_PLUGIN_DIR . 'admin/views/partials.php';

if ( ! logistica_is_tabbed_shell() ) {
	require LOGISTICA_PLUGIN_DIR . 'admin/views/panel-admin-settings.php';
	return;
}

$user_id   = get_current_user_id();
$bootstrap = Logistica_User_Panel::bootstrap( $user_id );

$user_panel_tabs = array(
	array(
		'id'    => 'avisos',
		'label' => __( 'Avisos', 'logistica' ),
	),
	array(
		'id'    => 'chequeo',
		'label' => __( 'Chequeo', 'logistica' ),
	),
	array(
		'id'    => 'agenda',
		'label' => __( 'Agenda', 'logistica' ),
	),
	array(
		'id'    => 'compras',
		'label' => __( 'Compras', 'logistica' ),
	),
	array(
		'id'    => 'informe',
		'label' => __( 'Informe de tiempos', 'logistica' ),
	),
);

logistica_admin_header( __( 'Inicio', 'logistica' ) );
?>
<section class="logistica-user-panel" data-user-panel>
	<div class="logistica-user-panel__loading" data-user-panel-loading data-logistica-tab-loading role="status" aria-live="polite" aria-busy="true">
		<div class="logistica-user-panel__loading-inner">
			<span class="logistica-user-panel__loading-spinner" aria-hidden="true"></span>
			<p data-user-panel-loading-message data-logistica-tab-loading-message><?php esc_html_e( 'Cargando tareas y recordatorios…', 'logistica' ); ?></p>
		</div>
	</div>

	<div class="logistica-user-panel__toolbar">
		<p class="logistica-user-panel__save-status" data-user-panel-save-status aria-live="polite"></p>
	</div>

	<div class="logistica-user-panel__layout">
		<aside class="logistica-user-panel__sidebar">
			<div class="logistica-user-panel__user-card" data-user-panel-user-card></div>

			<div id="user-panel-quick-links" class="logistica-user-panel__quick-links logistica-user-panel__sidebar-section">
				<div class="logistica-user-panel__quick-links-head">
					<h2 class="logistica-user-panel__sidebar-title">
						<span class="dashicons dashicons-admin-links" aria-hidden="true"></span>
						<span><?php esc_html_e( 'Accesos rápidos', 'logistica' ); ?></span>
					</h2>
					<button type="button" class="logistica-user-panel__quick-links-edit" data-user-panel-quick-links-edit aria-expanded="false" aria-controls="user-panel-quick-links-editor">
						<span class="dashicons dashicons-admin-generic" aria-hidden="true"></span>
						<span><?php esc_html_e( 'Personalizar', 'logistica' ); ?></span>
					</button>
				</div>
				<div class="logistica-user-panel__stats" data-user-panel-quick-links-list></div>
				<div id="user-panel-quick-links-editor" class="logistica-user-panel__quick-links-editor" data-user-panel-quick-links-editor hidden>
					<p class="logistica-user-panel__quick-links-editor-title"><?php esc_html_e( 'Elige hasta 6 secciones', 'logistica' ); ?></p>
					<div class="logistica-user-panel__quick-links-options" data-user-panel-quick-links-options></div>
					<div class="logistica-user-panel__quick-links-editor-actions" data-user-panel-quick-links-editor-actions hidden>
						<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--sm" data-user-panel-quick-links-save><?php esc_html_e( 'Guardar accesos', 'logistica' ); ?></button>
						<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--sm logistica-user-panel__btn--outline" data-user-panel-quick-links-cancel><?php esc_html_e( 'Cancelar', 'logistica' ); ?></button>
					</div>
				</div>
			</div>

			<section id="user-panel-resume" class="logistica-user-panel__sidebar-section" aria-labelledby="user-panel-resume-title">
				<h2 id="user-panel-resume-title" class="logistica-user-panel__sidebar-title">
					<span class="dashicons dashicons-update" aria-hidden="true"></span>
					<span><?php esc_html_e( 'Últimas actualizaciones', 'logistica' ); ?></span>
				</h2>
				<div class="logistica-user-panel__resume-carousel" data-user-panel-resume-carousel>
					<div class="logistica-user-panel__list logistica-user-panel__list--resume" data-user-panel-list="resume_points"></div>
					<div class="logistica-user-panel__resume-nav" data-user-panel-resume-nav hidden>
						<button type="button" class="logistica-user-panel__resume-nav-btn" data-user-panel-resume-prev aria-label="<?php esc_attr_e( 'Anterior', 'logistica' ); ?>">←</button>
						<span class="logistica-user-panel__resume-nav-indicator" data-user-panel-resume-indicator></span>
						<button type="button" class="logistica-user-panel__resume-nav-btn" data-user-panel-resume-next aria-label="<?php esc_attr_e( 'Siguiente', 'logistica' ); ?>">→</button>
					</div>
				</div>
			</section>
		</aside>

		<div class="logistica-user-panel__main" data-user-panel-tabs>
			<div class="logistica-user-panel__tabs" role="tablist" aria-label="<?php esc_attr_e( 'Secciones de inicio', 'logistica' ); ?>">
				<?php foreach ( $user_panel_tabs as $index => $user_panel_tab ) : ?>
					<button
						type="button"
						class="logistica-user-panel__tab<?php echo 0 === $index ? ' is-active' : ''; ?>"
						role="tab"
						id="user-panel-tab-btn-<?php echo esc_attr( $user_panel_tab['id'] ); ?>"
						data-user-panel-tab="<?php echo esc_attr( $user_panel_tab['id'] ); ?>"
						aria-controls="user-panel-tab-<?php echo esc_attr( $user_panel_tab['id'] ); ?>"
						aria-selected="<?php echo 0 === $index ? 'true' : 'false'; ?>"
					><?php echo esc_html( $user_panel_tab['label'] ); ?></button>
				<?php endforeach; ?>
			</div>

			<div class="logistica-user-panel__tab-panels">
				<div
					class="logistica-user-panel__tab-panel is-active"
					role="tabpanel"
					id="user-panel-tab-avisos"
					data-user-panel-tab-panel="avisos"
					aria-labelledby="user-panel-tab-btn-avisos"
				>
					<section id="user-panel-avisos" class="logistica-user-panel__section logistica-user-panel__section--wide logistica-user-panel__section--avisos" aria-labelledby="user-panel-avisos-title" data-user-panel-avisos-section>
						<header class="logistica-user-panel__avisos-head">
							<div class="logistica-user-panel__avisos-head-text">
								<div class="logistica-user-panel__avisos-title-row">
									<span class="logistica-user-panel__avisos-icon" aria-hidden="true">
										<span class="dashicons dashicons-bell"></span>
									</span>
									<h2 id="user-panel-avisos-title" class="logistica-user-panel__panel-title"><?php esc_html_e( 'Avisos', 'logistica' ); ?></h2>
									<span class="logistica-user-panel__avisos-count" data-user-panel-avisos-count hidden></span>
								</div>
								<p class="logistica-user-panel__avisos-lead"><?php esc_html_e( 'Prioriza lo vencido, lo de hoy y lo que vence en 48 h. Lo leído se oculta; el resumen llega cada mañana por correo.', 'logistica' ); ?></p>
							</div>
							<div class="logistica-user-panel__avisos-toolbar">
								<button type="button" class="logistica-user-panel__aviso-tool" data-user-panel-avisos-toggle-read>
									<span class="dashicons dashicons-visibility" aria-hidden="true"></span>
									<span data-user-panel-avisos-toggle-label><?php esc_html_e( 'Ver leídos', 'logistica' ); ?></span>
								</button>
								<button type="button" class="logistica-user-panel__aviso-tool" data-user-panel-avisos-delete-read hidden>
									<span class="dashicons dashicons-trash" aria-hidden="true"></span>
									<span><?php esc_html_e( 'Borrar leídos', 'logistica' ); ?></span>
								</button>
								<button type="button" class="logistica-user-panel__aviso-tool logistica-user-panel__aviso-tool--primary" data-user-panel-avisos-mark-all hidden>
									<span class="dashicons dashicons-yes" aria-hidden="true"></span>
									<span><?php esc_html_e( 'Marcar todos', 'logistica' ); ?></span>
								</button>
							</div>
						</header>
						<p class="logistica-user-panel__hint"><?php esc_html_e( 'Agenda y compras generan un solo aviso por ítem cuando está vencido, es para hoy o vence en las próximas 48 h; si sigue pendiente, se actualiza en lugar de duplicarse.', 'logistica' ); ?></p>
						<div class="logistica-user-panel__avisos" data-user-panel-avisos></div>
					</section>
				</div>

				<div
					class="logistica-user-panel__tab-panel"
					role="tabpanel"
					id="user-panel-tab-chequeo"
					data-user-panel-tab-panel="chequeo"
					aria-labelledby="user-panel-tab-btn-chequeo"
					hidden
				>
					<section id="user-panel-checklist" class="logistica-user-panel__section logistica-user-panel__section--wide" aria-labelledby="user-panel-checklist-title">
						<header class="logistica-user-panel__section-header">
							<h2 id="user-panel-checklist-title"><?php esc_html_e( 'Lista chequeo diario', 'logistica' ); ?></h2>
							<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--add logistica-user-panel__btn--add-checklist" data-user-panel-add-checklist>
								<span class="logistica-user-panel__btn-add-icon" aria-hidden="true"><span class="dashicons dashicons-plus-alt2"></span></span>
								<span class="logistica-user-panel__btn-add-text"><?php esc_html_e( 'Chequeo', 'logistica' ); ?></span>
							</button>
						</header>
						<p class="logistica-user-panel__hint"><?php esc_html_e( 'Organiza las actividades del día (Lunes–Domingo). Marca cada día como laborable, festivo, día libre, vacaciones o permisos.', 'logistica' ); ?></p>
						<div class="logistica-user-panel__checklist" data-user-panel-checklist></div>
					</section>
				</div>

				<div
					class="logistica-user-panel__tab-panel"
					role="tabpanel"
					id="user-panel-tab-agenda"
					data-user-panel-tab-panel="agenda"
					aria-labelledby="user-panel-tab-btn-agenda"
					hidden
				>
					<section id="user-panel-agenda" class="logistica-user-panel__section logistica-user-panel__section--wide" aria-labelledby="user-panel-agenda-title">
						<header class="logistica-user-panel__section-header">
							<h2 id="user-panel-agenda-title" class="logistica-user-panel__panel-title"><?php esc_html_e( 'Agenda de actividades', 'logistica' ); ?></h2>
							<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--add logistica-user-panel__btn--add-agenda" data-user-panel-add="agenda">
								<span class="logistica-user-panel__btn-add-icon" aria-hidden="true"><span class="dashicons dashicons-plus-alt2"></span></span>
								<span class="logistica-user-panel__btn-add-text"><?php esc_html_e( 'Actividad', 'logistica' ); ?></span>
							</button>
						</header>
						<div class="logistica-user-panel__paged-board" data-user-panel-agenda-board>
							<div class="logistica-user-panel__list-filters" data-user-panel-agenda-filters hidden>
								<div class="logistica-user-panel__list-filters-fields">
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Estado', 'logistica' ); ?></span>
										<select data-user-panel-agenda-filter="status">
											<option value=""><?php esc_html_e( 'Todos', 'logistica' ); ?></option>
											<?php foreach ( Logistica_User_Panel::get_agenda_statuses() as $key => $label ) : ?>
												<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option>
											<?php endforeach; ?>
										</select>
									</label>
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Prioridad', 'logistica' ); ?></span>
										<select data-user-panel-agenda-filter="priority">
											<option value=""><?php esc_html_e( 'Todas', 'logistica' ); ?></option>
											<?php foreach ( Logistica_User_Panel::get_priorities() as $key => $label ) : ?>
												<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option>
											<?php endforeach; ?>
										</select>
									</label>
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Fecha requerida', 'logistica' ); ?></span>
										<input type="date" data-user-panel-agenda-filter="fecha_requerida">
									</label>
								</div>
								<div class="logistica-user-panel__list-filters-actions">
									<span class="logistica-user-panel__list-filters-count" data-user-panel-agenda-filter-count></span>
									<button type="button" class="logistica-user-panel__filter-clear" data-user-panel-agenda-filter-clear hidden>
										<?php esc_html_e( 'Limpiar filtros', 'logistica' ); ?>
									</button>
								</div>
							</div>
							<div class="logistica-user-panel__list" data-user-panel-list="agenda"></div>
							<nav
								class="logistica-user-panel__paged-pagination logistica-table-pagination"
								data-user-panel-agenda-pagination
								hidden
								aria-label="<?php esc_attr_e( 'Paginación de agenda', 'logistica' ); ?>"
							>
								<span class="logistica-table-pagination__info" data-user-panel-agenda-page-info></span>
								<div class="logistica-table-pagination__controls">
									<span class="logistica-table-pagination__label" data-user-panel-agenda-page-label></span>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-agenda-page-prev>
										<span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span>
										<span><?php esc_html_e( 'Anterior', 'logistica' ); ?></span>
									</button>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-agenda-page-next>
										<span><?php esc_html_e( 'Siguiente', 'logistica' ); ?></span>
										<span class="dashicons dashicons-arrow-right-alt2" aria-hidden="true"></span>
									</button>
									<label class="logistica-table-pagination__size">
										<span><?php esc_html_e( 'Por página', 'logistica' ); ?></span>
										<select data-user-panel-agenda-page-size>
											<option value="3" selected>3</option>
											<option value="5">5</option>
											<option value="10">10</option>
											<option value="25">25</option>
											<option value="50">50</option>
										</select>
									</label>
								</div>
							</nav>
						</div>
					</section>
				</div>

				<div
					class="logistica-user-panel__tab-panel"
					role="tabpanel"
					id="user-panel-tab-compras"
					data-user-panel-tab-panel="compras"
					aria-labelledby="user-panel-tab-btn-compras"
					hidden
				>
					<section id="user-panel-compras" class="logistica-user-panel__section logistica-user-panel__section--wide" aria-labelledby="user-panel-compras-title">
						<header class="logistica-user-panel__section-header">
							<h2 id="user-panel-compras-title"><?php esc_html_e( 'Pendientes de compras', 'logistica' ); ?></h2>
							<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--add logistica-user-panel__btn--add-compra" data-user-panel-add="compras">
								<span class="logistica-user-panel__btn-add-icon" aria-hidden="true"><span class="dashicons dashicons-plus-alt2"></span></span>
								<span class="logistica-user-panel__btn-add-text"><?php esc_html_e( 'Cotización', 'logistica' ); ?></span>
							</button>
						</header>
						<p class="logistica-user-panel__hint"><?php esc_html_e( 'Cotizaciones y compras con producto, referencia, precio, fechas, estado y proveedor.', 'logistica' ); ?></p>
						<div class="logistica-user-panel__section-tools logistica-user-panel__section-tools--excel">
							<a class="button logistica-excel-btn logistica-excel-btn--export" data-user-panel-export-compras href="<?php echo esc_url( $bootstrap['compras_export_url'] ?? '' ); ?>">
								<span class="dashicons dashicons-media-spreadsheet" aria-hidden="true"></span>
								<span class="logistica-excel-btn__label"><?php esc_html_e( 'Exportar Excel (.xlsx)', 'logistica' ); ?></span>
							</a>
							<button type="button" class="button logistica-excel-btn logistica-excel-btn--import" data-user-panel-import-compras>
								<span class="dashicons dashicons-upload" aria-hidden="true"></span>
								<span class="logistica-excel-btn__label"><?php esc_html_e( 'Importar Excel', 'logistica' ); ?></span>
							</button>
						</div>
						<input type="file" accept=".xlsx,.xlsm,.csv" hidden data-user-panel-compras-file>
						<div class="logistica-user-panel__paged-board" data-user-panel-compras-board>
							<div class="logistica-user-panel__list-filters" data-user-panel-compras-filters hidden>
								<div class="logistica-user-panel__list-filters-fields">
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Estado', 'logistica' ); ?></span>
										<select data-user-panel-compras-filter="status">
											<option value=""><?php esc_html_e( 'Todos', 'logistica' ); ?></option>
											<?php foreach ( Logistica_User_Panel::get_compra_statuses() as $key => $label ) : ?>
												<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option>
											<?php endforeach; ?>
										</select>
									</label>
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Prioridad', 'logistica' ); ?></span>
										<select data-user-panel-compras-filter="priority">
											<option value=""><?php esc_html_e( 'Todas', 'logistica' ); ?></option>
											<?php foreach ( Logistica_User_Panel::get_priorities() as $key => $label ) : ?>
												<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option>
											<?php endforeach; ?>
										</select>
									</label>
									<label class="logistica-user-panel__list-filter">
										<span><?php esc_html_e( 'Fecha requerida', 'logistica' ); ?></span>
										<input type="date" data-user-panel-compras-filter="fecha_requerida">
									</label>
								</div>
								<div class="logistica-user-panel__list-filters-actions">
									<span class="logistica-user-panel__list-filters-count" data-user-panel-compras-filter-count></span>
									<button type="button" class="logistica-user-panel__filter-clear" data-user-panel-compras-filter-clear hidden>
										<?php esc_html_e( 'Limpiar filtros', 'logistica' ); ?>
									</button>
								</div>
							</div>
							<div class="logistica-user-panel__list" data-user-panel-list="compras"></div>
							<nav
								class="logistica-user-panel__paged-pagination logistica-table-pagination"
								data-user-panel-compras-pagination
								hidden
								aria-label="<?php esc_attr_e( 'Paginación de compras', 'logistica' ); ?>"
							>
								<span class="logistica-table-pagination__info" data-user-panel-compras-page-info></span>
								<div class="logistica-table-pagination__controls">
									<span class="logistica-table-pagination__label" data-user-panel-compras-page-label></span>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-compras-page-prev>
										<span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span>
										<span><?php esc_html_e( 'Anterior', 'logistica' ); ?></span>
									</button>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-compras-page-next>
										<span><?php esc_html_e( 'Siguiente', 'logistica' ); ?></span>
										<span class="dashicons dashicons-arrow-right-alt2" aria-hidden="true"></span>
									</button>
									<label class="logistica-table-pagination__size">
										<span><?php esc_html_e( 'Por página', 'logistica' ); ?></span>
										<select data-user-panel-compras-page-size>
											<option value="3" selected>3</option>
											<option value="5">5</option>
											<option value="10">10</option>
											<option value="25">25</option>
											<option value="50">50</option>
										</select>
									</label>
								</div>
							</nav>
						</div>
					</section>

					<section id="user-panel-proveedores" class="logistica-user-panel__section logistica-user-panel__section--wide" aria-labelledby="user-panel-proveedores-title">
						<header class="logistica-user-panel__section-header">
							<h2 id="user-panel-proveedores-title"><?php esc_html_e( 'Proveedores', 'logistica' ); ?></h2>
							<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--add logistica-user-panel__btn--add-proveedor" data-user-panel-add="proveedores">
								<span class="logistica-user-panel__btn-add-icon" aria-hidden="true"><span class="dashicons dashicons-plus-alt2"></span></span>
								<span class="logistica-user-panel__btn-add-text"><?php esc_html_e( 'Proveedor', 'logistica' ); ?></span>
							</button>
						</header>
						<p class="logistica-user-panel__hint"><?php esc_html_e( 'Registra empresas para seleccionarlas al crear cotizaciones o compras.', 'logistica' ); ?></p>
						<div class="logistica-user-panel__section-tools logistica-user-panel__section-tools--excel">
							<a class="button logistica-excel-btn logistica-excel-btn--export" data-user-panel-export-proveedores href="<?php echo esc_url( $bootstrap['proveedores_export_url'] ?? '' ); ?>">
								<span class="dashicons dashicons-media-spreadsheet" aria-hidden="true"></span>
								<span class="logistica-excel-btn__label"><?php esc_html_e( 'Exportar Excel (.xlsx)', 'logistica' ); ?></span>
							</a>
							<button type="button" class="button logistica-excel-btn logistica-excel-btn--import" data-user-panel-import-proveedores>
								<span class="dashicons dashicons-upload" aria-hidden="true"></span>
								<span class="logistica-excel-btn__label"><?php esc_html_e( 'Importar Excel', 'logistica' ); ?></span>
							</button>
						</div>
						<input type="file" accept=".xlsx,.xlsm,.csv" hidden data-user-panel-proveedores-file>
						<div class="logistica-user-panel__proveedores-board" data-user-panel-proveedores-board>
							<div class="logistica-user-panel__proveedores-toolbar" data-user-panel-proveedores-toolbar hidden>
								<label class="logistica-user-panel__proveedores-search">
									<span class="screen-reader-text"><?php esc_html_e( 'Buscar proveedores', 'logistica' ); ?></span>
									<span class="dashicons dashicons-search" aria-hidden="true"></span>
									<input
										type="search"
										data-user-panel-proveedores-search
										placeholder="<?php esc_attr_e( 'Buscar por nombre, contacto, correo, teléfono u oferta…', 'logistica' ); ?>"
										autocomplete="off"
									>
								</label>
								<span class="logistica-user-panel__proveedores-count" data-user-panel-proveedores-count></span>
							</div>
							<div class="logistica-user-panel__list" data-user-panel-list="proveedores"></div>
							<nav
								class="logistica-user-panel__proveedores-pagination logistica-table-pagination"
								data-user-panel-proveedores-pagination
								hidden
								aria-label="<?php esc_attr_e( 'Paginación de proveedores', 'logistica' ); ?>"
							>
								<span class="logistica-table-pagination__info" data-user-panel-proveedores-page-info></span>
								<div class="logistica-table-pagination__controls">
									<span class="logistica-table-pagination__label" data-user-panel-proveedores-page-label></span>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-proveedores-page-prev>
										<span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span>
										<span><?php esc_html_e( 'Anterior', 'logistica' ); ?></span>
									</button>
									<button type="button" class="logistica-user-panel__page-btn" data-user-panel-proveedores-page-next>
										<span><?php esc_html_e( 'Siguiente', 'logistica' ); ?></span>
										<span class="dashicons dashicons-arrow-right-alt2" aria-hidden="true"></span>
									</button>
									<label class="logistica-table-pagination__size">
										<span><?php esc_html_e( 'Por página', 'logistica' ); ?></span>
										<select data-user-panel-proveedores-page-size>
											<option value="3" selected>3</option>
											<option value="5">5</option>
											<option value="10">10</option>
											<option value="25">25</option>
											<option value="50">50</option>
										</select>
									</label>
								</div>
							</nav>
						</div>
					</section>
				</div>

				<div
					class="logistica-user-panel__tab-panel"
					role="tabpanel"
					id="user-panel-tab-informe"
					data-user-panel-tab-panel="informe"
					aria-labelledby="user-panel-tab-btn-informe"
					hidden
				>
					<section id="user-panel-informe-tiempos" class="logistica-user-panel__section logistica-user-panel__section--wide" aria-labelledby="user-panel-informe-tiempos-title">
						<header class="logistica-user-panel__section-header">
							<h2 id="user-panel-informe-tiempos-title" class="logistica-user-panel__panel-title"><?php esc_html_e( 'Informe de tiempos', 'logistica' ); ?></h2>
						</header>
						<p class="logistica-user-panel__hint"><?php esc_html_e( 'Por defecto muestra el día actual y solo gestiones activas (pendiente, en proceso, etc.). Usa los filtros o «Ver acumulado total» para el histórico completo.', 'logistica' ); ?></p>
						<div class="logistica-user-panel__list-filters" data-user-panel-informe-filters>
							<div class="logistica-user-panel__list-filters-fields">
								<label class="logistica-user-panel__list-filter">
									<span><?php esc_html_e( 'Tipo', 'logistica' ); ?></span>
									<select data-user-panel-informe-filter="tipo">
										<option value=""><?php esc_html_e( 'Todos', 'logistica' ); ?></option>
										<option value="compras"><?php esc_html_e( 'Compras', 'logistica' ); ?></option>
										<option value="agenda"><?php esc_html_e( 'Agenda', 'logistica' ); ?></option>
									</select>
								</label>
								<label class="logistica-user-panel__list-filter">
									<span><?php esc_html_e( 'Estado', 'logistica' ); ?></span>
									<select data-user-panel-informe-filter="status">
										<option value=""><?php esc_html_e( 'Todos', 'logistica' ); ?></option>
									</select>
								</label>
								<label class="logistica-user-panel__list-filter">
									<span><?php esc_html_e( 'Proveedor', 'logistica' ); ?></span>
									<select data-user-panel-informe-filter="proveedor_id">
										<option value=""><?php esc_html_e( 'Todos', 'logistica' ); ?></option>
									</select>
								</label>
								<label class="logistica-user-panel__list-filter">
									<span><?php esc_html_e( 'Desde', 'logistica' ); ?></span>
									<input type="date" data-user-panel-informe-filter="fecha_desde">
								</label>
								<label class="logistica-user-panel__list-filter">
									<span><?php esc_html_e( 'Hasta', 'logistica' ); ?></span>
									<input type="date" data-user-panel-informe-filter="fecha_hasta">
								</label>
							</div>
							<div class="logistica-user-panel__list-filters-actions">
								<span class="logistica-user-panel__list-filters-count" data-user-panel-informe-filter-count></span>
								<button type="button" class="logistica-user-panel__filter-clear" data-user-panel-informe-filter-clear hidden>
									<?php esc_html_e( 'Ver acumulado total', 'logistica' ); ?>
								</button>
							</div>
						</div>
						<div class="logistica-user-panel__informe" data-user-panel-informe-tiempos></div>
					</section>
				</div>
			</div>
		</div>
	</div>

	<script type="application/json" id="logistica-user-panel-bootstrap">
	<?php echo wp_json_encode( $bootstrap, JSON_UNESCAPED_UNICODE ); ?>
	</script>

	<div class="logistica-user-panel__modal" data-user-panel-modal hidden>
		<div class="logistica-user-panel__modal-backdrop" data-user-panel-modal-close tabindex="-1" aria-hidden="true"></div>
		<div class="logistica-user-panel__modal-dialog" role="dialog" aria-modal="true" aria-labelledby="user-panel-modal-title">
			<header class="logistica-user-panel__modal-header">
				<h3 id="user-panel-modal-title" class="logistica-user-panel__modal-title" data-user-panel-modal-title></h3>
				<button type="button" class="logistica-user-panel__modal-close" data-user-panel-modal-close aria-label="<?php esc_attr_e( 'Cerrar', 'logistica' ); ?>">
					<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
				</button>
			</header>
			<div class="logistica-user-panel__modal-body" data-user-panel-modal-body></div>
			<footer class="logistica-user-panel__modal-footer">
				<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--sm" data-user-panel-modal-save><?php esc_html_e( 'Guardar', 'logistica' ); ?></button>
				<button type="button" class="logistica-user-panel__btn logistica-user-panel__btn--sm logistica-user-panel__btn--outline" data-user-panel-modal-cancel><?php esc_html_e( 'Cancelar', 'logistica' ); ?></button>
			</footer>
		</div>
	</div>
</section>
<?php logistica_admin_footer(); ?>
