angular.module("RdmApp").controller("paspatCtrl",["$scope","$rootScope","common","DTOptionsBuilder","DTColumnBuilder","$http","$q","ApiServer","FileUploader",function(a,i,n,e,t,l,o,s,r){i.knilai={},a.setallNilai=function(a){null!==a&&""!==a&&angular.forEach(i.datasiswa,(function(i){i.paspat=a}))},a.tambahpas=function(){i.knilai.edit=!1,$(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"})},a.simpanPasPat=function(){i.knilai={},i.knilai.nilaipas={},angular.forEach(i.datasiswa,(function(a){i.knilai.nilaipas[a.siswa_id]=a.paspat})),$(".edit-modal").modal("hide"),$.blockUI({}),s.post("guru/pengetahuan/savepaspat/"+i.selectKelas,i.knilai,(function(a){$.unblockUI({}),a.success?(i.getharian(),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=e.newOptions().withOption("searching",!0).withOption("stateSave",!0).withOption("paging",!1).withOption("tabIndex",-1).withOption("responsive",!0).withOption("ordering",!1).withOption("processing",!1),a.dtOptions2=e.newOptions().withOption("searching",!0).withOption("paging",!1).withOption("ordering",!1).withOption("processing",!1),a.UploadTemplate=function(){i.knilai={},i.knilai.edit=!1,$(".upload-modal").modal("show")};var p=a.uploader=new r({url:base_url+"guru/pengetahuan/importnilai"});a.berhasilaa=0,a.gandaaa=0,a.gagalaa=0,a.hapussemua=function(){p.clearQueue(),a.berhasilaa=0,a.gandaaa=0,a.gagalaa=0},p.filters.push({name:"customFilter",fn:function(a,i){return this.queue.length<100}}),p.filters.push({name:"imageFilter",fn:function(a,i){var n="|"+a.name.substr(a.name.lastIndexOf(".")+1)+"|";return console.info("type",n),-1!=="|xls|xlsx|".indexOf(n)}}),p.onSuccessItem=function(i,n,e,t){a.berhasilka=a.berhasilka+n.sukses,a.gandaaa=a.gandaaa+n.double1,a.gagalaa=a.gagalaa+n.gagal,a.$apply(),console.info("onSuccessItem",i,n,e,t,a.gandaaa)},p.onCompleteAll=function(){i.getharian()},p.onBeforeUploadItem=function(a){a.url=base_url+"guru/pengetahuan/importnilai/paspat/"+i.selectKelas},p.onAfterAddingAll=function(a){p.uploadAll()}}]);