%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
/** Program **/ angular.module('MetronicApp').controller("Program", function($scope, $http, $state, $location, $timeout, Auth){ var CR=this; CR.sdata={p:1}; CR.open_form=function(dtl){ hide_form_errors($("#frm")); $("#frm").find('[type="file"]').val(''); CR.dtl=dtl?dtl:{id:'', is_medical:'0', is_phd:'0', status:'1'}; showModalNew($("#formModal"), true, true); $('.progChk').find(".allChk, .chk").prop('checked', false); if(dtl){ tinymce.EditorManager.get('ta_highlights').setContent(dtl.highlights); tinymce.EditorManager.get('ta_eligibility').setContent(dtl.eligibility); tinymce.EditorManager.get('ta_scholarship').setContent(dtl.scholarship); tinymce.EditorManager.get('ta_career_path').setContent(dtl.career_path); tinymce.EditorManager.get('ta_program_fee_dtl').setContent(dtl.program_fee_dtl); tinymce.EditorManager.get('ta_financial_assistance').setContent(dtl.financial_assistance); for(i=0; i<dtl.coupanIds.length; i++){ $('.progChk').find(".chk[value='"+dtl.coupanIds[i]['coupan_id']+"']").prop('checked', true); } }else{ tinymce.EditorManager.get('ta_highlights').setContent(''); tinymce.EditorManager.get('ta_eligibility').setContent(''); tinymce.EditorManager.get('ta_scholarship').setContent(''); tinymce.EditorManager.get('ta_career_path').setContent(''); tinymce.EditorManager.get('ta_program_fee_dtl').setContent(''); tinymce.EditorManager.get('ta_financial_assistance').setContent(''); } $('[href="#ptab_1"]').click(); } CR.lists=function(p){ show_loader(); CR.sdata.p=p?p:1; $http({url: API_URL+'program/lists', params:CR.sdata}).success( function(res){ //res=Auth.checkRes(res); CR.result=res.result; CR.page=res.page; } ).error(function(res){showHttpErr(res);}); } CR.save=function(){ tinyMCE.triggerSave(false, true); var frm=$("#frm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'program/save', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success( function(res) { //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.lists(CR.dtl.id?CR.sdata.p:1); hideModal($("#formModal")); }else{ show_form_errors(res.errors, frm); show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.edit_program=function(id){ show_loader(); $http({url: API_URL+'program/detail/'+id}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); CR.open_form(res); } ).error(function(res){showHttpErr(res);}); } CR.delete_program=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'program/delete', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); var pg=CR.sdata.p; if(CR.page.total==1){ pg=1; } CR.lists(pg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.removeProgImage=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'program/removeImage', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ CR.dtl.image=''; CR.dtl.image_url=''; show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.removeProgBrochure=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'program/removeBrochure', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ CR.dtl.brochure=''; CR.dtl.brochure_url=''; show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.selectedPrg={}; CR.initPlans=function(){ //show_loader(); App.blockUI({target: '#prgPBBx', boxed: true, message: 'Loading...'}); $http({url: API_URL+'program/initPlans'}).success( function(res){ App.unblockUI('#prgPBBx'); //res=Auth.checkRes(res); CR.allPrograms=res.allPrograms; var prg=typeof CR.allPrograms[0] != "undefined" ? CR.allPrograms[0] : {}; CR.getPlans(prg); } ).error(function(res){showHttpErr(res);}); } CR.getPlans=function(obj){ CR.selectedPrg=obj; CR.searchPlanInput=''; $.each(CR.allPrograms, function(k, v){ if(v.id==CR.selectedPrg.id){ CR.allPrograms[k]['actClass']='active'; }else{ CR.allPrograms[k]['actClass']=''; } }); //show_loader(); App.blockUI({target: '#plansPBBx', boxed: true, message: 'Loading...'}); $http({url: API_URL+'program/getPlans/'+CR.selectedPrg.id}).success( function(res){ App.unblockUI('#plansPBBx'); //res=Auth.checkRes(res); CR.plans=res.plans; CR.selectedPrg.noOfPlans=CR.plans.length; } ).error(function(res){showHttpErr(res);}); } CR.openPlanForm=function(dtl){ hide_form_errors($("#planfrm")); CR.planData=dtl?dtl:{id:'', status:'1', program_id:CR.selectedPrg.id}; showModal($("#planformModal"), true); $('.planChk').find(".allChk, .chk").prop('checked', false); $(".cchk").prop('checked', false); if(dtl){ for(i=0; i<dtl.coupanIds.length; i++){ $('.planChk').find(".chk[value='"+dtl.coupanIds[i]['coupan_id']+"']").prop('checked', true); } for(i=0; i<dtl.campus_ids.length; i++){ $(".cchk[value='"+dtl.campus_ids[i]+"']").prop('checked', true); } } } CR.savePlan=function(){ var frm=$("#planfrm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'program/savePlan', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success( function(res) { //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.getPlans(CR.selectedPrg); hideModal($("#planformModal")); }else{ //show_form_errors(res.errors, frm); show_alert_msg(res.msg, 'E'); } CR.planData={}; } ).error(function(res){showHttpErr(res);}); } CR.editPlan=function(id){ show_loader(); $http({url: API_URL+'program/planDetail/'+id}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); CR.openPlanForm(res); } ).error(function(res){showHttpErr(res);}); } CR.deletePlan=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'program/deletePlan', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.getPlans(CR.selectedPrg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } $scope.uploadPlanExcel=function(){ var frm=$("#planImpExcel"); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'program/uploadPlanExcel', method:'POST', data:formData, headers:{'Content-Type': undefined}}).success( function(res){ $('#planExcelFile').val(''); //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.getPlans(CR.selectedPrg); }else{ show_alert_msg(res.msg, 'E'); } } ); } /** Suggested Plans */ CR.openSuggestedPlanModal=function(obj){ CR.spSelectedPrg=angular.copy(obj); show_loader(); $http({url: API_URL+'program/initSuggestedPrograms/'+CR.spSelectedPrg.id}).success( function(res){ //res=Auth.checkRes(res); CR.spAllPrograms=res.allPrograms; CR.suggestedPrograms=res.suggestedPrograms; CR.spProgramId=''; showModal($("#suggestedPrgModal"), true); } ).error(function(res){showHttpErr(res);}); } CR.addSuggestedProgram=function(){ if(!CR.spProgramId){ return; } show_loader(); $http({url: API_URL+'program/addSuggestedProgram', method:'POST', data:(( {program_id:CR.spSelectedPrg.id, sug_program_id:CR.spProgramId} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.suggestedPrograms=res.suggestedPrograms; CR.spProgramId=''; }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.deleteSuggestedProgram=function(id){ if(!confirm("Are you sure to remove?")){ return; } show_loader(); $http({url: API_URL+'program/deleteSuggestedProgram', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); CR.suggestedPrograms=res.suggestedPrograms; }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.addSuggestedPlans=function(e){//Not in use var frm=$(e.target).closest('form'); show_loader(); $http({url: API_URL+'program/addSuggestedPlans', method:'POST', data:(frm.serialize())}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } /** Init **/ CR.init=function(){ set_tinymce("#ta_highlights", 600); set_tinymce("#ta_eligibility", 600); set_tinymce("#ta_scholarship", 600); set_tinymce("#ta_career_path", 600); set_tinymce("#ta_program_fee_dtl", 600); set_tinymce("#ta_financial_assistance", 600); show_loader(); $http({url: API_URL+'program/init'}).success( function(res){ //res=Auth.checkRes(res); CR.result=res.result; CR.page=res.page; CR.programTypes=res.programTypes; CR.academicCareers=res.academicCareers; CR.disciplines=res.disciplines; CR.schools=res.schools; CR.coupans=res.coupans; CR.campuses=res.campuses; } ).error(function(res){showHttpErr(res);}); } CR.init(); }); /** Non Angular */ function addSuggestedPlans(obj, noloader){ var frm=$(obj).closest('form'); if(!noloader){ show_loader(); } $.ajax({ url: API_URL+'program/addSuggestedPlans', type:'POST', data:(frm.serialize()), dataType:'JSON', success:function(res){ res=checkRes(res); if(res.success=='T'){ show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } }); } //EOF