<?php
    $dashboard_url = "";

    // echo "user_id: ".$user_id;
    // dd($user);
    // dd(auth()->user()->getAttributes());
    // echo "user id: ".auth()->user()->id;
    // echo "user id: ".$user_id;
    $role_id = $role != null ? $role->id : "";
    // echo "role id: ".$role_id;
    if(Gate::check('is-admin')) {
        $dashboard_url = "/admin";
        //  echo "user id: ".$user_id;
        // dd($role->id);
    } elseif (Gate::check('is-vendor')) {
        $dashboard_url = "/vendor";
    } 

    if(ISSET($residential)) {
        // echo '<br><br><br><br>';
        // dd($residential);
    }   
    
?>

<div class="aside aside-left aside-fixed d-flex flex-column flex-row-auto" id="kt_aside">
    <div class="brand flex-column-auto" id="kt_brand">
        <a href="<?php echo e(url('/')); ?>" class="brand-logo">
            <img alt="Logo" src="<?php echo e(asset('media/logo1-w.png')); ?>" />
        </a>
        <button class="brand-toggle btn btn-sm px-0" id="kt_aside_toggle">
            <span class="svg-icon svg-icon svg-icon-xl">
                <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
                    width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
                    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
                        <polygon points="0 0 24 0 24 24 0 24" />
                        <path
                            d="M5.29288961,6.70710318 C4.90236532,6.31657888 4.90236532,5.68341391 5.29288961,5.29288961 C5.68341391,4.90236532 6.31657888,4.90236532 6.70710318,5.29288961 L12.7071032,11.2928896 C13.0856821,11.6714686 13.0989277,12.281055 12.7371505,12.675721 L7.23715054,18.675721 C6.86395813,19.08284 6.23139076,19.1103429 5.82427177,18.7371505 C5.41715278,18.3639581 5.38964985,17.7313908 5.76284226,17.3242718 L10.6158586,12.0300721 L5.29288961,6.70710318 Z"
                            fill="#000000" fill-rule="nonzero"
                            transform="translate(8.999997, 11.999999) scale(-1, 1) translate(-8.999997, -11.999999)" />
                        <path
                            d="M10.7071009,15.7071068 C10.3165766,16.0976311 9.68341162,16.0976311 9.29288733,15.7071068 C8.90236304,15.3165825 8.90236304,14.6834175 9.29288733,14.2928932 L15.2928873,8.29289322 C15.6714663,7.91431428 16.2810527,7.90106866 16.6757187,8.26284586 L22.6757187,13.7628459 C23.0828377,14.1360383 23.1103407,14.7686056 22.7371482,15.1757246 C22.3639558,15.5828436 21.7313885,15.6103465 21.3242695,15.2371541 L16.0300699,10.3841378 L10.7071009,15.7071068 Z"
                            fill="#000000" fill-rule="nonzero" opacity="0.3"
                            transform="translate(15.999997, 11.999999) scale(-1, 1) rotate(-270.000000) translate(-15.999997, -11.999999)" />
                    </g>
                </svg>
            </span>
        </button>
    </div>
    <div class="aside-menu-wrapper flex-column-fluid" id="kt_aside_menu_wrapper">
        <div id="kt_aside_menu" class="aside-menu" data-menu-vertical="1" data-menu-scroll="1"
            data-menu-dropdown-timeout="500">
            <ul class="menu-nav">
                <li class="menu-item menu-item-active" aria-haspopup="true">
                    <a href="<?php echo e($dashboard_url); ?>" class="menu-link">
                        <span class="svg-icon menu-icon">
                            <i class="fas fa-tachometer-alt"></i>
                        </span>
                        <span class="menu-text">Dashboard</span>
                    </a>
                </li>
                <li class="menu-item menu-item-submenu" aria-haspopup="true"
                    data-menu-toggle="hover">
                    <a href="javascript:;" class="menu-link menu-toggle">
                        <span class="svg-icon menu-icon">
                            <i class="fas fa-building"></i>
                        </span>
                        <span class="menu-text">Projects</span>
                        <i class="menu-arrow"></i>
                    </a>
                    <div class="menu-submenu">
                        <i class="menu-arrow"></i>
                        <ul class="menu-subnav">
                            <li class="menu-item menu-item-parent" aria-haspopup="true">
                                <span class="menu-link">
                                    <span class="menu-text">Projects</span>
                                </span>
                            </li>
                    <?php if(ISSET($residential)): ?>
                        <?php $__currentLoopData = $residential; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $res): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>                           
                            <li class="menu-item menu-item-submenu" aria-haspopup="true"
                                data-menu-toggle="hover">
                                <a href="javascript:;" class="menu-link menu-toggle">
                                    <span class="menu-text"><?php echo e($res->name); ?></span>
                                    <i class="menu-arrow"></i>
                                </a>
                                <div class="menu-submenu">
                                    <i class="menu-arrow"></i>
                                    <ul class="menu-subnav">
                                    <?php if(Gate::check('is-admin')): ?>                                      
                                        <li class="menu-item overview" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">                                                                                                          
                                            <a href="<?php echo e(route('admin.overview.show', $res->id)); ?>" class="menu-link">
                                                <span class="menu-text">Overview</span>
                                            </a>
                                        </li>
                                        <?php if(Gate::check('is-hq') || Gate::check('is-director')): ?>    
                                            <li class="menu-item requisition" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">
                                                
                                                <a href="<?php echo e(url('admin/requisition/'.$res->id.'/list?type=all')); ?>" class="menu-link">
                                                    <span class="menu-text">Requisition</span>
                                                </a>
                                            </li>
                                        <?php else: ?>
                                            <li class="menu-item requisition" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">                                               
                                                <a href="<?php echo e(route('admin.requisition.show', $res->id)); ?>" class="menu-link">
                                                    <span class="menu-text">Requisition</span>
                                                </a>
                                            </li>
                                            
                                        <?php endif; ?>
                                        <!--li class="menu-item" aria-haspopup="true">
                                            <a href="hq-projects-requisition.html" class="menu-link">
                                                <span class="menu-text">Requisition</span>
                                            </a>
                                            
                                        </!--li-->
                                    <?php endif; ?>
                                        
                                        <li class="menu-item do" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">
                                            <a href="<?php echo e(route('admin.do.show', $res->id)); ?>" class="menu-link ">
                                                <span class="menu-text">Delivery Orders</span>
                                            </a>
                                        </li>
                                    <?php if(Gate::check('is-admin')): ?>
                                        <li class="menu-item stock-transfer" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">
                                            <a href="<?php echo e(route('admin.stock-transfer.show', $res->id)); ?>" class="menu-link ">
                                                <span class="menu-text">Stocks Transfer</span>
                                            </a>
                                        </li>
                                        <li class="menu-item inventory" aria-haspopup="true" data-id="<?php echo e($res->id); ?>">
                                            <a href="<?php echo e(route('admin.inventory.show', $res->id)); ?>"" class="menu-link ">
                                                <span class="menu-text">Inventory</span>
                                            </a>
                                        </li>
                                    <?php endif; ?>
                                    </ul>
                                </div>
                            </li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>                            
                    <?php endif; ?>                                        
                        </ul>
                    </div>
                </li>
                <li class="menu-item ro" aria-haspopup="true">
                    <a href="<?php echo e(route('admin.ro.index')); ?>" class="menu-link">
                        <span class="svg-icon menu-icon">
                            <i class="fas fa-cart-arrow-down"></i>
                        </span>
                        <span class="menu-text">Request Orders</span>
                    </a>
                </li>  
            <?php if(Gate::check('is-hq')): ?>
                <li class="menu-item material menu-item-submenu menu-item-open" aria-haspopup="true" data-menu-toggle="hover">
                    <a href="javascript:;" class="menu-link menu-toggle">
                        <span class="svg-icon menu-icon">
                            <i class="fas fa-cubes"></i>
                        </span>
                        <span class="menu-text">Material Settings</span>
                        <i class="menu-arrow"></i>
                    </a>
                    <div class="menu-submenu">
                        <i class="menu-arrow"></i>
                        <ul class="menu-subnav">
                            <li class="menu-item material menu-item-parent" aria-haspopup="true">
                                <span class="menu-link">
                                    <span class="menu-text">Material Settings</span>
                                </span>
                            </li>
                            <li class="menu-item material-trade" aria-haspopup="true">
                                <a href="<?php echo e(url('admin/material/trade')); ?>" class="menu-link">
                                    <span class="menu-text">Trades</span>
                                </a>
                            </li>
                            <li class="menu-item material-item" aria-haspopup="true">
                                <a href="<?php echo e(url('admin/material/item')); ?>" class="menu-link">
                                    <span class="menu-text">Items</span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </li>
                
            <?php endif; ?>

                
            <?php if(Gate::check('is-pm') || Gate::check('is-hq')): ?>                
                <li class="menu-item users" aria-haspopup="true">
                    <a href="<?php echo e(route('admin.users.index')); ?>" class="menu-link">
                        <span class="svg-icon menu-icon">
                            <i class="fas fa-user-tie"></i>
                        </span>
                        <span class="menu-text">Staff Settings</span>
                    </a>
                </li>
            <?php endif; ?>
                
            </ul>
        </div>
    </div>

</div><?php /**PATH D:\laravel\inventory\resources\views/layouts/side.blade.php ENDPATH**/ ?>