<?php ($unique_element = "update"); ?>
<!-- Modal ADD Branch -->
<div class="modal fade" id="md_update_subhead" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <?php echo e(Form::open(array('route' => 'subhead.update', 'class' => 'cls_form','id'=>'form_update_subhead'))); ?>

  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Update SubHead</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true"></span>
        </button>
      </div>
      <div class="modal-body">
        <div class = "card">
          <div class = "card-header">
          <div class = "col-md-5">
    <strong class="strong-margin">ACCOUNT INFORMATION</strong>
     </div>
              <div class = "col-md-6">


     </div>
             <div class = "col-md-1">
           <img src = "<?php echo e(asset('assets/images/icons/accountinformation.png')); ?>"/>


     </div>
          </div>
          <div class = "card-body form-fieldset">
                  <div class="row">
              
                <div class="col-sm-12">
                  <label class="label-color"> Type: <i style = "color:red;">*</i></label>
                <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('type',":message")); ?></small>

                <div class="input-group mb-3">

                  <select onchange="verifyBank(event,this,'<?php echo e($unique_element); ?>')" name="type" class="form-control form-control-sm cls_selection">
                  <?php $__currentLoopData = EF::getAccountsTypeList(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                    <?php if($rows === "Cash" || $rows === "Bank" || $rows === "General"): ?>
                       <option <?php if($subhead->type === $rows): ?> selected <?php endif; ?> value="<?php echo e($rows); ?>"><?php echo e($rows); ?></option>
                     <?php endif; ?>

                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>

                </div>
            </div>
            

        <div class="col-sm-12 <?php echo e($unique_element); ?>_subhead_bank_section" <?php if($subhead->type != "Bank"): ?> style="display: none;" <?php endif; ?>>
            <label class="label-color">Select Bank: <i style = "color:red;"></i></label>
              <small class="form-errors pull-right req" value=""><?php echo e($errors->first('bank',":message")); ?></small>

            <div class="input-group mb-3">
              <select onchange="setBank(event,this,'<?php echo e($unique_element); ?>')" class="form-control-sm form-control <?php echo e($unique_element); ?>_bank_list" name="bank" >
                  <option selected="true" value="<?php echo e(Crypt::encrypt(0)); ?>">Select Bank</option>
                  <?php $__currentLoopData = $bank_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option <?php if($subhead->bank_id === $rows->id): ?> selected <?php endif; ?>  value="<?php echo e(Crypt::encrypt($rows->id)); ?>"><?php echo e(ucwords($rows->branch_code)); ?> | <?php echo e(ucwords($rows->bank_name)); ?> | <?php echo e(ucwords($rows->location)); ?></option>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </select>



             <div id="view_add_button" class="input-group-prepend">
              </div>
            </div>
          </div>

            <div class="col-sm-6">
                <label class="label-color"> Code: <i style = "color:red;">*</i></label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('code',":message")); ?></small>
            <div class="input-group mb-3">

              <?php echo e(Form::Text('code',$subhead->code, ['class' => 'form-control form-control-sm', 'placeholder' => 'Code #' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'readonly' => 'series'])); ?>

            </div>
          </div>

          <?php ($flag = false); ?>

          <?php if($subhead->bank_id > 0): ?>
            <?php ($flag = true); ?>
          <?php endif; ?>

          <div class="col-sm-6">
              <label class="label-color"> Name: <i style = "color:red;">*</i> </label>
            <small class="form-errors pull-right req" value="*"><?php echo e($errors->first('name',":message")); ?></small>

            <div class="input-group mb-3">

              <?php echo e(Form::Text('name',$subhead->name, ['class' => 'form-control form-control-sm cls_required  '.$unique_element.'_subhead_name ', 'placeholder' => 'Name' , 'aria-label' => 'Default', 'aria-describedby' => 'inputGroup-sizing-default', 'id' => 'bank', 'readonly' => $flag])); ?>

            </div>
           </div>

        <div class="col-sm-6">
            <label class="label-color"> Opening Balance: <i style = "color:red;"></i> </label>
          <small class="form-errors pull-right req" value=""><?php echo e($errors->first('openining_balance',":message")); ?></small>

          <div class="input-group mb-3">

          <input value="<?php echo e($subhead->opening_balance); ?>"onkeyup="numberInWordsValue(this,'<?php echo e($unique_element); ?>_opening_balance_in_words'); checkOpeningBalanceAccount(this,'<?php echo e($unique_element); ?>');" type="number" name="opening_balance" class="<?php echo e($unique_element); ?>_opening_balance form-control form-control-sm" placeholder="Opening Balance">
          </div>
        </div>

        <div class="col-sm-6">

            <label class="label-color"> Opening Balance In Words: <i style = "color:red;"></i> </label>

          <div class="input-group mb-3">

          <input value="<?php echo e(EF::numberToWords($subhead->opening_balance)); ?>" readonly="" type="text"  class=" form-control form-control-sm <?php echo e($unique_element); ?>_opening_balance_in_words" placeholder="Opening Balance In Words">
          </div>
        </div>

         <?php ($nature = EF::getNatureList()); ?>
        <?php ($name  = 'debit_account'); ?>
        <?php ($label = 'Select Debit Account'); ?>


        <?php if(in_array($head->nature,[$nature[0],$nature[1],$nature[3],$nature[4]])): ?>
          <?php ($name  = 'credit_account'); ?>
          <?php ($label = 'Select Credit Account'); ?>
        <?php endif; ?>

        <div class="col-sm-12 account_<?php echo e($unique_element); ?>" style="height: 150px; <?php if($subhead->opening_balance <= 0): ?> display: none; <?php endif; ?>">

          <label class="label-color"><?php echo e($label); ?>: <i style = "color:red;"></i> </label>

          <div class="input-group mb-3">
            <select  name="<?php echo e($name); ?>" class="fstdropdown-select form-control form-control-sm ">
              <option value="<?php echo e(Crypt::encrypt(0)); ?>"><?php echo e($label); ?></option>
              <?php $__currentLoopData = $subhead_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if($subhead->id != $rows->id): ?>
                  <option <?php if($subhead->opening_balance_id == $rows->id): ?> selected <?php endif; ?> value="<?php echo e(Crypt::encrypt($rows->id)); ?>"><?php echo e($rows->head->code); ?>-<?php echo e($rows->head->name); ?> | <?php echo e($rows->code); ?>-<?php echo e($rows->name); ?></option>
                <?php endif; ?>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
           </div>
        </div>

        <input type="hidden" name="head_id" value="<?php echo e(Crypt::encrypt($head_id)); ?>">


       </div>
          </div>
        </div>

      </div>
      <div class="modal-footer">
        <input type="hidden" name="subhead_id" value="<?php echo e(Crypt::encrypt($subhead->id)); ?>">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button onclick="updateSubhead(event,this);" type="submit" class="btn btn-primary " content="update subhead">Update SubHead</button>
      </div>
    </div>
  </div>
  <?php echo e(Form::close()); ?>

</div>
<!-- END MODAL ADD BRANCH -->
<script type="text/javascript">
  setFstDropdown();
</script>
<?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/components/subhead/modals/update_subhead.blade.php ENDPATH**/ ?>