<?php //echo '<pre>';print_r($admin_detail);exit; ?>
<style>
    body {
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #292b2c;
    background-color: transparent;;
}
.help-block{
	color:red;
}
</style>
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="page-bar">
            <div class="page-title-breadcrumb">
                <div class=" pull-left">
                    <div class="page-title"><strong>Profile Edit</strong></div>
                </div>
            </div>
        </div>

        <div class="row" style="margin-top:50px;">

            <div class="col-md-12 col-sm-12">
                <div class="card  card-topline-yellow">

                    <div class="card-body ">
                        <div class="col-sm-12">

                            <form id="editprofile" name="editprofile" action="<?php echo base_url('agent/editpost'); ?>" method="POST" enctype="multipart/form-data">
                                <div class="row">
                                    <div class="form-group col-md-6">
                                        <label for="email">Name</label>
                                        <input type="text" id="name" name="name" value="<?php echo isset($agent_detail['name'])?$agent_detail['name']:''; ?>" class="form-control" placeholder="Enter Name">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="email">Email Id</label>
                                        <input type="text" id="email_id" name="email_id" value="<?php echo isset($agent_detail['email_id'])?$agent_detail['email_id']:''; ?>" class="form-control" placeholder="Enter Email Id">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="email">Mobile Number</label>
                                        <input type="text" id="mobile_number" name="mobile_number" value="<?php echo isset($agent_detail['mobile'])?$agent_detail['mobile']:''; ?>" class="form-control" placeholder="Enter Mobile Number">
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label for="address"> Address</label>
                                        <input type="text" id="address" name="address" value="<?php echo isset($agent_detail['address'])?$agent_detail['address']:''; ?>" class="form-control" placeholder="Enter Address">
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="bank_account"> Bank Account Number</label>
                                        <input type="text" id="bank_account" name="bank_account" value="<?php echo isset($agent_detail['bank_account'])?$agent_detail['bank_account']:''; ?>" class="form-control" placeholder="Enter Bank Account Number">

                                    </div>
                                    <div class="form-group col-md-6">
                                        <label for="bank_name"> Bank Name</label>
                                        <input type="text" id="bank_name" name="bank_name" value="<?php echo isset($agent_detail['bank_name'])?$agent_detail['bank_name']:''; ?>" class="form-control" placeholder="Enter  Bank Name">
                                    </div>
                                    
                                    <div class="form-group col-md-6">
                                        <label for="ifsccode"> Bank Ifsc Code</label>
                                        <input type="text" id="ifsccode" name="ifsccode" value="<?php echo isset($agent_detail['ifsccode'])?$agent_detail['ifsccode']:''; ?>" class="form-control" placeholder="Enter  Bank Ifsc Code">
                                    </div>
                                    
                                    <div class="form-group col-md-6">
                                        <label for="bank_holder_name"> Bank Account Holder Name</label>
                                        <input type="text" id="bank_holder_name" name="bank_holder_name" value="<?php echo isset($agent_detail['bank_holder_name'])?$agent_detail['bank_holder_name']:''; ?>" class="form-control" placeholder="Enter Bank Account Holder Name">
                                    </div>
                                    
                                    <div class="form-group col-md-6">
                                        <label for="kyc"> Kyc</label>
                                        <input class="form-control" id="kyc" name="kyc" type="file" placeholder="Enter kyc">
                                    </div>

                                    <div class="form-group col-md-6">
                                        <label>Location</label>
                                        <input type="text" id="location" name="location" value="<?php echo isset($agent_detail['location'])?$agent_detail['location']:''; ?>" class="form-control" placeholder="Enter Location">
                                    </div>
                                    
                                    <div class="form-group col-md-6">
                                        <label for="email">Profile Pic</label>
                                        <input type="file" id="profile_pic" name="profile_pic" class="form-control">
                                    </div>
                                    
                                    <div class="form-group col-md-6">
                                        <label for="">&nbsp;</label>
                                        <button type="submit" class="btn btn-info pull-right">Update</button>
                                    </div>
                                    
                                </div>
                            </form>

                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(document).ready(function() {
        $('#editprofile').bootstrapValidator({

            fields: {

                name: {
                    validators: {
                        notEmpty: {
                            message: 'Name is required'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z0-9. ]+$/,
                            message: 'Name can only consist of alphanumeric, space and dot'
                        }
                    }
                },
                email_id: {
                    validators: {
                        notEmpty: {
                            message: 'Email is required'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/,
                            message: 'Please enter a valid email address. For example johndoe@domain.com.'
                        }
                    }
                },
                mobile_number: {
                    validators: {
                        notEmpty: {
                            message: 'Mobile Number is required'
                        },
                        regexp: {
                            regexp: /^[0-9]{10}$/,
                            message: 'Mobile Number must be 10 digits'
                        }

                    }
                },



                address: {
                    validators: {
                        notEmpty: {
                            message: 'Address is required'
                        },
                        regexp: {
                            regexp: /^[ A-Za-z0-9_@.,/!;:}{@#&`~"\\|^?$*)(_+-]*$/,
                            message: 'Address wont allow <> [] = % '
                        }

                    }
                },
                bank_account: {
                    validators: {
                        notEmpty: {
                            message: 'Bank Account is required'
                        },
                        regexp: {
                            regexp: /^[0-9]{9,16}$/,
                            message: 'Bank Account  must be 9 to 16 digits'
                        }
                    }
                },

                bank_name: {
                    validators: {
                        notEmpty: {
                            message: 'Bank Name is required'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z0-9. ]+$/,
                            message: 'Bank Name can only consist of alphanumeric, space and dot'
                        }
                    }
                },
                ifsccode: {
                    validators: {
                        notEmpty: {
                            message: 'IFSC Code is required'
                        },
                        regexp: {
                            regexp: /^[A-Za-z0-9]{4}\d{7}$/,
                            message: 'IFSC Code must be alphanumeric'
                        }
                    }
                },
                bank_holder_name: {
                    validators: {
                        notEmpty: {
                            message: 'Bank Holder Name is required'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z0-9. ]+$/,
                            message: 'Bank Holder Name can only consist of alphanumeric, space and dot'
                        }
                    }
                },

                kyc: {
                    validators: {
                        regexp: {
                            regexp: /\.(docx|doc|pdf|xlsx|xls)$/i,
                            message: 'Uploaded file is not a valid. Only docx,doc,xlsx,pdf files are allowed'
                        }
                    }
                },
                location: {
                    validators: {
                        notEmpty: {
                            message: 'location is required'
                        }
                    }
                },

                profile_pic: {
                    validators: {
                        regexp: {
                            regexp: "(.*?)\.(png|jpg|jpeg|gif|Png|PNG)$",
                            message: 'Uploaded file is not a valid. Only png,jpg,jpeg,gif,Png,PNG files are allowed'
                        }
                    }
                }
            }
        })

    });
</script>