<?php
   include ('include_fns.php');

  session_start();

  function Show_Wizard_Body($account, $patient)
  {
    if(!check_admin_user())
    {
     echo "You do not seem to be logged in.";
     exit;
    }

    $CellNo = '';
    
    if (($account != '')&&($patient != -1))
    {
      $lstCellNo = ExecuteQuery("SELECT CELL FROM PATIENT WHERE ACCOUNT_KEY = '$account' AND PATIENT_KEY = $patient");
      $CellNo = $lstCellNo[0][0];
    }
    
    ?>

    <style>

    .ui-tabs.ui-tabs-vertical {
      padding: 0;
      width: 100%;
    }

    .ui-tabs.ui-tabs-vertical .ui-widget-header {
       border: none;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-nav {
      float: left;
      width: 10em;
      background: #CCC;
      border-radius: 4px 0 0 4px;
      border-right: 1px solid gray;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-nav li {
      clear: left;
      width: 100%;
      margin: 0.2em 0;
      border: 1px solid gray;
      border-width: 1px 0 1px 1px;
      border-radius: 4px 0 0 4px;
      overflow: hidden;
      position: relative;
      right: -2px;
      z-index: 2;
    }
    
    .ui-tabs.ui-tabs-vertical .ui-tabs-nav li a {
      display: block;
      width: 100%;
      padding: 0.6em 1em;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-nav li a:hover {
      cursor: pointer;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active {
      margin-bottom: 0.2em;
      padding-bottom: 0;
      border-right: 1px solid white;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-nav li:last-child {
      margin-bottom: 10px;
    }

    .ui-tabs.ui-tabs-vertical .ui-tabs-panel {
      float : left;
      width: 70%;
      position : relative;
    }

    </style>

    <script src="SMSdialog.js"></script>
    <script src="patientdialog.js"></script>


    <script>

      var account = '<?php echo $account ?>';
      var patient = <?php echo $patient ?>;
      var cellno  = '<?php echo $CellNo ?>';
      
      $(function() {

        $("#tabs2").tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );

        $('#btnEditPatient').button({ icons: { primary: 'ui-icon-folder-open'} }).click(function(event, ui){
           EditInsertPatient('edit', event, ui, account, patient);
        });

        $('#btnNotes').button({ icons: { primary: 'ui-icon-note'} }).click(function(){
           window.location.href = 'notes.php?id=' + account + '&id2=' + patient;
        });

        if (cellno != '')
        {
          $('#btnSendSMS').button({ icons: { primary: 'ui-icon-comment'} }).click(function(event, ui){
             CreateSMS(event, ui, account, patient, cellno);
          });
        }
        
        $('#btnPrintProfile').button({ icons: { primary: 'ui-icon-print'} }).click(function(){
           window.open('PatientProfilePDF.php?Account=' + account + '&Patient=' + patient, '_BLANK');
        });
        
      });
    </script>



    <?php

    if ($account <> '')
    {
      echo "<table width = 100% cellspacing = 0 cellpadding = 0 border = 0 id = 'patientwizardbody' class='shadetable indented'>";
      echo "<tr>";
      echo "<td valign='top' scope='col'>";
      echo "<div id = 'tabs2'>";
      echo "  <ul>";
      echo "    <li><a href = 'WizardInfo.php?header=Patient&account=".$account."&patient=".$patient."'>Patient</a></li>";
      echo "    <li><a href = 'WizardInfo.php?header=Address&account=".$account."&patient=".$patient."'>Address</a></li>";
      echo "    <li><a href = 'WizardInfo.php?header=Appointments&account=".$account."&patient=".$patient."'>Appointments</a></li>";
      echo "    <li><a href = 'WizardInfo.php?header=Notes&account=".$account."&patient=".$patient."'>Patient Notes</a></li>";
      echo "    <li><a href = 'WizardInfo.php?header=SMS&account=".$account."&patient=".$patient."'>SMS History</a></li>";      
      echo "  </ul>";
      echo "</div>";
      echo "</td>";
      echo "<td width = '200' valign = 'top' scope='col'>";
	    echo "  <table width = '200' border='0' align='left'>";
	  
      if (($_SESSION['driver'] == '-1')&&($_SESSION['viewonly']=='F'))
      {  
        echo "	  <tr>";
	      echo "		<td width = '200' align = 'middle'><button id='btnEditPatient' class='wizardbtns'>Edit Patient</button></td>";
	      echo "	  </tr>";
	      echo "	  <tr>";
	      echo "		<td width = '200' align = 'middle'><button id='btnNotes' class='wizardbtns'>Additional Notes</button></td>";
	      echo "	  </tr>";
      }  

      if ($CellNo != '')
      {
        echo "	  <tr>";
	    echo "		<td width = '200' align = 'middle'><button id='btnSendSMS' class='wizardbtns'>Send SMS</button></td>";
	    echo "	  </tr>";
      };
    
    echo "    <tr>";
    echo "    <td width = '200' align = 'middle'><button id='btnPrintProfile' class='wizardbtns'>Print Profile</button></td>";
    echo "    </tr>";
      
      echo "  </table>";
      echo "</td>";
      echo "</tr>";
      echo "</table>";
    }
  }
  
  $account = $_GET['account'];
  $patient = $_GET['patient'];
  
  Show_Wizard_Body($account, $patient);

?>
  
