<?php
/**
 * Created by PhpStorm.
 * User: Gael Wamba Musikingala
 * Date: 2019/05/21
 * Time: 8:33 AM
 */

//20190521 - Included the layout in wizard steps. - Gael

// print_rr($_REQUEST);
// die("XXXX");

$stepData = json_decode($_COOKIE[$_SERVER["QUERY_STRING"]]);
//print_rr($stepData);

$title = isset($stepData) ? $stepData->title : "";
$name = isset($stepData) ? $stepData->name : "";
$lastName = isset($stepData) ? $stepData->lastName : "";
$Email_Address = isset($stepData) ? $stepData->Email_Address : "";
$idNumber = isset($stepData) ? $stepData->idNumber : "";
$birth = isset($stepData) ? $stepData->birth : "";
$Telephone_Home = isset($stepData) ? $stepData->Telephone_Home : "";
$Telephone_Mobile = isset($stepData) ? $stepData->Telephone_Mobile : "";

$pdo = $SA->query('SELECT type FROM inputtitles');
$pdo->execute();
$results = $pdo->fetchAll();

foreach ($results as $row) {
    $selected = ($row["type"] == $title ) ? "selected" : "";
    $titleOptions .= "<option value='".$row["type"]."' $selected>".$row['type']."</option>";
}


$WizardContent = "
    <h1 class='text-center'>Contact Person Information</h1>
    <form role='form' id='sa-legal-basic'>
        <div class='form-body padding-top35px'>
            <div class='form-group form-md-line-input' id='title'>
                <select class='form-control edited input-lg' id='form_control_1'>
                    <option value='NONE' selected=''>Please select</option>
                    $titleOptions
                </select>
                <label for='form_control_1'>Title</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='name' >
                <input type='text' class='form-control input-lg' value='$name'>
                <label for='form_control_1'>Name</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='lastName'>
                <input type='text' class='form-control input-lg' value='$lastName'  >
                <label for='form_control_1'>Last Name</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='Email-Address' >
                <input type='email' class='form-control input-lg' value='$Email_Address'>
                <label for='form_control_1'>Email Address <span class='required' aria-required='true'>*</span></label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='idNumber'>
                <input type='numbers' class='form-control input-lg' value='$idNumber' maxlength='13'>
                <label for='form_control_1'>ID Number</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input ' id='birth'>
                <input type='text' class='form-control input-lg' value='$birth' id='mask_date2'>
                <label for='form_control_1'>Date of Birth</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='Telephone-Home' >
                <input type='text' class='form-control input-lg' value='$Telephone_Home' id='mask_phone_home'>
                <label for='form_control_1'>Telephone Home</label>
                <span class='help-block hiddenContent'></span>
            </div>

            <div class='form-group form-md-line-input' id='Telephone-Mobile' >
                <input type='text' class='form-control input-lg' value='$Telephone_Mobile' id='mask_phone_mobile'>
                <label for='form_control_1'>Telephone Mobile <span class='required' aria-required='true'>*</span></label>
                <span class='help-block hiddenContent'></span>
            </div>
        </div>

        

        <div class='col-md-6 col-xs-12'>
            <div class='form-actions noborder'>
                <div class='padding-top52px'></div>
                <a href='#'>
                    <button type='button' class='btn purple btn-lg' id='backButton'>Back</button>
                </a>
            </div>
        </div>

        <div class='col-md-6 col-xs-12'>
            <div class='form-actions noborder'>
                <div class='padding-top52px'></div>
                <a href='#'>
                    <button type='button' class='btn purple btn-lg' id='saveData'>Continue</button>
                </a>
            </div>
        </div>

        <div class='form-actions noborder hidden' id='updateContact'>
            <div class='padding-top52px'></div>
            <a href='#'>
                <button type='button' class='btn purple btn-lg' id='updateButton'>Update</button>
            </a>
        </div>

        <div class='padding-bottom-100px'> </div>
    </form>
    <div class='padding-bottom-100px'> </div>
";

require("layout_basic.php");
?>
