<!DOCTYPE html>
<html>
  <?php
  $this->load->view('template/header_script');

   $Currency = getCurrency();
  

  ?>

  <style>
    .profile_div{
        width:100%;
        text-align: center;
        padding-top:0px;
        padding-bottom: 30px;

    }

    .profile_circle{
        width:120px;
        height:120px;
        border-radius: 50%;
        background-color: #a8a8a8;
        margin: 0 auto;
        position: relative;
    }
    .profile_circle img{
        width:100%;
        height:100%;
        border-radius: 50%;
        object-position: center;
        object-fit: cover;
    }
    .profile_circle input{
        position: absolute;
        top:0px;
        left:0px;
        right:0px;
        bottom: 0px;
        opacity: 0;
    }
</style>
<body class="bg-dark">
<div class="sufee-login d-flex align-content-center flex-wrap">
        <div class="container">
            <div class="login-content">
                <div class="login-logo">

                    <a href="index.html">

                      <label><h1>Garage Registration</h1></label>
                    </a>
                </div>
                <div class="login-form">
                  <?php 
        $url = (isset($Garege_id)||!empty($Garege_id))
        ?'Registration_request/updateGarage/'.$Garege_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="profile_div">
                <div class="profile_circle">
                      <?php $req = (!isset($Garege_id)||empty($Garege_id))
                  ?'form-control required':'form-control';?>
                     <img id="image_id_1" src="<?= (isset($garageData->profile_pic))?base_url($garageData->profile_pic):'' ?>" 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 class="form-group">
                            <label>User 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($garageData->name))?$garageData->name:'' ?>" >
                        </div>
                    <div class="form-group">
                    <div class="row">
                    <div class="col-md-3">
                    <label for="nf-email" class=" form-control-label">Code</label>
                    <select name="phone_code" id="selectSm" class="form-control required">
                        <option value=""></option>    
                       <?php foreach($Currency as $crny) { ?> 
                        <?php  if  (isset($Garage_id)||!empty($Garage_id)) { ?>
                          <option <?= $garageData->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-9">
                      <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($garageData->phone_no))?$garageData->phone_no:'' ?>" >
                    </div>
                </div>
                        <div class="form-group">
                            <label>Email address</label>
                             <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($garageData->email))?$garageData->email:'' ?>" >
                        </div>
                        <div class="form-group">
                            <label>Password</label>
                           <input type="password" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"  data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" id="nf-brand" name="password" placeholder="Enter Password" class="form-control required" value="" >
                        </div>
                         <div class="form-group">
                         <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($garageData->location))?$garageData->location:'' ?>">
                      <input type="hidden" name="lat" id="lat" value="<?= (isset($garageData->lat))?$garageData->lat:'' ?>" required class="form-control required" readonly="">
                      <input type="hidden" name="lng" id="lng"  value="<?= (isset($garageData->lng))?$garageData->lng:'' ?>" required class="form-control required" readonly="">
                  </div>
                   <div class="form-group">
                      <label for="nf-email" class=" form-control-label">Garage 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="garage_code" placeholder="Garage Code" class="form-control required" value="<?= (isset($garageData->garage_code))?$garageData->garage_code:$garage_code ?>"  >
                    </div>
                    <div class="form-group">
                      <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($garageData->altered_no))?$garageData->altered_no:'' ?>" >
                    </div>
                     <div class="form-group"> 
                       <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($garageData->address))?$garageData->address:'' ?></textarea> 
                       
                      </div>
                        <div class="form-group">
                      <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($garageData->website))?$garageData->website:'' ?>" >
                    </div>
                      <div class="form-group">
                      <label for="nf-email" class=" form-control-label">Working From</label>
                     <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"   id="nf-brand" name="working_from" placeholder="Working From" class="form-control required" value="<?= (isset($garageData->working_from))?$garageData->working_from:'' ?>" >
                    </div>
                     <div class="form-group">
                      <label for="nf-email" class=" form-control-label">Working To</label>
                    <input type="text" data-parsley-trigger="change" data-parsley-trigger="change"  data-parsley-minlength="2"   id="nf-brand" name="working_to" placeholder="Working To" class="form-control required" value="<?= (isset($garageData->working_to))?$garageData->working_to:'' ?>" >
                    </div>
<!-- <div class="form-group">
                  <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($Garage_id)||!empty($Garage_id)) { 
                       $garage = explode(',', $garageData->amenities);
                       $selected = in_array($amenitie->id, $garage) ? 'selected="selected"': '';
                       ?>

                       <option <?= $selected ? "selected" : "" ; ?> value="<?= $amenitie->id ?>"><?= $amenitie->name ?></option> 
                     <?php }else { ?> 
                      <option  value="<?= $amenitie->id ?>"><?= $amenitie->name ?></option>
                    <?php }} ?> 
                  </select>

                  
                </div> -->
                   <!--   <div class="form-group">
                  <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($Garage_id)||!empty($Garage_id)) { 
                       $garage = explode(',', $garageData->amenities);
                       $selected = in_array($amenitie->id, $garage) ? 'selected="selected"': '';
                       ?>

                       <option <?= $selected ? "selected" : "" ; ?> value="<?= $amenitie->id ?>"><?= $amenitie->name ?></option> 
                     <?php }else { ?> 
                      <option  value="<?= $amenitie->id ?>"><?= $amenitie->name ?></option>
                    <?php }} ?> 
                  </select>

                  
                </div> -->
                       <!--  <div class="checkbox">
                            <label>
                                <input type="checkbox"> Agree the terms and policy
                            </label>
                        </div> -->
                        <button type="submit" class="btn btn-primary btn-flat m-b-30 m-t-30">Register</button>
                        <div class="social-login-content">
                           <!--  <div class="social-button">
                                <button type="button" class="btn social facebook btn-flat btn-addon mb-3"><i class="ti-facebook"></i>Register with facebook</button>
                                <button type="button" class="btn social twitter btn-flat btn-addon mt-2"><i class="ti-twitter"></i>Register with twitter</button>
                            </div> -->
                        </div>
                       <!--  <div class="register-link m-t-15 text-center">
                            <p>Already have account ? <a href="#"> Sign in</a></p>
                        </div> -->
                    </form>
                </div>
            </div>
        </div>
    </div>

<?php
        $this->load->view('template/footer_script');
    ?>
  </body>
</html>