<div class="col-sm-10 form-group">
    <div class="row">
        <div class="col-sm-12 ">
            <div class="col-sm-6 col-sm-offset-3">
                <div class="input-group">
                    <input type="text"
                           name="search_bank_name"
                           id="search_bank_name"
                           class="form-control"
                           placeholder="Search Bank Name..." 
                           aria-describedby="basic-addon1">
                    <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
        <input type="hidden" id="baseUrl" value="<?php echo base_url() ?>">
    </div>

    <div class="row gray_ttc">
        <div class="col-sm-12 form-group" style="padding: 0">
            <div class="col-sm-12 white form-group" >
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px">
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c; display: block">
                        <span class=" col-sm-6  form-group">
                            <h3 id="header_name" style="margin: 0">Add Bank Name</h3>
                        </span> 
                        <span class=" col-sm-6 form-group text-right" id="add_bank_name_button" style="padding-top: 8px">
                            <a href="javascript:void(0)" class="btn btn-success text-right" id="addBankForm"><i class="fa fa-plus-circle" title="Add Forbidden"></i></a>
                        </span>
                    </div>

                    <div class="col-sm-12 form-group" id="addBankFormView" style="display: none">
                        <?php
                        $url = 'admin/save-bank-name'; //formID4
                        echo form_open($url, 'class="cmxform" id="formID4" name="bankFORM"');
                        ?>
                        <div class="col-sm-12 padding-zero">
                            <div class="form-group col-sm-6">
                                <div class="input-group">
                                    <input type="text"
                                           id="bank_name"
                                           name="bank_name" 
                                           class="form-control validate[required,custom[bankNameExistence]]"
                                           placeholder="Enter Bank Name...."
                                           value="<?php echo set_value('bank_name'); ?>"
                                           aria-describedby="basic-addon1">
                                    <span class="input-group-addon" id="basic-addon1"><i class="fa  fa-link"></i></span>
                                </div>
                                <span id="bank_name_error" style="color:red"><?php echo form_error('bank_name'); ?></span>
                                <input type="hidden" id="bank_name_exists" value="">
                            </div>
                            <div class="form-group col-sm-6">
                                <label class="col-sm-2 text-left padding-zero" for="bank_status"> Status : &nbsp;</label>
                                <div class="radio radio-success col-sm-10 margin-zero" >
                                    <input type="radio"
                                           data-errormessage-value-missing="Please Select Bank Status" 
                                           class="validate[required]" 
                                           name="bank_status" 
                                           id="published" 
                                           value="1">
                                    <label for="published">Active</label>
                                    <span style="margin-right: 30px"></span>
                                    <input type="radio" 
                                           data-errormessage-value-missing="Please Select Bank Status" 
                                           class="validate[required]" 
                                           name="bank_status" 
                                           id="unpublished" 
                                           value="2">
                                    <label for="unpublishded">Pending</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-sm-2 ">
                            <a href="javascript:void(0)" class="btn btn-success" id="cancelBankForm"><i class="fa fa-times"></i></a>
                            <button type="submit" class="btn btn-success"><i class="fa fa-save"></i></button>
                        </div>

                        <?php echo form_close(); ?>

                        <div class="form-group col-sm-12"><br></div>
                    </div>
                </div>




                <!--Update Bank form start-->
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px;display: none" id="EditBankForm">    
                    <?php
                    $edit_url = 'admin/update-bank-name'; //formID1
                    echo form_open($edit_url, 'class="cmxform" id="formID1" name="editBankFORM"');
                    ?>
                    <div class="col-sm-12 padding-zero">
                        <div class="form-group col-sm-6">
                            <div class="input-group">
                                <input type="text"
                                       id="edit_bank_name"
                                       name="edit_bank_name" 
                                       class="form-control validate[required,custom[editBankNameExistence]]"
                                       placeholder="Enter Bank Name...."
                                       value=""
                                       aria-describedby="basic-addon1">
                                <span class="input-group-addon" id="basic-addon1"><i class="fa  fa-link"></i></span>
                            </div>
                            <input type="hidden" id="edit_bank_name_exists" value="">
                            <span id="edit_bank_name_error" style="color:red"><?php echo form_error('edit_bank_name'); ?></span>
                        </div>
                        <input type="hidden" id="editBankID" name="edit_bank_id" value="">
                        <div class="form-group col-sm-6">
                            <label class="col-sm-2 text-left padding-zero" for="bank_status"> Status : &nbsp;</label>
                            <div class="radio radio-success col-sm-10 margin-zero" >
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Bank Status" 
                                       class="validate[required]" 
                                       name="edit_bank_status" 
                                       id="published" 
                                       value="1">
                                <label for="published">Active</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio" 
                                       data-errormessage-value-missing="Please Select Bank Status" 
                                       class="validate[required]" 
                                       name="edit_bank_status" 
                                       id="unpublished" 
                                       value="2">
                                <label for="unpublishded">Pending</label>
                            </div>
                        </div>

                        <div class="form-group col-sm-2 ">
                            <a href="javascript:void(0)" 
                               class="btn btn-success" id="canceleditBankForm"><i class="fa fa-times"></i></a>
                            <button type="submit" class="btn btn-success"><i class="fa fa-save"></i></button>
                        </div>
                    </div>
                    <?php echo form_close(); ?>
                    <div class="form-group col-sm-12"><br></div>
                </div>
                <!--Update Bank form end-->


            </div>




            <div class="col-sm-12 white form-group">
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px" >
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c;">
                        <span class=" col-sm-12  form-group">
                            <h3 style="margin: 0">Manage Bank</h3>
                        </span> 
                    </div>

                    <div class="col-sm-12 form-group white" id="editManage">
                        <div class="col-sm-12 gray_ttc form-group" style="margin-left: 5px;border-bottom: 1px solid #80c12c">
                            <div class="form-group col-sm-6">
                                <strong>Bank Name</strong>
                            </div>
                            <div class="form-group col-sm-3">
                                <strong>Total Branch</strong>
                            </div>
                            <div class="form-group col-sm-3">
                                <strong> Action</strong>
                            </div>
                        </div>
                        <span class="col-sm-12 text-center text-danger" id="message">
                            <?php
                            if (isset($message)) {
                                echo $message;
                            }
                            ?>
                        </span>
                        <div class="col-sm-12  form-group"> </div>
                        <div id="manageBankView" class="col-sm-12 padding-zero">
                            <?php
                            foreach ($all_bank_name as $bank_value) {
                                ?>
                                <div id="singleBankView<?php echo $bank_value->bank_id; ?>" class="col-sm-12  form-group" style="margin-left: 5px;background: #ededed">
                                    <div class="col-sm-6 " style="padding-top: 5px;padding-bottom: 5px">
                                        <?php echo $bank_value->bank_name ?>
                                    </div>
                                    <div class="col-sm-3 " style="padding-top: 5px;padding-bottom: 5px;">
                                        <?php
                                        if ($total_branch[$bank_value->bank_id] == 0) {
                                            echo $total_branch[$bank_value->bank_id];
                                        } else {
                                            echo '<a href="' . base_url('admin/bank-branch/' . $bank_value->bank_id) . '">' . $total_branch[$bank_value->bank_id] . '</a>';
                                        }
                                        ?>
                                    </div>
                                    <div class="col-sm-3 " style="padding-top: 5px;padding-bottom: 5px">
                                        <a href="javascript:void(0)" id="editBankName<?php echo $bank_value->bank_id; ?>">
                                            <i class="fa fa-edit" title="Edit"></i>
                                        </a>
                                        <span>&nbsp;&nbsp;</span>

                                        <span id="statusAction<?php echo $bank_value->bank_id; ?>" class="padding-zero">
                                            <?php
                                            if ($bank_value->bank_status == 1) {
                                                ?>
                                                <a href="javascript:void(0)"  id="pendingBankName<?php echo $bank_value->bank_id; ?>" >
                                                    <i class="fa fa-user-times" title="Pending"></i>
                                                </a><span>&nbsp;&nbsp;</span>       
                                                <?php
                                            } else {
                                                ?>
                                                <a href="javascript:void(0)"  id="activeBankName<?php echo $bank_value->bank_id; ?>" >
                                                    <i class="fa fa-user-plus" title="Acitve"></i>
                                                </a><span>&nbsp;&nbsp;</span>   
                                                <?php
                                            }
                                            ?>
                                        </span>
                                        <a href="javascript:void(0)"  id="deleteBankName<?php echo $bank_value->bank_id; ?>" >
                                            <i class="fa fa-trash" title="Delete"></i>
                                        </a>                                           
                                    </div>
                                </div>

                                <div class="modal fade" style="" id="viewActiveBankModal<?php echo $bank_value->bank_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                    <?php
                                    $message = '<span style="text-align:center">Are you sure you want to Active this?</span>';
                                    $this->cf->view_modal('Active' . $bank_value->bank_id, $message);
                                    ?>
                                </div>
                                <div class="modal fade" style="" id="viewPendingBankModal<?php echo $bank_value->bank_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                    <?php
                                    $message1 = '<span style="text-align:center">Are you sure you want to Pending this?</span>';
                                    $this->cf->view_modal('Pending' . $bank_value->bank_id, $message1);
                                    ?>
                                </div>
                                <div class="modal fade" style="" id="viewDeleteBankModal<?php echo $bank_value->bank_id; ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                    <?php
                                    $message2 = '<span style="text-align:center">Are you sure you want to delete this?</span>';
                                    $this->cf->view_modal('Delete' . $bank_value->bank_id, $message2);
                                    ?>
                                </div>
                                <?php
                            }
                            echo $pagination_link;
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="col-sm-10 form-group ">
    <div class="col-sm-12 gray">
        <label>&nbsp;&nbsp;<a href="<?php echo base_url() ?>">Dashboard </a>->> Forbidden</label>
    </div>
</div>


<script type="text/javascript" src="<?php echo base_url() ?>back_end_resource/payment/bank.js"></script>

<?php
if (form_error('bank_name') != '') {
    ?>
    <script>
        document.getElementById('addBankFormView').style.display = 'block';
    </script>
    <?php
}
?>
<?php
if (form_error('edit_bank_name') != '') {
    ?>
    <script>
        editBankName('<?php echo base_url(); ?>admin/edit-bank-name', '<?php echo set_value('edit_bank_id'); ?>', '<?php echo base_url() . 'admin/view-bank-name'; ?>');
    </script>
    <?php
}