<div class="row page-titles">
  <div class="col-md-5 align-self-center">
    <h4 class="text-themecolor">COMMITTEE OF ADMINISTRATION</h4>
  </div>
  <div class="col-md-7 align-self-center text-right">
    <div class="d-flex justify-content-end align-items-center">
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="<?php echo base_url(); ?>admin/dashboard">DASHBOARD</a></li>
        <li class="breadcrumb-item active">COA</li>
      </ol>
    </div>
  </div>
</div>
<!-- Start Page Content -->
<!-- ============================================================== -->
<!-- Row -->
<div class="row">
  <!-- Column -->
  <div class="col-lg-4 col-xlg-3 col-md-5">
    <div class="card">
      <div class="card-body">
        <center class="m-t-30"> 
          <?php if($coa[0]->image == 'NA'){ ?>
          <img src="<?php echo base_url(); ?>public/custom/images/coa/default.jpg" class="img-circle" width="150" />
          <?php }else{ ?>
          <img src="<?php echo base_url().$coa[0]->image; ?>" class="img-circle" width="150" />
          <?php } ?>
          <h4 class="card-title m-t-10"><?php echo ucwords($coa[0]->name); ?></h4>
          <h6 class="card-subtitle"><strong><?php echo Modules::run('coa/getName',"coa_designations",$coa[0]->designation,"name"); ?></strong> <?php if($coa[0]->division !== '0'){ echo ' - '.Modules::run('coa/getName',"coa_designations",$coa[0]->division,"name"); } ?></h6>
          <?php if($coa[0]->status == '1'){
            echo '<span class="badge badge-success">ACTIVE</span>';
          }else{
            echo '<span class="badge badge-danger">DEACTIVE</span>';
          } ?>
        </center>
      </div>
      <!-- <div><hr></div> -->
  
      <!-- <div class="card-body">
        <small class="text-muted">Email</small>
        <h6><?php echo $coa[0]->email_1; ?></h6> 
        <?php if($coa[0]->email_2 !== ""){ ?>
        <h6><?php echo$coa[0]->email_2; ?></h6> 
        <?php } ?>
      </div> -->
    </div>
  </div>
  
  <div class="col-lg-8 col-xlg-9 col-md-7">
    <div class="card">
      <!-- Nav tabs -->
      <ul class="nav nav-tabs profile-tab" role="tablist">
        <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#profile" role="tab">PROFILE</a> </li>
        <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#settings" role="tab">UPDATE</a> </li>
      </ul>
      <!-- Tab panes -->
      <div class="tab-content">
        <div class="tab-pane active" id="profile" role="tabpanel">
          <div class="card-body">
            <div class="row">
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Organisation</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->organisation; ?> </p>
              </div>
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Address</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->address; ?> </p>
              </div>
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Office No.</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->office_number; ?> </p>
              </div>
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Fax No.</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->fax; ?> </p>
              </div>
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Mobile No.</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->mobile; ?> </p>
              </div>
              <div class="col-md-12 col-xs-6 b-r"> 
                <strong>Email</strong>
                <br>
                <p class="text-muted"><?php echo $coa[0]->email_1; ?> <?php if($coa[0]->email_2 !== '0'){ echo ' | '.$coa[0]->email_2; } ?></p>
              </div>
            </div>
            <hr>
            <p class="m-t-10"><?php echo $coa[0]->about; ?></p>

            <div class="form-actions m-t-10">
              <button type="button" class="btn btn-rounded btn-outline-danger col-md-3" onclick="window.location.href='<?php echo base_url(); ?>coa/list'">CANCEL</button>  
            </div>
          </div>
        </div>
        <div class="tab-pane" id="settings" role="tabpanel">
          <div class="card-body">
            <form id="update_coa" class="form-material">
              <div class="form-body">
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>NAME <span>*</span></strong></label>
                      <input type="text" id="name" name="name" value="<?php echo $coa[0]->name; ?>" class="form-control">
                      <label for="name" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>DESIGNATION <span>*</span></strong></label>
                      <select name="designation" id="designation" class="form-control">
                      <option value="">SELECT DESIGNATION</option>
                      <?php foreach($designation as $val){ 
                        $selected = false;
                        if($val->id == $coa[0]->designation){
                          $selected = true;
                        }  
                      ?>
                      <option value="<?php echo $val->id; ?>" <?php if($selected){ echo 'selected'; }?>><?php echo strtoupper($val->name); ?></option>
                      <?php } ?>
                      </select>
                      <label for="designation" class="error"></label> 
                    </div>
                  </div>
              
                  <?php if($coa[0]->division !== 0 || $coa[0]->division !== ""){ ?>
                  <div class="col-md-12" id="division_div">
                    <div class="form-group">
                      <label class="control-label"><strong>DIVISION</strong></label>
                      <select name="division" id="division" class="form-control">
                      <option value="">SELECT DIVISION</option>
                      <?php 
                      if($division !== "No Data"){
                        foreach($division as $val){
                          $selected = false;
                          if($val->id == $coa[0]->division){
                            $selected = true;
                          }
                      ?>
                      <option value="<?php echo $val->id; ?>" <?php if($selected){ echo 'selected'; } ?> ><?php echo strtoupper($val->name); ?></option>
                      <?php  }
                      }
                      ?>
                      </select>
                      <label for="division" class="error"></label> 
                    </div>
                  </div>
                  <?php }else{ ?>
                  <div class="col-md-12" id="division_div" style="display:none;">
                    <div class="form-group">
                      <label class="control-label"><strong>DIVISION</strong></label>
                      <select name="division" id="division" class="form-control">
                      <option value="">SELECT DIVISION</option>
                      </select>
                      <label for="division" class="error"></label> 
                    </div>
                  </div>
                  <?php } ?>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>ORGANISATION <span>*</span></strong></label>
                      <input type="text" id="organisation" name="organisation" value="<?php echo $coa[0]->organisation; ?>" class="form-control">
                      <label for="organisation" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>ADDRESS <span>*</span></strong></label>
                      <textarea id="address" name="address" class="form-control" rows="3"><?php echo $coa[0]->address; ?></textarea>
                      <label for="address" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>OFFICE NO <span>*</span></strong></label>
                      <input type="text" id="office_number" name="office_number" value="<?php echo $coa[0]->office_number; ?>" class="form-control">
                      <label for="office_number" class="error"></label> 
                    </div>
                  </div>
                  
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>FAX NO </strong></label>
                      <input type="text" id="fax" name="fax" value="<?php echo $coa[0]->fax; ?>" class="form-control">
                      <label for="fax" class="error"></label> 
                    </div>
                  </div>
                  
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>MOBILE NO </strong></label>
                      <input type="text" id="mobile" name="mobile" value="<?php echo $coa[0]->mobile; ?>" class="form-control">
                      <label for="mobile" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>EMAIL 1 <span>*</span></strong></label>
                      <input type="email" id="email_1" name="email_1" value="<?php echo $coa[0]->email_1; ?>" class="form-control">
                      <label for="email_1" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>EMAIL 2</strong></label>
                      <input type="email" id="email_2" name="email_2" value="<?php echo $coa[0]->email_2; ?>" class="form-control">
                      <label for="email_2" class="error"></label> 
                    </div>
                  </div>
                  
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>ABOUT</strong></label>
                      <textarea id="about" name="about" class="form-control" rows="3"><?php echo $coa[0]->about; ?></textarea>
                      <label for="about" class="error"></label> 
                    </div>
                  </div>

                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>IMAGE</strong></label>
                      <input type="file" name="image" id="image" class="form-control"/>
                      <label> Note : image size ( 250 x 250 pixels )</label> 
                      <div>
                        <?php
                          $url = '';
                          if($coa[0]->image == "NA" || $coa[0]->image == ""){
                            $url = 'public/custom/images/coa/default.jpg';
                          }else{
                            $url = $coa[0]->image;
                          }
                        ?>
                        <img src="<?php echo base_url().$url; ?>" height="250px" width="250px">  
                      </div>
                      <label for="image" class="error"></label> 
                    </div>
                  </div>
             
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="control-label"><strong>STATUS</strong></label>
                      <select name="status" id="status" class="form-control">
                        <option value="1" <?php if($coa[0]->status == '1'){echo 'selected'; }?>>ACTIVE</option>
                        <option value="0" <?php if($coa[0]->status == '0'){echo 'selected'; }?>>DEACTIVE</option>
                      </select>
                      <label for="status" class="error"></label> 
                    </div>
                  </div>
                </div>
              </div>
          
              <input type="hidden" id="id" name="id" value="<?php echo $coa[0]->id; ?>">
              <input type="hidden" id="imgpath" name="imgpath" value="<?php echo $coa[0]->image; ?>">

              <div class="form-actions">
                <button type="submit" class="btn btn-rounded btn-outline-success col-md-3">SAVE</button>  
                <button type="button" class="btn btn-rounded btn-outline-danger col-md-3" onclick="window.location.href='<?php echo base_url(); ?>coa/list'">CANCEL</button>  
              </div>
            </form>                            
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- Column -->
</div>
<!-- Row -->
<!-- ============================================================== -->
<!-- End PAge Content -->
<!-- ============================================================== -->