<?php
/*----include header file----*/
require_once APPPATH."/views/common/header.php"; ?>
    <div class="boxLwd">
        <h2>LWD</h2>
        
        <div class="row costLine">
		  <form class="lwd" method="post" action="<?php echo base_url() ?>index.php/lwd">
            <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 ui-widget">
                 <select name="costcenterlwd" class="combobox costcenterlwd">
				    <option selected="selected">Select Cost Center</option>
					 <?php
						if( !empty( $costcenter ) )
						{
							foreach( $costcenter as $val ):
						?>
							<option <?php if($val['costcenter_id']==$this->session->userdata('costcenterlwd')){ echo "selected"; } ?> value="<?= $val['costcenter_id']; ?>"><?= $val['costcenter_name']; ?></option>
						<?php
							endforeach;
						}
					?>                   
                </select>
            </div>
             <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 cost2">
                <select name="contractarealwd" class="combobox contractarealwd">
                    <option>Select Contract Area</option>
					<?php if($this->session->userdata('contractarealwd')!="") { ?> 
                     <?php
                            if( !empty( $contract_areas ) )
                            {
                               foreach( $contract_areas as $vals ) 
							   {
								  if($this->session->userdata('contractarealwd')==$vals['contractarea_id']) {
                            ?>  
                                    <option selected="selected" value="<?= $vals['contractarea_id']; ?>"><?= ucfirst($vals['contractarea_name']); ?></option>
								
                             <?php
							      }
							   }
                            }
                        ?>
					<?php } ?>
                </select>
            </div>
           <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 cost2">
               <select name="officelwd" class="combobox officelwd">
                    <option>Select Office</option>
					<?php if($this->session->userdata('officelwd')!="") { ?> 
                     <?php
                            if( !empty( $detail ) )
                            {
                               foreach( $detail as $vals ) 
							   {
								  if($this->session->userdata('officelwd')==$vals['office_id']) {
                            ?>  
                                    <option selected="selected" value="<?= $vals['office_id']; ?>"><?= ucfirst($vals['office_name']); ?></option>
								
                             <?php
							      }
							   }
                            }
                        ?>
					<?php } ?>
					
                </select>
            </div>
		  </form>
        </div>
        
        <div class="row LwdButtons">
             <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 addNewButton">
                <button class="btn thumbnail" type="submit" data-toggle="modal" data-target="#lightbox">Add New</button>
                <button class="btn btn-default" type="submit">Export</button>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <form method="post">
                    <label> Show </label>
                    <select style="width: 15% !important;" id="select_limit" name="select_limit" onchange="this.form.submit()">
                        <option <?= ($current_limit == '25')? 'selected' : '' ; ?> value="25">25</option>
                        <option <?= ($current_limit == '50')? 'selected' : '' ; ?> value="50">50</option>
                        <option <?= ($current_limit == '100')? 'selected' : '' ; ?> value="100">100</option>
                        <option <?= ($current_limit == '500')? 'selected' : '' ; ?> value="500">500</option>
                    </select>
                     <label> Entries </label>
                    </form>
                </div>
                <div class="col-sm-6">
                    <?= $this->pagination->create_links(); ?>
                </div>
            </div>
        </div>

        <div class="row tableLWD">
            <table id="examplelwd" class="table table-striped table-bordered" width="98%" cellpadding="1" cellspacing="1">
                <thead>
                    <tr>
                       <th>Number</th>
                        <th>Login Name</th>
                        <th style="display: none;"></th>
                        <th>Number</th>
                        <th>Email</th>
                        <th>Signals Allow</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                     <?php
                       
                        if( !empty( $detail ) ):
						
						    foreach ($detail as $detail):
                           
                    ?>
                        <tr>
                            <td><?= $detail['ref'] ?></td>
                            <td><?= ucfirst($detail['loginname'] ) ?></td>
                            <td style="display: none"><?= $detai['createdate'] ?></td>
                            <td><?= ucfirst( $detail['number'] )  ?></td>
                            <td><?= ucfirst( $detail['emailaddress'] ) ?></td>
                            <td>
                                <select data-lwd_id="<?= $detail['ref'] ?>" name="signal_kill" class="signal_kill">
                                    <option <?= ($detail['signal_kill'] == 0)? 'selected' : '';  ?> value="0">Not</option>
                                    <option <?= ($detail['signal_kill'] == 1)? 'selected' : '';  ?> value="1">Allow</option>
                                </select>
                            </td>
                            <td> 
                                <select data-cost_id="<?= $detail->office_id ?>" name="status" class="office_status custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left ui-autocomplete-input">
                                    <option value="0" <?php if( $detail['is_verified'] == 0 || $detail['is_verified'] == "" ) { echo 'selected'; } ?> >Pending</option>
                                    <option value="1" <?php if( $detail['is_verified'] == 1 ) { echo 'selected'; } ?>>Inactive</option>
                                    <option value="2" <?php if( $detail['is_verified'] == 2 ) { echo 'selected'; } ?>>Active</option>
                                </select>
                            </td>
                            <td><a href="#">Edit</a>&nbsp&nbsp<a href="<?= base_url() ?>index.php/lwd/profile_view/sdffd">View</a></td>
                        </tr>
                    <?php
                            endforeach;
                        endif;
                    ?>
                    
                </tbody>
            </table>                  
            <?= $this->pagination->create_links(); ?>
        </div>
           
   </div>
</div>
</div>

<div id="lightbox" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <button type="button" class="close hidden" data-dismiss="modal" aria-hidden="true">×</button>
        <div class="modal-content">
            <div class="modal-body">
            
            <div class="row">
            <div class="col-lg-12">
                <h2>Add LWD</h2>
            </div>
            </div>
            <form id="add_lwd">
            <div class="ajax_msg"></div>
             <div class="row lighboxInner selectpopup">
            	<div class="col-lg-12">
                <select name="costcenter" class="costCenterSelect costcenterpopup">
                	<option value="">Select Cost Center</option>
                    <?php
						if( !empty( $costcenter ) )
						{
							foreach( $costcenter as $val ):
						?>
							<option <?php if($val['costcenter_id']==$this->session->userdata('costcenterlwd')){ echo "selected"; } ?> value="<?= $val['costcenter_id']; ?>"><?= $val['costcenter_name']; ?></option>
						<?php
							endforeach;
						}
					?>
                </select>
                </div>
             </div>
			 
			 <div class="row lighboxInner selectpopup">
            	<div class="col-lg-12">
                <select name="contractarea" class="costCenterSelect contractareapopup">
                	<option value="">Select Contract Area</option> 
                </select>
                </div>
             </div>
			 
			 <div class="row lighboxInner selectpopup">
            	<div class="col-lg-12">
                <select name="office" class="costCenterSelect officepopup">
                	<option value="">Select Office</option>
                </select>
                </div>
             </div>
			 
             <span id="restpartpopup" style="display:none;">
             <div class="row lighboxInner">
            	<div class="col-lg-6">
                    <div class="form-group label-floating">
                            <label class="control-label">Full Name</label>
                            <input type="text" name="fname" class="form-control fullNameField">
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="form-group label-floating">
                            <label class="control-label">Login Name</label>
                            <input type="text" name="login_name" id="login_name" class="form-control fullNameField" onchange="return login_name_check()">
                    </div>
                    
                    <span class="login_name_error"></span>
                </div>
             </div>
             
             <div class="row lighboxInner">
            	<div class="col-lg-6">
                    <div class="form-group label-floating">
                            <label class="control-label">Email Address</label>
                            <input type="email" id="email_address" name="email" onchange="return email_address_check()" class="form-control fullNameField">
                    </div>
                    <span class="email_error"></span>
                </div>
                <div class="col-lg-6">
                     <div class="form-group label-floating">
                            <label class="control-label">Password</label>
                            <input type="password" class="form-control fullNameField" name="password">
                    </div>
              	</div>
              </div>
                
              <div class="row lighboxInner">
                    <div class="col-lg-6 selectLwdNew">
                        <select name="gender">
                            <option value="">Gender</option>
                            <option value="male">Male</option>
                            <option value="female">Female</option>
                        </select>
                    </div>
                    <div class="col-lg-6 lwdDob">
                        <label class="control-label"></label>
                        <input type="text" class="form-control fullNameField" placeholder="Device id" name="dob">
                    </div>
              </div>
              
              <div class="row lighboxInner">
                    <div class="col-lg-6">
                        <div class="form-group label-floating">
                            <label class="control-label">Phone Number Ex. 440123456789</label>
                            <input type="text" class="form-control fullNameField" name="number">
                    	</div>
                    </div>
                    <div class="col-lg-6">
                        <div class="form-group label-floating">
                            <label class="control-label">IMEI Number</label>
                            <input type="text" class="form-control fullNameField" name="imei">
                    	</div>
                    </div>
              </div>
              <div class="row lighboxInner lightBoxSelect">
                    <div class="col-lg-12">
                    <textarea name="address" class="fullNameField" placeholder="Address"></textarea>
                    </div>
              </div>

              	<div class="row lighboxInner lightBoxSelect">
	              	<div class="col-xs-12 col-sm-12 col-md-2 col-lg-12">
                        <button class="btn btn-default" id="submit_button" type="submit" value="Add New">Add New</button>
		            </div>
	            </div>
				</span>
	            </form>
            </div>
        </div>
    </div>
</div>

<?php require_once APPPATH."/views/common/footer.php"; ?>