<?php
include("core/init.php");
include("session.php");
/***********Table Used**********/
$mainTable = "inquries"; //Module main table name.
/****************View Detail Process Starts**********************/
$record = null;
if (Input::particularInputExists("get", "id")) {
    if (Db::getInstance()->num_rows("select id from {$mainTable} where id='" . Input::getInput("id") . "'") > 0) {
        $record = Db::getInstance()->get_row("select * from {$mainTable} where id='" . Input::getInput("id") . "'");
    } else {
        Redirect::to("Inquiries");
    }
}
/****************View Detail Process Ends**********************/
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Inquiry Detail - <?php echo Config::get("project/site_title"); ?></title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="shortcut icon" href="dist/img/admin-panel.png">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">

    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div>
        <!-- Content Wrapper. Contains page content -->
        <div>
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    Inquiry Detail
                    <small></small>
                </h1>
            </section>

            <!-- Main content -->
            <section class="content">

                <div class="row">

                    <div class="col-md-12">

                        <div class="box box-primary">
                            <div class="box-body table-responsive box-header">
                                <table class="table table-striped table-bordered table-hover">
                                    <colgroup>
                                        <col style="width: 30%;">
                                        <col style="width: 70%;">
                                    </colgroup>
                                    <tbody>
                                        <tr>
                                            <td>Name</td>
                                            <td><?php echo $record['name']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Email</td>
                                            <td><?php echo $record['email']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Phone Number</td>
                                            <td><?php echo $record['phone']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Location</td>
                                            <td><?php echo $record['location']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Message</td>
                                            <td><?php echo $record['message'] ? nl2br($record['message']) : ''; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Created At</td>
                                            <td>
                                                <?php 
                                                $createdAt = new DateTime($record["date_time"]);
                                                echo $createdAt->format(Config::get("formats/dt_tm_report"));
                                                ?>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.box-body -->
                        </div>
                        <!-- /.box -->

                    </div>

                </div>

            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->

    </div>
    <!-- ./wrapper -->

    <!-- jQuery 2.2.3 -->
    <script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- Bootstrap 3.3.6 -->
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <!-- Slimscroll -->
    <script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="plugins/fastclick/fastclick.js"></script>
    <!-- AdminLTE App -->
    <script src="dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="dist/js/demo.js"></script>
</body>

</html>