<?php
class Wiaas_Admin_Supplier {

    public static function init() {

        add_action('init', array(__CLASS__, 'init_admin_supplier'));
    }

    public static function init_admin_supplier() {

        $current_user = wp_get_current_user();

        $role = $current_user->roles[0];

        $is_supplier = $role === 'supplier';

        if ($is_supplier) {

            require_once dirname( __FILE__ ) . '/admin-supplier/class-wiaas-admin-supplier-orders.php';
            add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );

        }
    }

    public static  function enqueue_scripts() {
        $plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );

        wp_enqueue_script( 'wiaas-admin-supplier', $plugin_url . '/assets/js/wiaas-admin-supplier.js' );

        wp_enqueue_style( 'wiaas-admin-supplier', $plugin_url . '/assets/css/wiaas-admin-supplier.css' );
    }
}

Wiaas_Admin_Supplier::init();