<script type="text/javascript" src="<?php echo base_url();?>assets/js/master_settings.js"></script>
<style type="text/css">
    .form-group > label {
        width: 0px;
    }
    
</style>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">Master Settings Edit</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box-header">
                    <div class="box-body table-responsive">
                        <?php if(!empty($success)) {?>
                            <div class="alert alert-success alert-dismissable">
                                <i class="fa fa-thumbs-o-up"></i>
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4><?php echo $success;?></h4>
                            </div>
                        <?php }
                        else if(!empty($error)) {?>
                            <div class="alert alert-danger alert-dismissable">
                                <i class="fa fa-thumbs-o-down"></i>
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <h4><?php echo $error;?></h4>
                            </div>
                        <?php }?>
                    </div>
                    <!-- .box-tools -->
                </div>
            </div>
            
            <div class="col-xs-12">
                <!--<h3 style="margin-top: 0; margin-right: 5px; width: 100%; display: inline-block;">
                    <a class="label btn btn-primary float-rht edit" href="<?php echo $view_link?>"><span>View</span></a>
                </h3>--> 
                <form name="master_settings" action="<?php echo $form_action;?>" method="post" enctype="multipart/form-data">
                    <div class="box box-danger">
                        <div class="box-body">
                            <ul class="error_container"></ul>
                            <!--<h3 class="major_txt_color" style="margin: 10px 0 25px 0;">Company</h3>-->
                            <div class="col-xs-12">
                                <div class="form-group float-clear">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" class="form-control check_all" name="check_all" value="all" />&nbsp;&nbsp;Select All
                                        </label>
                                    </div>
                                </div>
                                <?php foreach($setting as $key=>$value) {?>
                                    <div class="col-md-3">
                                        <div class="form-group master_div">
                                            <label>&nbsp;</label>
                                            <div class="checkbox">
                                                <label>
                                                    <input type="checkbox" class="form-control master_name" name="master_name[]" value="<?php echo $value->id;?>" <?php echo ($value->status == 1) ? 'checked' : '';?> />&nbsp;&nbsp;<?php echo $value->master_name;?>
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                            
                            
                            <div class="col-xs-12 blck" id="payments-chk">
                                <div class="sub-title" ><h4><i class="fa fa-fire" style="font-size: 14px;"></i> Disable Payment Types</h4><i class="ctrl opener fa fa-chevron-down" style="float: right; margin-top: -25px;"></i></div>
                                <div class="blck-content col-xs-12" style="display: none;">
                                    <div class="row">
                                        <?php
                                            $i = 0;
                                            foreach( $payment_types as $z => $pay_type ) :
                                                ?>
                                                <div class="col-md-3">
                                                    <div class="form-group">
                                                        <label>&nbsp;</label>
                                                        <div class="checkbox">
                                                            <label <?php echo $pay_type['status'] == '3' ? 'style="color: #999;"' : ''; ?>>
                                                                <input type="checkbox" class="form-control" name="payment_chk[]" value="<?php echo $pay_type['id'];?>" <?php echo $pay_type['paid_cnt'] > 0 ? ' readonly disabled " ' : ( $pay_type['status'] == '3' ? 'checked' : '' ); ?> />&nbsp;&nbsp;<span <?php echo $pay_type['paid_cnt'] > 0 ? 'style="color: #999; text-decoration: line-through;" title="Already used!"' : ''; ?>><?php echo $pay_type['name']; ?></span> <?php echo ( $pay_type['paid_cnt'] > 0 ? ' <span style="font-size: 11px; color: #999;">(Using: '. $pay_type['paid_cnt'] .')</span>' : '' ); ?>
                                                            </label>
                                                        </div>
                                                    </div>
                                                </div>

                                                <?php
                                                    echo ++$i % 4 == 0 ? '</div><div class="row">' : '';
                                            endforeach;
                                        ?>
                                        
                                    </div>
                                    
                                    <div style="padding-top: 10px; border-top: 1px dotted #ccc;">
                                        <ol style="list-style: none; margin-left: -15px;">
                                            <li style="color: #999; font-size: 10px;">* Checked types are disabled right now!</li>
                                            <li style="color: #f33; font-size: 10px;">* Striked out types are already used by some other transaction and can not be disabled right now!</li>
                                        </ol>
                                    </div>
                                </div>
                            </div>    
                            
                        </div>
                        
                        <div class="box-footer form-actions float-clear" style="text-align:center;">
                            <input class="btn reset" type="reset" value="Reset" />
                            <input type="submit" name="submit" value="Update" class="btn btn-success btn-primary" />
                        </div>
                    </div><!-- /.box -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>