<div class="content-wrapper">
  <section class="content-header">
    <h1>
      <?= $page_title ?>
      <small><?= $page_desc ?></small>
    </h1>
    <ol class="breadcrumb">
     <li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
     <li><?= $menu ?></li>
     <li class="active"><?= $sub_menu ?></li>
   </ol>
  </section>
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <?php 
          $redirectUrl = (isset($customer_id) && !empty($customer_id))
                            ?'Customer/updateCustomer/'.$customer_id
                            :'Customer/createCustomer';
          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 } ?>
      </div>
      <div class="col-md-12">
        <div class="box box-warning">
          <div class="box-header with-border">
            <h3 class="box-title">Personal Details</h3>
          </div>
          <form role="form" action="<?=base_url($redirectUrl)?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
            <div class="box-body">
              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>First Name</label>
                     <input type="text" class="form-control required" data-parsley-trigger="change"  
                      data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$"
                      required="" name="first_name"  placeholder="Enter Patient First Name" 
                      value="<?= (isset($customer_data) && isset($customer_data->first_name))?$customer_data->first_name:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Last Name</label>
                     <input type="text" class="form-control required" data-parsley-trigger="change"  
                     data-parsley-minlength="2"  data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$" required="" name="last_name"  placeholder="Enter Patient Last Name"
                      value="<?= (isset($customer_data) && isset($customer_data->last_name))?$customer_data->last_name:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>


              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Email</label>
                     <input type="email" class="form-control required" data-parsley-trigger="change"  
                     data-parsley-minlength="2" required="" name="email"  placeholder="Enter Patient Email"
                      value="<?= (isset($customer_data) && isset($customer_data->email))?$customer_data->email:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Phone</label>
                     <input type="number" class="form-control required" data-parsley-trigger="change"  
                     data-parsley-minlength="2" required="" name="phone" placeholder="Enter Patient Phone"
                      value="<?= (isset($customer_data) && isset($customer_data->phone))?$customer_data->phone:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>


              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Date Of Birth</label>
                      <div class="input-group date" data-provide="datepicker">
                        <input id="datepicker" type="text" class="form-control required" data-parsley-trigger="change" data-parsley-minlength="2" required="" name="date_of_birth" placeholder="Pick Date Of Birth" autocomplete="off" value="<?= (isset($customer_data) && isset($customer_data->date_of_birth))?$customer_data->date_of_birth:'' ?>">
                        <div class="input-group-addon">
                          <i class="fa fa-calendar"></i>
                        </div>
                      </div>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Alternate Phone</label>
                     <input type="number" class="form-control" data-parsley-trigger="change"  
                     data-parsley-minlength="2" name="alt_phone"  placeholder="Enter Alternate Phone" 
                      value="<?= (isset($customer_data) && isset($customer_data->alt_phone))?$customer_data->alt_phone:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>


              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Address</label>
                     <textarea class="form-control required" data-parsley-trigger="change"  
                     data-parsley-minlength="2" required="" name="address" placeholder="Enter Patient Address"><?= (isset($customer_data) && isset($customer_data->address))?trim($customer_data->address):'' ?></textarea>
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group">
                    <label for="exampleInputEmail1">Profile Picture</label>
                    <div class="col-md-12">
                      <div class="col-md-3">
                        <img id="profile_image" src="<?= (isset($customer_data) && isset($customer_data->profile_image))?base_url($customer_data->profile_image):'' ?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>'" height="75" width="75" />
                      </div>
                      <div class="col-md-9" style="padding-top: 25px;">
                        <input name="profile_image" type="file" accept="image/*" 
                        class="<?= (isset($customer_id) && !empty($customer_id))?'':'required' ?>" 
                        onchange="setImg(this,'profile_image')" />
                      </div>
                    </div>
                  </div>
                </div>
              </div>


              <div style="border-bottom: 1px solid #f4f4f4;border-bottom-width: 1px;border-bottom-style: solid;
                           border-bottom-color: rgb(244, 244, 244);">
                <h3 class="box-title" style="font-size: 18px !important;">
                  Medical Details
                </h3>
              </div><br>

              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>SSN</label>
                     <input type="text" class="form-control" data-parsley-trigger="change"  
                     data-parsley-minlength="2" name="ssn" placeholder="Provide SSN" 
                      value="<?= (isset($customer_data) && isset($customer_data->ssn))?$customer_data->ssn:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>GRP</label>
                     <input type="text" class="form-control" data-parsley-trigger="change"  
                     data-parsley-minlength="2" name="grp" placeholder="Provide GRP" 
                      value="<?= (isset($customer_data) && isset($customer_data->grp))?$customer_data->grp:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>


              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Issuer</label>
                     <input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" 
                      type="text" name="issuer" placeholder="Provide Issuer" 
                      value="<?= (isset($customer_data) && isset($customer_data->issuer))?$customer_data->issuer:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Insurance Provider</label>
                     <input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" 
                      type="text" name="insurance_provider" placeholder="Provide Insurance Provider" 
                      value="<?= (isset($customer_data) && isset($customer_data->insurance_provider))?$customer_data->insurance_provider:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>


              <div class="col-md-12">
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Member ID</label>
                     <input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" 
                      type="text" name="member_id" placeholder="Provide Member ID" 
                      value="<?= (isset($customer_data) && isset($customer_data->member_id))?$customer_data->member_id:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
                <div class="col-md-6">
                  <div class="form-group has-feedback">
                     <label>Group Number</label>
                     <input class="form-control" data-parsley-trigger="change" data-parsley-minlength="2" 
                      type="text" name="group_number" placeholder="Provide Group Number" 
                      value="<?= (isset($customer_data) && isset($customer_data->group_number))?$customer_data->group_number:'' ?>">
                     <span class="glyphicon  form-control-feedback"></span>
                  </div>
                </div>
              </div>
              <div class="col-md-12">          
                <div class="box-footer">
                  <div style="text-align: center;">
                    <button type="submit" class="btn btn-primary">Submit</button>
                  </div>
                </div>        
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </section>
</div>