<?php include("includes/head.php");?>

<link rel="stylesheet" href="scripts/colorbox/css/colorbox.css" />
<script src="scripts/colorbox/js/jquery.min.js"></script>
<script src="scripts/colorbox/js/jquery.colorbox.js"></script>

<style>
	#cboxOverlay{ visibility: visible; opacity: 0.3 !important;}
</style>

<body>

<!--[if lt IE 8]>
        <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
<!-- Header top area start-->

<?php include("includes/header.php");?>
<!-- Header top area end-->
<!-- Menu area start-->
<?php include("includes/navigation.php");?>
<!-- Menu area end-->
<!-- Data table area Start-->
<div class="admin-dashone-data-table-area mg-b-40" style="min-height:500px;">
  <div class="container">
    <div class="row">
      <div class="col-lg-12">
        <div class="row">
          <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="width:110% !important;">
            <div class="tab-content view-mail-ov-mg-t-30">
              <div class="tab-pane fade in zoomInDown shadow-reset active">
                <div class="sparkline8-list shadow-reset">
                  <div class="sparkline8-hd">
                    <div class="main-sparkline8-hd">
                      <h1>Phase-4 Stakeholders Ranking</h1>
                      <div class="sparkline8-outline-icon">
                      <!--<button class="btn btn-sm btn-success login-submit-cs" type="button" id="btnEdit">Edit</button>&nbsp;-->
                      <a href="dashboard.php"><button class="btn btn-sm btn-danger login-submit-cs" type="button">Back to Dashboard</button></a>&nbsp;
                      
                      <?php if(isset($_GET['mode']) && $_GET['mode']=='PW'){?>
                         <a href="sh-ranking.php"><button class="btn btn-sm btn-warning login-submit-cs" type="button">Show All Sakeholders</button></a>&nbsp;
                        <?php }else{?>
                        <a href="sh-ranking.php?mode=PW"><button class="btn btn-sm btn-warning login-submit-cs" type="button">View Priority Stakeholders</button></a>&nbsp;
                        <?php }?>
                        
                      <a href="sh-analyzing.php"><button class="btn btn-sm btn-primary login-submit-cs" type="button">Back to Previous Step</button></a>&nbsp;
                      <!--<a href="sh-prioritizing.php"><button class="btn btn-sm btn-success login-submit-cs" type="submit">Proceed to Next Step</button></a>-->
                      </div>
                    </div>
                  </div>
                  <div class="sparkline8-graph">
                    <div class="container bootstrap snippet">
                      <div class="row">
                        <div class="container">
                          
                            <div class="container text-center text-md-left mt-5" id="shCategroiesData">
                              <?php 
								  //--------------- Category Info ----------
								  $category_counter = 0;
								  $wherecluase = '';
								  
								  if(isset($_GET['mode']) && $_GET['mode']=='PW')
								  {
								  	$wherecluase = "AND is_high_priority='1'";
								  }
								  
								  $selQry_cat = "SELECT * FROM ".TBL_CATEGORIES." ORDER BY category_title";
								  $catInfo =  $con->getMultiRow($selQry_cat, __FILE__,__LINE__);
								  $totSHCatListings = count($catInfo);
									if($totSHCatListings>0)
									{
										for($shcat=0;$shcat<$totSHCatListings;$shcat++)
										{
											$category_counter++;
								  //----------------------------------------
								?>
                              <!-- Grid row -->
                              <?php if($category_counter==1){?>
                              <div class="row mt-3" style="margin-bottom:10px;">
                                <?php }?>
                                <div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4" style="text-align:left;">
                                  <!-- Links -->
                                  <h6 class="text-uppercase font-weight-bold" title="<?php echo $catInfo[$shcat]['category_title'];?>"><strong><?php echo $catInfo[$shcat]['category_title'];?></strong></h6>
                                  <hr class="deep-purple accent-2 mb-4 mt-0 d-inline-block mx-auto" style="width: 125px; margin-top:0px !important; margin-bottom:0px !important;">
                                  <?php 
                                        $shsrno = 0;
                                        $selQry_sh = "SELECT * FROM ".TBL_STAKEHOLDERS." WHERE category_id='".$catInfo[$shcat]['category_id']."' $wherecluase ORDER BY name";
                                        $shInfo =  $con->getMultiRow($selQry_sh, __FILE__,__LINE__);
                                        $totSHListings = count($shInfo);
                                        if($totSHListings>0)
                                        {
                                  ?>
                                  <ul>
                                    <?php
									for($shh=0;$shh<$totSHListings;$shh++){										
										$shsrno++;									
									?>
                                    <li onMouseOver="javascript: showRankIcon('<?php echo $shInfo[$shh]['id'];?>');" onMouseOut="javascript: hideRankIcon('<?php echo $shInfo[$shh]['id'];?>');">                                   
                                        <a href="sh-update-s3.php?sid=<?php echo $shInfo[$shh]['id'];?>" class="popup" title="<?php echo $shInfo[$shh]['name'];?>">
                                            <span style="color:<?php echo !empty($shInfo[$shh]['sh_current_orientation'])?$shInfo[$shh]['sh_current_orientation']:'#a9b7af';?>; font-size:<?php echo !empty($shInfo[$shh]['orientation_sh_influence'])?$shInfo[$shh]['orientation_sh_influence']:'';?>px;"><?php echo $shInfo[$shh]['abbreviation'];?></span>
                                        </a>&nbsp;
                                        <a href="#!"><i class="fa fa-line-chart" aria-hidden="true" onClick="javascript: rankStakeHolders('<?php echo $shInfo[$shh]['id'];?>');" style=" display:none;" id="rankIcon_<?php echo $shInfo[$shh]['id'];?>" title="Click to Rank <?php echo $shInfo[$shh]['abbreviation'];?>"></i></a>
                                    </li>
                                    <?php }?>
                                  </ul>
                                  <?php }?>
                                </div>
                                <?php if($category_counter==6){$category_counter=0;?>
                              </div>
                              <?php }?>
                              <?php }
								}?>
                              <!-- Grid row -->
                            </div>
                            
                            <!--<div style="text-align:right; margin-top:40px;"><button class="btn btn-sm btn-primary login-submit-cs" type="button" id="btnRankSH">Rank Stakholders</button></div>-->
                          
                        </div>
                      </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- Data table area End-->
<!-- Footer Start-->
<?php include("includes/footer.php");?>
<!-- Footer End-->
<!-- jquery
		============================================ -->
<!--<script src="js/vendor/jquery-1.11.3.min.js"></script>-->
<!-- bootstrap JS
		============================================ -->
<script src="js/bootstrap.min.js"></script>
<!-- meanmenu JS
		============================================ -->
<script src="js/jquery.meanmenu.js"></script>
<!-- mCustomScrollbar JS
		============================================ -->
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script>
<!-- sticky JS
		============================================ -->
<script src="js/jquery.sticky.js"></script>
<!-- scrollUp JS
		============================================ -->
<script src="js/jquery.scrollUp.min.js"></script>
<!-- Tree Viewer JS
		============================================ -->
<script src="js/tree-line/jstree.min.js"></script>
<script src="js/tree-line/jstree.active.js"></script>
<!-- notification JS 
		============================================ -->
<script src="js/Lobibox.js"></script>
<script src="js/notification-active.js"></script>
<!-- main JS
		============================================ -->
<script src="js/main.js"></script>

<script>
function getCategoriesList(tabid)
{	
	userData = 'action_type=view&tabid='+tabid;
	
	$.ajax({
		type: 'POST',
		url: 'categoriesActions.php',
		data: userData,
		success:function(html)
		{			
			/*$('.colorbox').colorbox({
			  'onClosed':function(){
				$('#shCategroiesData').html(html);
			  }
			});*/
			
			$('#shCategroiesData').html(html);
			
			//window.location.href = 'sh-identifying.php';
		},
		error:function(html)
		{			
			//
		}
	});
}

function showRankIcon(shid)
{
	$("#rankIcon_"+shid).show();
}

function hideRankIcon(shid)
{
	$("#rankIcon_"+shid).hide();
}

function rankStakeHolders(shid)
{	
	$.ajax({
		type: 'POST',
		url: 'stackholdersActions.php',
		data: 'action=rankSH&rankIDS='+shid,
		dataType: 'JSON',
		beforeSend: function(){
			//$('.submitBtn').attr("disabled","disabled");
		},
		success:function(response)
		{			
			if(response[0].message == 'ok')
			{
				window.location.href = 'sh-rank.php?shid='+response[0].shid;
			}
			else
			{
				//
			}			
		}
	});
}

$(document).ready(function(){
	
	$(".popup").colorbox({
		escKey: false,
		overlayClose: false
	});
	
});

</script>
</body>
</html>