<aside class="main-sidebar">
    <section class="sidebar">
        <?php
        use mdm\admin\components\Helper;
        $menuItems = [
            ['label' => 'Home', 'icon' => 'home', 'url' => Yii::$app->homeUrl],
            ['label' => 'Info', 'icon' => 'info', 'url' => ['/site/about'], 'visible' => Helper::checkRoute('/site/about'),
                'items' => [
                    ['label' => 'About', 'icon' => 'info', 'url' => ['/site/about'], 'visible' => Helper::checkRoute('/site/about')],
                    ['label' => 'Terms and Conditions', 'icon' => 'handshake-o', 'url' => ['/site/terms-and-conditions'], 'visible' => Helper::checkRoute('/site/terms-and-conditions')],
                    ['label' => 'Privacy Policy', 'icon' => 'thumbs-up', 'url' => ['/site/privacy-policy'], 'visible' => Helper::checkRoute('/site/privacy-policy')],
                    ]
            ],
            ['label' => 'Help', 'icon' => 'question', 'url' => ['/site/help'], 'visible' => Helper::checkRoute('/site/help')],
            ['label' => 'Update', 'icon' => 'wrench', 'url' => ['/update'], 'visible' => Helper::checkRoute('/update/index')],

            ['label' => 'Setting Menu', 'options' => ['class' => 'header'], 'visible' => Helper::checkRoute('/sync-config/index')],
            ['label' => 'Configuration', 'icon' => 'cog', 'url' => ['/sync-config'], 'visible' => Helper::checkRoute('/sync-config/index')],
            ['label' => 'Log Sync', 'icon' => 'list', 'url' => ['/sync-to-jurnal'], 'visible' => Helper::checkRoute('/sync-to-jurnal/index')],
            ['label' => 'Account Configuration', 'icon' => 'check', 'url' => ['/sync-account-to-jurnal'], 'visible' => Helper::checkRoute('/sync-account-to-jurnal/index')],
            ['label' => 'Sync', 'icon' => 'refresh', 'url' => ['/import-master'], 'visible' => Helper::checkRoute('/import-master'),
                'items' => [
                    ['label' => 'Master Sync', 'icon' => 'refresh', 'url' => ['/import-master'], 'visible' => Helper::checkRoute('/import-master/index')],
                    ['label' => 'Sales Sync', 'icon' => 'refresh', 'url' => ['/import-data-transaction'], 'visible' => Helper::checkRoute('/import-data-transaction/index')],
                    ['label' => 'Auto Sync', 'icon' => 'refresh', 'url' => ['/auto-sync'], 'visible' => Helper::checkRoute('/auto-sync/index')],
                    ]
            ],

            ['label' => 'User Access', 'options' => ['class' => 'header'], 'visible' => Helper::checkRoute('/admin/route')],
            ['label' => 'Change Password', 'icon' => 'key', 'url' => ['/site/change-password'], 'visible' => Helper::checkRoute('/site/change-password')],
            ['label' => 'Login', 'icon' => 'sign-in', 'url' => ['/site/login'], 'visible' => Yii::$app->user->isGuest],
            ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'icon' => 'sign-out', 'url' => ['/site/logout'], 'template' => '<a href="{url}" data-method="post">{icon}{label}</a>'],
            ['label' => 'Admin', 'icon' => 'cogs', 'url' => ['/admin/route'], 'visible' => Helper::checkRoute('/admin/route'),
                'items' => [
                    ['label' => 'Route', 'icon' => 'user-md', 'url' => ['/admin/route'], 'visible' => Helper::checkRoute('/admin/route')],
                    ['label' => 'Permission', 'icon' => 'user-secret', 'url' => ['/admin/permission'], 'visible' => Helper::checkRoute('/admin/permission')],
                    ['label' => 'Role', 'icon' => 'id-card', 'url' => ['/admin/role'], 'visible' => Helper::checkRoute('/admin/role')],
                    ['label' => 'Assignment', 'icon' => 'user-circle', 'url' => ['/admin/assignment'], 'visible' => Helper::checkRoute('/admin/assignment')],
                    ['label' => 'Users', 'icon' => 'users', 'url' => ['/admin/user'], 'visible' => Helper::checkRoute('/admin/user')],
                    ['label' => 'Add User', 'icon' => 'user-plus', 'url' => ['/site/signup'], 'visible' => Helper::checkRoute('/site/signup')],
                    ['label' => 'Set User Password', 'icon' => 'key', 'url' => ['/site/set-password'], 'visible' => Helper::checkRoute('/site/set-password')],
                ]
            ],
        ];

        echo dmstr\widgets\Menu::widget(
            [
                'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
                'items' => $menuItems
            ]
        );
        ?>
    </section>
</aside>