<?php
/**
 * Created by Sublime Text.
 * User: Gael Musikingala
 * Date: 2019-05-10
 * Time: 11:24 AM
 */

$ROUTE = $_SERVER['QUERY_STRING'];


$steps["client/details/sa-natural"] = array(
   "step" => 0
   , "stepName" => "Personal Details"
   , "stepLink" => "login.php?client/details/sa-natural
");

$steps["client/details/sa-natural/contact"] = array(
   "step" => 1
   , "stepName" => "Contact Information"
   , "stepLink" => "login.php?client/details/sa-natural/contact
");

$steps["client/details/sa-natural/product"] = array(
   "step" => 2
   , "stepName" => "Product Selection"
   , "stepLink" => "login.php?client/details/sa-natural/product
");

$steps["client/details/sa-natural/contribution"] = array(
   "step" => 3
   , "stepName" => "Transaction Details"
   , "stepLink" => "login.php?client/details/sa-natural/contribution
");

$steps["client/details/sa-natural/payment"] = array(
   "step" => 3
   , "stepName" => "Transaction Details"
   , "stepLink" => "login.php?client/details/sa-natural/payment
");

$steps["client/details/sa-natural/tax"] = array(
   "step" => 3
   , "stepName" => "Transaction Details"
   , "stepLink" => "login.php?client/details/sa-natural/tax
");

$steps["client/details/sa-natural/bank"] = array(
   "step" => 4
   , "stepName" => "Bank Details"
   , "stepLink" => "login.php?client/details/sa-natural/bank
");

$steps["client/details/sa-natural/review"] = array(
   "step" => 5
   , "stepName" => "Review & Submit"
   , "stepLink" => "login.php?client/details/sa-natural/review
");

$currentStep = $steps[$ROUTE]["step"];
$WizardHeader = "
   <div class='circle-small'>
      <h5 class='bold font-18px margin-top-30' style='color:#fff; margin-bottom:20px '><b>Questions ?</b></h5>
      <hr style='width:55px; margin: auto;'>
      <p class='text-center' style='color:#fff; line-height: 20px'>Please don't hesitate to <br> contact us if you have any <br> queries</p>
      <h5 class='margin-top-30' style='color:#fff;'>business@sabullion.co.za</h5>
      <h5 style='color:#fff;'>+21 21 447 3240</h5>
  </div>
";

$ii = 0;
$strStepContent ="";
foreach ($steps as $route => $stepDetails) 
{
   //20190510 - Adding css class - Gael
   $done = ($currentStep >= $steps[$route]["step"]) ? "done" : '';
   $first = ($steps[$route]["step"] == 0 ) ? "first" : "" ;
   $last = ($steps[$route]["step"] == 5  ) ? "last" : "" ;

   //20190510 - Remove duplicates steps. - Gael
   $arrCheck[] = $steps[$route]["step"];
   if(count(array_keys($arrCheck, $steps[$route]["step"])) > 1){
      continue;
   }

   // $strStepContent .= "
   //    <div class='col-md-2 mt-step-col $first $last $done'>
   //       <div class='mt-step-title'>
   //          <a id='aStep_".$steps[$route]["step"]."' style='text-decoration: none; font-weight: normal;' 
   //          onclick='jsClearSANaturalNextStepInputs(".$steps[$route]["step"].");' href='".$steps[$route]["stepLink"]."'>".$steps[$route]["stepName"]."</a>
   //       </div>
   //    </div>
   // ";

   $strStepContent .= "
      <div class='col-md-2 mt-step-col $first $last $done'>
         <div class='mt-step-title $first'>
            <a id='aStep_".(isset($steps[$route]["step"]) ? $steps[$route]["step"] : '')."' style='text-decoration: none; font-weight: normal;' 
             href='#'>".$steps[$route]["stepName"]."</a>
         </div>
      </div>
   ";
}

echo "
	<div class='row'>
    	<div class='col-md-10 col-md-offset-1'>
        	<div class='mt-element-step' style='padding-left:144px;'>
            <div class='row '>
               $strStepContent
            </div>
        </div>
   	</div>
      <div class='clearfix'></div>
   	<div class='$boxSize'>
   		$WizardHeader
         $WizardContent
      </div>
   </div>

   <script>
      function jsClearSANaturalNextStepInputs(step)
      {
         if(confirm(\"Are you sure you want to back to this step, You are going to lose all the next steps data?\"))
         {
            var url = '../dashboard/ajaxFunctions.php?type=jsClearSANaturalNextStepInputs&step='+step;
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open( 'GET', url, false ); 
            xmlHttp.send( null );
            //alert(xmlHttp.responseText);
         }else{
            return false;
         }
      }
   </script>
";
?>