angular.module("RdmApp").controller("prestasiCtrl",["$scope","$rootScope","common","DTOptionsBuilder","DTColumnBuilder","$http","$q","ApiServer","FileUploader",function(a,t,i,e,o,s,n,d,l){a.dataEdit={},a.dodataTambah=function(){a.dataEdit={},a.dataEdit.edit=!1,$(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"})},a.dodataEdit=function(t,i){a.dataEdit={},a.dataEdit.edit=!0,a.dataEdit.siswa_id=t,a.dataEdit.prestasi_id=i.prestasi_id,a.dataEdit.prestasi_keterangan=i.prestasi_keterangan,a.dataEdit.prestasi_nama=i.prestasi_nama,$(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"})},a.savedataEdit=function(){$(".edit-modal").modal("hide"),$.blockUI({}),d.post("guru/walas/saveprestasi/"+t.walas,a.dataEdit,(function(a){$.unblockUI({}),a.success?(t.getwalassiswa(),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.dodataDelete=function(a){Swal.fire({type:"warning",title:"Perhatian",confirmButtonText:"Yes, delete it!",showCancelButton:!0,html:"Apakah Anda yakin akan menghapus data ini?"}).then((i=>{i.value&&($.blockUI({}),d.post("guru/walas/deleteprestasi",a,(function(a){$.unblockUI({}),a.success?(t.getwalassiswa(),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.dtOptions=e.newOptions().withOption("searching",!0).withOption("stateSave",!0).withOption("paging",!1).withOption("responsive",!0).withOption("ordering",!1).withOption("processing",!1),a.dtOptions2=e.newOptions().withOption("searching",!0).withOption("stateSave",!0).withOption("paging",!1).withOption("ordering",!1).withOption("processing",!1)}]);