<style type="text/css">
/*steps wizard*/
.bs-wizard {margin-top: 40px;}
.bs-wizard {border-bottom: solid 1px #e0e0e0; padding: 0 0 10px 0;}
.bs-wizard > .bs-wizard-step {padding: 0; position: relative;}
.bs-wizard > .bs-wizard-step + .bs-wizard-step {}
.bs-wizard > .bs-wizard-step .bs-wizard-stepnum {color: #595959; font-size: 16px; margin-bottom: 5px;}
.bs-wizard > .bs-wizard-step .bs-wizard-info {color: #999; font-size: 14px;}
.bs-wizard > .bs-wizard-step > .bs-wizard-dot {position: absolute; width: 30px; height: 30px; display: block; background: #fbe8aa; top: 45px; left: 50%; margin-top: -15px; margin-left: -15px; border-radius: 50%;} 
.bs-wizard > .bs-wizard-step > .bs-wizard-dot:after {content: ' '; width: 14px; height: 14px; background: #fbbd19; border-radius: 50px; position: absolute; top: 8px; left: 8px; } 
.bs-wizard > .bs-wizard-step > .progress {position: relative; border-radius: 0px; height: 8px; box-shadow: none; margin: 20px 0;}
.bs-wizard > .bs-wizard-step > .progress > .progress-bar {width:0px; box-shadow: none; background: #fbe8aa;}
.bs-wizard > .bs-wizard-step.complete > .progress > .progress-bar {width:100%;}
.bs-wizard > .bs-wizard-step.active > .progress > .progress-bar {width:50%;}
.bs-wizard > .bs-wizard-step:first-child.active > .progress > .progress-bar {width:0%;}
.bs-wizard > .bs-wizard-step:last-child.active > .progress > .progress-bar {width: 100%;}
.bs-wizard > .bs-wizard-step.disabled > .bs-wizard-dot {background-color: #f5f5f5;}
.bs-wizard > .bs-wizard-step.disabled > .bs-wizard-dot:after {opacity: 0;}
.bs-wizard > .bs-wizard-step:first-child  > .progress {left: 50%; width: 50%;}
.bs-wizard > .bs-wizard-step:last-child  > .progress {width: 50%;}
.bs-wizard > .bs-wizard-step.disabled a.bs-wizard-dot{ pointer-events: none; }
/*google map*/
 #map {height: 300px;}
 #description {font-family: Roboto;font-size: 15px;font-weight: 300;}
 #infowindow-content .title {font-weight: bold;}
 #infowindow-content {display: none;}
 #map #infowindow-content {display: inline;}
 .pac-card {margin: 10px 10px 0 0;border-radius: 2px 0 0 2px;box-sizing: border-box;-moz-box-sizing: border-box;outline: none;box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);background-color: #fff;font-family: Roboto;}
 #pac-container {padding-bottom: 12px;margin-right: 12px;}
 .pac-controls {display: inline-block;padding: 5px 11px;}
 .pac-controls label {font-family: Roboto;font-size: 13px;font-weight: 300;}
</style>
<div class="container">
    <div class="row bs-wizard" style="border-bottom:0;">
        <div class="col bs-wizard-step complete" id="step1">
          <div class="text-center bs-wizard-stepnum text-white">Step 1</div>
          <div class="progress"><div class="progress-bar"></div></div>
          <a href="#" class="bs-wizard-dot"></a>
          <div class="bs-wizard-info text-center text-white">
          	Create movement.
          </div>
        </div>
        
        <div class="col bs-wizard-step disabled" id="step2">
          <div class="text-center bs-wizard-stepnum text-white">Step 2</div>
          <div class="progress"><div class="progress-bar"></div></div>
          <a href="#" class="bs-wizard-dot"></a>
          <div class="bs-wizard-info text-center text-white">
          	Add staff to the movement.
          </div>
        </div>
        
        <div class="col bs-wizard-step disabled">
          <div class="text-center bs-wizard-stepnum text-white">Step 3</div>
          <div class="progress"><div class="progress-bar"></div></div>
          <a href="#" class="bs-wizard-dot"></a>
          <div class="bs-wizard-info text-center text-white">
          	Save movement.
          </div>
        </div>        
    </div>        
</div>

<div class="container mb-5">  

    <section class="container" style="padding-bottom: 1rem;">
        <div class="card bg-light-transparent">
            <div class="card-body">
                <div class="row">
                    <div class="col">
                        <h5>Step 1: Create Movement</h5>
                    </div>
                </div>
                <div class="row">
                    <div class=" col card-body">
                        <div class="card no-shadow">
                            <div class="card-body">
                                <div class="form-group row">
                                    <label class="col-lg-4">Date <span class="text-danger"> * </span></label>							
            				        <div class="col-lg-8" >
            					       <input type="text" name="Date" class="datepicker form-control" id="newdate">
                                       <input type="hidden" name="groupid" class="form-control" placeholder="group id" id="groupid">	
            				        </div>
                                </div>  
                                <div class="form-group row">
                                    <label class="col-lg-4">Department <span class="text-danger"> * </span> </label>
                                    <div class="col-lg-8">
                                        <select class="form-control select" name="dept" id="newdept">
                                            <option value="-1">select department</option>
                                            <?php foreach ($departments as $dept): ?>
                                            <option  value="<?php echo $dept['id']; ?>"><?php echo $dept['name'].' ('.$dept['branch_name'].') ';?></option>
                                            <?php endforeach ?>                                                       
                                        </select>
                                    </div>                                          
                                </div>
                                <div class="form-group row">
                                    <label class="col-lg-4">Type <span class="text-danger"> * </span> </label>                            
                                    <div class="col-lg-8" >
                                        <select class="form-control select" name="type" id="type" onchange="typeChange();">
                                            <option value="-1">Select Type</option>
                                            <?php foreach ($movementTypes as $type): ?>
                                            <option value="<?php echo $type->id;?>"><?php echo $type->movementType;?></option>                        
                                            <?php endforeach ?>                         
                                        </select>
                                    </div>
                                </div>
                                
                                
                                <div class="form-group row" id="client_row">
                                    <label class="col-lg-4">Client <span class="text-danger"> * </span> </label>		 				
            				        <div class="col-lg-8" >
            					        <select class="form-control select" name="client" id="client" placeholder="Select Client">
                                            <option value="-1">Select Client</option>
                                            <?php foreach ($customers as $cust): ?>
                                                <option value="<?php echo $cust->customer_id;?>"><?php echo $cust->name;?></option>
                                            <?php endforeach ?>	
                                                <option value="-1">Others</option>															
            					        </select>
            				        </div><br> 
                                </div>

                                <div class="form-group row">
                                    <label class="col-lg-4">Description <span class="text-danger"> * </span></label>
                                        <div class="col-lg-8">
                                            <textarea rows="4" class="form-control" id="desc"></textarea>
                                        </div>
                                </div>
                                <div class="form-group row">
                                    <label class="col-lg-4">Destination</label>
                                    <div class="col-lg-8">
                                        <div id="type-selector" class="pac-controls d-none">
                                          <input type="radio" name="type" id="changetype-all" checked="checked">
                                          <label for="changetype-all">All</label>

                                          <input type="radio" name="type" id="changetype-establishment">
                                          <label for="changetype-establishment">Establishments</label>

                                          <input type="radio" name="type" id="changetype-address">
                                          <label for="changetype-address">Addresses</label>

                                          <input type="radio" name="type" id="changetype-geocode">
                                          <label for="changetype-geocode">Geocodes</label>
                                        </div>
                                        <div id="strict-bounds-selector" class="pac-controls d-none">
                                          <input type="checkbox" id="use-strict-bounds" value="">
                                          <label for="use-strict-bounds">Strict Bounds</label>
                                        </div>
                                        <input class="form-control" type="search" id="pac-input" type="text" placeholder="Search venue" aria-label="Search">
                                        <!-- google map -->
                                        <div id="map"></div>
                                        <div id="infowindow-content">
                                          <img src="" width="16" height="16" id="place-icon">
                                          <span id="place-name"  class="title"></span><br>
                                          <span id="place-address"></span>
                                        </div>

                                        <!-- google map -->

                                    </div>
                                </div>
                                <span class="text-danger"> <small><i>[NOTES : ] * require </i></small></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row text-right">
                	<div class="col">
                		<a class="btn btn-info" id="createMove" href="#staffSection"><i class="fas fa-users"></i> Create Movement</a>
                	</div>
                </div>
            </div>
        </div>
    </section>

    <section class="container d-none" style="padding-bottom: 1rem;" id="staffSection">
        <div class="card bg-light-transparent">
            <div class="row text-right mt-3 mr-1">
                <div class="col">
                    <button class="btn btn-info" id="addBtn" data-toggle="modal" data-target="#new"> <i class="fas fa-plus"></i> Add Staff</button>

                    <button class="btn btn-info disabled" id="saveBtn" disabled> <i class="fas fa-save"></i> Save</button>
                </div>
            </div>  
            <div class="card-body">
                <div class="row">
                    <div class="col">
                        <h5>Step 2 & 3: Add staff to the movement & save</h5>
                    </div>
                </div>
                <div class="card no-shadow" >
                    <div class="card-body pt-3">
                        <div class="col-12 table-responsive p-0 m-0 " style="margin-top:2rem ">
                            <table class="table table-bordered" width="100%">
        				        <thead>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="#: activate to sort column ascending" style="width: 0px;">
        						      #
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Company Code/ Cost Centre: activate to sort column ascending" style="width: 0px;">
        						      Date
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Company Name: activate to sort column ascending" style="width: 0px;">
        						      Name
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Salary/ Wage Month: activate to sort column ascending" style="width: 0px;">
        						      Time Out
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Employee Total Upload: activate to sort column ascending" style="width: 0px;">
        						      Time In
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Total Net Pay: activate to sort column ascending" style="width: 0px;">
        						      Remarks
        					       </th>
        					       <th class="sorting" tabindex="0" aria-controls="table_contact" rowspan="1" colspan="1" aria-label="Action: activate to sort column ascending" style="width: 0px;">
        						      Action
        					       </th>						
        				        </thead>	
        				        <tbody id="tableBody"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

	<div class="modal fade" id="new" role="dialog" aria-labelledby="Add New" aria-hidden="true">
  		<div class="modal-dialog" role="document">
    		<div class="modal-content">
      			<div class="modal-header">
       				<h5 class="modal-title">Add New Staff</h5>
        			<a class="close" data-dismiss="modal" aria-label="Close">
          				<span aria-hidden="true">&times;</span>
        			</a>
      			</div>
      			<div class="modal-body">
                    <div class="row">
                        <div class="col-3">
                            Date <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input type="text" name="Date" class="form-control" id="modal_new_date" readonly>
                            </div>
                        </div>
                    </div>
        			<div class="row">
                        <div class="col-3">
                            Department <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input type="text" class="form-control" id="modal_new_department" readonly>
                            </div>
                        </div>
                    </div>
        			<div class="row">
        				<div class="col-3">
        					Name <span class="text-danger"> * </span>
        				</div>
        				<div class="col-1">
        					:
        				</div>
        				<div class="col-8" align="left">
        					<div class="form-group">
        						<select class="form-control select"  id="modal_new_user" style="width:100%;">
                                    <option value="-1">Select Staff</option>      
                                        <?php foreach ($users as $user): ?>
                                            <option value="<?php echo $user['id']?>" data-deptid="<?php echo $user['department_id']; ?>"><?php echo $user['name'];?></option>                                          
                                        <?php endforeach ?>                                         
                                </select>
        					</div>
        				</div>
        			</div>
        			<div class="row">
        				<div class="col-3">
        					Time Out <span class="text-danger"> * </span>
        				</div>
        				<div class="col-1">
        					:
        				</div>
        				<div class="col-8" align="left">
        					<div class="form-group">
                                <input placeholder="Select time" type="text" class="form-control timepicker" id="modal_new_timeout">
                            </div>
        				</div>
        			</div>
        			<div class="row">
        				<div class="col-3">
        					Time In <span class="text-danger"> * </span>
        				</div>
        				<div class="col-1">
        					:
        				</div>
        				<div class="col-8" align="left">
                            <div class="form-group">
                                <input placeholder="Select time" type="text"  class="form-control timepicker" id="modal_new_timein">
                            </div>
                        </div>
        			</div>
                    <div id="replacement_wrapper" class="d-none">
                        <hr>
                        <div class="row">
                            <div class="col-3">
                                Replacement Date <span class="text-danger"> * </span>
                            </div>
                            <div class="col-1">
                                :
                            </div>
                            <div class="col-8" align="left">
                                <div class="form-group">
                                    <input type="text" name="replacementDate" class="datepicker form-control" id="modal_replacement_date">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-3">
                                Replacement Time In <span class="text-danger"> * </span>
                            </div>
                            <div class="col-1">
                                :
                            </div>
                            <div class="col-8" align="left">
                                <div class="form-group">
                                    <input placeholder="Select time" type="text" class="form-control timepicker" id="modal_replacement_timein">
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-3">
                                Replacement Time Out <span class="text-danger"> * </span>
                            </div>
                            <div class="col-1">
                                :
                            </div>
                            <div class="col-8" align="left">
                                <div class="form-group">
                                    <input placeholder="Select time" type="text" class="form-control timepicker" id="modal_replacement_timeout">
                                </div>
                            </div>
                        </div>
                    </div>

      			</div>
      			<div class="modal-footer">
      				<button type="button" class="btn btn-primary" id="btnAdd" >Add</button>
        			<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
     			</div>
    		</div> 
 		</div>
	</div>

    <div class="modal fade" id="edit" tabindex="-1" role="dialog" aria-labelledby="Add New" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Edit Staff Movement Time</h5>
                    <a class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </a>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-3">
                            Date <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input type="text" name="Date" class="form-control" id="editId" readonly>
                                <input type="text" name="Date" class="form-control" id="editDate" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-3">
                            Name <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input class="form-control" id="editName" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-3">
                            Time Out <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input placeholder="Select time" type="text" class="form-control timepicker" id="editTimeOut">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-3">
                            Time In <span class="text-danger"> * </span>
                        </div>
                        <div class="col-1">
                            :
                        </div>
                        <div class="col-8" align="left">
                            <div class="form-group">
                                <input placeholder="Select time" type="text"  class="form-control timepicker" id="editTimeIn">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="editSave" >save</button>
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                </div>
            </div> 
        </div>
    </div>


    <div class="modal fade" id="error_notice" tabindex="-1" role="dialog" aria-labelledby="Add New" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title"><span class="text-danger"><i class="fas fa-exclamation-triangle"></i> Error</span></h5>
                    <a class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </a>
                </div>
                <div class="modal-body">
                    Please make sure that 
                    <ul>
                        <li>All forms have been filled</li>
                        <li><a href="<?php echo base_url('/hr/StaffMovement/calendar'); ?>" target="_blank">Your movement not been created yet - click on this link</a> </li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">closed</button>
                </div>
            </div> 
        </div>
    </div>

</div>

<?php
$this->load->view('scripts/steps.php');
$this->load->view('scripts/google_map.php');
?>