@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            <div class="card">
                
              <nav aria-label="breadcrumb">
                <ol class="breadcrumb pb-3">
                  <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                  <li class="breadcrumb-item active" aria-current="page">Dashboard</li>
                </ol>
              </nav>


                <div class="card-body text-center">
                    
                    <div class="row mb-4">
                        <div class="col-2 justify-content-start">
                        </div>
                        <div class="col-8 mt-3 justify-content-center">
                        </div>
                        <div class="col-2">
                        </div>
                    </div>

                    {{-- <div class="input-group mb-3">
                      <input type="text" class="form-control col-3" placeholder="Pilih Tarikh" aria-label="Tarikh" id="dashboarddate" name="dashboarddate" aria-describedby="basic-addon1">
                    </div> --}}

                    <div class="row mt-4 col-12 d-flex justify-content-center">
                        {{-- First Column --}}

                        <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-success">
                              <div class="inner">
                                <h3>RM {{ ($ringkasanharian['gadai'][0]['jumlahpinjaman']) ? number_format($ringkasanharian['gadai'][0]['jumlahpinjaman'],2) : "0.00"  }}</h3>
          
                                <p >Pembiayaan Hari Ini</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-warning">
                              <div class="inner">
                                <h3>RM {{ ($ringkasanharian['tebus'][0]['jumlahpinjaman']) ? number_format($ringkasanharian['tebus'][0]['jumlahpinjaman'],2) : "0.00"  }}</h3>
          
                                <p>Penyelesaian Pem. Hari Ini</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-success">
                              <div class="inner">
                                <h3>RM {{ number_format($keseluruhanupahharian,2) }}</h3>
          
                                <p>Keuntungan Hari Ini</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          {{-- End First Column --}}

                          {{-- Second Column --}}
                          <div class="col-lg-6 col-xl-4 col-12">
                          
                            <div class="card bg-light mb-3" style="max-width: 20rem;">
                              <div class="card-header font-weight-bold" style=" padding: 10px; height: 72px;">Pembiayaan<brx>Terkumpul</div>
                              <div class="card-body mx-auto">
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Tawarruq : </h5>
                                  <p class="card-text font-weight-bold">RM {{ ($dashboard[0]['gadaitawarruq']) ? number_format((float)$dashboard[0]['gadaitawarruq'],2) : "0.00" }}</p>
                                </div>
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Ar-Rahn : </h5>
                                  <p class="card-text font-weight-bold">RM {{ ($dashboard[0]['gadai']) ? number_format((float)$dashboard[0]['gadai'],2) : "0.00" }}</p>
                                </div>
                              </div>
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                          
                            <div class="card bg-light mb-3" style="max-width: 20rem;">
                              <div class="card-header font-weight-bold">Penyelesaian Pembiayaan Terkumpul</div>
                              <div class="card-body mx-auto">
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Tawarruq : </h5>
                                  <p class="card-text font-weight-bold">RM {{ ($dashboard[0]['tebustawarruq']) ? number_format((float)$dashboard[0]['tebustawarruq'],2) : "0.00" }}</p>
                                </div>
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Ar-Rahn : </h5>
                                  <p class="card-text font-weight-bold">RM {{ ($dashboard[0]['tebus']) ? number_format((float)$dashboard[0]['tebus'],2) : "0.00" }}</p>
                                </div>
                              </div>
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                          
                            <div class="card bg-light mb-3" style="max-width: 20rem;">
                              <div class="card-header font-weight-bold" style=" padding: 10px; height: 72px;">Keuntungan dan Keuntungan<br>Terkumpul</div>
                              <div class="card-body mx-auto">
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Keuntungan : </h5>
                                  <p class="card-text font-weight-bold">RM {{ number_format($keuntungan,2) }}</p>
                                </div>
                                <div class="row text-justify">
                                  <h5 class="card-title font-weight-bold">Keuntungan Simpan : </h5>
                                  <p class="card-text font-weight-bold">RM {{ number_format($upahsimpan,2) }}</p>
                                </div>
                              </div>
                            </div>
                          </div>

                          {{-- End Second Column --}}

                          {{-- Third Column --}}

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-light">
                              <div class="inner">
                                <h3>RM {{ ($dashboard[0]['variasi']) ? number_format((float)$dashboard[0]['variasi'],2) : "0.00" }}</h3>
          
                                <p>Varians</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-light">
                              <div class="inner">
                                <h3>RM {{ number_format($totalmarhun,2) }}</h3>
          
                                <p>N. Marhun Kumpul</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-light">
                              <div class="inner">
                                <h3>RM {{ ($dashboard[0]['outstanding']) ? number_format((float)$dashboard[0]['outstanding'],2) : "0.00" }}</h3>
          
                                <p>Outstanding</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          {{-- End Third Column --}}

                          {{-- Fourth Column --}}

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-info">
                              <div class="inner">
                                <h3>RM {{ number_format($getVault,2) }}</h3>
          
                                <p>Peti Besi Cawangan</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          <div class="col-lg-6 col-xl-4 col-12">
                            <!-- small box -->
                            <div class="small-box bg-primary">
                              <div class="inner">
                                <h3>RM {{ ($komuditicheck) ? number_format($komuditicheck['unit_komuditi'],2) : '0.00' }}</h3>
          
                                <p>Baki Komoditi</p>
                              </div>
                              <div class="icon">
                              </div>
                              {{-- <a href="{{ route('home.gadaian6bulan') }}" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a> --}}
                            </div>
                          </div>

                          {{-- End Fourth Column  --}}

                    </div>

                    <div class="mt-3">



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

    var tablecapaian = $('#table-capaian').DataTable({
          "scrollX": true
        });

    $('#dashboarddate').datepicker({
        format: 'dd-mm-yyyy'
    });

    $('#dashboarddate').change(function(){

      $.ajax({
            method:'get',
            url: "{{ route('khazanah.dashboarddate') }}",
            data:{'kodcaw' : kodcaw,'tarikh' : date },
            success: function(panjar){
                gadaitable(panjar);
            }
        });

    });
    
    </script>

@endsection
