<?php
  $Currency = getCurrency();
  
?>
<!-- PAGE-INDEX-STARTS -->

<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <div class="row m-0">
            <div class="col-sm-4">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><?= $pTitle ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li><a href="<?= base_url() ?>">Dashboard</a></li>
                            <li><a ><?= $menu ?></a></li>
                            <li class="active"><?= $smenu ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- PAGE-INDEX-ENDS -->
<?php
  $express_code = getexpress_code();
  $country = getCurrency();
  
?>
<!-- PAGE-CONTENT-STARTS -->

<div class="content">
  <div class="animated fadeIn">
      <div class="row">
        <div class="col-lg-12">
        <?php 
        $url = (!isset($Express_id)||empty($Express_id))
        ?'Express/createExpress':'Express/updateExpress/'.$Express_id;
        if($this->session->flashdata('message')) { 
        $flashdata = $this->session->flashdata('message'); ?>
          <div class="alert alert-<?= $flashdata['class'] ?>">
            <button class="close" data-dismiss="alert" type="button">×</button>
            <?= $flashdata['message'] ?>
          </div>
          <?php } ?>
          <form role="form" action="<?= base_url($url) ?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
            <div class="card">
              <div class="card-header">
                <strong><?= $pDescription ?></strong>
              </div>
              <div class="card-body card-block">
                <div class="form-group">
                  <div class="row">
                    <div class="col-md-6">

                      <label for="nf-email" class=" form-control-label">Name</label>
                      <input type="text" data-parsley-trigger="change" data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="name" placeholder="Enter Name" class="form-control required" value="<?= (isset($ExpressData->name))?$ExpressData->name:'' ?>" >
                    </div>
                    <?php $req = (!isset($Express_id)||empty($Express_id))
                  ?'form-control required':'form-control';?>
                    <div class="col-md-6">
                      <label>Profile Picture</label><br>
                     
                        <img id="image_id_1" src="<?= (isset($ExpressData->image))?base_url($ExpressData->image):'' ?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="75" width="75" />
                        <input name="profile_image" type="file" accept="image/*" onchange="setImg(this,'image_id_1');" class="<?= base_url($req) ?>"/>
                    </div>
                  </div>
               
                </div>
                
                <div class="form-group">
                  <div class="row">
                    <div class="col-md-2">
                    <label for="nf-email" class=" form-control-label">Code</label>
                    <select name="phone_code" id="selectSm" class="form-control required">
                        <option value="">Code</option>    
                        <?php foreach($Currency as $crny) { ?> 
                        <?php  if  (isset($Express_id)||!empty($Express_id)) { ?>
                        <option <?= $ExpressData->code == $crny['code'] ? "selected" : "" ; ?> value="<?= $crny['code'] ?>"><?= $crny['code'] ?></option>
                        <?php }else { ?> 
                        <option  value="<?= $crny['code'] ?>"><?= $crny['code'] ?></option>
                        <?php }} ?> 
                      </select>

                  
                    </div>
                    <div class="col-md-4">
                      <label for="nf-email" class=" form-control-label">Phone Number</label>
                      <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="phone" placeholder="Enter Phone Number" class="form-control required" value="<?= (isset($ExpressData->phone_no))?$ExpressData->phone_no:'' ?>" >
                    </div>
                     <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Email</label>
                      <input type="email" id="pd_email" name="email" placeholder="Enter Email" class="form-control required" onfocusout="myFunction()" value="<?= (isset($ExpressData->email_id))?$ExpressData->email_id:'' ?>" >
                      <br>
                        <div id="email_req" style="color: red"></div>
                    </div>
                  </div>
                </div>

                
             
               
                <div class="form-group">
                  <div class="row">
                   <!--  <div class="col-md-4">
                    <label for="nf-email" class=" form-control-label">Provide Services</label>
                    <select name="services[]"  id="second" class="form-control chosen-select" multiple data-placeholder="Choose Services...">
                  
                        <?php foreach($services as $service) { ?> 
                        <?php  if  (isset($Express_id)||!empty($Express_id)) { ?>
                       <option <?= $ExpressData->service_name == $service['service_name'] ? "selected" : "" ; ?> value="<?= $services['service_name'] ?>"><?= $service['service_name'] ?></option> 
                        <?php }else { ?> 
                        <option  value="<?= $service->service_name ?>"><?= $service->service_name ?></option>
                        <?php }} ?> 
                      </select>

                  
                    </div>

                    <div class="col-md-2">
                    
                   <input id="button" type="button" value="Append" />
                  <p id="area"></p>

                  
                    </div> -->
                    
                    <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Location</label>
                      <input type="text" name="location" id="location"  required class="form-control required" placeholder="Enter Location" onkeypress="ratelocation()" value="<?= (isset($ExpressData->location))?$ExpressData->location:'' ?>">
                      
                   
                   
                    </div>
                     <div class="col-md-3">
                      <label for="nf-email" class=" form-control-label">Latitude</label>
                      <input type="text" name="lat" id="lat" value="<?= (isset($ExpressData->lat))?$ExpressData->lat:'' ?>" required class="form-control required" readonly="">
                     
                   
                    </div>
                     <div class="col-md-3">
                      <label for="nf-email" class=" form-control-label">Longitude</label>
                     
                    <input type="text" name="lng" id="lng"  value="<?= (isset($ExpressData->lng))?$ExpressData->lng:'' ?>" required class="form-control required" readonly="">
                   
                    </div>
                  </div>
                </div>
                 <div class="form-group">
                  <div class="row">

 <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Express Code</label>
                      <input type="text" readonly="" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="express_code" placeholder="Express Code" class="form-control required" value="<?= (isset($ExpressData->Express_code))?$ExpressData->Express_code:$express_code ?>"  >
                    </div>



                    <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Altered Number</label>
                      <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="altered_no" placeholder="Enter Altered Number" class="form-control required" value="<?= (isset($ExpressData->altered_no))?$ExpressData->altered_no:'' ?>" >
                    </div>
                   <!--  <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Postal Code</label>
                      <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="postal_code" placeholder="Enter Postal Code" class="form-control required" value="<?= (isset($ExpressData->postal_code))?$ExpressData->postal_code:'' ?>" >
                    </div> -->
                  </div>
                </div>
                <div class="form-group">
                  <div class="row">
                   <!--  <div class="col-md-6">
                    <label for="nf-email" class=" form-control-label">City</label>
                    <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="city" placeholder="Enter City" class="form-control required" value="<?= (isset($ExpressData->city))?$ExpressData->city:'' ?>" >

                  
                    </div> -->
                  <!--  <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Altered Number</label>
                      <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="altered_no" placeholder="Enter Altered Number" class="form-control required" value="<?= (isset($ExpressData->altered_no))?$ExpressData->altered_no:'' ?>" >
                    </div> -->
                  </div>
                </div>
              
                  <div class="form-group">
                    <div class="row">         
                     <div class="col-md-6"> 
                       <label for="nf-email"  class=" form-control-label">Address</label>
                                <textarea type="text" data-parsley-trigger="change" data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="address" placeholder="Enter Address" class="form-control required" ><?= (isset($ExpressData->address))?$ExpressData->address:'' ?></textarea> 
                       
                      </div>
                    <!--  <div class="col-md-6">
                      <label for="nf-email" class=" form-control-label">Website</label>
                      <input type="url" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2" id="nf-brand" name="website" placeholder="Enter Website url" class="form-control required" value="<?= (isset($ExpressData->website))?$ExpressData->website:'' ?>" >
                    </div> -->
                    </div>
                  </div>
                  <!-- <div class="form-group">
                  <div class="row">
                    <div class="col-md-6">
                    <label for="nf-email" class=" form-control-label">Working hours</label>
                    <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="working_hours" placeholder="Enter Working hours" class="form-control required" value="<?= (isset($ExpressData->working_hours))?$ExpressData->working_hours:'' ?>" >

                  
                    </div>
                   <div class="col-md-6">
                    <label for="nf-email" class=" form-control-label">Provide Amenities</label>
                    <select name="amenities[]"  id="second" class="form-control chosen-select" multiple data-placeholder="Choose Services...">
                  
                        <?php foreach($amenities as $amenitie) { ?> 
                        <?php  if  (isset($Express_id)||!empty($Express_id)) { ?>
                       <option <?= $ExpressData->amenities == $amenitie['name'] ? "selected" : "" ; ?> value="<?= $amenitie['id'] ?>"><?= $amenitie['name'] ?></option> 
                        <?php }else { ?> 
                        <option  value="<?= $amenitie->id ?>"><?= $amenitie->name ?></option>
                        <?php }} ?> 
                      </select>

                  
                    </div>
                  </div>
                </div>
 -->


               <!--   <div class="form-group">
                  <div class="row">
                    <div class="col-md-6">
                    <label for="nf-email" class=" form-control-label">Provide services</label>
                     <select name="services[]"   class="form-control" data-placeholder="Choose Services...">
                  
                        <?php foreach($services as $service) { ?> 
                        <?php  if  (isset($Express_id)||!empty($Express_id)) { ?>
                       <option <?= $ExpressData->service_name == $service['service_name'] ? "selected" : "" ; ?> value="<?= $services['id'] ?>"><?= $service['service_name'] ?></option> 
                        <?php }else { ?> 
                        <option  value="<?= $service->id ?>"><?= $service->service_name ?></option>
                        <?php }} ?> 
                      </select>
                    </div>

                    <div class="col-md-5">
                    <label for="nf-email" class=" form-control-label">Services Amount </label>
                    <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="amount[]" placeholder="Enter Services Amount" class="form-control required" value="<?= (isset($ExpressData->working_hours))?$ExpressData->working_hours:'' ?>" >
                       </div> -->
                  <!-- 
                    <div class="col-md-1">
                    <div class="row marginTop10">
                     
                      <div class="col-md-6">
                 <div class="col-sm-2" style="padding-left: initial;">
                        <i class="fa fa-plus-circle cpoint fav-add-icon" onclick="addTimePicker(jQuery(this))" count="1"></i>
                      </div>
                     
                      </div>

                    </div> -->
                  </div>
                    
                  </div>
                </div>

 <div id="scheduleTimerCntr"></div>


              
                  <div class="form-group">
                    <div class="row">
                      <div class="col-md-12">
                          <button type="submit" class="btn btn-primary">
                                <i class="fa "></i>Submit
                          </button>
                      </div>
                    </div>
                  </div>   
                </div>
              </div>
            </form>
          </div>
         </div>
      </div>
   </div>
   <div class="clear-fix"></div>
  


                <div class="form-group" id="scheduleTimerHtml" class="hide">
                  <div class="row" id="timePicker_{:count}">
                    <div class="col-md-6">
                    <label for="nf-email" class=" form-control-label">Provide services</label>
                     <select name="services[]"   class="form-control" data-placeholder="Choose Services...">
                  
                        <?php foreach($services as $service) { ?> 
                        <?php  if  (isset($Express_id)||!empty($Express_id)) { ?>
                       <option <?= $ExpressData->service_name == $service['service_name'] ? "selected" : "" ; ?> value="<?= $services['id'] ?>"><?= $service['service_name'] ?></option> 
                        <?php }else { ?> 
                        <option  value="<?= $service->id ?>"><?= $service->service_name ?></option>
                        <?php }} ?> 
                      </select>
                    </div>

                    <div class="col-md-5">
                    <label for="nf-email" class=" form-control-label">Services Amount </label>
                    <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[0-9\ , - + \/]+$" id="nf-brand" name="amount[]" placeholder="Enter Services Amount" class="form-control required" value="<?= (isset($ExpressData->working_hours))?$ExpressData->working_hours:'' ?>" >
                       </div>
                  
                    <div class="col-md-1">
                    <div class="row marginTop10">
                      <div class="col-md-6"></div>
                      <div class="col-md-6">
                         <i class="padTop12 fa fa-times-circle-o cpoint fav-rem-icon" onclick="remTimePicker({:count})"></i>
                      </div>
                    </div>
                  </div>
                    
                  </div>
                </div>















<script type="text/javascript">

function addTimePicker(thisObj){
  var count = thisObj.attr('count')+1,
      inputHtml = jQuery('[id="scheduleTimerHtml"]').html();

  thisObj.attr('count',count);
  jQuery('[id="scheduleTimerCntr"]').append(inputHtml.replace(/{:count}/g,count));
}



function remTimePicker(count){
  jQuery('[id="timePicker_'+count+'"]').remove();
}



</script> 
       
  
 