<?php if (!defined('ABSPATH')) exit; // Exit if accessed directly  ?>
<h1 style="display: flex;align-items: center;gap: 10px;">
    <?php esc_html_e('Global Cliparts', 'web-to-print-online-designer'); ?>
    <a href="<?php echo esc_url(admin_url('admin.php?page=nbdesigner_manager_arts')); ?>" class="button-primary"><?php esc_html_e('Cliparts', 'web-to-print-online-designer'); ?></a>
</h1>
<?php echo( $notice ); ?>
<div class="wrap nbdesigner-container">
    <div class="clear"></div>
    <div class="postbox" id="nbd-list-arts">
        <h3 class="nbd-admin-line-height"><?php esc_html_e('List arts ', 'web-to-print-online-designer'); ?>
            <?php if(is_array($cat) && (sizeof($cat) > 0)): ?>
            <select onchange="if (this.value) window.location.href=this.value+'#nbd-list-arts'">
                <option value="<?php echo admin_url('admin.php?page=nbdesigner_manager_arts&tab=global'); ?>"><?php esc_html_e('Select a category', 'web-to-print-online-designer'); ?></option>
                <?php foreach($cat as $cat_index => $val): ?>
                <option value="<?php echo add_query_arg(array('cat_id' => $val['id']), admin_url('admin.php?page=nbdesigner_manager_arts&tab=global')) ?>" <?php selected( $val['id'], $current_cat_id ); ?>><?php echo( $val['name'] ); ?></option>
                <?php endforeach; ?>
            </select>
            <?php  endif; ?>
            <span class="nbdesigner-right">
                <a class="nbd-toggle-art-view" title="<?php esc_html_e('View mode white', 'web-to-print-online-designer');?>" href="javascript:void(0)" onclick="NBDESIGNADMIN.changeModeViewArt()"></a>
                <a class="nbd-toggle-art-view black nbd-admin-margin-right-15" title="<?php esc_html_e('View mode black', 'web-to-print-online-designer');?>" href="javascript:void(0)" onclick="NBDESIGNADMIN.changeModeViewArt()"></a>
                <a href="<?php echo admin_url('admin.php?page=nbdesigner_manager_arts&tab=global'); ?>"><?php esc_html_e('All arts', 'web-to-print-online-designer'); ?></a>
            </span>
        </h3>
        <div class="nbdesigner-list-fonts inside">
            <div class="nbdesigner-list-arts-container">
                <?php if(is_array($list) && (sizeof($list) > 0)): ?>
                    <?php 
                        foreach($list as $val): 
                        $art_url 	= isset($val['url']) ? $val['url'] : '';
                        $art_id 	= isset($val['id']) ? $val['id'] : '';;
                    ?>
                        <span class="nbdesigner_art_link "><img src="<?php echo esc_url( $art_url ); ?>" /><span class="nbdesigner_action_delete_art" data-index="<?php echo( $art_id ); ?>" onclick="NBDESIGNADMIN.delete_art(this)">&times;</span></span>
                    <?php endforeach; ?>
                <?php else: ?>
                    <?php esc_html_e('You don\'t have any art.', 'web-to-print-online-designer');?>
                <?php endif; ?>
            </div>
            <div class="tablenav top">
                <div class="tablenav-pages">
                    <span class="displaying-num"><?php echo esc_html( $total ) . ' ' . esc_html__('arts', 'web-to-print-online-designer'); ?></span>

                    <span class="pagination-links">
                        <?php
                            if($prev_page) {
                                echo '<a class="prev-page" href="'. home_url() .'/wp-admin/admin.php?page=nbdesigner_manager_arts&tab=global&amp;cursor='. $prev_page .'">≪</a>';
                            }
                            if($next_page) {
                                echo '<a class="next-page" href="'. home_url() .'/wp-admin/admin.php?page=nbdesigner_manager_arts&tab=global&amp;cursor='. $next_page .'">≫</a>';
                            }
                        ?>
                    </span>

                </div>
            </div>
        </div>
    </div>
</div>