<?php include("includes/head.php");?>
<?php
$shid = isset($_GET['sid'])?$_GET['sid']:'';

if(!empty($shid))
{
	//-------------------------------------------------------------				
	$selSH_Query = "SELECT ".TBL_CATEGORIES.".category_title,".TBL_STAKEHOLDERS.".* FROM ".TBL_STAKEHOLDERS." 
	INNER JOIN ".TBL_CATEGORIES." ON (".TBL_STAKEHOLDERS.".category_id=".TBL_CATEGORIES.".category_id)
	WHERE ".TBL_STAKEHOLDERS.".id = '".$shid."' ";
	$shInfo = $con->getSingleRow($selSH_Query);	
	//-------------------------------------------------------------
	if($shInfo)
	{
		$selQuery_map_det_I = "SELECT 
			".TBL_STAKEHOLDERS.".id as sh_id,
			".TBL_STAKEHOLDERS.".abbreviation as name,
			".TBL_STAKEHOLDERS.".sh_current_orientation,
			".TBL_MAPPINGS_DETAILS.".orientation_type,
			".TBL_MAPPINGS_DETAILS.".node_color,
			".TBL_MAPPINGS_DETAILS.".node_size,
			".TBL_MAPPINGS_DETAILS.".node_positionX,
			".TBL_MAPPINGS_DETAILS.".node_positionY,
			".TBL_MAPPINGS_DETAILS.".node_positionX2,
			".TBL_MAPPINGS_DETAILS.".node_positionY2,
			".TBL_MAPPINGS_DETAILS.".node_width,
			".TBL_MAPPINGS_DETAILS.".node_height,
			".TBL_MAPPINGS_DETAILS.".node_positionCX,
			".TBL_MAPPINGS_DETAILS.".node_positionCY,
			".TBL_MAPPINGS_DETAILS.".sh_svg_file,
			".TBL_MAPPINGS_DETAILS.".sh_json_data
		FROM  ".TBL_STAKEHOLDERS."
		INNER JOIN ".TBL_MAPPINGS_DETAILS." ON (".TBL_STAKEHOLDERS.".id=".TBL_MAPPINGS_DETAILS.".sh_id)
		WHERE sh_id='".$shid."' 
		AND ".TBL_MAPPINGS_DETAILS.".orientation_type='I'
		ORDER BY ".TBL_MAPPINGS_DETAILS.".id asc;";
		$mapdetInfo_I = $con->getMultiRow($selQuery_map_det_I);
		
		$selQuery_map_det_CD = "SELECT 
			".TBL_STAKEHOLDERS.".id as sh_id,
			".TBL_STAKEHOLDERS.".abbreviation as name, 
			".TBL_STAKEHOLDERS.".sh_current_orientation,
			".TBL_MAPPINGS_DETAILS.".orientation_type,
			".TBL_MAPPINGS_DETAILS.".node_color,
			".TBL_MAPPINGS_DETAILS.".node_size,
			".TBL_MAPPINGS_DETAILS.".node_positionX,
			".TBL_MAPPINGS_DETAILS.".node_positionY,
			".TBL_MAPPINGS_DETAILS.".node_positionX2,
			".TBL_MAPPINGS_DETAILS.".node_positionY2,
			".TBL_MAPPINGS_DETAILS.".node_width,
			".TBL_MAPPINGS_DETAILS.".node_height,
			".TBL_MAPPINGS_DETAILS.".node_positionCX,
			".TBL_MAPPINGS_DETAILS.".node_positionCY,
			".TBL_MAPPINGS_DETAILS.".sh_svg_file,
			".TBL_MAPPINGS_DETAILS.".sh_json_data
		FROM  ".TBL_STAKEHOLDERS."
		INNER JOIN ".TBL_MAPPINGS_DETAILS." ON (".TBL_STAKEHOLDERS.".id=".TBL_MAPPINGS_DETAILS.".sh_id)
		WHERE sh_id='".$shid."'
		AND (".TBL_MAPPINGS_DETAILS.".orientation_type='C' OR ".TBL_MAPPINGS_DETAILS.".orientation_type='D')
		ORDER BY ".TBL_MAPPINGS_DETAILS.".id asc;";
		$mapdetInfo_CD = $con->getMultiRow($selQuery_map_det_CD);
		//---------------------------------------------------
		$selQuery_map_history = "SELECT 
			".TBL_STAKEHOLDERS.".id as sh_id,
			".TBL_STAKEHOLDERS.".abbreviation as name, 
			".TBL_STAKEHOLDERS.".sh_current_orientation,
			".TBL_RANKING_HISTORY.".orientation_type,
			".TBL_RANKING_HISTORY.".node_color,
			".TBL_RANKING_HISTORY.".node_size,
			".TBL_RANKING_HISTORY.".node_positionX,
			".TBL_RANKING_HISTORY.".node_positionY,
			".TBL_RANKING_HISTORY.".node_positionX2,
			".TBL_RANKING_HISTORY.".node_positionY2,
			".TBL_RANKING_HISTORY.".node_width,
			".TBL_RANKING_HISTORY.".node_height,
			".TBL_RANKING_HISTORY.".node_positionCX,
			".TBL_RANKING_HISTORY.".node_positionCY,
			".TBL_RANKING_HISTORY.".update_detail
		FROM  ".TBL_STAKEHOLDERS."
		INNER JOIN ".TBL_RANKING_HISTORY." ON (".TBL_STAKEHOLDERS.".id=".TBL_RANKING_HISTORY.".sh_id)
		WHERE ".TBL_RANKING_HISTORY.".sh_id='".$shid."'
		AND ".TBL_RANKING_HISTORY.".status='1'
		ORDER BY ".TBL_RANKING_HISTORY.".id asc;";
	    $mapdethistoryInfo = $con->getMultiRow($selQuery_map_history);
	  //---------------------------------------------------
	}	
	else
	{
		//SH not found in mapping table.
	}	
}
?>
<link rel="stylesheet" type="text/css" href="scripts/raphael/css/styles.css">
<script type="text/javascript" src="scripts/raphael/js/js/bootstrap.min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/main.js"></script>
<script type="text/javascript" src="scripts/raphael/js/raphael-min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/raphael.js"></script>
<script type="text/javascript" src="scripts/raphael/js/helpers_svg_paths.js"></script>
<script type="text/javascript" src="scripts/raphael/js/javascript_card.js"></script>
<script>

function OpenPopupCenter(pageURL, title, w, h) {
            var left = (screen.width - w) / 2;
            var top = (screen.height - h) / 4;  // for 25% - devide by 4  |  for 33% - devide by 3
            var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
        } 
		
$( document ).ready(function() {
		
		<?php $serno = 0;?>		
		<?php 
		$tot_mappingsInfo_I = count($mapdetInfo_I);
		if($tot_mappingsInfo_I > 0){
			
			for($mdi=0;$mdi<$tot_mappingsInfo_I;$mdi++)
			{
				$serno++;
				?>
				redrawNameSet('<?php echo $serno;?>','<?php echo isset($mapdetInfo_I[$mdi]['orientation_type'])?$mapdetInfo_I[$mdi]['orientation_type']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['name'])?$mapdetInfo_I[$mdi]['name']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['sh_id'])?$mapdetInfo_I[$mdi]['sh_id']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_color'])?$mapdetInfo_I[$mdi]['node_color']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_size'])?$mapdetInfo_I[$mdi]['node_size']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['id'])?$mapdetInfo_I[$mdi]['id']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionX'])?$mapdetInfo_I[$mdi]['node_positionX']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionY'])?$mapdetInfo_I[$mdi]['node_positionY']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionX2'])?$mapdetInfo_I[$mdi]['node_positionX2']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionY2'])?$mapdetInfo_I[$mdi]['node_positionY2']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_width'])?$mapdetInfo_I[$mdi]['node_width']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_height'])?$mapdetInfo_I[$mdi]['node_height']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionCX'])?$mapdetInfo_I[$mdi]['node_positionCX']:'';?>','<?php echo isset($mapdetInfo_I[$mdi]['node_positionCY'])?$mapdetInfo_I[$mdi]['node_positionCY']:'';?>','','');		
				<?php
			}
		} 
		?>
		
		<?php 
		$tot_mappingshistoryInfo = count($mapdethistoryInfo);
		if($tot_mappingshistoryInfo > 0){
			$counter_history = 0;
			for($mh=0;$mh<$tot_mappingshistoryInfo;$mh++)
			{ 
				$serno++;
				?>				
				redrawNameSet('<?php echo $serno;?>','<?php echo isset($mapdethistoryInfo[$mh]['orientation_type'])?$mapdethistoryInfo[$mh]['orientation_type']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['name'])?$mapdethistoryInfo[$mh]['name']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['sh_id'])?$mapdethistoryInfo[$mh]['sh_id']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_color'])?$mapdethistoryInfo[$mh]['node_color']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_size'])?$mapdethistoryInfo[$mh]['node_size']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['id'])?$mapdethistoryInfo[$mh]['id']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionX'])?$mapdethistoryInfo[$mh]['node_positionX']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionY'])?$mapdethistoryInfo[$mh]['node_positionY']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionX2'])?$mapdethistoryInfo[$mh]['node_positionX2']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionY2'])?$mapdethistoryInfo[$mh]['node_positionY2']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_width'])?$mapdethistoryInfo[$mh]['node_width']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_height'])?$mapdethistoryInfo[$mh]['node_height']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionCX'])?$mapdethistoryInfo[$mh]['node_positionCX']:'';?>','<?php echo isset($mapdethistoryInfo[$mh]['node_positionCY'])?$mapdethistoryInfo[$mh]['node_positionCY']:'';?>','','<?php echo isset($mapdethistoryInfo[$mh]['update_detail'])?$mapdethistoryInfo[$mh]['update_detail']:'';?>');		
				<?php				
			}
		} 
		?>
		
		<?php 
		$tot_mappingsInfo_CD = count($mapdetInfo_CD);
		if($tot_mappingsInfo_CD > 0){
			
			for($mdcd=0;$mdcd<$tot_mappingsInfo_CD;$mdcd++)
			{				
				if($mapdetInfo_CD[$mdcd]['orientation_type']=='C')
				{
					$serno++;
				}
				else
				{
					//
				}				
				?>
				redrawNameSet('<?php if($mapdetInfo_CD[$mdcd]['orientation_type']=='C'){echo $serno;}?>','<?php echo isset($mapdetInfo_CD[$mdcd]['orientation_type'])?$mapdetInfo_CD[$mdcd]['orientation_type']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['name'])?$mapdetInfo_CD[$mdcd]['name']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['sh_id'])?$mapdetInfo_CD[$mdcd]['sh_id']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_color'])?$mapdetInfo_CD[$mdcd]['node_color']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_size'])?$mapdetInfo_CD[$mdcd]['node_size']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['id'])?$mapdetInfo_CD[$mdcd]['id']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionX'])?$mapdetInfo_CD[$mdcd]['node_positionX']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionY'])?$mapdetInfo_CD[$mdcd]['node_positionY']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionX2'])?$mapdetInfo_CD[$mdcd]['node_positionX2']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionY2'])?$mapdetInfo_CD[$mdcd]['node_positionY2']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_width'])?$mapdetInfo_CD[$mdcd]['node_width']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_height'])?$mapdetInfo_CD[$mdcd]['node_height']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionCX'])?$mapdetInfo_CD[$mdcd]['node_positionCX']:'';?>','<?php echo isset($mapdetInfo_CD[$mdcd]['node_positionCY'])?$mapdetInfo_CD[$mdcd]['node_positionCY']:'';?>','','');//	
				<?php				
			}
		}
		?>
		
				
});
</script>
<style>
.table th {
	background-color:#e7e6e6;
}
</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">
            <div class="view-mail-ov-mg-t-30">
              <div id="" class="shadow-reset">
                <div class="row">
                  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="background:#FFFFFF;">
                    <div style="margin-top:20px;">
                      <div class="mail-title" style="margin-top:10px; margin-left:21px; text-align:right; font-size:31px; float:left; padding-left:126px;"> <strong>Individual Stakeholder Card</strong> </div>
                      <div style="float:right;" id="shName"><img src="uploads/stake-holders/<?php echo $shInfo['sh_logo'];?>" width="50" height="50" id="shLogo">&nbsp; <a title="<?php echo $shInfo['name'];?>" onClick="javascript: showSHUpdateModal('<?php echo $shInfo['id'];?>');return false;" style=" cursor:pointer;"><strong><?php echo $shInfo['name'];?></strong></a> </div>
                    </div>
                    <div class="view-mail-wrap">
                      <div class="sparkline8-graph" style="margin-top:60px;">
                        <div class="static-table-list">
                          <table class="table" border="1">
                            <div style="text-align:right;"><i class="fa fa-edit popup" href="sh-update-gen-info.php?sid=<?php echo $shInfo['id'];?>" style="cursor:pointer;" title="CLick to update info"></i></div>
                            <thead>
                              <tr>
                                <th>Category</th>
                                <th>Abbreviation</th>
                                <th>Interest</th>
                                <th>Influence</th>
                                <th>Current Orientation</th>
                                <th>Desired Orientation</th>
                              </tr>
                            </thead>
                            <tbody>
                              <tr>
                                <td id="shCatTitle"><?php echo $shInfo['category_title'];?></td>
                                <td id="shAbbreviation"><?php echo $shInfo['abbreviation'];?></td>
                                <td id="shInterest"><?php echo $shInfo['orientation_sh_interest'];?></td>
                                <td id="shInfluence"><?php 
									if(isset($shInfo['orientation_sh_influence']) &&  $shInfo['orientation_sh_influence']== '10')
									{
										echo 'Low';
									}
									elseif(isset($shInfo['orientation_sh_influence']) &&  $shInfo['orientation_sh_influence']== '16')
									{
										echo 'Medium';
									}
									elseif(isset($shInfo['orientation_sh_influence']) &&  $shInfo['orientation_sh_influence']== '20')
									{
										echo 'High';
									}
									?>
                                </td>
                                <td id="shCurrentOrientation"><?php 
									if(isset($shInfo['sh_current_orientation']) &&  $shInfo['sh_current_orientation']== 'green')
									{
										echo 'Supportive';
									}
									elseif(isset($shInfo['sh_current_orientation']) &&  $shInfo['sh_current_orientation']== 'red')
									{
										echo 'Resistant';
									}
									elseif(isset($shInfo['sh_current_orientation']) &&  $shInfo['sh_current_orientation']== 'orange')
									{
										echo 'Neutral';
									}
									?>
                                </td>
                                <td id="shDesiredOrientation"><?php 
									if(isset($shInfo['sh_desired_orientation']) &&  $shInfo['sh_desired_orientation']== 'green')
									{
										echo 'Supportive';
									}
									elseif(isset($shInfo['sh_desired_orientation']) &&  $shInfo['sh_desired_orientation']== 'red')
									{
										echo 'Resistant';
									}
									elseif(isset($shInfo['sh_desired_orientation']) &&  $shInfo['sh_desired_orientation']== 'orange')
									{
										echo 'Neutral';
									}
									?>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div class="view-mail-content">
                        <div class="sparkline8-graph">
                          <div class="static-table-list">
                            <table class="table" border="1" style="width:100%;">
                              <div style="text-align:right;"><i class="fa fa-edit" style=" cursor:pointer;" title="CLick to update info" onClick="OpenPopupCenter('sh-update-ranking.php?shid=<?php echo $shInfo['id'];?>', 'TEST!?', 1200, 600);"></i></div>
                              <thead>
                                <tr>
                                  <th style="text-align:center;">Analysis</th>
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td><div id="canvas"></div></td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>
                      </div>
                      <div class="view-mail-content">
                        <div class="sparkline8-graph">
                          <div class="static-table-list">
                            <table class="table" border="1">
                              <thead>
                                <tr>
                                  <th style="text-align:center;" colspan="2">Stakeholder Introduction&nbsp;<i class="fa fa-edit popup" href="sh-update-introduction.php?sid=<?php echo $shInfo['id'];?>" style=" cursor:pointer;" title="CLick to update info"></i></th>
                                </tr>
                              </thead>
                              <tbody>
                                <tr>
                                  <td colspan="2"><div id="sh_intro"><?php echo $shInfo['description'];?> </div>
                                    <input for="clear" id="clear" name="clear" title="Erase all names from the grid" type="button" value="Clear" style="display:none;">
                                  </td>
                                </tr>
                                <tr>
                                  <th width="23%">Areas of Operations</th>
                                  <td width="77%" ><?php echo $shInfo['areas_of_operations'];?></td>
                                </tr>
                                <?php
                                if($shid!=14){
                                ?>
                                <tr>
                                  <th width="23%">PWD Oriented</th>
                                  <td width="77%" ><?php echo ($shInfo['pwd_oriented']=='Y')?"Yes":"No";?></td>
                                </tr>
                                <?php
                                }
                                ?>
                                <tr>
                                  <th width="23%">Address</th>
                                  <td width="77%" ><?php echo $shInfo['address'];?></td>
                                </tr>
                                <tr>
                                  <th width="23%">Focal Person</th>
                                  <td width="77%" ><?php echo $shInfo['focal_person'];?></td>
                                </tr>
                                <tr>
                                  <th width="23%">Contact#</th>
                                  <td width="77%" ><?php echo $shInfo['tel_no'];?></td>
                                </tr>
                                <tr>
                                  <th width="23%">E-mail</th>
                                  <td width="77%" ><?php echo $shInfo['email'];?></td>
                                </tr>
                                <tr>
                                  <th width="23%">Website</th>
                                  <td width="77%" ><?php echo $shInfo['website_url'];?></td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>
                      </div>
                      <div class="view-mail-content">
                        <div class="sparkline8-graph">
                          <div class="static-table-list">
                            <table class="table" border="1">
                              <div style="text-align:right;"><i class="fa fa-edit popup" href="sh-update-summries.php?sid=<?php echo $shInfo['id'];?>" style=" cursor:pointer;" title="CLick to update info"></i></div>
                              <tbody>
                                <tr>
                                  <th width="40%">Summary of <?php echo !empty($orgsInfo['name'])?$orgsInfo['name']:'';?> interaction with stakeholder.</th>
                                  <td width="60%" id="sh_summary_interaction"><?php echo $shInfo['sh_summary_interaction'];?></td>
                                </tr>
                                <tr>
                                  <th>What is important for Stakeholder?</th>
                                  <td id="important_for_sh"><?php echo $shInfo['important_for_sh'];?></td>
                                </tr>
                                <tr>
                                  <th>How could SH contribute to <?php echo !empty($orgsInfo['name'])?$orgsInfo['name']:'';?>.</th>
                                  <td id="sh_contribute"><?php echo $shInfo['sh_contribute'];?></td>
                                </tr>
                                <tr>
                                  <th>How could the stakeholder block <?php echo !empty($orgsInfo['name'])?$orgsInfo['name']:'';?>?</th>
                                  <td id="sh_block"><?php echo $shInfo['sh_block'];?></td>
                                </tr>
                                <tr>
                                  <th>Key Issues/Concerns of stakeholder.</th>
                                  <td id="sh_issues_concerns"><?php echo $shInfo['sh_issues_concerns'];?></td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>
                      </div>
                      <div class="sparkline8-graph">
                        <div class="static-table-list">
                          <table class="table" border="1">
                            <thead>
                              <tr>
                                <th colspan="6" style="text-align:center;">Interaction Updates&nbsp;<i class="fa fa-plus popup" href="sh-add-interactions.php?sid=<?php echo $shInfo['id'];?>" style=" cursor:pointer;" title="Add Interaction"></i></th>
                              </tr>
                              <tr>
                                <th width="20%">Interaction#</th>
                                <th width="20%">Date</th>
                                <th width="40%">Interaction</th>  
                                <th width="40%">Attachment</th>                               
                                <th width="20%">Actions</th>
                              </tr>
                            </thead>
                            <tbody id="shInterationsUpdates">
                              <?php 
									$counter_intupd = 0;
									$selQuery_int_upd = "SELECT * FROM  ".TBL_INTERACTION_UPDATES." WHERE sh_id='".$_GET['sid']."' ORDER BY id desc;";
									$intupdInfo = $con->getMultiRow($selQuery_int_upd);
									$tot_mappingsInfo = count($intupdInfo);
									if($tot_mappingsInfo > 0)
									{
										 for($int=0;$int<$tot_mappingsInfo;$int++)
										 {
											$counter_intupd++;
							  ?>
                              <?php if(!empty($intupdInfo[$int]['interaction_detail'])){?>                              
                              <tr>
                                <td id="interno_<?php echo $shInfo['id'];?>_<?php echo $intupdInfo[$int]['id'];?>"><?php echo $intupdInfo[$int]['interaction_no'];?></td>
                                <td id="interdate_<?php echo $shInfo['id'];?>_<?php echo $intupdInfo[$int]['id'];?>"><?php echo $intupdInfo[$int]['interaction_date'];?></td>
                                <td id="interdetail_<?php echo $shInfo['id'];?>_<?php echo $intupdInfo[$int]['id'];?>"><?php echo $intupdInfo[$int]['interaction_detail'];?></td>
                                <td id="attachment_file_<?php echo $shInfo['id'];?>_<?php echo $intupdInfo[$int]['id'];?>">
                                <a href="uploads/documents/<?php echo isset($intupdInfo[$int]['attachment_file'])?$intupdInfo[$int]['attachment_file']:'';?>" target="_blank" title="Click to view or download"><?php echo isset($intupdInfo[$int]['attachment_file'])?$intupdInfo[$int]['attachment_file']:'';?></a></td>
                                <td style="text-align:center;">
                                <i class="fa fa-edit popup" href="sh-update-interations.php?sid=<?php echo $intupdInfo[$int]['sh_id'];?>&intid=<?php echo $intupdInfo[$int]['id'];?>" style=" cursor:pointer;" title="Update Strategy"></i>&nbsp;
                                <i class="fa fa-trash popup" data-title="Delete Interation" href="del-interations.php?sid=<?php echo $intupdInfo[$int]['sh_id'];?>&intid=<?php echo $intupdInfo[$int]['id'];?>" style=" cursor:pointer;" title="Delete Strategy"></i>
                                </td>
                              </tr>                        
                              <?php }?>
                              <?php }
                             }?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div class="sparkline8-graph">
                        <div class="static-table-list">
                          <table class="table" border="1" id="strategies_table">
                            <thead>
                              <tr>
                                <th colspan="6" style="text-align:center;"><?php echo !empty($orgsInfo['name'])?$orgsInfo['name']:'';?> strategy, Responsibilities, execution, milestones achieved.&nbsp;<i class="fa fa-plus popup" href="sh-add-strategies.php?sid=<?php echo $shInfo['id'];?>" style=" cursor:pointer;" title="Add Strategy"></i></th>
                              </tr>
                              <tr>
                                <th width="3%">Sr#
                                  </td>
                                <th width="7%">Strategy</th>
                                <th width="34%">Responsibility</th>
                                <th width="26%">Key milestones</th>
                                <th width="33%">Related Documents</th>
                                <th>Actions</th>
                              </tr>
                            </thead>
                            <tbody id="shRISREMA">
                              <?php 
									$counter_str = 0;
									$selQuery_str = "SELECT * FROM  ".TBL_STRATEGIES." WHERE sh_id='".$_GET['sid']."' ORDER BY id desc;";
									$strInfo = $con->getMultiRow($selQuery_str);
									$tot_mappingsInfo = count($strInfo);
									if($tot_mappingsInfo > 0){
										 for($ru=0;$ru<$tot_mappingsInfo;$ru++)
										 {
											$counter_str++;
									?>
                              <tr>
                                <td><?php echo $counter_str;?>.</td>
                                <td id="strategy_<?php echo $shInfo['id'];?>_<?php echo $strInfo[$ru]['id'];?>"><?php echo isset($strInfo[$ru]['strategy'])?$strInfo[$ru]['strategy']:'';?></td>
                                <td id="responsibility_<?php echo $shInfo['id'];?>_<?php echo $strInfo[$ru]['id'];?>"><?php echo isset($strInfo[$ru]['responsibility'])?$strInfo[$ru]['responsibility']:'';?></td>
                                <td id="key_milestones_<?php echo $shInfo['id'];?>_<?php echo $strInfo[$ru]['id'];?>"><?php echo isset($strInfo[$ru]['key_milestones'])?$strInfo[$ru]['key_milestones']:'';?></td>
                                <td id="related_documents_<?php echo $shInfo['id'];?>_<?php echo $strInfo[$ru]['id'];?>">
                                <a href="uploads/documents/<?php echo isset($strInfo[$ru]['related_documents'])?$strInfo[$ru]['related_documents']:'';?>" target="_blank" title="Click to view or download"><?php echo isset($strInfo[$ru]['related_documents'])?$strInfo[$ru]['related_documents']:'';?></a></td>
                                <td style="text-align:center;">
                                <i class="fa fa-edit popup" href="sh-update-strategies.php?sid=<?php echo $strInfo[$ru]['sh_id'];?>&stid=<?php echo $strInfo[$ru]['id'];?>" style=" cursor:pointer;" title="Update Strategy"></i>&nbsp;
                                <i class="fa fa-trash popup" data-title="Delete Strategy" href="del-strategy.php?sid=<?php echo $strInfo[$ru]['sh_id'];?>&stid=<?php echo $strInfo[$ru]['id'];?>" style=" cursor:pointer;" title="Delete Strategy"></i>
                                </td>
                              </tr>
                              <?php }
                                    }?>
                              <tr>
                                <td colspan="6"></td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </div>
                      <div class="sparkline8-graph">
                        <div class="static-table-list" style="text-align:right;">
                          <a href="convert.php?shid=<?php echo $shid;?>" target="_blank"><button class="btn btn-sm btn-success login-submit-cs" type="button">Word</button></a>
                          <button class="btn btn-sm btn-success login-submit-cs" type="button" onClick="javascript: generatePDF('<?php echo $shid;?>');">PDF</button>
                         </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- Modal HTML -->
<!--<div id="myModal" class="modal fade">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
           
        </div>
    </div>
</div>-->
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <!--<div class="modal-header">
        <h4 class="modal-title"></h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>-->
      <div class="modal-body"> </div>
      <!--<div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>-->
    </div>
  </div>
</div>
<!-- Data table area End-->
<!-- Footer Start-->
<?php include("includes/footer.php");?>
<!-- Footer End-->
<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>
<!-- 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() {
	/*$( ".openPopup" ).click(function() {	
	  var dataURL = $(this).attr('data-target');	
      //$('#myModal').modal({show:true});  
		$('.modal-body').load(dataURL,function(){			
		    //$('#tblProductHistory').dataTable( {} );
            $('#myModal').modal({show:true});
        });
	});*/
	
	//$(".popup").colorbox();
	
	$(".popup").colorbox({
		/*onComplete : function() { 
		   $(this).colorbox.resize(); 
		},*/ 
	  escKey: false,
	  overlayClose: false,
	  opacity:"0.2",
	  width:"60%",
	   /*height:"500",
	  title:"To close this dialog click X icon at the right"*/
	});
	
	
});

function showSHUpdateModal(shid)
{
	var dataURL = "sh-update-card.php?sid="+shid;
	
	$(".modal-body").html("");
	$('.modal-body').load(dataURL,function(){	
		$('#myModal').modal({show:true});
	});
}

function generatePDF(sid)
{
	var url = 'tcpdf/examples/print-sh-card.php?shid='+sid;
	//var svg = generateSVG();
	var svg = paper.toSVG();
		
	if(svg!='')
	{		
		svgToPng(svg,(imgData)=>{
			
			//----------------------------
			$.ajax({
				  url : 'svgdiagram/ajax.php',
				  type: "POST",
				  data : 'action=saveSVGImg&shid=' + sid + '&svgImg=' + imgData + '&svg=' + encodeURIComponent(svg),
				  success: function(data, textStatus, jqXHR) {     
					
					data = $.trim(data);
					
					if(data == 'OK'){
						//	
					}								              
				  },
				  error: function (jqXHR, textStatus, errorThrown){
					//alert('ERROR');
				  },
				  complete:function(jqXHR,textStatus){ 
					window.open(url, '_blank').focus();
				  }
			});
			//----------------------------
			document.getElementById('myImg').style.display = 'none';
		});
	}	
}
</script>
<script>

   window.onload = function(){
   	//
   }
	
 //const svg = paper.toSVG();
	
 function svgToPng(svg, callback) {
	const url = getSvgUrl(svg);
	svgUrlToPng(url, (imgData) => {
		callback(imgData);
		URL.revokeObjectURL(url);
	});
}

function getSvgUrl(svg) {
    return  URL.createObjectURL(new Blob([svg], { type: 'image/svg+xml' }));
}

function svgUrlToPng(svgUrl, callback) {
   
	const svgImage = document.getElementById('myImg');
    document.body.appendChild(svgImage);
	
    svgImage.onload = function () {
        const canvas = document.createElement('canvas');
        canvas.width = svgImage.clientWidth;
        canvas.height = svgImage.clientHeight;
        const canvasCtx = canvas.getContext('2d');
        canvasCtx.drawImage(svgImage, 0, 0);
        const imgData = canvas.toDataURL('image/png');
        callback(imgData);
        //document.body.removeChild(imgPreview);
    };
    svgImage.src = svgUrl;
}
</script>

<img id="myImg" src="">

</body>
</html>