File: /home/cafsindia/crm_cafsindia_com/dist/dashboard_bk.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'
},
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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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,
"ordering": false,
"info": false
});
$('#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() {
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/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() {
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/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,
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/mis_rm_chart", function(json) {
options.series = json;
chart = new Highcharts.Chart(options);
});
}
function crm_chart(){
/*
Highcharts.setOptions({
colors: Highcharts.map(Highcharts.getOptions().colors, function (color) {
return {
radialGradient: {
cx: 0.5,
cy: 0.3,
r: 0.7
},
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
})
});
*/
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);
},
});
}
/*
{
name: 'Appointment',
id: 'Appointment',
data: [
['v11.0', 24.13],
['v8.0', 17.2],
['v9.0', 8.11],
['v10.0', 5.33],
['v6.0', 1.06],
['v7.0', 0.5]
]
}, {
name: 'Follow Up',
id: 'Follow Up',
data: [
['v40.0', 5],
['v41.0', 4.32],
['v42.0', 3.68],
['v39.0', 2.96],
['v36.0', 2.53],
['v43.0', 1.45],
['v31.0', 1.24],
['v35.0', 0.85],
['v38.0', 0.6],
['v32.0', 0.55],
['v37.0', 0.38],
['v33.0', 0.19],
['v34.0', 0.14],
['v30.0', 0.14]
]
}, {
name: 'Dropped',
id: 'Dropped',
data: [
['v35', 2.76],
['v36', 2.32],
['v37', 2.31],
['v34', 1.27],
['v38', 1.02],
['v31', 0.33],
['v33', 0.22],
['v32', 0.15]
]
}, {
name: 'Fixed',
id: 'Fixed',
data: [
['v8.0', 2.56],
['v7.1', 0.77],
['v5.1', 0.42],
['v5.0', 0.3],
['v6.1', 0.29],
['v7.0', 0.26],
['v6.2', 0.17]
]
}, {
name: 'Met',
id: 'Met',
data: [
['v12.x', 0.34],
['v28', 0.24],
['v27', 0.17],
['v29', 0.16]
]
}
*/
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);
});
}
//Chart function - END