angular.module("RdmApp").controller("pindahkelasCtrl",["$scope","$rootScope","common","DTOptionsBuilder","DTColumnBuilder","$http","$q","ApiServer","FileUploader",function(a,t,n,i,e,s,l,o,r){a.dtInstance={},a.dtInstance2={},a.dataEdit={},a.prosesNaik=function(){a.filteredArray=a.datasiswaasal.filter((function(a){return 1==a.select}));var t={};t.kelas_id=a.tujuanData.kelas_id,t.tingkat_id=a.selectData.tingkat_id,t.data=a.filteredArray,$.blockUI({}),o.post("proktor/pindahkelas/save",t,(function(t){$.unblockUI({}),t.success?(a.reloadTable(),a.reloadTableTujuan(),Swal.fire({type:"success",title:"Berhasil",showConfirmButton:!1,html:"Data Berhasil Disimpan",timer:1e3})):Swal.fire({type:"error",title:"Gagal",showConfirmButton:!0,html:t.message}).then((a=>{a.value&&($(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"}))}))}))},t.datasiswaasal={},a.reloadTable=function(){t.datasiswaasal={},""!==a.selectData.kelas_id&&($.blockUI({}),o.post("proktor/pindahkelas/data",a.selectData,(function(a){$.unblockUI({}),t.datasiswaasal=a.data})))},t.datasiswatujuan={},a.reloadTableTujuan=function(){t.datasiswatujuan={},""!==a.tujuanData.kelas_id&&($.blockUI({}),o.post("proktor/pindahkelas/data",a.tujuanData,(function(a){$.unblockUI({}),t.datasiswatujuan=a.data})))},a.dodataEdit=function(t){a.dataEdit=t,$(".edit-modal").modal("show"),$(".modal-dialog").draggable({handle:".modal-header"})},a.changeTingkat=function(){a.tujuanData.kelas_id="",a.selectData.kelas_id="",t.datasiswatujuan={},t.datasiswaasal={}},a.currPg=0,a.recordsDisplay=0,a.currPg2=0,a.recordsDisplay2=0,a.tujuanData={},a.tujuanData.kelas_id="",a.tujuanData.tingkat_id="",a.tujuanData.tahunajaran_id="",a.selectData={},a.selectData.kelas_id="",a.selectData.tingkat_id="",a.selectData.tahunajaran_id="",a.dtOptions=i.newOptions().withOption("searching",!0).withOption("paging",!0).withOption("stateSave",!0).withOption("processing",!0).withOption("columnDefs",[{orderable:!1,targets:0}]).withOption("drawCallback",(function(t){if(t.aoData.length>0){var n=this.api().page.info();a.currPg=n.start,a.recordsDisplay=n.recordsDisplay}})).withOption("lengthMenu",[[10,25,50,100,200,-1],[10,25,50,100,200,"All"]]),a.dtOptions2=i.newOptions().withOption("searching",!0).withOption("paging",!0).withOption("processing",!0).withOption("columnDefs",[{orderable:!1,targets:0}]).withOption("drawCallback",(function(t){if(t.aoData.length>0){var n=this.api().page.info();a.currPg2=n.start,a.recordsDisplay2=n.recordsDisplay}})).withOption("lengthMenu",[[10,25,50,100,200,-1],[10,25,50,100,200,"All"]]),a.getdatatingkat=function(){o.get("proktor/pindahkelas/datatingkat",(function(n){t.asalajaran=n.asalajaran,t.tujuanajaran=n.tujuanajaran,t.asaltingkat=n.asaltingkat,t.asalkelas=n.asalkelas,a.tujuanData.tahunajaran_id=t.tujuanajaran.tahunajaran_id,a.selectData.tahunajaran_id=t.asalajaran.tahunajaran_id}))},a.getdatatingkat()}]);