<div class="row">
  <div class="col-lg-12 mt-4">
    <div class="card">
      <div class="card-header form-card-header">
        <h4 class="m-b-0 text-light">UPDATE BSM </h4>
      </div>
      <div class="card-body">
        <form id="update_bsm" class="form-material">
          <div class="form-body">
            <div class="row">
            <div class="col-md-4">
                <div class="form-group">
                  <label class="control-label"><strong>SELECT TYPE <span>*</span></strong></label>
                  <select name="type" id="type" class="form-control"   autocomplete="off" required="">
                    <option value="">SELECT TYPE</option>
                    <option value="bsm" <?php if($bsm[0]->type == 'bsm'){echo 'selected'; }?>>BSM</option>
                    <option value="rbsm" <?php if($bsm[0]->type == 'rbsm'){echo 'selected'; }?>>RBSM</option>
                  </select>
                  <label for="type" class="error"></label> 
                </div>
              </div>

              <div class="col-md-4">
                <div class="form-group">
                  <label class="control-label"><strong>SELECT YEAR <span>*</span></strong></label>
                  <select name="year" id="year" class="form-control"   autocomplete="off" required="">
                    <option value="">SELECT YEAR</option>
                    <?php foreach($years_master as $val){ ?>
                      <option value="<?php echo $val->year; ?>" <?php if($bsm[0]->year == $val->year){echo 'selected'; }?>><?php echo $val->year; ?></option>
                    <?php } ?>
                  </select>
                  <label for="year" class="error"></label> 
                </div>
              </div>
              
              <div class="col-md-4">
                <div class="form-group">
                  <label class="control-label"><strong>STATUS</strong></label>
                  <select name="status" id="status" class="form-control"   autocomplete="off" >
                    <option value="1" <?php if($bsm[0]->status == '1'){echo 'selected'; }?>>ACTIVE</option>
                    <option value="0" <?php if($bsm[0]->status == '0'){echo 'selected'; }?>>DEACTIVE</option>
                  </select>
                  <label for="status" class="error"></label> 
                </div>
              </div>

            <div class="col-md-6">
                <div class="form-group">
                  <label class="control-label"><strong>START DATE</strong></label>
                    <input type="text" id="from_date" name="from_date" class="form-control"   autocomplete="off" maxlength="100" <?php if($bsm[0]->from_date !== 'NA'){ ?> value="<?php echo date("d-m-Y",strtotime($bsm[0]->from_date)); ?>" <?php } ?> >
                  <label for="from_date" class="error"></label> 
                </div>
              </div>

              <div class="col-md-6">
                <div class="form-group">
                  <label class="control-label"><strong>END DATE</strong></label>
                  <input type="text" id="to_date" name="to_date" class="form-control"   autocomplete="off" maxlength="100" <?php if($bsm[0]->to_date !== 'NA'){ ?> value="<?php echo date("d-m-Y",strtotime($bsm[0]->to_date)); ?>" <?php } ?>>
                  <label for="to_date" class="error"></label> 
                </div>
              </div>

              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label"><strong>UPLOAD IMAGE</strong></label>
                  <input type="file" name="image" id="image" class="form-control"   autocomplete="off" />
                  <label> Note : image size ( 250 x 180 pixels )</label>
                  <label for="image" class="error"></label> 
                </div>
              </div>
              <!--
              <div class="col-md-6">
                <div class="form-group">
                  <label class="control-label"><strong>UPLOAD FILE <span>*</span></strong></label>
                  <input type="file" id="file" name="file" class="form-control">
                  <label> Note : max size 5 mb allowed. </label>
                  <label for="file" class="error"></label> 
                </div>
              </div>
              -->
            
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label"><strong>Link </strong></label>
                  <input type="text" id="filepath_forpdf" name="filepath_forpdf" class="form-control"   autocomplete="off" maxlength="100" required="" value="<?php echo $bsm[0]->filepath_forpdf; ?>">
                  <label for="name" class="error"></label> 
                </div>
              </div>
              
              <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 $bsm[0]->name; ?>" class="form-control"   autocomplete="off" maxlength="255" required="">
                  <label for="name" class="error"></label> 
                </div>
              </div>
            </div>
          </div>
          
          <input type="hidden" id="id" name="id" value="<?php echo $bsm[0]->id; ?>">

          <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(); ?>bsm/list'">CANCEL</button>  
          </div>
        </form>
      </div>
    </div>
  </div>
</div>