angular.module("RdmApp").controller("pengetahuanCtrl",["$scope","$rootScope","common","DTOptionsBuilder","DTColumnBuilder","$http","$q","ApiServer","FileUploader",function(i,t,a,e,n,l,r,o,s){t.knilai={},i.kirimNilai=function(){t.knilai.kirimnilai=[],$i=0;var i=!1;angular.forEach(t.dataharian,(function(a){var e={};e.siswa_id=a.siswa_id,e.rapor=a.rapor,parseInt(a.rapor)&&(i=!0),e.predikat=a.predikat,e.desc=a.desc,t.knilai.selectKelas=t.selectKelas,t.knilai.kirimnilai[$i]=e,$i++})),i?($.blockUI({}),o.post("guru/pengetahuan/kirimnilai",t.knilai,(function(i){$.unblockUI({}),t.getharian(),t.getdatakelas(),i.success?Swal.fire({type:"success",title:"Berhasil",showConfirmButton:!1,html:"Data Berhasil Dikirim",timer:1e3}):Swal.fire({type:"error",title:"Gagal",showConfirmButton:!0,html:i.message})}))):Swal.fire({type:"warning",title:"Perhatian!!!",showConfirmButton:!0,html:"Nilai rapor masih kosong semua, nilai tidak bisa di kirim."})},i.batalNilai=function(){t.knilai.kirimnilai=[],t.knilai.selectKelas=t.selectKelas,$.blockUI({}),o.post("guru/pengetahuan/batalnilai",t.knilai,(function(i){$.unblockUI({}),t.getharian(),t.getdatakelas(),i.success?Swal.fire({type:"success",title:"Berhasil",showConfirmButton:!1,html:"Data Berhasil Dikirim",timer:1e3}):Swal.fire({type:"error",title:"Gagal",showConfirmButton:!0,html:i.message})}))},i.dtOptions=e.newOptions().withOption("searching",!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",titleAttr:"Print",customize:function(i){t.customepdf(i,"Nilai Pengetahuan","Rapor Digital Madrasah")}},{extend:"excelHtml5",text:'<i class="fa fa-file-text-o"></i> Excel',exportOptions:{columns:[0,2,3]},titleAttr:"Excel"}]).withOption("stateSave",!0).withOption("responsive",!0).withOption("lengthMenu",[[10,25,50,100,200,-1],[10,25,50,100,200,"All"]]).withOption("paging",!1).withOption("processing",!0)}]);