<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 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">Edit Driver Details</h3>
        </div>
        <form role="form" action="<?=base_url('Broker/update/'.encode_param($broker_id))?>" 
         method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
          <div class="box-body">
            <div class="col-md-6">
              <div class="form-group has-feedback">
                <label>Broker Name</label>
                <input type="text" class="form-control required" data-parsley-trigger="change"  
                 data-parsley-minlength="2" value="<?= $broker_data->broker_name ?>" data-parsley-pattern="^[a-zA-Z\ . ! @ # $ % ^ & * () + = , \/]+$" required="" name="broker_name"  placeholder="Enter Company Name">
                <span class="glyphicon form-control-feedback"></span>
              </div>
              <?php if($this->session->userdata['user_type'] == 1){ ?>
                <div class="form-group">
                 <label>Select Company</label>
                 <select name="company_id" class="form-control">
                   <option selected value="">All Company</option>
                   <?php 
                     if(!empty($company_data)){
                       foreach ($company_data as $company) {
                         $chkFlg = ($broker_data->company_id == $company->company_id)?'selected':'';
                         echo '<option value="'.$company->company_id.'" '.$chkFlg.'>
                                '.$company->company_name.
                              '</option>';
                       } 
                     }
                   ?>
                 </select> 
               </div>
              <?php } else { ?>
                <input type="hidden" name="company_id" value="<?= $broker_data->company_id ?>">
              <?php } ?>
              <div class="form-group has-feedback">
                <label>Email</label>
                <input type="email" class="form-control required" data-parsley-trigger="change" 
                 data-parsley-minlength="2" value="<?= $broker_data->broker_email ?>" required="" 
                 name="broker_email" placeholder="Enter email ID">
                <span class="glyphicon  form-control-feedback"></span>
              </div>
              <div class="form-group has-feedback">
                <label>Phone</label>
                <input type="number" class="form-control required" data-parsley-trigger="change"  
                 data-parsley-minlength="2" value="<?= $broker_data->broker_phone ?>" required="" name="broker_phone" placeholder="Broker Phone">
                <span class="glyphicon  form-control-feedback"></span> 
              </div>  
            </div> 

            <div class="col-md-6">
              <div class="form-group has-feedback">
                <label>Address</label>
                <input type="text" class="form-control required" data-parsley-trigger="change"  
                 data-parsley-minlength="2" value="<?= $broker_data->address ?>" required="" name="address"  placeholder="Enter Broker Address">
                <span class="glyphicon  form-control-feedback"></span>
              </div>
              <div class="form-group has-feedback">
                <label>City</label>
                <input type="text" class="form-control required" data-parsley-trigger="change" 
                 data-parsley-minlength="2" value="<?= $broker_data->city ?>" required="" 
                 name="city" placeholder="Enter City">
                <span class="glyphicon  form-control-feedback"></span>
              </div>
              <div class="form-group has-feedback">
                <label>Phone</label>
                <input type="text" class="form-control required" data-parsley-trigger="change"  
                 data-parsley-minlength="2" value="<?= $broker_data->state ?>" required="" name="state" placeholder="Enter State">
                <span class="glyphicon  form-control-feedback"></span> 
              </div>   
            </div>
            <div class="col-md-12" style="text-align: center;">          
              <div class="box-footer">
                <button type="submit" class="btn btn-primary">Submit</button>
              </div>        
            </div> 
          </div> 
        </form>
      </div>
    </div>
  </section>
</div>