<section id="breadcrumb-section" class="breadcrumb-section clearfix" style="background-image: url(assets/images/breadcrumb-bg.jpg);">
<div class="overlay-black">
<div class="container">
<h2 class="page-title">My Account</h2>
</div>
</div>
</section>
<div class="breadcrumb-list">
<div class="container">
<ul>
<li class="breadcrumb-item"><a href="<?php echo base_url();?>">Home</a></li>
<li class="breadcrumb-item active">My Account</li>
</ul>
</div>
</div>


<section id="service-section" class="service-section sec-ptb-100 clearfix">
<div class="container">
<div class="row">

<div class="col-lg-3 col-md-12 col-sm-12">
<div class="sidebar-section">

<div class="service-menu mb-30">
<h2 class="sidebar-title">Quick Links</h2>
<ul>
<li>
    <a href="<?php echo base_url();?>dashboard">Dashboard</a>
</li>
<li>
    <a href="<?php echo base_url();?>deposite">Deposite</a>
</li>
<li>
    <a href="<?php echo base_url();?>withdrawls">Withdrawl</a>
</li>
<li>
    <a href="<?php echo base_url();?>transactions">Transactions</a>
</li>
<li class="active">
    <a href="#">My Profile</a>
</li>
<li>
    <a href="<?php echo base_url();?>logout">Logout</a>
</li>
</ul>
</div>
</div>
</div>


<div class="col-lg-9 col-md-12 col-sm-12">
<div class="service-details">
<ul class="nav nav-pills" id="pills-tab" role="tablist">

<li class="nav-item">

<a class="nav-link active linkin" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Personal Details</a>

</li>

<li class="nav-item">

<a class="nav-link linkin" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Bank Details</a>

</li>
<li class="nav-item">

<a class="nav-link linkin" id="pills-profile2-tab" data-toggle="pill" href="#pills-profile2" role="tab" aria-controls="pills-profile2" aria-selected="false">Change Pin/Password</a>

</li>
</ul>

<div class="tab-content" id="pills-tabContent" style="margin-top:10px;">
			
          <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">
          
                                            <?php $user=$this->db->get_where("users",array("id"=>$this->session->userdata("user")))->row();?>
                                                                
                                                                <table class="table table-condensed table-bordered">
                                                                	<tbody>
                                                                    	<tr><th colspan="2"><h4 class="text-danger"><?php echo $this->session->userdata("name");?></h4></th></tr>
                                                                    	<tr><th>Reg Date</th><th><?php echo $user->created;?></th></tr>
                                                                    	<tr><th>Client ID</th><th><?php echo 'ST00'.$this->session->userdata("user");?></th></tr>
                                                                    	<tr><th>Email Address </th><th><?php echo $this->session->userdata("email");?></th></tr>
                                                                    	<tr><th>Phone Numbers </th><th><?php echo $user->mobile;?></th></tr>
                                                                    	<tr><th>Aadhar </th><th><?php echo $user->aadhar;?></th></tr>
                                                                    	<tr><th>PAN</th><th><?php echo $user->pan_no;?></th></tr>
                                                                    	<tr><th>City/Pin</th><th><?php echo $user->city.' '.$user->zipcode;?></th></tr>
                                                                    </tbody>
                                                                </table>
          </div>

          <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">

          <form action="" method="post" id="bankform">
                    	<div class="form-group">
                        	<label>Bank Name</label>
                            <input type="text" class="form-control" name="bank_name" value="<?php echo $user->bank_name;?>" required />
                        </div>
                    	<div class="form-group">
                        	<label>Account Holder Name</label>
                            <input type="text" class="form-control" name="acc_holder" value="<?php echo $user->acc_holder;?>" required />
                        </div>
                    	<div class="form-group">
                        	<label>Account No</label>
                            <input type="text" class="form-control" name="acc_no" value="<?php echo $user->acc_no;?>" required />
                        </div>
                        <div class="row">
                    	<div class="form-group col-md-6">
                        	<label>IFSC Code</label>
                            <input type="text" class="form-control" name="ifsc" value="<?php echo $user->ifsc;?>" required />
                        </div>
                    	<div class="form-group col-md-6">
                        	<label>Account Type</label>
                            <select class="form-control" name="acc_type" required>
                            	<option value="Current">Current</option>
                            	<option value="Saving" <?php if($user->acc_type=="Saving"){echo "selected";}?>>Saving</option>
                            </select>
                        </div>
                        </div>
                        <button type="submit" class="btn btn-info">Save Details</button>
                    </form>


          </div>
          
          
          <div class="tab-pane fade" id="pills-profile2" role="tabpanel" aria-labelledby="pills-profile2-tab">
          <div class="row">
                	<div class="col-md-4">
                    	<h5 class="text-warning">Change Password</h5>
                        <form action="" method="post" id="change_password">
                            <div class="form-group">
                                <label>New Password</label>
                                <input type="password" class="form-control" name="password" required />
                            </div>
                            <div class="form-group">
                                <label>Confirm Password</label>
                                <input type="password" class="form-control" name="cpassword" required />
                            </div>
                            <b class="text-danger" id="pmsg"></b>	
                            <button type="submit" class="btn btn-info">Change Password</button>	
                        </form>
                    </div>
                    
                    <div class="col-md-4">
                    	<h5 class="text-warning">Change TRADE PIN</h5>
                        <form action="" method="post" id="change_pin">
                            <div class="form-group">
                                <label>New PIN</label>
                                <input type="number" maxlength="4" class="form-control" name="pin" required />
                            </div>
                            <div class="form-group">
                                <label>Confirm PIN</label>
                                <input type="number" maxlength="4" class="form-control" name="cpin" required />
                            </div>
                            <b class="text-danger" id="pnmsg"></b>	
                            <button type="submit" class="btn btn-info">Change PIN</button>	
                        </form>
                    </div>
                </div>
          </div>
    
</div>
</div>
</div>
</section>
<script>
	$(document).ready(function(){
		$('#change_password').submit(function(e){e.preventDefault();
		var formdata=$(this).serialize();
			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>home/ajax_change_password',
				 data: {formdata:formdata},
				 success: function(response){
					 $("#pmsg").html(response);
				 }
			});
		});
		$('#change_pin').submit(function(e){e.preventDefault();
		var formdata=$(this).serialize();
			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>home/ajax_change_pin',
				 data: {formdata:formdata},
				 success: function(response){
					 $("#pnmsg").html(response);
				 }
			});
		});
		$("#bankform").submit(function(e){e.preventDefault();
			var formdata=$(this).serialize();
			$.ajax({
			 type: "POST",//dataType:'json',
			 url: '<?php echo base_url();?>home/ajax_bankform',
			 data: {formdata:formdata},
			 success: function(res){//alert(res.target);
					alert(res);
				 }
			 });
		});
		
	});
	</script>