@extends('layouts.app')

@section('content')

<div class="container">
    <div class="row">
        <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"><a href="{{ route('laporan') }}">Laporan</a></li>
                  <li class="breadcrumb-item active" aria-current="page">Lejer Am</li>
                </ol>
              </nav>

                <div class="card-body text-center">
                    <div class="row form-group">
                        <div class="col-md-2">
                        </div>
                        <div class="col-md-15">
                        </div>
                    </div>
                      <div class="container">
                      <form method="post">
                      @csrf
                    <div class="row">

                    <div class="col-sm-2">Mula</div>
                     <div class="col-sm-4"><input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetimepicker1" name="datetimepicker1"    autocomplete="off"  aria-describedby="basic-addon1"></div>
                      </div>
                     <br> <div class="row">
                  <div class="col-sm-2">Hingga</div>
                 <div class="col-sm-4"><input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetimepicker2" name="datetimepicker2"    autocomplete="off"  aria-describedby="basic-addon1"></div>
                 </div>
                    <br>
                    <div class="row">
                    <div class="col-sm-1"> </div>   <div class="col-sm-6"></div>
                    <div class="col-sm-3"></div>
                    <div class="col-sm-1"> <input type="submit" class="btn btn-success ml-md-1" id="submit_button" name="submit_button" value="Cetak Lejer AM" formtarget="_blank"  formaction="{{route('cetak.lejer_am')}}">
                      </div>
                    </div>

                       <br>
                     <div class="row">

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


                     </div>



                      </form>
                    </div><!--end section form-->
                </div>
            </div>
        </div>
    </div>
    </div>
</div>

<script type="text/javascript">
    var api_url = "<?php echo $api_url ?>";
    var kodcaw = "<?php echo $cawangan_info['kodcaw'] ?>";

    var tablecustomers = $('#myTable').DataTable({
        "ordering": false
    });
    $(document).ready( function () {
        console.log('dsasa');
        $('#datetimepicker1').datepicker({
            format: 'dd-mm-yyyy'
        });



        var current = new Date();
        var current_date = current.getDate();
        var current_month = current.getMonth()+1;
        var current_year = current.getFullYear();
        var today_date = current_year + '-' +current_month+'-'+current_date;
        $.ajax({
            method:'get',
            url: api_url + '/api/marhun/laporan/'+kodcaw+'/' + today_date,
            success: function(customers){
                customertable(customers);
            },error: function(XMLHttpRequest, textStatus, errorThrown) {
                console.log(textStatus);
            }
        });
    });

    $('#datetimepicker1').change(function(){
        var input_date = this.value;
        var split_date = input_date.split('-');
        var today_date = split_date[2] + '-' +split_date[1]+'-'+split_date[0];
        $.ajax({
            method:'get',
            url: api_url + '/api/marhun/laporan/'+kodcaw+'/' + today_date,
            success: function(customers){
                customertable(customers);
            }
        });
    });





</script>


<script type="text/javascript">


$(document).ready( function () {
        console.log('dsasa');
        $('#datetimepicker2').datepicker({
            format: 'dd-mm-yyyy'
        });

    });
</script>




<script type="text/javascript">


$(document).ready( function () {
        console.log('dsasa');
        $('#datetimepicker3').datepicker({
            format: 'dd-mm-yyyy'
        });

    });
</script>















<div class="modal" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h5 class="modal-title">Laporan Imbangan Duga Cawangan</h5>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>


      <!-- Modal body -->
      <div class="modal-body">

      <style>
#details {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 50%;
}

#details td, #details th {

  padding: 8px;
  font-size:11px;
}

#details tr:nth-child(even){background-color: #ffffff;}

#details tr:hover {background-color: #ffffff;}

#details th {
  padding-top: 12px;
 font-style:bold;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
}
</style>

<form action="{{route('imbangduga.cetak')}}" method="post">

@csrf

   <table id="details">
   <tr>
   <td>  <input type="text" class="form-control" placeholder="Pilih Tarikh" aria-label="Tarikh" id="datetimepicker3" name="datetimepicker3"    autocomplete="off"  aria-describedby="basic-addon1">     </td>
   </tr>

   <tr>
   <td>    <input type="submit" class="btn btn-success ml-md-5" id="submit_button" name="submit_button" value="Jana Laporan" >   </td>
   </tr>








   </table>

</form>







      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Kembali</button>
      </div>

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


















@endsection



