
<?php $__env->startSection('content'); ?>
<main id="main" class="main">

    <div class="pagetitle">
      <h1>Mutasi Saldo</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a>Dashboard</a></li>
          <li class="breadcrumb-item"><a>Keuangan</a></li>
          <li class="breadcrumb-item active">Mutasi Saldo</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <section class="section dashboard">
      <?php if(Session::get('msg')): ?>
      <div class="alert alert-success alert-dismissible fade show" role="alert">
          <i class="bi bi-check-circle me-1"></i>
                <?php echo e(Session::get('msg')); ?>

          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
      </div>
      <?php endif; ?>


      <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-body">
              <h5 class="card-title">Data Mutasi Saldo</h5>
              <form method="GET" action="<?php echo e(url('dashboard/mutation')); ?>" class="row g-3 mt-1 mb-1">
                <?php echo csrf_field(); ?>
                <div class="col-auto">
                    <select name="month" id="month" class="form-select" required>
                        <?php $__currentLoopData = range(1, 12); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e(str_pad($m, 2, '0', STR_PAD_LEFT)); ?>" 
                                <?php echo e($month == str_pad($m, 2, '0', STR_PAD_LEFT) ? 'selected' : ''); ?>>
                                <?php echo e(DateTime::createFromFormat('!m', $m)->format('F')); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="col-auto">
                    <select name="year" id="year" class="form-select" required>
                        <?php
                            $currentYear = $year ?? now()->format('Y');
                            $startYear = 2020; // Adjust as necessary
                            $endYear = $currentYear + 5;
                        ?>
                        <?php for($y = $startYear; $y <= $endYear; $y++): ?>
                            <option value="<?php echo e($y); ?>" <?php echo e($year == $y ? 'selected' : ''); ?>><?php echo e($y); ?></option>
                        <?php endfor; ?>
                    </select>
                </div>
                <div class="col-auto">
                    <button type="submit" class="btn btn-primary">Filter</button>
                </div>
            </form>

              <!-- Default Table -->
              <table class="table" id="table">
                <thead>
                  <tr>
                    <th scope="col">#</th>
                    <th scope="col">Waktu</th>
                    <th scope="col">Nominal</th>
                    <th scope="col">Deskripsi</th>
                    <th scope="col">Saldo Akhir</th>
                </thead>
                <tbody>
                  <?php 
                    $i = 1;
                  ?>
                  <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $datas): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr>
                    <th scope="row"><?php echo e($i++); ?></th>
                    <td><?php echo e($datas->created_at); ?></td>
                    <?php if($datas->type == 1): ?>
                      <td><span class="badge bg-success">IN</span>Rp. <?php echo e(number_format($datas->nominal,2,',','.')); ?></td>
                    <?php endif; ?>
                    <?php if($datas->type == 0): ?>
                      <td><span class="badge bg-danger">OUT</span>Rp. <?php echo e(number_format($datas->nominal,2,',','.')); ?></td>
                    <?php endif; ?>
                    <td><?php echo e($datas->description); ?></td>
                    <td>Rp. <?php echo e(number_format($datas->last_balance,2,',','.')); ?></td>
                  </tr>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>  
                </tbody>
              </table>
              <!-- End Default Table Example -->
            </div>
          </div>
        </div>
      </div>
    </section>

  </main><!-- End #main -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('dashboard.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/tpsa9543/public_html/tpscmalang/resources/views/dashboard/mutation.blade.php ENDPATH**/ ?>