<!-- Page Heading -->

          <div class="d-sm-flex align-items-center justify-content-between mb-4">

            <h1 class="h3 mb-0 text-gray-800">Rekap Bidang</h1>

            <!-- <a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Generate Report</a> -->

          </div>

          <!-- Content Row -->

          <div class="row">

            <!-- Earnings (Monthly) Card Example -->

            <div class="col-xl-12 col-md-12 mb-4">

              <div class="card border-left-primary shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col">

                      <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Rekap Bidang Per-Triwulan</div>

                      <div class="h5 mb-0 font-weight-bold text-gray-800 row">

                      	<div class="input-group mb-3 input-group-sm col-md-6">

                      		<div class="input-group-prepend">

                      			<label class="input-group-text" for="periode_thn_all"><i class="fas fa-calendar-alt"></i></label>

                      		</div>

                      		<select class="custom-select" id="periode_thn_all">

                      		</select>

                      	</div>

                      	<div class="col-md-3">

                      		<button id="btn-laporan_rekap_bidang_pertriwulan" class="d-none btn-block d-sm-inline-block btn btn-sm btn-success shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Export Laporan</button>

                      	</div>

                        <div class="col-md-3">

                          <button id="btn-laporan_rekap_bidang_pertriwulan_pdf" class="d-none btn-block d-sm-inline-block btn btn-sm btn-info shadow-sm"><i class="fas fa-file-pdf fa-sm text-white-50"></i>&nbsp Laporan PDF</button>

                        </div>

                      </div>

                    </div>

                  </div>

                </div>

              </div>

            </div>

            <div class="col-xl-12 col-md-12 mb-4">

              <div class="card border-left-primary shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col">

                      <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Rekap Bidang</div>

                      <div class="h5 mb-0 font-weight-bold text-gray-800 row">

                        <div class="input-group mb-3 input-group-sm col-md-4">

                          <div class="input-group-prepend">

                            <label class="input-group-text" for="periode_thn_all_3"><i class="fas fa-calendar-alt"></i></label>

                          </div>

                          <select class="custom-select" id="periode_thn_all_3">

                          </select>

                        </div>

                        <div class="input-group mb-3 input-group-sm col-md-4">

                          <div class="input-group-prepend">

                            <label class="input-group-text" for="bidang"><i class="fas fa-network-wired"></i></label>

                          </div>

                          <select class="custom-select" id="bidang_3">

                          </select>

                        </div>

                        <div class="col-md-2">

                          <button id="btn-laporan_rekap_bidang_pertriwulan_3" class="d-none btn-block d-sm-inline-block btn btn-sm btn-success shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Export Laporan</button>

                        </div>

                        <div class="col-md-2">

                          <button id="btn-laporan_rekap_bidang_pertriwulan_pdf_3" class="d-none btn-block d-sm-inline-block btn btn-sm btn-info shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Laporan PDF</button>

                        </div>

                      </div>

                    </div>

                  </div>

                </div>

              </div>

            </div>

            <div class="col-xl-12 col-md-12 mb-4">

              <div class="card border-left-primary shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col">

                      <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Rekap Bidang Per-Triwulan</div>

                      <div class="h5 mb-0 font-weight-bold text-gray-800 row">

                        <div class="input-group mb-3 input-group-sm col-md-4">

                          <div class="input-group-prepend">

                            <label class="input-group-text" for="periode_thn_all_2"><i class="fas fa-calendar-alt"></i></label>

                          </div>

                          <select class="custom-select" id="periode_thn_all_2">

                          </select>

                        </div>

                        <div class="input-group mb-3 input-group-sm col-md-4">

                          <div class="input-group-prepend">

                            <label class="input-group-text" for="bidang"><i class="fas fa-network-wired"></i></label>

                          </div>

                          <select class="custom-select" id="bidang">

                          </select>

                        </div>

                        <div class="col-md-2">

                          <button id="btn-laporan_rekap_bidang_pertriwulan_2" class="d-none btn-block d-sm-inline-block btn btn-sm btn-success shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Export Laporan</button>

                        </div>

                        <div class="col-md-2">

                          <button id="btn-laporan_rekap_bidang_pertriwulan_pdf_2" class="d-none btn-block d-sm-inline-block btn btn-sm btn-info shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Laporan PDF</button>

                        </div>

                      </div>

                    </div>

                  </div>

                </div>

              </div>

            </div>

            <!-- Earnings (Monthly) Card Example -->

           <!--  <div class="col-xl-12 col-md-12 mb-4">

              <div class="card border-left-success shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col">

                      <div class="text-xs font-weight-bold text-success text-uppercase mb-1">Rekap Unit Misioner Per Triwulan</div>

                      <div class="h5 mb-0 font-weight-bold text-gray-800 row">

                      	<div class="input-group mb-3 input-group-sm col-md-8">

                      		<div class="input-group-prepend">

                      			<label class="input-group-text" for="periode_thn_pertriwulan"><i class="fas fa-calendar-alt"></i></label>

                      		</div>

                      		<select class="custom-select" id="periode_thn_pertriwulan">

                      		</select>

                      	</div>

                      	<div class="col-md-4">

                      		<button id="btn-laporan_rekap_um_pertriwulan" class="d-none btn-block d-sm-inline-block btn btn-sm btn-success shadow-sm"><i class="fas fa-file-excel fa-sm text-white-50"></i>&nbsp Export Laporan</button>

                      	</div>

                      </div>

                    </div>

                  </div>

                </div>

              </div>

            </div> -->

            <!-- Earnings (Monthly) Card Example -->

<!-- 

            <div class="col-xl-3 col-md-6 mb-4">

              <div class="card border-left-info shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col mr-2">

                      <div class="text-xs font-weight-bold text-info text-uppercase mb-1">Tasks</div>

                      <div class="row no-gutters align-items-center">

                        <div class="col-auto">

                          <div class="h5 mb-0 mr-3 font-weight-bold text-gray-800">50%</div>

                        </div>

                        <div class="col">

                          <div class="progress progress-sm mr-2">

                            <div class="progress-bar bg-info" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>

                          </div>

                        </div>

                      </div>

                    </div>

                    <div class="col-auto">

                      <i class="fas fa-clipboard-list fa-2x text-gray-300"></i>

                    </div>

                  </div>

                </div>

              </div>

            </div> -->

            <!-- Pending Requests Card Example -->

            <!-- <div class="col-xl-3 col-md-6 mb-4">

              <div class="card border-left-warning shadow h-100 py-2">

                <div class="card-body">

                  <div class="row no-gutters align-items-center">

                    <div class="col mr-2">

                      <div class="text-xs font-weight-bold text-warning text-uppercase mb-1">Pending Requests</div>

                      <div class="h5 mb-0 font-weight-bold text-gray-800">18</div>

                    </div>

                    <div class="col-auto">

                      <i class="fas fa-comments fa-2x text-gray-300"></i>

                    </div>

                  </div>

                </div>

              </div>

            </div>

          </div> -->

<script type="text/javascript">

$(document).ready(function(){

    var base_url = "<?=base_url()?>";

	/////////////////////////////////////////////////

    var periode_thn_all = function(){

      jQuery.ajax({

        url: base_url+"Periode_thn/data_periode_thn",

        dataType:'json',

        success:function(response){

        	// console.log(response)

        	// alert(JSON.stringify(response))

          var data = response;

          var $id = $('#periode_thn_all');

          $id.empty();

          $id.append('<option value="" selected>- Pilih Periode Tahun -</option>');

        //   alert(param)

          for (var i = 0; i < data.length; i++) {

            $id.append('<option value="'+data[i].periode_thn+'">' + data[i].periode_thn +'</option>');

          }        

        }            

      });

    }

    periode_thn_all();

    var periode_thn_all_2 = function(){

      jQuery.ajax({

        url: base_url+"Periode_thn/data_periode_thn",

        dataType:'json',

        success:function(response){

          // console.log(response)

          // alert(JSON.stringify(response))

          var data = response;

          var $id = $('#periode_thn_all_2');

          $id.empty();

          $id.append('<option value="" selected>- Pilih Periode Tahun -</option>');

        //   alert(param)

          for (var i = 0; i < data.length; i++) {

            $id.append('<option value="'+data[i].periode_thn+'">' + data[i].periode_thn +'</option>');

          }        

        }            

      });

    }

    periode_thn_all_2();

    var periode_thn_all_3 = function(){

      jQuery.ajax({

        url: base_url+"Periode_thn/data_periode_thn",

        dataType:'json',

        success:function(response){

          // console.log(response)

          // alert(JSON.stringify(response))

          var data = response;

          var $id = $('#periode_thn_all_3');

          $id.empty();

          $id.append('<option value="" selected>- Pilih Periode Tahun -</option>');

        //   alert(param)

          for (var i = 0; i < data.length; i++) {

            $id.append('<option value="'+data[i].periode_thn+'">' + data[i].periode_thn +'</option>');

          }        

        }            

      });

    }

    periode_thn_all_3();

    var data_bidang = function(){

      jQuery.ajax({

        url: base_url+"bidang/data_bidang",

        dataType:'json',

        success:function(response){

          // console.log(response)

          // alert(JSON.stringify(response))

          var data = response;

          var $id = $('#bidang');

          $id.empty();

          $id.append('<option value="" selected>- Pilih Bidang -</option>');

        //   alert(param)

          for (var i = 0; i < data.length; i++) {

            $id.append('<option value="'+data[i].id_bidang+'_'+data[i].nama+'">' + data[i].nama +'</option>');

          }        

        }            

      });

    }

    data_bidang();

    var data_bidang_3 = function(){

      jQuery.ajax({

        url: base_url+"bidang/data_bidang",

        dataType:'json',

        success:function(response){

          // console.log(response)

          // alert(JSON.stringify(response))

          var data = response;

          var $id = $('#bidang_3');

          $id.empty();

          $id.append('<option value="" selected>- Pilih Bidang -</option>');

        //   alert(param)

          for (var i = 0; i < data.length; i++) {

            $id.append('<option value="'+data[i].id_bidang+'_'+data[i].nama+'">' + data[i].nama +'</option>');

          }        

        }            

      });

    }

    data_bidang_3();

    // var periode_thn_pertriwulan = function(){

    //   jQuery.ajax({

    //     url: base_url+"Periode_thn/data_periode_thn",

    //     dataType:'json',

    //     success:function(response){

    //     	// console.log(response)

    //     	// alert(JSON.stringify(response))

    //       var data = response;

    //       var $id = $('#periode_thn_pertriwulan');

    //       $id.empty();

    //       $id.append('<option value="" selected>- Pilih Periode Tahun -</option>');

    //     //   alert(param)

    //       for (var i = 0; i < data.length; i++) {

    //         $id.append('<option value="'+data[i].periode_thn+'">' + data[i].periode_thn +'</option>');

    //       }        

    //     }            

    //   });

    // }

    // periode_thn_pertriwulan();

    $("#btn-laporan_rekap_bidang_pertriwulan").click(function(){

    	var periode = $("#periode_thn_all").val();

    	if (periode == "") {

    		Command: toastr["warning"]("Periode Belum Dipilih", "warning");

    	}else{

    		window.location = base_url+"laporan_rekap_bidang/laporan_rekap_bidang_pertriwulan/"+periode.replace('/', '-');

    	}

      	

    })

    $("#btn-laporan_rekap_bidang_pertriwulan_pdf").click(function(){

      var periode = $("#periode_thn_all").val();

      if (periode == "") {

        Command: toastr["warning"]("Periode Belum Dipilih", "warning");

      }else{

        window.open(base_url+"laporan_rekap_bidang/laporan_rekap_bidang_pertriwulan_pdf/"+periode.replace('/', '-'), "PKA", "fullscreen=yes, scrollbars=yes");

        // window.location = base_url+"Laporan_excel/cetak_excel_dashboard_user/"+periode.replace('/', '-');

      }

    });

    $("#btn-laporan_rekap_bidang_pertriwulan_2").click(function(){

      var periode = $("#periode_thn_all_2").val();

      var bidang = $("#bidang").val();

      if (periode == "" || bidang =="") {

        Command: toastr["warning"]("Data Belum Lengkap", "warning");

      }else{

        window.location = base_url+"laporan_rekap_bidang/laporan_rekap_bidang_pertriwulan_2/"+periode.replace('/', '-')+"/"+bidang;

      }

        

    })

    $("#btn-laporan_rekap_bidang_pertriwulan_pdf_2").click(function(){

      var periode = $("#periode_thn_all_2").val();

      var bidang = $("#bidang").val();

      if (periode == "" || bidang =="") {

        Command: toastr["warning"]("Data Belum Lengkap", "warning");

      }else{

        window.open(base_url+"laporan_rekap_bidang/laporan_rekap_bidang_pertriwulan_pdf_2/"+periode.replace('/', '-')+"/"+bidang, "PKA", "fullscreen=yes, scrollbars=yes");

        // window.location = base_url+"Laporan_excel/cetak_excel_dashboard_user/"+periode.replace('/', '-');

      }

    });



    $("#btn-laporan_rekap_bidang_pertriwulan_3").click(function(){

      var periode = $("#periode_thn_all_3").val();

      var bidang = $("#bidang_3").val();

      if (periode == "" || bidang =="") {

        Command: toastr["warning"]("Data Belum Lengkap", "warning");

      }else{

        window.location = base_url+"laporan_rekap_bidang/laporan_rekap_bidang_3/"+periode.replace('/', '-')+"/"+bidang;

      }

        

    })

    $("#btn-laporan_rekap_bidang_pertriwulan_pdf_3").click(function(){

      var periode = $("#periode_thn_all_3").val();

      var bidang = $("#bidang_3").val();

      if (periode == "" || bidang =="") {

        Command: toastr["warning"]("Data Belum Lengkap", "warning");

      }else{

        window.open(base_url+"laporan_rekap_bidang/laporan_rekap_bidang_pertriwulan_pdf_3/"+periode.replace('/', '-')+"/"+bidang, "PKA", "fullscreen=yes, scrollbars=yes");

        // window.location = base_url+"Laporan_excel/cetak_excel_dashboard_user/"+periode.replace('/', '-');

      }

    });

    // $("#btn-laporan_rekap_um_pertriwulan").click(function(){

    // 	var periode = $("#periode_thn_pertriwulan").val();

    // 	if (periode == "") {

    // 		Command: toastr["warning"]("Periode Belum Dipilih", "warning");

    // 	}else{

    // 		window.location = base_url+"laporan_rekap_unit_misioner/laporan_rekap_um_pertriwulan/"+periode.replace('/', '-');

    // 	}

      	

    // })

})

    ////////////////////////////////////////////////

</script>