<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header mb_9">
      <h1>Customers</h1>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="row">
         <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 mb_20">
             <select id="coptionStatus" class="form-control status_control align_left">
                <option>Select status</option>
                <option <?php if($active==1){echo "selected";} ?> value="Active">Active</option>
                <option <?php if($active==0){echo "selected";} ?> value="Inactive">Inactive</option>
            </select>
        </div>
      </div>
		<div class="row">			
			<div class="col-lg-12">
			<input type="hidden" class="btn btn-success" data-toggle="modal" data-target="#AddItem" id="ItemCreateItemBtn" data-backdrop="static" data-keyboard="false"> 
			</div>
		</div>
		<div class="modal fade" id="AddItem">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close mfwPopUpClose" data-dismiss="modal" aria-label="Close">
                  <i class="fa fa-remove" class="remover"></i></button>
                <h4 class="modal-title">Customer Details</h4>
              </div>
              <div class="modal-body"> 
					  <div class="row">
						<form role="form" id="mfwUserFormId" data-target="user/create_user">
						  <div class="box-body">
						
							<div class="row">
								<div class="col-md-6"> 							
									<div class="form-group">
									  <label for="UserName">Customer Name</label>
									  <input type ="hidden" name="UserRole" value="2">
									  <input type ="hidden" id="farm_action" value="user/create_user">
									  <input type="text" class="form-control" id="UserName" name="UserName" placeholder="User Name" required autocomplete="off">
									</div>
								</div>
								<div class="col-md-6">
									<div class="form-group">
									  <label for="UserEmail">Email Address</label>
									  <input type="text" class="form-control" id="UserEmail" name="UserEmail" placeholder="Email" required autocomplete="off">
									</div>
								</div>
							</div>
							<div class="row">
								<div class="col-md-6">
									<div class="form-group">
									  <label for="UserMobile">Mobile Number</label>
									  <input type="text" class="form-control" id="UserMobile" name="UserMobile" placeholder="Mobile" required autocomplete="off">
									</div>
								</div>
								<div class="col-md-6">
									<div class="form-group">
									  <label for="UserPassword">Password</label>
									  <input type="text" class="form-control" id="UserPassword" name="UserPassword" placeholder="Password"  autocomplete="off">
									</div>
								</div>
							</div> 
							<div class="row">
							    <div class="col-md-6">
									<div class="form-group">
									  <label for="WordNumber">Ward Number</label>
									  <input type="text" class="form-control" id="WordNumber" name="WordNumber" placeholder="Ward Number" required autocomplete="off">
									</div>
								</div>
							    <div class="col-md-6">
									<div class="form-group">
									  <label for="HouseNumber">House Number</label>
									  <input type="text" class="form-control" id="HouseNumber" name="HouseNumber" required placeholder="House Number" autocomplete="off">
									</div>
								</div>
							</div>
							<div class="row">
							    <div class="col-md-6">
									<div class="form-group">
									  <label for="Town">Town</label>
									  <input type="text" class="form-control" id="Town" name="Town" placeholder="Town" required autocomplete="off">
									</div>
								</div>
							    <div class="col-md-6">
									<div class="form-group">
									  <label for="District">District</label>
									  <input type="text" class="form-control" id="District" name="District" required placeholder="District" autocomplete="off">
									</div>
								</div>
							</div>
							 
						  </div>
						  <!-- /.box-body -->
 
						  <div class="box-footer">
						  <input type="hidden" id="UserId" name="UserId">
							<button type="submit" class="btn btn-primary pull-right" id="hdaCreateUser">Submit</button>
						  </div>
						</form>  
						</div> 
              </div> 
            </div>
            <!-- /.modal-content -->
          </div>
          <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
	
	<div class="row">
	<div class="col-lg-12">
		<div class="box">
            <div class="box-body">
			<div class="table-responsive">
              <table id="mfw_ItemsTable" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Sr No.</th>
                  <th>Name</th>
                  <th>Email</th>
                  <th>Mobile No.</th>
                  <th>City</th>
                  <th>Orders</th>
                  <th>Action</th>
                  <th>Status</th>
                </tr>
                </thead>
                <tbody>
				<?php if(!empty($customer)){
					$countItem = count($customer);
					 $i = $countItem;
					 $a=1;
					foreach($customer as $value){ 
				?>
                <tr>
                  <td><?php echo $a; ?></td>
					<td><?php echo $value['userName']; ?></td>
					<td><span class="cus_email"><?php if(!empty($value['userEmail'])){ echo $value['userEmail']; } ?></span></td>
					<td><?php if(!empty($value['userMobile'])){ echo $value['userMobile']; } ?></td>
					<td><?php if(!empty($value['address'])){  
					$test_str = $value['address']; 
                    $words = explode('|', $test_str);
                    if($words[0]){
                       echo $words[0];
                    }
                    } ?></td>
					<td><a class="btn-primary icon_btn" href="<?php echo base_url('directsales/orders_history')."/".$value['userId']; ?>" target="_blank"><i class="fa fa-eye" aria-hidden="true"></i></a>
					
					</td>
					<td><button class="btn-primary user_edit_btn icon_btn" data-id="<?php echo $value['userId']; ?>" title="Edit"><i class="fa fa-pencil-square-o"></i></button>
					</td> 
					<td>
					    <label class="switch UserStatus" data-UserStatusId="<?php echo $value['userId']; ?>" data-statusValue='<?php if($value['status']==1) {echo "0"; }else{ echo "1";}?>'>
                          <input type="checkbox" name="u_status"<?php if($value['status']==1) {echo 'checked'; }?> >
                          <span class="slider round"></span>
                        </label>
					</td>
                </tr>
				<?php 
				$a++;
				$i--;
				}
				} ?> 
                </tbody>
                <tfoot> 
                <tr>
                  <th>Sr No.</th>
                  <th>Name</th>
                  <th>Email</th>
                  <th>Mobile No.</th>
                  <th>City</th>
                  <th>Orders</th>
                  <th>Action</th>
                  <th>Status</th>
                </tr>
                </tfoot> 
              </table>
            </div>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
		</div>
		</div>

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  