%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
/** Publisher **/ angular.module('MetronicApp').controller("Publisher", 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.api_all_states_checked=false; CR.dtl=dtl?dtl:{status:'1', id:'', api:{api_enabled:'N', system_id_generate:'N', state_codes:[]}}; if(!CR.dtl.api || typeof CR.dtl.api.api_enabled === "undefined"){ CR.dtl.api={api_enabled:'N', system_id_generate:'N', state_codes:[]}; } CR.states.forEach(v=>{ if(CR.dtl.api.state_codes.indexOf(v.code)>=0){ v.is_added_in_api=true; }else{ v.is_added_in_api=false; } }); CR.checkApiState(); showModal($("#formModal"), true); } CR.checkAllApiStates=()=>{ CR.states.forEach(v=>{ if(CR.api_all_states_checked){ v.is_added_in_api=true; }else{ v.is_added_in_api=false; } }); } CR.checkApiState=()=>{ let flg=0; CR.states.forEach(v=>{ if(!v.is_added_in_api){ flg=1; } }); if(flg){ CR.api_all_states_checked=false; }else{ CR.api_all_states_checked=true; } } CR.lists=function(p){ show_loader(); CR.sdata.p=p?p:1; $http({url: API_URL+'publisher/lists', params:CR.sdata}).success( function(res){ CR.result=res.result; CR.page=res.page; } ).error(function(res){showHttpErr(res);}); } CR.save=function(){ var frm=$("#frm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'publisher/save', method:'POST', data:formData, headers:{'Content-Type': undefined}}).success( function(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_publisher=function(id){ show_loader(); $http({url: API_URL+'publisher/detail/'+id}).success( function(res){ CR.open_form(res); } ).error(function(res){showHttpErr(res);}); } CR.updateStatus=function(id, st){ show_loader(); $http({url: API_URL+'publisher/updateStatus', method:'POST', data:(( {id:id, status:st} ))}).success( function(res){ if(res.success){ show_alert_msg(res.msg); CR.lists(CR.sdata.p); hideModal($("#formModal")); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.viewTargets=function(id, user){ CR.tuser_id=id; CR.tuser=user; show_loader(); $http({url: API_URL+'publisher/viewTargets/'+id}).success( function(res){ CR.months=months(); CR.targets=res.targets; showModal($("#targetModal"), true); } ).error(function(res){showHttpErr(res);}); } CR.saveTarget=function(){ var frm=$("#targetfrm"); hide_form_errors(frm); var formData=new FormData(frm[0]); show_loader(); $http({url:API_URL+'publisher/saveTarget', method:'POST', data:formData, headers:{'Content-Type': undefined}}).success( function(res) { if(res.success){ show_alert_msg(res.msg); hideModal($("#targetModal")); CR.months=[]; }else{ show_form_errors(res.errors, frm); show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } CR.delete_publisher=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'publisher/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.removeDoc=function(id){ if(!confirm("Are you sure to delete?")){ return; } show_loader(); $http({url: API_URL+'publisher/removeDoc', method:'POST', data:(( {id:id} ))}).success( function(res){ //res=Auth.checkRes(res); if(res.success=='T'){ CR.dtl.pub_proposal_doc=''; CR.dtl.doc_url=''; show_alert_msg(res.msg); }else{ show_alert_msg(res.msg, 'E'); } } ).error(function(res){showHttpErr(res);}); } /** NDA */ CR.getNDAContent=function(){ show_loader(); $http({url: API_URL+'publisher/getNDAContent'}).success( function(res){ hide_loader(); //res=Auth.checkRes(res); tinymce.EditorManager.get('ta_nda').setContent(res.nda); } ).error(function(res){showHttpErr(res);}); } CR.saveNDAContent=function(){ show_loader(); tinyMCE.triggerSave(false, true); var nda=$('#ta_nda').val(); $http({url:API_URL+'publisher/saveNDAContent', method:'POST', data:(({nda:nda}))}).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);}); } /** \NDA End */ /** Init **/ CR.init=function(){ setBsDatepicker(); set_tinymce("#ta_nda"); show_loader(); $http({url: API_URL+'publisher/init'}).success( function(res){ CR.result=res.result; CR.page=res.page; CR.utmSources=res.utmSources; CR.states=res.states; } ).error(function(res){showHttpErr(res);}); } CR.init(); }); //EOF