<?php
// Exit if accessed directly
if (!defined('ABSPATH')) {
	exit();
}

if (! current_user_can('manage_options')) {
	wp_die(
		esc_html__('You do not have permission to access this page.', 'gsheetconnector-for-jetform')
	);
}
$gshfjf_free_system_log = new GSHFJF_JetForm_Connector_Init();
?>
<div class="system-statuswc">
	<div class="wrap w-100 m-0">
		<div class="info-container inner-wrap w-100 bg-white p-40">
			<div class="heading mt-0"><?php esc_html_e('System Information', 'gsheetconnector-for-jetform'); ?></div>
			<p><?php echo esc_html__('View detailed information about your plugin, server, and WordPress setup for troubleshooting and support.', 'gsheetconnector-for-jetform'); ?></p>
			<div class="text-right d-flex justify-end">
				<button id="copy-system-info-free"
					class="btn btn-primary d-flex align-center gap-10"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="gsc-copy-icon">
						<rect x="9" y="9" width="13" height="13" rx="2" stroke="currentColor" stroke-width="2"></rect>
						<rect x="2" y="2" width="13" height="13" rx="2" stroke="currentColor" stroke-width="2"></rect>
					</svg><?php esc_html_e('Copy System Info', 'gsheetconnector-for-jetform'); ?>
				</button>
			</div>
			<?php
			echo wp_kses_post($gshfjf_free_system_log->gshfjf_system_info());
			?>
		</div>
		<div class="system-error shadow-box mt-40 p-30">
			<div class="error-container">
				<div class="error-log-head flex-wrap gap-20">
					<div class="heading mt-0 mb-0"><?php esc_html_e('Error Log', 'gsheetconnector-for-jetform'); ?></div>

					<div class="errorlog-button-list">
						<button type="button" class="button btn-logs gshfjf-clear-content-logs"><?php esc_html_e('Clear Logs', 'gsheetconnector-for-jetform'); ?></button>
						<button type="button" class="button button-primary" id="gshfjf-csv-info"><?php esc_html_e('Download CSV', 'gsheetconnector-for-jetform'); ?></button>
						<button type="button" class="button btn-logs" id="gshfjf-copy-logs-info"><?php esc_html_e('Copy Logs', 'gsheetconnector-for-jetform'); ?></button>
						<div class="gshfjf-copy-msg d-none"></div>
					</div>
				</div>
			</div>

			<div class="gshfjf-clear-content-logs-msg"></div>
			<input type="hidden" name="gshfjf-ajax-nonce" id="gshfjf-ajax-nonce"
				value="<?php echo esc_attr(wp_create_nonce('gshfjf-ajax-nonce')); ?>" />
			<?php
			echo wp_kses_post($gshfjf_free_system_log->gshfjf_display_error_log());
			?>
		</div>
	</div>
</div>
</div>