%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
/** Master **/
angular.module('MetronicApp').controller("Master", function($scope, $http, $state, $location, $timeout, Auth){
var CR=this;
/** GA Code */
CR.gaData={};
CR.getGACode=function(){
show_loader();
$http({url: API_URL+'master/getGACode'}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.gaData=res.dtl;
}
).error(function(res){showHttpErr(res);});
}
CR.saveGACode=function(){
show_loader();
$http({url:API_URL+'master/saveGACode', method:'POST', data:((CR.gaData))}).success(
function(res) {
if(res.success=='T'){
show_alert_msg(res.msg);
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
/** \GA Code End */
/** Admin Emails */
CR.sdataAE={p:1};
CR.openAEform=function(dtl){
hide_form_errors($("#aefrm"));
CR.aeDtl=dtl?dtl:{id:''};
showModal($("#aeFormModal"));
}
CR.listAE=function(p){
show_loader();
CR.sdataAE.p=p?p:1;
$http({url: API_URL+'master/adminEmails', params:CR.sdataAE}).success(
function(res){
//res=Auth.checkRes(res);
CR.AEList=res.result;
CR.AEPage=res.page;
}
).error(function(res){showHttpErr(res);});
}
CR.saveAE=function(){
var frm=$("#aefrm");
hide_form_errors(frm);
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/saveAdminEmail', 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.listAE(CR.aeDtl.id?CR.sdataAE.p:1);
hideModal($("#aeFormModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.editAE=function(id){
show_loader();
$http({url: API_URL+'master/adminEmailDtl/'+id}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.openAEform(res);
}
).error(function(res){showHttpErr(res);});
}
CR.deleteAE=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteAdminEmail', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
var pg=CR.sdataAE.p;
if(CR.AEPage.total==1){
pg=1;
}
CR.listAE(pg);
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
/** Init **/
CR.init=function(){
CR.listAE();
}
CR.init();
});
/** UTM Sources **/
angular.module('MetronicApp').controller("UtmSource", function($scope, $http, $state, $location, $timeout, Auth){
var CR=this;
CR.sdataUTM={};
CR.openUTMform=function(dtl){
hide_form_errors($("#utmfrm"));
CR.utmDtl=dtl?dtl:{id:'', status:'1', default_for_admin: '0'};
showModal($("#utmFormModal"));
}
CR.listUTM=function(){
show_loader();
$http({url: API_URL+'master/utmSources', params:CR.sdataUTM}).success(
function(res){
CR.utmLists=res.result;
}
).error(function(res){showHttpErr(res);});
}
CR.saveUTM=function(){
var frm=$("#utmfrm");
hide_form_errors(frm);
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/saveUtmSource', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success(
function(res) {
if(res.success=='T'){
show_alert_msg(res.msg);
CR.listUTM();
hideModal($("#utmFormModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.editUTM=function(id){
show_loader();
$http({url: API_URL+'master/utmSourceDtl/'+id}).success(
function(res){
hide_loader();
CR.openUTMform(res);
}
).error(function(res){showHttpErr(res);});
}
CR.deleteUTM=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteUtmSource', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
if(res.success=='T'){
show_alert_msg(res.msg);
CR.listUTM();
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
/** Init */
CR.listUTM();
});
/** State **/
angular.module('MetronicApp').controller("State", function($scope, $http, $state, $location, $timeout, Auth){
var CR=this;
CR.sdataSTT={};
CR.openSTTform=function(dtl){
hide_form_errors($("#sttfrm"));
CR.sttDtl=dtl?dtl:{id:'', status:'1'};
showModal($("#sttFormModal"));
}
CR.listSTT=function(){
show_loader();
$http({url: API_URL+'master/states', params:CR.sdataSTT}).success(
function(res){
//res=Auth.checkRes(res);
CR.sttLists=res.result;
}
).error(function(res){showHttpErr(res);});
}
CR.saveSTT=function(){
var frm=$("#sttfrm");
hide_form_errors(frm);
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/saveState', 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.listSTT();
hideModal($("#sttFormModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.editSTT=function(id){
show_loader();
$http({url: API_URL+'master/stateDtl/'+id}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.openSTTform(res);
}
).error(function(res){showHttpErr(res);});
}
CR.deleteSTT=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteState', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
CR.listSTT();
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.selectedST={};
CR.initCities=function(){
App.blockUI({target: '#statePBBx', boxed: true, message: 'Loading...'});
$http({url: API_URL+'master/initCities'}).success(
function(res){
App.unblockUI('#statePBBx');
//res=Auth.checkRes(res);
CR.allStates=res.allStates;
CR.getCities(CR.allStates[0]);
}
).error(function(res){showHttpErr(res);});
}
CR.getCities=function(obj){
CR.selectedST=obj;
CR.searchStateInput='';
$.each(CR.allStates, function(k, v){
if(v.id==CR.selectedST.id){
CR.allStates[k]['actClass']='active';
}else{
CR.allStates[k]['actClass']='';
}
});
App.blockUI({target: '#citiesPBBx', boxed: true, message: 'Loading...'});
$http({url: API_URL+'master/getCities/'+CR.selectedST.id}).success(
function(res){
App.unblockUI('#citiesPBBx');
//res=Auth.checkRes(res);
CR.cities=res.cities;
CR.selectedST.noOfCities=CR.cities.length;
}
).error(function(res){showHttpErr(res);});
}
CR.openCityForm=function(dtl){
hide_form_errors($("#cityfrm"));
CR.cityData=dtl?dtl:{id:'', status:'1', state_id:CR.selectedST.id};
showModal($("#cityformModal"), true);
}
CR.saveCity=function(){
var frm=$("#cityfrm");
hide_form_errors(frm);
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/saveCity', 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.getCities(CR.selectedST);
hideModal($("#cityformModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.editCity=function(id){
show_loader();
$http({url: API_URL+'master/cityDetail/'+id}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.openCityForm(res);
}
).error(function(res){showHttpErr(res);});
}
CR.deleteCity=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteCity', method:'POST', data:(( {id:id} ))}).success(
function(res){
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
CR.getCities(CR.selectedST);
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
$scope.uploadCityExcel=function(){
var frm=$("#cityImpExcel");
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/uploadCityExcel', method:'POST', data:formData, headers:{'Content-Type': undefined}}).success(
function(res){
$('#cityExcelFile').val('');
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
CR.getCities(CR.selectedST);
}else{
show_alert_msg(res.msg, 'E');
}
}
);
}
/** Init */
CR.listSTT();
});
/** Notifications **/
angular.module('MetronicApp').controller("Notifications", function($scope, $http, $state, $location, $timeout, Auth){
var CR=this;
CR.sdata={};
CR.openForm=function(dtl){
hide_form_errors($("#frm"));
CR.data=dtl?dtl:{id:'', status:'1', type:'BOTH'};
showModal($("#formModal"));
$(".nchk").prop('checked', false);
if(dtl){
var steps=dtl.steps.split(",");
for(i=0; i<steps.length; i++){
$(".nchk[value='"+steps[i]+"']").prop('checked', true);
}
}
}
CR.lists=function(){
show_loader();
$http({url: API_URL+'master/notifications', params:CR.sdata}).success(
function(res){
CR.result=res.result;
}
).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+'master/saveNotification', method:'POST', data:(formData), headers:{'Content-Type': undefined}}).success(
function(res) {
if(res.success=='T'){
show_alert_msg(res.msg);
CR.lists();
hideModal($("#formModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.edit=function(id){
show_loader();
$http({url: API_URL+'master/notificationDtl/'+id}).success(
function(res){
hide_loader();
CR.openForm(res);
}
).error(function(res){showHttpErr(res);});
}
CR.delete=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteNotification', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
if(res.success=='T'){
show_alert_msg(res.msg);
CR.lists();
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
/** Init */
CR.lists();
});
/** FAQ **/
angular.module('MetronicApp').controller("FAQ", function($scope, $http, $state, $location, $timeout, Auth){
var CR=this;
CR.sdata={};
CR.openForm=function(dtl){
hide_form_errors($("#frm"));
CR.data=dtl?dtl:{id:'', status:'1'};
showModal($("#formModal"), true);
$('.fcatChk').find(".allChk,.chk").prop('checked', false);
if(dtl){
tinymce.EditorManager.get('ta_ans').setContent(dtl.ans);
var cat_ids=dtl.cat_ids.split(",");
for(i=0; i<cat_ids.length; i++){
$('.fcatChk').find(".chk[value='"+cat_ids[i]+"']").prop('checked', true);
}
}else{
tinymce.EditorManager.get('ta_ans').setContent('');
}
}
CR.lists=function(){
show_loader();
$http({url: API_URL+'master/faqs', params:CR.sdata}).success(
function(res){
//res=Auth.checkRes(res);
CR.result=res.result;
}
).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+'master/saveFaq', 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();
hideModal($("#formModal"));
}else{
//show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.edit=function(id){
show_loader();
$http({url: API_URL+'master/faqDetail/'+id}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.openForm(res);
}
).error(function(res){showHttpErr(res);});
}
CR.delete=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteFaq', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
CR.lists();
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.sdataCT={};
CR.openCTform=function(dtl){
hide_form_errors($("#ctfrm"));
CR.ctDtl=dtl?dtl:{id:'', status:'1'};
showModal($("#ctFormModal"));
}
CR.listCT=function(){
show_loader();
$http({url: API_URL+'master/faqCats', params:CR.sdataCT}).success(
function(res){
//res=Auth.checkRes(res);
CR.cats=res.cats;
}
).error(function(res){showHttpErr(res);});
}
CR.saveCT=function(){
var frm=$("#ctfrm");
hide_form_errors(frm);
var formData=new FormData(frm[0]);
show_loader();
$http({url:API_URL+'master/saveFaqCat', 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.listCT();
hideModal($("#ctFormModal"));
}else{
show_form_errors(res.errors, frm);
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
CR.editCT=function(id){
show_loader();
$http({url: API_URL+'master/faqCatDetail/'+id}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
CR.openCTform(res);
}
).error(function(res){showHttpErr(res);});
}
CR.deleteCT=function(id){
if(!confirm("Are you sure to delete?")){
return;
}
show_loader();
$http({url: API_URL+'master/deleteFaqCat', method:'POST', data:(( {id:id} ))}).success(
function(res){
hide_loader();
//res=Auth.checkRes(res);
if(res.success=='T'){
show_alert_msg(res.msg);
CR.listCT();
}else{
show_alert_msg(res.msg, 'E');
}
}
).error(function(res){showHttpErr(res);});
}
/** Init */
CR.init=function(){
set_tinymce("#ta_ans", 150);
show_loader();
$http({url: API_URL+'master/initFaq'}).success(
function(res){
//res=Auth.checkRes(res);
CR.result=res.result;
CR.cats=res.cats;
}
).error(function(res){showHttpErr(res);});
}
CR.init();
});
//EOF