<!-- HEAD LIST -->

<?php $__currentLoopData = $head_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $head_rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  <div class="row">
    <div class="col-lg-12 col-xl-12">
      <div class="card card-collapse card-collapsed">
        <div class="card-header">
           <a style="vertical-align: middle; text-decoration: none; margin-top: 3px;" href="#" class="card-options-link cls_collapsed " ><i class="icon fe fe-plus head-color">&nbsp;&nbsp;</i>
               </a>
          <h3 class="card-title head-color"><?php echo e($head_rows->code); ?> - <?php echo e($head_rows->name); ?></h3>
              <?php ($balance = $journal->getClosingBalance(['id' => $head_rows->id])); ?>


              <small class="head-color" style="margin-left: 10px;"> 
                  <?php if($balance < 0 && in_array($head_rows->nature,['Capital / Equity','Long-term Liability','Short-term Liability','Revenue'])): ?>
                (<?php echo e(EF::numberFormat(abs($balance))); ?>)
              <?php else: ?>
                  <?php echo e(EF::numberFormat(($balance))); ?>

              <?php endif; ?>
              </small>


              <?php ($pass_data = []); ?>

                <?php (
                    
                    $pass_data = array(

                      'head_id'     => Crypt::encrypt($head_rows->id),
                      'branch'      => trim($head_rows->branch->code.' '.$head_rows->branch->name),
                      'name'        => $head_rows->name,
                      'nature'      => trim($head_rows->nature),
                      'code'        => ($head_rows->code),
                    )
                ); ?>

            <div class="card-options">
                <?php if(Auth::user()->hasAnyPermission(['All','Add Subhead'])): ?>    
                  <abbr title="Add Subhead">
                    <a href="javascript:void(0)" onclick="showSubHeadModel(event,'<?php echo e(Crypt::encrypt($head_rows->id)); ?>')" class="btn btn-sm btn-primary"><i class=" fe fe-plus"></i></a>&nbsp;
                  </abbr>
                <?php endif; ?>

                <?php if(Auth::user()->hasAnyPermission(['All','Update Head'])): ?>    
                  <abbr title="Update Head">
                    <a  href="javascript:void(0)" onclick="update(event,'<?php echo e(json_encode($pass_data)); ?>','form_update_head','md_update_head');" data-toggle="modal" data-target="#md_update_head" class="btn btn-sm btn-primary"><i class=" fe fe-edit"></i></a>&nbsp;
                  </abbr>
                <?php endif; ?>

                <?php if(Auth::user()->hasAnyPermission(['All','Remove Head'])): ?>    
                  <?php if($head_rows->flag === "0"): ?>
                    <abbr title="Remove Head">
                      <a onclick="removeHead(event,this)" href="<?php echo e(route('head.trash',['id' => Crypt::encrypt($head_rows->id)])); ?>" content="remove head" class="btn btn-sm btn-primary"><i class=" fe fe-trash"></i> </a>
                    </abbr>
                  <?php endif; ?>
                <?php endif; ?>
            </div>
        </div>
        
        <?php ($subhead_tag = 'subhead_'.$nature.$head_rows->id); ?>
        <div id="head_section_<?php echo e($head_rows->code); ?>" class="card-body" >

              <?php ($subhead['subhead']  = $accountObj->getSubHeadByHead($head_rows->id)); ?>

              <?php ($subhead['head']     = $head_rows); ?>

              <?php ($subhead['journal']     = $journal); ?>


          

              <?php ($subhead_view = view('components.subhead.subhead_table',$subhead)); ?>
    
             <?php echo $subhead_view; ?>


        </div>
      </div>
    </div>
  </div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<!-- END HEAD LIST --><?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/components/head/head_tabs.blade.php ENDPATH**/ ?>