File: /home/cafsindia/crm_cafsindia_com/dist/dashboard_bk28july2018.js
$(document).ready(function() {
// $("input").change(function(){
// alert("The text has been changed.");
// });
Highcharts.theme = {
//colors: [ '#4F87CE', '#666666', '#CEC7C7','#CC3366','#B39DDB','#FFEB3B','#009688','#E91E63','#795548'],
chart: {
backgroundColor: {
linearGradient: [0, 0, 500, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(240, 240, 255)']
]
},
},
title: {
style: {
color: '#000',
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
}
},
subtitle: {
style: {
color: '#666666',
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
}
},
legend: {
itemStyle: {
font: '9pt Trebuchet MS, Verdana, sans-serif',
color: 'black',
width: 200
},
itemHoverStyle:{
color: 'gray'
}
}
};
// Apply the theme
Highcharts.setOptions(Highcharts.theme);
});
// Onchange function - START
function get_team_info(date,emp_role,emp_cat,emp_id,misc){
var frm = "get_team_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,date:date,misc:misc},
success: function(data) {
$('table#team_info_table tbody').html(data);
},
});
}
function get_renewal_info(date){
var frm = "get_renewal_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date},
success: function(data) {
$('table#renewal_info_table tbody').html(data);
},
});
}
function get_productivity_info(date){
var frm = "get_productivity_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date},
success: function(data) {
$('#productivity_info_table').html(data);
},
});
}
function get_renew_life_info(date){
var frm = "get_renew_life_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date},
success: function(data) {
$('table#renew_life_info_table tbody').html(data);
},
});
}
function get_renew_hl_info(date){
var frm = "get_renew_hl_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date},
success: function(data) {
$('table#renew_hl_info_table tbody').html(data);
},
});
}
function get_renew_rm_info(date,ids){
var frm = "get_renew_rm_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date,ids:ids},
success: function(data) {
$('table#renew_rm_info_table tbody').html(data);
},
});
}
// Onchange function - END
// Model Popup function - START
function get_lead_info(emp_role,emp_cat,emp_id,lead_status,date,misc){
var frm = "get_lead_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,lead_status:lead_status,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_rm_lead_info(emp_role,emp_cat,emp_id,prospect,date,misc){
var frm = "get_rm_lead_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,prospect:prospect,date:date,misc:misc},
success: function(data) {
//alert(data);
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function rm_lead_info(emp_role,emp_cat,emp_id,prospect,date,misc){
var frm = "rm_lead_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,prospect:prospect,date:date,misc:misc},
success: function(data) {
//alert(data);
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_lead_info_issued(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_lead_info_issued";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_lead_info_type(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_lead_info_type";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_rm_ocl(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_rm_ocl";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_admin_ocl(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_admin_ocl";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_mis_rmlead(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_mis_rmlead";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_mis_hllead(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_mis_hllead";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_mis_lead_info(emp_role,emp_cat,emp_id,sts,date,misc){
var frm = "get_mis_lead_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,emp_role:emp_role,emp_cat:emp_cat,emp_id:emp_id,sts:sts,date:date,misc:misc},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_issued_info(mode,cat,sts){
var frm = "get_issued_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,mode:mode,cat:cat,sts:sts},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_document_info(mode,cat,sts){
var frm = "get_document_info";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,mode:mode,cat:cat,sts:sts},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
function get_renewal_info_list(date,cat,sts){
var frm = "get_renewal_info_list";
$.ajax({
type: "POST",
url: "./dashboard/call_back.php",
data: {frm:frm,date:date,cat:cat,sts:sts},
success: function(data) {
$('#lead_model_body').html(data);
$('#detail_list').DataTable( {
"paging": false,
"dom": '<"top"fi>rt<"bottom"flp><"clear">'
});
$('#detail_list_model').modal('show');
},
});
}
// Model Popup function - END
//Chart function - START
function mis_life_chart() {
var options = {
chart: {
renderTo: 'mis_life_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Life chart'
},
tooltip: {
formatter: function() {
percentage = this.percentage.toFixed(2);
return '<b>' + this.point.name + '</b>: ' + this.y+ '</b>: ' + percentage+'%';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
center: [150, 75],
dataLabels: {
enabled: false,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
percentage = this.percentage.toFixed(2);
return '<b>' + this.point.name + '</b>: ' + this.y + '</b>: ' + percentage+'%';
}
},
showInLegend: true
}
},
legend: {
enabled: true,
floating: true,
verticalAlign: 'center',
align:'right',
width: 200,
x:-30,
y:10,
useHTML: true,
labelFormatter: function() {
percentage = this.percentage.toFixed(2);
return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
}
},
series: []
};
$.getJSON("index.php/home/mis_life_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function mis_hl_chart() {
var options = {
chart: {
renderTo: 'mis_hl_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Health chart'
},
tooltip: {
formatter: function() {
percentage = this.percentage.toFixed(2);
return '<b>' + this.point.name + '</b>: ' + this.y + '</b>: ' + percentage+'%';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
center: [150, 75],
dataLabels: {
enabled: false,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
percentage = this.percentage.toFixed(2);
return '<b>' + this.point.name + '</b>: ' + this.y + '</b>: ' + percentage+'%';
}
},
showInLegend: true
}
},
legend: {
enabled: true,
floating: true,
verticalAlign: 'top',
align:'right',
width: 200,
x:-30,
y:30,
useHTML: true,
labelFormatter: function() {
//return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
percentage = this.percentage.toFixed(2);
return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
}
},
series: []
};
$.getJSON("index.php/home/mis_hl_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function mis_rm_chart() {
var options = {
chart: {
renderTo: 'mis_rm_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'RM chart'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
center: [150, 75],
dataLabels: {
enabled: false,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
showInLegend: true
}
},
legend: {
enabled: true,
floating: true,
verticalAlign: 'top',
align:'right',
width: 200,
x:-30,
y:30,
useHTML: true,
labelFormatter: function() {
//return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
percentage = this.percentage.toFixed(2);
return "<div class='col-md-12 pd0' style='display:inline-flex;font-size:11px !important;border:1px dotted #CCCCCC;border-bottom:0px;'><div style='float:left;width:65px;padding:2px;overflow:hidden; text-overflow:ellipsis;border-right: 1px dotted #CCCCCC;'>"+this.name+"</div><div style='float:left;padding:2px;width:75px;text-align:center;border-right: 1px dotted #CCCCCC;'>"+ this.y +"</div><div style='float:left;padding:2px;width:43px;'>"+percentage+"%</div></div>";
}
},
series: []
};
$.getJSON("index.php/home/mis_rm_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function crm_chart(){
var options = {
chart: {
type: 'pie',
name:'Lead Status',
renderTo: 'crm_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Over all performance'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
showInLegend: false
}
},
series: [],
drilldown: {
series: []
}
};
$.ajax({
type: "POST",
url: './index.php/home/crm_chart',
success: function(data) {
var rslt = JSON.parse(data);
options.series = rslt.series;
options.drilldown.series = rslt.drill_list;
chart = new Highcharts.Chart(options);
},
});
}
function am_crm_chart(emp_id,emp_cat,emp_role){
var options = {
chart: {
type: 'pie',
name:'Lead Status',
renderTo: 'crm_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Over all performance'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
showInLegend: false
}
},
series: [],
drilldown: {
series: []
}
};
$.ajax({
type: "POST",
url: "./index.php/home/am_crm_chart?emp_id="+emp_id+"&emp_cat="+emp_cat+"&emp_role="+emp_role,
success: function(data) {
var rslt = JSON.parse(data);
options.series = rslt.series;
options.drilldown.series = rslt.drill_list;
chart = new Highcharts.Chart(options);
},
});
}
function rm_ni_chart() {
var options = {
chart: {
renderTo: 'rm_ni_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Not Interested chart'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: false,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
showInLegend: true
}
},
legend: {
enabled: true,
floating: true,
verticalAlign: 'top',
align:'right',
width: 200,
y:30,
useHTML: true,
labelFormatter: function() {
return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
}
},
series: []
};
$.getJSON("index.php/home/rm_ni_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function rmm_ni_chart() {
var options = {
chart: {
renderTo: 'rmm_ni_chart',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'Not Interested chart'
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
dataLabels: {
enabled: false,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
showInLegend: true
}
},
legend: {
enabled: true,
floating: true,
verticalAlign: 'top',
align:'right',
width: 200,
y:30,
useHTML: true,
labelFormatter: function() {
return "<div class='col-md-12'> "+ this.name + " - "+ this.y +"</div>";
}
},
series: []
};
$.getJSON("index.php/home/rmm_ni_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function bar_report(role,category,start_date,end_date,status){
var options = {
chart: {
renderTo: 'bar_report',
type: 'column'
},
title: {
text: 'Report'
},
xAxis: {
categories: [],
crosshair: true,
title: {
text: 'Names'
}
},
yAxis: {
min: 0,
title: {
text: 'Value'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: []
};
$.getJSON("index.php/Report/role_wise_bar?role="+role+"&category="+category+"&status="+status+"&start="+start_date+"&end="+end_date, function(json) {
options.xAxis.categories = json[0]['data'];
options.series[0] = json[1];
chart = new Highcharts.Chart(options);
});
}
//Chart function - END