<?php
include_once('components/header.php');
$page = isset($_GET['page']) ? $_GET['page'] : 'home';

if($page == 'add_child')
{
    $page_title = "Add Child";
    $add_btn_active = 'active';
    $hide_search = true;
}
else
{
    if($page == 'edit_child')
    {
        $page_title = "Edit Child";
        $add_btn_active = '';
        $hide_search = true;
    }
    else
    {
       $add_btn_active = '';
        $hide_search = false; 
    } 
}
?>
<div class="content">
    <div class="left-content">
        <div class="top-links">
            <div class="side-bar-head">
                Control Panel
            </div>
            <a class="sidebar-btn <?php echo $add_btn_active ?>" href="index.php?page=add_child">Add Child</a>
        </div>
        <a id="logout" class="sidebar-btn logout">Log out</a>
    </div>
    <div class="right-content">
        <div class="top-header">
            <div class="search-bar">
                <?php
                if (!$hide_search) {
                    echo '<input type="text" class="search-box" placeholder="Search Child">';
                }
                else
                {
                    echo '<h3 class="title">'.$page_title.'</h3>';
                }
                ?>
            </div>
        </div>
        <?php
        switch ($page) {
            case 'edit_child':
                require_once('./edit_child.php');
                exit;
            case 'add_child':
                require_once('./add_child.php');
                exit;
            case 'dashboard':
                require_once('./child_list.php');
                exit;
            case 'home':
            default:
                require_once('./child_list.php');
        }
        ?>
    </div>
</div>
<?php
include_once('components/footer.php');
?>