<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Local template scope variables.
/**
 * Help modal partial.
 *
 * @package NNAXFUF_Plugin
 */
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$help_is_trash_view     = ( isset( $current_view ) && $current_view === 'trash' );
$help_can_manage_here   = isset( $can_manage_current_folder ) ? (bool) $can_manage_current_folder : false;
$help_role_sharing      = isset( $help_role_sharing_enabled ) ? (bool) $help_role_sharing_enabled : false;
$help_time_limits       = isset( $help_share_time_limit_enabled ) ? (bool) $help_share_time_limit_enabled : false;
$help_owner_rights      = isset( $help_share_owner_rights_enabled ) ? (bool) $help_share_owner_rights_enabled : false;
$help_shared_delete     = isset( $help_shared_folder_file_delete_enabled ) ? (bool) $help_shared_folder_file_delete_enabled : false;
?>
<div id="nnaxfuf-help-modal" class="nnaxfuf-modal uk-flex-top" uk-modal>
    <div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical uk-width-1-1 uk-width-2-3@m">
        <button class="uk-modal-close-default" type="button" uk-close></button>

        <h3 class="uk-modal-title"><?php esc_html_e( 'Help & quick guide', 'nnax-frontend-user-files' ); ?></h3>
        <p class="uk-text-muted uk-margin-small-bottom">
            <?php esc_html_e( 'This overview only shows functions that are currently available in your current view and with your current permissions.', 'nnax-frontend-user-files' ); ?>
        </p>

            <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Navigation', 'nnax-frontend-user-files' ); ?></h4>
            <ul class="uk-list uk-list-small uk-margin-small-top">
                <li><?php esc_html_e( 'Click a folder name to open that folder.', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'Use the breadcrumb above the table to jump back to parent folders.', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'At the top right, you can switch between "My Files" and "My Trash".', 'nnax-frontend-user-files' ); ?></li>
            </ul>

            <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Search, filter and sorting', 'nnax-frontend-user-files' ); ?></h4>
            <ul class="uk-list uk-list-small uk-margin-small-top">
                <li><?php esc_html_e( 'Use search to find files and folders by name.', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'Use the filter menu to limit the list (for example shared items or file types).', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'Click table headers to sort the list.', 'nnax-frontend-user-files' ); ?></li>
            </ul>

        <?php if ( ! $help_is_trash_view ) : ?>
            <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Actions per item', 'nnax-frontend-user-files' ); ?></h4>
            <ul class="uk-list uk-list-small uk-margin-small-top">
                <li><?php esc_html_e( 'Open the action menu (three dots) to see all available actions for a file or folder.', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'In "Details", you can view metadata, history and rename the item (if permitted).', 'nnax-frontend-user-files' ); ?></li>
                <li><?php esc_html_e( 'Files can be downloaded directly, folders as ZIP.', 'nnax-frontend-user-files' ); ?></li>
            </ul>
        <?php else : ?>
                <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Trash view', 'nnax-frontend-user-files' ); ?></h4>
                <ul class="uk-list uk-list-small uk-margin-small-top">
                    <li><?php esc_html_e( 'In trash view, you can restore or permanently delete items (depending on your permissions).', 'nnax-frontend-user-files' ); ?></li>
                    <li><?php esc_html_e( 'Details and downloads are also available in trash view.', 'nnax-frontend-user-files' ); ?></li>
                </ul>
            <?php endif; ?>

            <?php if ( ! $help_is_trash_view ) : ?>
                <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Create folders and upload', 'nnax-frontend-user-files' ); ?></h4>
                <?php if ( $help_can_manage_here ) : ?>
                    <ul class="uk-list uk-list-small uk-margin-small-top">
                        <li><?php esc_html_e( 'Use "New Folder" to create a subfolder in the current folder.', 'nnax-frontend-user-files' ); ?></li>
                        <li><?php esc_html_e( 'Use "Upload File(s)" to upload one or multiple files.', 'nnax-frontend-user-files' ); ?></li>
                    </ul>
                <?php else : ?>
                    <p class="uk-text-muted uk-margin-small-top">
                        <?php esc_html_e( 'In this folder, uploads and creating subfolders are currently not allowed with your permissions.', 'nnax-frontend-user-files' ); ?>
                    </p>
                <?php endif; ?>
            <?php endif; ?>
        <?php if ( $sharing_active && ! $help_is_trash_view ) : ?>
            <h4 class="uk-heading-bullet uk-margin-small"><?php esc_html_e( 'Sharing', 'nnax-frontend-user-files' ); ?></h4>
            <ul class="uk-list uk-list-small uk-margin-small-top">
                <li><?php esc_html_e( 'If sharing is available for an item, you can grant access in the share dialog from the action menu.', 'nnax-frontend-user-files' ); ?></li>
                <?php if ( $help_role_sharing ) : ?>
                    <li><?php esc_html_e( 'Sharing with complete WordPress roles is enabled.', 'nnax-frontend-user-files' ); ?></li>
                <?php endif; ?>
                <?php if ( $help_time_limits ) : ?>
                    <li><?php esc_html_e( 'Time-limited sharing with start and end dates is enabled.', 'nnax-frontend-user-files' ); ?></li>
                <?php endif; ?>
                <?php if ( $help_owner_rights ) : ?>
                    <li><?php esc_html_e( 'Extended sharing roles are enabled (Normal/Manager).', 'nnax-frontend-user-files' ); ?></li>
                <?php endif; ?>
                <?php if ( $help_shared_delete ) : ?>
                    <li><?php esc_html_e( 'For folder sharing, deleting files inside shared folders can also be enabled.', 'nnax-frontend-user-files' ); ?></li>
                <?php endif; ?>
            </ul>
        <?php endif; ?>

        <div class="uk-margin-top uk-text-right">
            <button class="uk-button uk-button-default uk-button-small uk-modal-close" type="button">
                <?php esc_html_e( 'Close', 'nnax-frontend-user-files' ); ?>
            </button>
        </div>
    </div>
</div>
