<?php
defined( 'ABSPATH' ) || exit;

use Avirtum\GutenDraw\Models\SettingsModel;
use Avirtum\GutenDraw\Models\AccessModel;
?>

<div class="gutendraw-app-wrap">
    <div class="gutendraw-app">
        <div class="gutendraw-header">
            <div class="gutendraw-title">
                <span><?php SettingsModel::echoIcon(); ?></span>
                <span>GutenDraw<sup><?php echo sanitize_key(SettingsModel::getSup()); ?></sup> - </span>
                <span><?php esc_html_e('All Diagrams', 'gutendraw'); ?></span>
            </div>
            <div class="gutendraw-toolbar">
                <?php if ( AccessModel::currentUserCan(AccessModel::ACCESS_RIGHT_CREATE) ) { ?>
                <a class="gutendraw-button gutendraw-button-save" href="?page=gutendraw&action=new" title="<?php esc_html_e('Create a new diagram', 'gutendraw'); ?>"><?php esc_html_e('Add New Diagram', 'gutendraw'); ?></a>
                <?php } ?>
            </div>
        </div>
        <div class="gutendraw-data">
            <?php $table->views(); ?>
            <form method="post">
                <?php $table->search_box( esc_html__( 'Search', 'gutendraw'), 'item' ); ?>
                <input type="hidden" name="page" value="<?php echo sanitize_key( ( filter_input(INPUT_GET, 'page', FILTER_DEFAULT) ) ); ?>">
                <?php $table->display(); ?>
            </form>
        </div>
    </div>
</div>