<!DOCTYPE html>
<html>

<head>
    <!-- TABLES CSS CODE -->
    <?php include "comman/code_css_form.php"; ?>
    <!-- </copy> -->
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

        <?php include "sidebar.php"; ?>
        <?php
        if (!isset($authority_name)) {
            $authority_name = $authority_email = $authority_contact_number = $authority_cash_credit = $authority_status = $authority_address = $authority_note = $q_idd = "";
        }
        ?>

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    <?= $page_title; ?>
                    <small>Add/Update Authority</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="<?php echo $base_url; ?>dashboard"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li><a href="<?php echo $base_url; ?>authority\/view">Authority List</a></li>
                    <li class="active"><?= $page_title; ?></li>
                </ol>
            </section>

            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <!-- right column -->
                    <div class="col-md-3">
            <?php require_once 'sub_sidemenu_management.php'; ?>
          </div> 
                    <div class="col-md-9">
                        <!-- Horizontal Form -->
                        <div class="box box-info ">
                            <div class="box-header with-border">
                                <h3 class="box-title">Please Enter Valid Data</h3>
                            </div>
                            <!-- /.box-header -->
                            <!-- form start -->
                            <form id="authority-form">
                                <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
                                <input type="hidden" id="base_url" value="<?php echo $base_url;; ?>">
                                <div class="box-body">
                                    <div class="col-sm-12">
                                        <label for="authority_name" class="control-label"> Name<label class="text-danger">*</label></label>
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="authority_name" name="authority_name" placeholder="Enter a name" value="<?=$authority_name?>">
                                            <span id="authority_name_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <label for="authority_email" class="control-label">Email<label class="text-danger">*</label></label>
                                        <div class="form-group">
                                            <input type="email" class="form-control" id="authority_email" name="authority_email" placeholder="Enter your email address" value="<?=$authority_email?>">
                                            <span id="authority_email_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <label for="authority_contact_number" class="control-label">Contact Number<label class="text-danger">*</label></label>
                                        <div class="form-group">
                                            <input type="number" class="form-control" id="authority_contact_number" name="authority_contact_number" placeholder="Enter a contact number" value="<?=$authority_contact_number?>">
                                            <span id="authority_contact_number_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <label for="authority_address" class="control-label">Address</label>
                                        <div class="form-group">
                                            <textarea type="text" class="form-control" id="authority_address" name="authority_address" placeholder="Enter an Address"><?=$authority_address?></textarea>
                                            <span id="authority_address_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <label for="authority_note" class="control-label">Note</label>
                                        <div class="form-group">
                                            <textarea type="text" class="form-control" id="authority_note" name="authority_note" placeholder="Write your note here"><?=$authority_note?></textarea>
                                            <span id="authority_note_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <label for="authority_cash_credit" class="control-label">Cash Credit (CC) Loan Permit<label class="text-danger">*</label></label>
                                        <div class="form-group">
                                            <input type="number" class="form-control" id="authority_cash_credit" name="authority_cash_credit" placeholder="Cash Credit here.." value="<?=$authority_cash_credit?>">
                                            <span id="authority_cash_credit_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label style="margin-bottom: 10px !important;" for="authority_status" class="control-label">Status </label>
                                            <select name="authority_status" class="form-control" id="authority_status">
                                                <option selected disabled>--select status--</option>
                                                <option value="1" <?= ($authority_status=='1') ? 'selected' : '' ?>>Active</option>
                                                <option value="0" <?= ($authority_status=='0') ? 'selected' : '' ?>>Inactive</option>
                                            </select>
                                            <span id="authority_status_msg" style="display:none" class="text-danger"></span>
                                        </div>
                                    </div>
                                    
                                    <!-- /.box-footer -->
                                    <div class="box-footer">
                                        <div class="col-sm-8 col-sm-offset-2 text-center">
                                            <!-- <div class="col-sm-4"></div> -->
                                            <?php
                                            if ($authority_name != "") {
                                                $btn_name = "Update";
                                                $btn_id = "update";
                                            ?>
                                                <input type="hidden" name="q_id" id="q_id" value="<?php echo $q_idd; ?>" />
                                            <?php
                                            } else {
                                                $btn_name = "Save";
                                                $btn_id = "save";
                                            }

                                            ?>

                                            <div class="col-md-3 col-md-offset-3">
                                                <button type="button" id="<?php echo $btn_id; ?>" class=" btn btn-block btn-success" title="Save Data"><?php echo $btn_name; ?></button>
                                            </div>
                                            <div class="col-sm-3">
                                                <a href="<?= base_url('dashboard'); ?>">
                                                    <button type="button" class="col-sm-3 btn btn-block btn-warning close_btn" title="Go Dashboard">Close</button>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- /.box-footer -->
                            </form>
                        </div>
                        <!-- /.box -->

                    </div>
                    <!--/.col (right) -->
                </div>
                <!-- /.row -->

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

        <?php include "footer.php"; ?>


        <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
        <div class="control-sidebar-bg"></div>
    </div>
    <!-- ./wrapper -->
    <!-- SOUND CODE -->
    <?php include "comman/code_js_sound.php"; ?>
    <!-- TABLES CODE -->
    <?php include "comman/code_js_form.php"; ?>

    <script src="<?php echo $theme_link; ?>js/authority.js"></script>
    <!-- Make sidebar menu hughlighter/selector -->
    <script>
        $(".<?php echo basename(__FILE__, '.php'); ?>-active-li").addClass("active");
    </script>
</body>

</html>