<?php
include("../../packages/require.php");
include("controller/controller_access.php");
$curpage = "access";
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <title><?=$title['access'];?></title>
    <?php include($global['root']."packages/head.php");?>
</head>
<body class="<?=$global['body-css'];?>">
    <div class="wrapper">

        <?php include($global['root']."section/header.php");?>
      
        <?php include($global['root']."section/sidebar.php");?>

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                  <h1>
                    Module Role Access
                    <small>Adding and editing your role access list</small>
                  </h1>
                  <ol class="breadcrumb">
                        <li><a href="<?=$path['dashboard'];?>"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="<?=$path['access'];?>">Role Access</a></li>
                  </ol>
            </section>

            <!-- Main content -->
            <section class="content">
                <!-- Default box -->
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">Add New Data</h3>
                    </div>
                    <form name="form-insert" action="module/access/insert.php?action=add" enctype="multipart/form-data" method="post" onsubmit="return validateForm();">
                        <div class="box-body">
                            <div class="form-group" style="width: 500px;">
                                <label for="input-title">Title *</label>
                                <input type="text" class="form-control" name="title" id="input-title" placeholder="Title">
                                <div id="error-title" class="error-text"></div>
                            </div>
                            <div class="form-group" style="width: 500px;">
                                <label for="input-slug">Slug *</label>
                                <input type="text" class="form-control" name="slug" id="input-slug" placeholder="Slug">
                                <div id="error-slug" class="error-text"></div>
                            </div>
                            <div class="form-group" style="width: 500px;">
                                <label for="input-module">Module *</label>
                                <select id="input-module" name="module" class="form-control">
                                    <option value="">-Choose Page-</option>
                                    <option value="general">General</option>
                                    <option value="dashboard">Dashboard</option>
                                    <option value="po">PO</option>
                                    <option value="report">Report</option>
                                    <option value="client">Client</option>
                                    <option value="region">Region</option>
                                    <option value="unit">Unit</option>
                                    <option value="ppn">PPN</option>
                                    <option value="admin">Admin</option>
                                </select>
                                <div id="error-module" class="error-text"></div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer clearfix">
                            <div class="row">
                                <div class="col-sm-6 col-xs-6">
                                    <div class="text-left">
                                        <a href="<?=$path['access'];?>" class="btn btn-default">
                                            <i class="fa fa-arrow-left"></i> Back
                                        </a>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-xs-6">
                                    <div class="text-right">
                                        <div class="btn-group">
                                            <button type="submit" class="btn btn-success">
                                                <i class="fa fa-save"></i> Save Data
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-footer-->
                    </form>
                </div>
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->

        <?php include($global['root']."section/footer.php");?>

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

    <?php include($global['root']."packages/footer.php");?>
    <script type="text/javascript">
        function validateForm(){
            var title = $("#input-title").val();
            var modules = $("#input-module").val();

            if(title != ""){
                $("#error-title").html("");
                $("#error-title").hide();
                $("#input-title").removeClass("input-error");
            } else {
                $("#error-title").show();
                $("#error-title").html("<i class='fa fa-warning'></i> This field is required.");
                $("#input-title").addClass("input-error");
                $("#input-title").focus();
                return false;
            }
            if(modules != ""){
                $("#error-module").html("");
                $("#error-module").hide();
                $("#input-module").removeClass("input-error");
            } else {
                $("#error-module").show();
                $("#error-module").html("<i class='fa fa-warning'></i> This field is required.");
                $("#input-module").addClass("input-error");
                $("#input-module").focus();
                return false;
            }
        }
    </script>
</body>
</html>