<?php
$cs = Yii::app()->getClientScript();

$baseUrl = Yii::app()->baseUrl;

$livesite = Yii::app()->getBaseUrl(true) . "/";

?>

<?php
//$modelCompanySettings = new MasCompanySettings();
//$modelCompanySettings = $modelCompanySettings->find(array('condition'=>'crm_company_id='.(int) Yii::app()->user->master_user_company_id));    

$current_url = Yii::app()->urlManager->parseUrl(Yii::app()->request);
$purchase = '';

  switch ($current_url) {
        //PURCHASE MENU

        case 'requisition/index':

            $purchase = 'active';

            break;

        case 'enquiry/index':

            $purchase = 'active';

            break;

        case 'materialreceipt/index':

            $purchase = 'active';

            break;

        case 'qualitycheck/index':

            $purchase = 'active';

            break;

        case 'purchaseinvoice/index':

            $purchase = 'active';

            break;

        case 'debitnote/index':

            $purchase = 'active';

            break;

        case 'purchasingorder/index':

            $purchase = 'active';

            break;

        case 'vendor/index':

            $purchase = 'active';

            break;

        case 'directpurchaseorder/index':

            $purchase = 'active';

            break;

        case 'purchasingorder/deliverytracker':

            $purchase = 'active';

            break;

        case 'purchasingorder/paymenttracker':

            $purchase = 'active';

            break;

      

        case 'purchasingorder/indexmovementanalysis':

            $purchase = 'active';

            break;

        case 'purchasingorder/createmovementanalysis':

            $purchase = 'active';

            break;

        case 'directpurchase/index':

            $purchase = 'active';

            break;
  }

?>
 <!---------------------------------------     Start purchase li ----------------------------------------->
 <?php //if ($modelCompanySettings->purchase_menu==1) {?>

<li id="purchase" <?php echo "class='$purchase has-sub l2'"; ?>>

    <a href="<?php echo 'index.php?r=requisition/index'; ?>" data-target="#purchase_menu">

        <i class="fa fa-credit-card"></i>

        <span>Purchase</span>

    </a>

    <ul class="menu-2-sub" id="purchase_menu">

        <?php
        if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["vendor_view"])) {
            ?>

            <li class="has-sub l2"><a href="<?php echo $baseUrl; ?>/index.php?r=vendor/index"><i class="material-icons">monetization_on</i>Supplier</a>

            <?php } ?>

       
            <li><a href="javascript:;"><i class="fa fa-cogs"></i> Operations</a><ul>

                    <?php
                    //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["requisition_view"])) {
                        ?>

                        <!-- <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=requisition/index"><i class="fa fa-info-circle"></i>Requisition</a></li>
                        <?php //} ?> -->

                    <?php /* if (isset(Yii::app()->user->havePermissionOn['po_new_order_movement_analysis_view']) || Yii::app()->user->authorised_user == 1) { ?>

                      <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=purchasingorder/indexmovementanalysis"><i class="material-icons">list</i>New Order Movement Analysis</a></li>

                      <?php } */ ?>

                    <?php /* if (isset(Yii::app()->user->havePermissionOn['report_purchase_stock_list_view']) || Yii::app()->user->authorised_user == 1) { ?>

                      <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=purchasingorder/movementanalysis"><i class="material-icons">list</i>New Order Movement Analysis</a></li>

                      <?php } */ ?>

                    <?php
                    //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["enquiry_view"])) {
                        ?>

                        <!-- <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=enquiry/index"><i class="material-icons">phone</i>Purchase Enquiry</a></li> -->

                    <?php //} ?>

                    <?php
                    //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["purchase_order_view"])) {
                        ?>

                        <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=purchasingorder/index"><i class="material-icons">list</i>Purchase Order</a></li>

                    <?php //} ?>


                        <?php
                        //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["purchase_material_view"])) {
                            ?>

                            <!-- <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=materialreceipt/index"><i class="material-icons">list</i>Material Receipt</a></li> -->

                            <?php
                        //}
                        ?>


                        <?php
                        //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["purchase_qc_view"])) {
                            ?>

                            <!-- <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=qualitycheck/index"><i class="material-icons">list</i>Quality Check</a></li> -->

                            <?php
                        //}

                        ?>

                        <?php
                        //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["purchase_invoice_view"])) {
                            ?>

                            <!-- <li class="l2"><a href="<?php echo $baseUrl; ?>/index.php?r=purchaseinvoice/index"><i class="material-icons">list</i> Purchase Invoice</a></li> -->

                            <?php
                        //}
                    ?>

                    <?php

                        //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["pur_debitnote_view"])) {
                            ?>

                            <!-- <li><a href="<?php echo $baseUrl; ?>/index.php?r=debitnote/index"><i class="fa fa-money"></i> Purchase Return</a></li> -->

                            <?php
                        //}
                    
                    ?>

                    <?php //if (isset(Yii::app()->user->havePermissionOn['pur_landingcost_view']) || Yii::app()->user->authorised_user == 1) { ?>

                       <!-- <li><a href="#" onclick="loadPopupModal('purchaseinvoice/calculateLandingCost', 'Landing Cost Calculation', 'xl')"><i class="fa fa-plus"></i>Landing Cost Calculation</a></li>-->

                    <?php //} ?>

                    <?php
                    /* if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["direct_purchase_view"])) {

                      ?>

                      <li><a  href="<?php echo $baseUrl; ?>/index.php?r=directpurchase/index"><i class="fa fa-balance-scale"></i> Direct Purchase</a></li>

                      <?php

                      } */
                    ?>

                    <?php /* if($allPermissions->purchase_directpurchase == 1){

                      if(Yii::app()->user->authorised_user == 1   || ((int) Yii::app()->user->havePermissionOn["pur_stock_ledger_view"])){ ?>

                      <li><a  href="<?php echo $baseUrl;?>/index.php?r=stockledger/index"><i class="fa fa-balance-scale"></i> Stock Ledger</a></li>

                      <?php } } */ ?>

                </ul>

            </li>

            <!-- <li>
            <a href="javascript:void(0);"><i class="fa fa-search" aria-hidden="true"></i> Trackers</a>
            <ul> -->
        <?php
            //if (Yii::app()->user->authorised_user == 1 || ((int) Yii::app()->user->havePermissionOn["pur_deliverytrack_view"])) {
                ?>

                <!-- <li><a href="<?php echo $baseUrl; ?>/index.php?r=purchasingorder/deliverytracker"><i class="fa fa-search"></i> Delivery Tracker</a></li>

                <li><a href="<?php echo $baseUrl; ?>/index.php?r=purchasingorder/paymenttracker"><i class="fa fa-search"></i> Receipt Tracker</a></li> -->

                <?php

                //}
            ?>
        <!-- </ul>
        </li> -->

    </ul>
</li>

<?php //}

?>