<?php
$task       = ! empty( $_GET['task'] ) ? $_GET['task'] : 'dashboard';
$menu_items = EDD_FES()->dashboard->get_vendor_dashboard_menu();
?>

<div class="fes-vendor-menu-con col-lg-3 col-12">
    <nav class="fes-vendor-menu">
     <?php
    $user = wp_get_current_user(); 
	echo get_avatar(get_current_user_id() , 120,'' ,$user->display_name ); ?>
     <span class="side-uname"><?php
	echo $user->display_name; ?></span>
   <?php
		if (class_exists('EDD_Wallet'))
			{        $wallet = edd_currency_filter( edd_wallet()->wallet->balance(get_current_user_id()) );
                     echo '<span class="m-wallet">موجودی کیف پول: '.$wallet.'</span>';
            } ?>
	<ul>
		<?php foreach ( $menu_items as $item => $values ) : $values['task'] = isset( $values['task'] ) ? $values['task'] : ''; ?>
		<?php
        
        global $post;
        $post_slug=$post->post_name;
        
        if($values['link'] != '') { ?>
		    <li class="fes-vendor-menu-tab <?php echo 'fes-vendor-' . esc_attr( $values['task'] ) . '-tab';
			if ( $post_slug === $values['link'] ) { echo ' active'; } ?>">
				<a href='<?php echo get_home_url() . '/' . $values['link']; ?>'>
					<i class="fas fa-<?php echo esc_attr( $values['icon'] ); ?>"></i> <span><?php echo isset( $values['name'] ) ? $values['name'] : $item; ?></span>
				</a>
			</li>
		<?php } else { ?>
			<li class="fes-vendor-menu-tab <?php echo 'fes-vendor-' . esc_attr( $values['task'] ) . '-tab';
			if ( $task === $values['task'] &&  $post_slug == 'vendor-dashboard' ) { echo ' active'; } ?>">
				<a href='<?php echo get_home_url().'/vendor-dashboard/?task='. $values['task']; ?>'>
					<i class="fas fa-<?php echo esc_attr( $values['icon'] ); ?>"></i> <span><?php echo isset( $values['name'] ) ? $values['name'] : $item; ?></span>
				</a>
			</li>
			<?php } ?>
		<?php endforeach; ?>
	</ul>
</nav>
</div>