<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Channellimo
            <small>Preview</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">Partnership</li>
          </ol>
        </section>
        
        <section class="content">
        	<div class="col-lg-12">
            <div class="box box-primary col-lg-8">
              <div class="box-header with-border">
                <h3 class="box-title">FORM EDIT</h3>
              </div>
              		<!--<th style="border-top: 1px solid #ddd;width:80px;"></th>-->
                    <div class="form-group col-lg-8">	   
                    	<table class="table" style="font-size:16px;">
                        <tr>
                        	<td><label>Code</label> : <?php echo $result->par_code?></td>
                            <td><label>Name</label> : <?php echo $result->par_name?></td>
                            <td><label>Phone</label> : <?php echo $result->par_phone?></td>
                        </tr>
                        <tr>
                            <td><label>Email</label> : <?php echo $result->par_email?></td>
                            <td><label>Website </label> : <?php echo $result->par_website?></td>
                            <td><label>Address </label> : <?php echo $result->par_address?></td>
                        </tr>
                        <tr>
                        	<td><label>Remark</label> : <?php echo $result->par_phone?></td>
                        </tr>
                     </table>
                    </div>
                    <div class="form-group col-lg-12">
                    	<h4><a href="#" data-toggle="modal" data-target="#myModal">ADD User</a></h4>
                        <table id="example1" class="table table-bordered table-striped">
                        <thead>
                          <tr>
                            <th>ID</th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th>Username</th>
                            <th>Fullname</th>
                            <th>Email</th>
                            <th>Phone</th>
                            <th>Createby</th>
                            <th>Createdate</th>
                          </tr>
                        </thead>
                        <tbody>
                        <?php 
                        $i=1; 
						$user = $this->db->query('SELECT *,`tbluser`.`username` as myuser,`tbl_partnership_user`.`username` as user FROM `tbl_partnership_user` INNER JOIN `tbluser` ON `tbluser`.`userid`=`tbl_partnership_user`.`createby` WHERE `par_id` = '.$result->par_id.' AND `tbl_partnership_user`.`status` = 1 order by id DESC');
                        foreach($user->result_array() as $v)
                        {
                            echo'<tr>
                              <td>'.$i.'</td>
                              <td><a href="#" data-toggle="modal" data-target="#myUser'.$i.'"><i class="fa fa-edit"></i>Edit</a></td>
							  <td><a href="'.site_url("admin/partnership/reset_password/".$v['id']."").'" class="confirmation">Reset</a></td>
                              <td><a href="'.site_url("admin/partnership/delete_user/".$v['id']."").'" class="confirmation"><i class="fa fa-remove"></i>Delete</a></td>
                              <td>'.$v['user'].'</td>
                              <td>'.$v['fullname'].'</td>
                              <td>'.$v['email'].'</td>
							  <td>'.$v['phone'].'</td>
                              <td>'.$v['myuser'].'</td>
                              <td>'.$v['createdate'].'</td>
                            </tr>';
							echo get_user_info_update($i,$v);
							$i++;
                        }
                        ?>
                        </tbody>
                      </table>
                    </div>
                </div>
          
            </div>
        </section>
     </div>
     
      <!-- Modal -->
      <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">
        
          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">ADD Price</h4>
            </div>
            <div class="modal-body">
             <form method="post" id="userForm">
             	 <input id="par_id" name="par_id" class="form-control" type="hidden" placeholder="Enter Car" value="<?php echo $result->par_id;?>">
  
                <div class="form-group col-lg-12">
					<label>Username</label>
					<input id="username" name="username" class="form-control" type="text" placeholder="Enter Username">
				</div>
                
                <div class="form-group col-lg-12">
					<label>Password</label>
					<input id="password" name="password" class="form-control" type="text" placeholder="Enter Password">
				</div>
                
                <div class="form-group col-lg-12">
					<label>FullName</label>
					<input id="fullname" name="fullname" class="form-control" type="text" placeholder="Enter FullName">
				</div>
                
                <div class="form-group col-lg-12">
					<label>Email</label>
					<input id="email" name="email" class="form-control" type="text" placeholder="Enter Email">
				</div>
                
                 <div class="form-group col-lg-12">
					<label>Phone</label>
					<input id="phone" name="phone" class="form-control" type="text" placeholder="Enter Phone">
				</div>
                
                 <div class="form-group col-lg-12">
					<label>Remark</label>
                    <textarea id="remark" name="remark" class="textarea" placeholder="Place some text here" style="width: 100%; height: 80px;"></textarea>
				</div>
  
                <div class="form-group col-lg-12">
                    <input type="submit" value="Submit" class="btn btn-primary">
                    <button type="reset" class="btn btn-danger">Reset</button>
                </div>
             </form>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
          </div>
          
        </div>
     </div>
      
     <script type="text/javascript">
	 	 $body = $("body");
		 $("#userForm").submit(function(e) {
			if ($('#userForm')[0].checkValidity() == true)
			{
				var url = "<?php echo site_url("admin/partnership/add_user");?>"; 
				$.ajax({
					   type: "POST",
					   url: url,
					   data: $("#userForm").serialize(), // serializes the form's elements.
					   success: function(data)
					   {
						  alert(data);
						  window.location.reload();
					   }
					 });
				e.preventDefault(); // avoid to execute the actual submit of the form.
			}
		});
	 </script>

