<div class="content-header">
    <div class="container-fluid">
        <div class="row column_title">
            <div class="col-md-12">
                <div class="page_title">
                    <h2><?php echo (isset($customerdetails)) ? 'Edit Admin' : 'Add Admin' ?></h2>
                </div>
            </div>
        </div>
    </div>
</div>
<section class="content">
    <div class="container-fluid">
        <?php
        if(isset($customerdetails)) {
          $action = 'updateadmin';
        }else{
          $action = 'insertadmin';
        }
      ?>
        <form method="post" id="customer_add" class="card" action="<?php echo base_url() . "admin/".$action; ?>">
            <div class="card-body">

                <div class="row">
                    <input type="hidden" name="id" id="c_id" value="<?php echo (isset($customerdetails)) ? $customerdetails['id'] : '' ?>">
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label class="form-label">Full Name<span class="form-required">*</span></label>
                            <input type="text" required="true" class="form-control" value="<?php echo (isset($customerdetails)) ? $customerdetails['name'] : '' ?>" id="c_name" name="name" placeholder="Full Name">
                        </div>
                    </div>

                    <div class="col-sm-6 col-md-4">
                        <div class="form-group">
                            <label class="form-label">Email</label>
                            <input type="text" required="true" class="form-control" value="<?php echo (isset($customerdetails)) ? $customerdetails['email'] : '' ?>" id="c_email" name="email" placeholder="User Email" <?php if(isset($customerdetails)) { ?> disabled<?php } ?>>

                        </div>
                    </div>

                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label class="form-label">Password<span class="form-required">*</span></label>
                            <input class="form-control" required="true" id="c_password" autocomplete="off" type="password" placeholder="Password" name="password" value="<?php echo (isset($customerdetails)) ? $customerdetails['password'] : '' ?>">
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label class="form-label">Permissions<span class="form-required">*</span></label>
                            <select name="permissions" class="form-control" required="true" id="permissions">
                                <option value="" selected disabled>Assign Permissions</option>
                                <option value="ReadOnly" <?php if($customerdetails['permissions'] == "ReadOnly") { ?> selected<?php } ?>>Read Only</option>
                                <option value="ReadUpdate" <?php if($customerdetails['permissions'] == "ReadUpdate") { ?> selected<?php } ?>>Read and Update</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 pt-5">
                        <div class="form-check">
                            <input type="checkbox" class="form-check-input" value="true" id="sendReports" name="sendReports" <?=$customerdetails['sendReports']===true ? 'checked' : '';?>>
                            <label class="form-check-label" for="exampleCheck1">Send this user Report Emails</label>
                        </div>
                    </div>
                </div>
                <?php if(!isset($customerdetails)) { ?>
                <input type="hidden" id="c_created_date" name="createdDate" value="<?php echo date('Y-m-d h:i:s'); ?>">
                <?php } ?>
                <div class="modal-footer">

                    <button type="submit" class="btn btn-primary"> <?php echo (isset($customerdetails)) ? 'Update Admin' : 'Add Admin' ?></button>
                </div>
            </div>
        </form>
    </div>
</section>
<!-- /.content -->