<?php
/**
 * Carga la vista de configuración de un módulo en el panel ?config=1.
 *
 * @package Logistica
 */

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

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

if ( ! class_exists( 'Logistica_Roles', false ) || ! Logistica_Roles::user_can_manage_config() ) {
	echo '<div class="notice notice-warning"><p>' . esc_html__( 'No tienes permisos para administrar estas opciones.', 'logistica' ) . '</p></div>';
	return;
}

$tab_slug = isset( $logistica_config_tab_slug )
	? sanitize_key( (string) $logistica_config_tab_slug )
	: logistica_get_current_tab();
$view_path = Logistica_Tabs::config_module_view_path( $tab_slug );

if ( '' === $view_path ) {
	require LOGISTICA_PLUGIN_DIR . 'admin/views/config/placeholder.php';
	return;
}

require $view_path;
