<script type="text/javascript" src="<?php echo base_url();?>assets/js/user.js"></script>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">User Add</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
<?php #echo '<pre>';print_r($masters_str);exit;?>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <!-- general form elements -->
                <div class="box box-danger">
                    <span class="all_mandatory">All fields are mandatory</span>
                    <!-- form start -->
                    <div class="box-body form-box">
                        <form action="<?php echo $form_action;?>" method="post" name="user" id="user">
                            <input type="hidden" name="user_id" value="" />
                            <div class="error_wrapper">
                                <span><ul class="error_container"></ul></span>
                            </div>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Name</label>
                                        <input type="text" class="form-control" name="name" placeholder="Name" maxlength="20" autofocus />
                                    </div>
                                    
                                    <div class="form-group m-h30">
                                        <label class="leftcol">Role</label>
                                        <label class="radio_label" for="role">
                                            <input type="radio" name="role" value="2" /> &nbsp;&nbsp;Administrator
                                        </label> 
                                        <label class="radio_label" for="role">
                                            <input type="radio" name="role" value="1" checked /> &nbsp;&nbsp;User
                                        </label> 
                                    </div>
                                    
                                    <div class="form-group" style="clear: both;">
                                        <label>Contact No</label>
                                        <input type="text" class="form-control integer_value" name="contact_no" placeholder="Contact No" />
                                    </div>
                                    
                                    <div class="form-group m-h30">
                                        <label class="leftcol">Status</label>
                                        <label class="radio_label" for="status">
                                            <input type="radio" name="status" value="1" checked /> &nbsp;&nbsp;Confirmed
                                        </label> 
                                        <label class="radio_label" for="status">
                                            <input type="radio" name="status" value="0" /> &nbsp;&nbsp;Blocked
                                        </label> 
                                    </div>
                                    
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>User Name</label>
                                        <input type="text" class="form-control" name="user_name" placeholder="Login user name" maxlength="50" value="" />
                                    </div>
                                    
                                    <div class="form-group">
                                        <label>Password<br/ ><span style="font-size: 10px; color: #999;">(Default: 12345)</span></label>
                                        <input type="password" class="form-control" name="password" placeholder="Login Password" maxlength="10" value= "12345" />
                                    </div>
                                </div>
                            </div>
                            
                            <!-- Permission div Start-->
                            <div class="permission_container col-xs-12">
                                <br />
                                <div class="permission_row col-xs-12 even">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[check_all]" value="1" class="check_all" />
                                                <span class="permission_txt">Full Permissions</span>
                                            </label>
                                            
                                            <label style="width: 25%;">
                                                <input type="checkbox" name="permissions[home][]" class="permission master" value="1" data-master="home" checked />
                                                <span class="permission_txt">Dashboard</span>
                                            </label>
                                            
                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[sett][]" class="permission master" value="1" data-master="sett" checked />
                                                <span class="permission_txt">Settings</span>
                                            </label>
                                            
                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[otp][]" class="permission master" value="1" data-master="otp" />
                                                <span class="permission_txt">OTP</span>
                                            </label>
                                            
                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[sms][]" class="permission master" value="1" data-master="sms" />
                                                <span class="permission_txt">Send SMS</span>
                                            </label>
                                            
                                            <label style="width: 25%; padding-top: 10px;">
                                                <input type="checkbox" name="permissions[notification][]" class="permission master" value="1" data-master="notification" checked />
                                                <span class="permission_txt">Notification</span>
                                            </label>
                                            
                                            <label style="width: 24%; padding-top: 10px;">
                                                <input type="checkbox" name="permissions[day_end_report][]" class="permission master" value="1" data-master="day_end_report" checked />
                                                <span class="permission_txt">Day End Report</span>
                                            </label>
                                            
                                            <label style="width: 24%; padding-top: 10px;">
                                                <input type="checkbox" name="permissions[daily_report][]" class="permission master" value="1" data-master="daily_report" checked />
                                                <span class="permission_txt">Daily Report</span>
                                            </label>
                                            
                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[prasadam_consolidate][]" class="permission master" value="1" data-master="prasadam_consolidate" />
                                                <span class="permission_txt">Prasadam Consolidated Report</span>
                                            </label>
                                            
                                            <label style="width: 25%; padding-top: 10px;">
                                                <input type="checkbox" name="permissions[kattalai_archanai_report][]" class="permission master" value="1" data-master="kattalai_archanai_report" checked />
                                                <span class="permission_txt">Kattalai Archanai Report</span>
                                            </label>
                                            
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="permission_row col-xs-12 even" style="padding-left: 15px !important; padding-right: 15px !important;">
                                   <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <label style="width: 25%;">
                                                <input type="checkbox" name="permissions[add_all]" value="1" class="add_all" />
                                                <span class="permission_txt">Add All</span>
                                            </label>

                                            <label style="width: 25%;">
                                                <input type="checkbox" name="permissions[edit_all]" value="1" class="edit_all" />
                                                <span class="permission_txt">Edit All</span>
                                            </label>

                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[view_all]" value="1" class="view_all" />
                                                <span class="permission_txt">View All</span>
                                            </label>

                                            <label style="width: 24%;">
                                                <input type="checkbox" name="permissions[delete_all]" value="1" class="delete_all"/>
                                                <span class="permission_txt">Delete All</span>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="administrator permission_row col-xs-12 odd">
                                    <div class="panel panel-default master_container">
                                        <div class="panel-heading">
                                            <label>
                                                <input type="checkbox" name="master[masters]" value="1" class="master super_master" data-master="<?php echo $masters_str;?>" />
                                                <span class="permission_txt">Masters</span>
                                            </label>
                                            <div class="pull-right compress_btn compress">
                                                <span class="btn btn-success btn-sm">
                                                    <i class="fa fa-compress"></i>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="panel-body">
                                        <?php foreach($masters as $key => $master) {?>
                                            <?php $controller_name = trim($master->controller_name);?>
                                            <div class="master_container col-md-6">
                                                <div class="checkbox permission_div">
                                                    <label>
                                                        <h5>
                                                            <input type="checkbox" name="master[<?php echo $controller_name;?>][]" class="master" data-master="<?php echo $controller_name;?>" value="ALL" />
                                                            <span class="permission_txt"><?php echo $master->master_name;?></span>
                                                        </h5>
                                                    </label>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="master[<?php echo $controller_name;?>][]" class="permission view" value="1" />
                                                            <span class="permission_txt">View</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="master[<?php echo $controller_name;?>][]" class="permission add" value="2" />
                                                            <span class="permission_txt">Add</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="master[<?php echo $controller_name;?>][]" class="permission edit" value="3" />
                                                            <span class="permission_txt">Edit</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="master[<?php echo $controller_name;?>][]" class="permission delete" value="4" />
                                                            <span class="permission_txt">Delete</span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php }?>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="administrator permission_row col-xs-12 even">
                                    <div class="panel panel-default master_container">
                                        <div class="panel-heading">
                                            <label>
                                                <input type="checkbox" name="inventory[inventory]" value="1" class="master super_master" data-master="<?php echo $inventory_str;?>" />
                                                <span class="permission_txt">Inventory</span>
                                            </label>
                                            <div class="pull-right compress_btn compress">
                                                <span class="btn btn-success btn-sm">
                                                    <i class="fa fa-compress"></i>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="panel-body">
                                        <?php foreach($inventories as $key => $inventory) {?>
                                            <?php $controller_name = trim($inventory->controller_name);?>
                                            <div class="col-md-6 master_container">
                                                <div class="checkbox permission_div">
                                                    <label>
                                                        <h5>
                                                            <input type="checkbox" name="inventory[<?php echo $controller_name;?>][]" class="master" data-master="<?php echo $controller_name;?>" value="ALL" />
                                                            <span class="permission_txt"><?php echo $inventory->inventory_name;?></span>
                                                        </h5>
                                                    </label>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="inventory[<?php echo $controller_name;?>][]" class="permission view" value="1" />
                                                            <span class="permission_txt">View</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="inventory[<?php echo $controller_name;?>][]" class="permission add" value="2" />
                                                            <span class="permission_txt">Add</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="inventory[<?php echo $controller_name;?>][]" class="permission edit" value="3" />
                                                            <span class="permission_txt">Edit</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="inventory[<?php echo $controller_name;?>][]" class="permission delete" value="4" />
                                                            <span class="permission_txt">Delete</span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php }?>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="administrator permission_row col-xs-12 even">
                                    <div class="panel panel-default master_container">
                                        <div class="panel-heading">
                                            <label>
                                                <input type="checkbox" name="statue[statue]" value="1" class="master super_master" data-master="<?php echo $statues_str;?>" />
                                                <span class="permission_txt">Statue and Books</span>
                                            </label>
                                            <div class="pull-right compress_btn compress">
                                                <span class="btn btn-success btn-sm">
                                                    <i class="fa fa-compress"></i>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="panel-body">
                                        <?php foreach($statues as $key => $statuebook) {?>
                                            <?php $controller_name = trim($statuebook->controller_name);?>
                                            <div class="col-md-6 master_container">
                                                <div class="checkbox permission_div">
                                                    <label>
                                                        <h5>
                                                            <input type="checkbox" name="statue[<?php echo $controller_name;?>][]" class="master" data-master="<?php echo $controller_name;?>" value="ALL" />
                                                            <span class="permission_txt"><?php echo $statuebook->menu_name;?></span>
                                                        </h5>
                                                    </label>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="statue[<?php echo $controller_name;?>][]" class="permission view" value="1" />
                                                            <span class="permission_txt">View</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="statue[<?php echo $controller_name;?>][]" class="permission add" value="2" />
                                                            <span class="permission_txt">Add</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="statue[<?php echo $controller_name;?>][]" class="permission edit" value="3" />
                                                            <span class="permission_txt">Edit</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="statue[<?php echo $controller_name;?>][]" class="permission delete" value="4" />
                                                            <span class="permission_txt">Delete</span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php }?>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="administrator user permission_row col-xs-12 odd">
                                    <div class="panel panel-default master_container">
                                        <div class="panel-heading">
                                            <label>
                                                <input type="checkbox" name="billing[billing]" value="1" class="master super_master" data-master="<?php echo $service_str;?>" />
                                                <span class="permission_txt">Billing</span>
                                            </label>
                                            <div class="pull-right compress_btn compress">
                                                <span class="btn btn-success btn-sm">
                                                    <i class="fa fa-compress"></i>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="panel-body">
                                        <?php foreach($services as $key => $service) {?>
                                            <?php $controller_name = trim($service->controller_name);?>
                                            <div class="col-md-6 master_container">
                                                <div class="checkbox permission_div">
                                                    <label>
                                                        <h5>
                                                            <input type="checkbox" name="billing[<?php echo $controller_name;?>][]" class="master" data-master="<?php echo $controller_name;?>" value="ALL" />
                                                            <span class="permission_txt"><?php echo $service->service_name;?></span>
                                                        </h5>
                                                    </label>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="billing[<?php echo $controller_name;?>][]" class="permission view" value="1" />
                                                            <span class="permission_txt">View</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="billing[<?php echo $controller_name;?>][]" class="permission add" value="2" />
                                                            <span class="permission_txt">Add</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="billing[<?php echo $controller_name;?>][]" class="permission edit" value="3" />
                                                            <span class="permission_txt">Edit</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="billing[<?php echo $controller_name;?>][]" class="permission delete" value="4" />
                                                            <span class="permission_txt">Delete</span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php }?>
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="administrator permission_row col-xs-12 even">
                                    <div class="panel panel-default master_container">
                                        <div class="panel-heading">
                                            <label>
                                                <input type="checkbox" name="reports[reports]" value="1" class="master super_master" data-master="<?php echo $report_str;?>" />
                                                <span class="permission_txt">Reports</span>
                                            </label>
                                            <div class="pull-right compress_btn compress">
                                                <span class="btn btn-success btn-sm">
                                                    <i class="fa fa-compress"></i>
                                                </span>
                                            </div>
                                        </div>
                                        <div class="panel-body">
                                        <?php foreach($reports as $key => $report) {?>
                                            <?php $controller_name = trim($report->controller_name);?>
                                            <div class="col-md-6 master_container">
                                                <div class="checkbox permission_div">
                                                    <label>
                                                        <h5>
                                                            <input type="checkbox" name="reports[<?php echo $controller_name;?>][]" class="master" data-master="<?php echo $controller_name;?>" value="ALL" />
                                                            <span class="permission_txt"><?php echo $report->report_name;?></span>
                                                        </h5>
                                                    </label>
                                                </div>
                                                
                                                <div class="form-group">
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="reports[<?php echo $controller_name;?>][]" class="permission view" value="1" />
                                                            <span class="permission_txt">View</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="reports[<?php echo $controller_name;?>][]" class="permission add" value="2" />
                                                            <span class="permission_txt">Add</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="reports[<?php echo $controller_name;?>][]" class="permission edit" value="3" />
                                                            <span class="permission_txt">Edit</span>
                                                        </label>
                                                    </div>
                                                    
                                                    <div class="checkbox permission_div">
                                                        <label>
                                                            <input type="checkbox" name="reports[<?php echo $controller_name;?>][]" class="permission delete" value="4" />
                                                            <span class="permission_txt">Delete</span>
                                                        </label>
                                                    </div>
                                                </div>
                                            </div>
                                        <?php }?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="box-footer" style="text-align:center;">
                                <input class="btn reset" type="reset" value="Reset" />
                                <input type="submit" name="submit" value="Save" class="btn btn-success btn-primary" style="margin-left: 50px;" />
                            </div>
                        </form>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>