<?php include("includes/head.php");?>
<link rel="stylesheet" href="scripts/colorbox/css/colorbox.css" />
<!--<script src="scripts/colorbox/js/jquery.colorbox-min.js"></script>-->
<script src="scripts/colorbox/js/jquery.min.js"></script>
<script src="scripts/colorbox/js/jquery.colorbox.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style>
body {
	font-family: Arial, Helvetica, sans-serif;
}
table {
	font-size: 1em;
}
.ui-draggable, .ui-droppable {
	background-position: top;
}
#sortable {
	list-style-type: none;
	margin: 0;
	padding: 0;
	width: 60%;
}
#sortable li {
	margin: 0 3px 3px 3px;
	padding: 0.4em;
	padding-left: 1.5em;
	height: 18px;
	width:306px;
	height:32px;
}
#sortable li span {
	position: absolute;
	margin-left: -1.3em;
}
</style>
<!--<script src="https://code.jquery.com/jquery-1.12.4.js"></script>-->
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
  $( function() {
    //$( "#sortable" ).sortable();
	
	$('#sortable').sortable({
		axis: 'y',
		update: function (event, ui) {
			var data = $(this).sortable('serialize');
			//alert(data);
			// POST to server using $.post or $.ajax
			$.ajax({
				data: data,
				type: 'POST',
				url: 'save-order.php',
				success:function(response){
				    
					Lobibox.notify('success', {
							title: 'Success',
							msg: 'Stakeholder updated successfully.'
						});
						
					/*if(response[0].message == 'ok'){
					
						Lobibox.notify('success', {
							title: 'Success',
							msg: 'Stakeholder updated successfully.'
						});
					
					}
					else{
					
						Lobibox.notify('error', {
								title: 'Error',
								msg: 'Some problem occurred, please try again.'
						});
					}*/
				   
				},
				error:function(html)
				{	
					Lobibox.notify('error', {
							title: 'Error',
							msg: 'Some problem occurred, Please try again.'
						});
				}
			});
		},
	});

    $( "#sortable" ).disableSelection();
	
  } );
</script>
<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="inbox-mailbox-area mg-b-40">
  <div class="container-fluid">
    <div class="row">
    
      <div class="col-lg-12">
        <div class="row">
          
          <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
            <div class="tab-content view-mail-ov-mg-t-30">
              <div id="viewmail" class="tab-pane custom-inbox-message active">
                <div class="view-mail-wrap">
                  <div class="sparkline8-hd">
                    <div class="main-sparkline8-hd">
                      <h1>Stakeholders Prioritizing</h1>
                      <div class="sparkline8-outline-icon">
                      <a href="dashboard.php"><button class="btn btn-sm btn-danger login-submit-cs" type="button">Back to Dashboard</button></a>&nbsp;
                      </div>
                    </div>
                  </div>
                  <div class="view-mail-content">
                    <div class="text-center text-md-left mt-5" id="shCategroiesData">
                      <?php 
						  //--------------- Category Info ----------
						  $category_counter = 0;
						  $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){?>
                      <span 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;width: 23% !important;">
                          <!-- 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']."' 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> <a href="sh-card.php?sid=<?php echo $shInfo[$shh]['id'];?>" title="<?php echo $shInfo[$shh]['name'];?>" target="_blank"><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> <!--<i class="fa fa-plus" style="font-size:10px !important; cursor:pointer;"></i></li>-->
                            <?php }?>
                            </li>
                          </ul>
                          <?php }?>
                        </div>
                        <?php if($category_counter==4){$category_counter=0;?>
                      </span>
                      <?php }?>
                      <?php }
								}?>
                      <!-- Grid row -->
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          
          <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <div class="inbox-email-menu-list shadow-reset">
              <div class="compose-email"> <a href="#">Stakeholders Prioritizing</a> </div>             
              
                <!--<li>
                  <h4 class="Inbox-category-ad"><i class="fa fa-folder-o" aria-hidden="true"></i> Folder</h4>
                </li>-->
                
				  <?php 
					$shsrno = 0;
					$selQry_sh = "SELECT * FROM ".TBL_STAKEHOLDERS." WHERE 1=1 ORDER BY sort_order asc";
					$shInfo =  $con->getMultiRow($selQry_sh, __FILE__,__LINE__);
					$totSHListings = count($shInfo);
					if( $totSHListings > 0 )
					{
                  ?>
                  <ul class="nav nav-tabs" id="sortable">
                    <?php
					for($shh=0;$shh<$totSHListings;$shh++){										
						$shsrno++;										
					?>
                    	
                        <!--<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><?php echo $shInfo[$shh]['abbreviation'];?></li>-->
                        
                        <!--<a href="sh-update-s3.php?sid=<?php echo $shInfo[$shh]['id'];?>" class="popup" title="<?php echo $shInfo[$shh]['name'];?>">-->
                        
                        <li class="ui-state-default" id="shs-<?php echo $shInfo[$shh]['id'];?>"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>						
                            <div href="sh-update-s4.php?sid=<?php echo $shInfo[$shh]['id'];?>" class="popup" style=" cursor:pointer; 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'];?></div>                        
                        </li>
                            
                        <!--</a>-->
                        
                    <?php }?>
                  </ul>
                  <?php }?>
                  
            </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>
$(document).ready(function(){
	
	$(".popup").colorbox({
		escKey: false,
		overlayClose: false
	});
	
});
</script>
</body>
</html>
