angular.module("RdmApp").controller("nilaiketerampilanCtrl",["$scope","$rootScope","common","DTOptionsBuilder","DTColumnBuilder","$http","$q","ApiServer","FileUploader",function(a,e,t,i,n,l,o,s,r){e.knilai={},a.tambahharian=function(){e.knilai={},e.knilai.edit=!1,$(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"})},a.deleteKompnilai=function(a){Swal.fire({type:"warning",title:"Perhatian",confirmButtonText:"Ya, Hapus!",showCancelButton:!0,html:"Apakah Anda yakin akan menghapus nilai ini? Nilai yang sudah di hapus tidak bisa dikembalikan lagi."}).then((t=>{t.value&&($.blockUI({}),s.post("guru/keterampilan/deletenilai",a,(function(a){$.unblockUI({}),e.getketerampilan(),a.success?Swal.fire({type:"success",title:"Berhasil",showConfirmButton:!1,html:"Data Berhasil Dihapus",timer:1e3}):Swal.fire({type:"error",title:"Gagal",showConfirmButton:!0,html:a.message})})))}))},a.savedataharian=function(){$(".edit-modal").modal("hide"),$.blockUI({}),s.post("guru/keterampilan/nilaiket",e.knilai,(function(a){$.unblockUI({}),a.success?(e.getketerampilan(),Swal.fire({type:"success",title:"Berhasil",showConfirmButton:!1,html:"Data Berhasil Disimpan",timer:1e3})):Swal.fire({type:"error",title:"Gagal",showConfirmButton:!0,html:a.message}).then((a=>{a.value&&($(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"}))}))}))},a.dtOptions=i.newOptions().withOption("searching",!0).withOption("stateSave",!0).withButtons([{extend:"copy",text:'<i class="fa fa-files-o"></i> Copy',titleAttr:"Copy"},{extend:"pdfHtml5",text:'<i class="fa fa-print" aria-hidden="true"></i> Print',download:"open",exportOptions:{columns:[0,1,2,3]},titleAttr:"Print",customize:function(a){e.customepdf(a,"Absen Siswa","RDM")}},{extend:"excelHtml5",text:'<i class="fa fa-file-text-o"></i> Excel',exportOptions:{columns:[0,2,3]},titleAttr:"Excel"}]).withOption("paging",!1).withOption("ordering",!1).withOption("processing",!1),a.dtOptions2=i.newOptions().withOption("searching",!0).withOption("paging",!1).withOption("ordering",!1).withOption("processing",!1),a.UploadTemplate=function(){e.knilai={},e.knilai.edit=!1,$(".upload-modal").modal("show")};var u=a.uploader=new r({url:base_url+"guru/keterampilan/importnilai"});a.berhasilaa=0,a.gandaaa=0,a.gagalaa=0,a.hapussemua=function(){u.clearQueue(),a.berhasilaa=0,a.gandaaa=0,a.gagalaa=0},u.filters.push({name:"customFilter",fn:function(a,e){return this.queue.length<100}}),u.filters.push({name:"imageFilter",fn:function(a,e){var t="|"+a.name.substr(a.name.lastIndexOf(".")+1)+"|";return console.info("type",t),-1!=="|xls|xlsx|".indexOf(t)}}),u.onSuccessItem=function(e,t,i,n){a.berhasilka=a.berhasilka+t.sukses,a.gandaaa=a.gandaaa+t.double1,a.gagalaa=a.gagalaa+t.gagal,a.$apply(),console.info("onSuccessItem",e,t,i,n,a.gandaaa)},u.onCompleteAll=function(){e.getketerampilan()},u.onBeforeUploadItem=function(a){a.url=base_url+"guru/keterampilan/importnilai/praktek/"+e.selectKelas},u.onAfterAddingAll=function(a){u.uploadAll()}}]);