<!-- Page Heading -->


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


            <h1 class="h3 mb-0 text-gray-800">Sampah File PKA</h1>


            <!-- <a href="javascript:void(0)" class="d-none d-sm-inline-block btn btn-sm btn-danger shadow-sm" onclick="getcontens('page/sampah_file_pka');"><i class="fas fa-trash-alt fa-sm text-white-50"></i>  Lihat Sampah</a> -->


          </div>





          <!-- Content Row -->


          <div class="row" id="file">





          </div>


          <hr>


          <button type="button" class="btn btn-primary btn-sm" onclick="getcontens('page/file_pka');"><i class="fas fa-arrow-left"></i> Kembali</button>


          <!-- <div class="modal-footer">


            <button type="button" class="btn btn-danger btn-sm" onclick="getcontens('page/sampah_file_pka');"><i class="fas fa-trash-alt"></i> Lihat Sampah</button>


          </div> -->





<script type="text/javascript">


  $(document).ready(function(){


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


    var file = function(){


      $.ajax({


                url             : base_url + 'Save_pka/select_data_sampah_save', 


                type            : "POST",


                dataType        : 'json',


                mimeType        : 'multipart/form-data',


                // data            : form_data,


                contentType     : false,


                cache           : false,


                processData     : false,


                success         : function(result){


                  // alert(JSON.stringify(result))


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


                    var no = i+1;


                    $("#file").append(`


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


                        


                        <div class="card shadow h-100 py-2" style="border-left: 5px solid #`+randomColor()+`">


                          <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-primary text-uppercase mb-1">`+result[i].nama_save+`</div>


                                <div class="h5 mb-0 font-weight-bold text-gray-800">`+result[i].jumlah+` Page </div>


                              </div>


                              <div class="col-auto">


                                <a href='javascript:void(0)' title="Restore File PKA" onclick="restore('`+result[i].ks+`');">


                                <i class="fas fa-trash-restore-alt fa-2x text-gray-300"></i>


                                </a>


                              </div>





                            </div>


                          </div>


                        </div>


                        


                      </div>


                    `)


                  }


                },


                error: function(jqXHR, textStatus, errorThrown) {


                  swal.close();


                    Command: toastr["error"](errorThrown, "Error");


                }


          });


    }


    file();


    restore = function(kode_save){


      bootbox.confirm("Apakah Anda Yakin Akan Memulihkan Data?", function(result){ 


        if (result==true) {


              $.ajax({


                url             : base_url + 'Save_pka/restore_save_pka', 


                type            : "POST",


                dataType        : 'json',


                data            : {kode_save:kode_save},


                success         : function(response){


                    if(response == true){


                        // $('#'+id_modal).modal('hide'); 


                        Command: toastr["success"]("Data Berhasil Dipulihkan", "Berhasil");


                        getcontens('page/file_pka');


                    }else{


                        Command: toastr["error"]("Simpan error, data tidak berhasil disimpan", "Error");


                    }


                },


                error: function(jqXHR, textStatus, errorThrown) {


                  $('#loading').modal('show');


                        Command: toastr["error"](errorThrown, "Error");


                },


                beforeSend: function () {


                  $('#loading').modal('show');


                },


                complete: function () {


                    $('#loading').modal('hide');


                }


          }); 


        }


      }) 


    }


  });


</script>