<?php
/**
 * Created by Sublime Text.
 * User: Gael Musikingala
 * Date: 2019-05-17
 * Time: 11:24 AM
 */

$ROUTE = $_SERVER['QUERY_STRING'];

$steps["client/details/non-sa-natural"] = array(
   "step" => 0
   , "stepName" => "Personal Details"
   , "stepLink" => "login.php?client/details/non-sa-natural
");

$steps["client/details/non-sa-natural/contact"] = array(
   "step" => 1
   , "stepName" => "Contact Information"
   , "stepLink" => "login.php?client/details/non-sa-natural/contact
");

$steps["client/details/non-sa-natural/product"] = array(
   "step" => 2
   , "stepName" => "Product Selection"
   , "stepLink" => "login.php?client/details/non-sa-natural/product
");

$steps["client/details/non-sa-natural/bank"] = array(
   "step" => 3
   , "stepName" => "Bank Details"
   , "stepLink" => "login.php?client/details/non-sa-natural/bank
");

$steps["client/details/non-sa-natural/review"] = array(
   "step" => 4
   , "stepName" => "Review & Submit"
   , "stepLink" => "login.php?client/details/non-sa-natural/review
");

$currentStep = $steps[$ROUTE]["step"];
$WizardHeader = "
   <div class='circle-small'>
      <h5 class='margin-top-30' style='color:#fff;'>Questions?</h5>
      <p class='small text-center' style='color:#fff;'>Please don't hesitate to contact us if you have any queries</p>
      <h5 style='color:#fff;'>business@sabullion.co.za</h5>
      <h5 style='color:#fff;'>+21 21 447 3240</h5>
  </div>
";

$i = 0;
foreach ($steps as $route => $stepDetails) 
{
   $i++;
   //20190510 - Adding css class - Gael
   $done = ($currentStep >= $steps[$route]["step"]) ? "done" : '';
   $first = ($steps[$route]["step"] == 0 ) ? "first" : "" ;
   $last = ($steps[$route]["step"] == 4  ) ? "last" : "" ;

   //20190510 - Remove duplicates steps. - Gael
   $arrCheck[] = $steps[$route]["step"];
   if(count(array_keys($arrCheck, $steps[$route]["step"])) > 1){
      continue;
   }
   $colSize = ($i%2 == 1) ? "col-md-2" : "col-md-3";

   $strStepContent .= "
      <div class='$colSize 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='jsClearSANonNaturalNextStepInputs(".$steps[$route]["step"].");' href='".$steps[$route]["stepLink"]."'>".$steps[$route]["stepName"]."</a>
         </div>
      </div>
   ";
}

echo "
	<div class='row'>
    	<div class='col-md-10 col-md-offset-1'>
        	<div class='mt-element-step'>
            <div class='row step-line'>
               $strStepContent
            </div>
        </div>
   	</div>
      <div class='clearfix'></div>
   	<div class='$boxSize'>
   		$WizardHeader
         $WizardContent
      </div>
   </div>

   <script>
      function jsClearSANonNaturalNextStepInputs(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=jsClearSANonNaturalNextStepInputs&step='+step;
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open( 'GET', url, false ); 
            xmlHttp.send( null );
            //alert(xmlHttp.responseText);
         }else{
            return false;
         }
      }
   </script>
";
?>