Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:58:26

0001 /*

0002 Template Name: Admin Pro Admin

0003 Author: Wrappixel

0004 Email: niravjoshi87@gmail.com

0005 File: js

0006 */
0007 $(function () {
0008     "use strict";
0009     // ============================================================== 

0010     // Newsletter

0011     // ============================================================== 

0012 
0013     function draw_chartist(group_types, group_types_name, chartist_name, labels, num_monthly) {
0014 
0015         $(group_types_name).empty();
0016         $.each(group_types, function(i) {
0017             var new_li = '<li class="ps-3"><h5><i class="fa fa-circle me-1 ';
0018             new_li += 'view_chartist_lable_' + i + '"></i>' + group_types[i]+ '</h5>';
0019             new_li += '</li>';
0020             $(group_types_name).append(new_li);
0021         });
0022 
0023         new Chartist.Line(chartist_name, {
0024             labels: labels,
0025             series: num_monthly
0026             },
0027             {top: 0,
0028              low: 1,
0029              showPoint: true,
0030              fullWidth: true,
0031              plugins: [
0032                  Chartist.plugins.tooltip()
0033              ],
0034             axisY: {
0035                 labelInterpolationFnc: function (value) {
0036                     // return (value / 1) + 'k';

0037                     if (value > 1000000000000000) {
0038                         return (value / 1000000000000000) + 'P';
0039                     } else if (value > 1000000000000) {
0040                         return (value / 1000000000000) + 'T';
0041                     } else if (value > 1000000000) {
0042                         return (value / 1000000000) + 'G';
0043                     } else if (value > 1000000) {
0044                         return (value / 1000000) + 'M';
0045                     } else if (value > 1000) {
0046                         return (value / 1000) + 'K';
0047                     } else {
0048                         return value;
0049                     }
0050                 }
0051             },
0052             showArea: false
0053         });
0054     }
0055 
0056     function draw_chartist1(labels, data, group_types_name, chartist_name, group_types_select) {
0057         var g_types = Object.keys(data);
0058 
0059         var select_option = $(group_types_select + " option").filter(':selected').text();
0060         select_option = $.trim(select_option);
0061 
0062         $(group_types_select).empty();
0063         if (select_option === 'All'){
0064             var all_option = '<option value="All" selected="selected">All</option>';
0065             $(group_types_select).append(all_option);
0066         } else {
0067             var all_option = '<option value="All">All</option>';
0068             $(group_types_select).append(all_option);
0069         }
0070         $.each(g_types, function(i) {
0071             if (select_option === g_types[i]){
0072                 var new_opt = '<option value="' + g_types[i] + '" selected="selected">' + g_types[i] + '</option>';
0073                 $(group_types_select).append(new_opt);
0074             } else {
0075                 var new_opt = '<option value="' + g_types[i] + '">' + g_types[i] + '</option>';
0076                 $(group_types_select).append(new_opt);
0077             }
0078         });
0079 
0080         if (select_option === 'All'){
0081             var num_monthly = Object.keys(data).map(function(key){
0082                 var mnum_monthly_status = Object.keys(data[key]).map(function(key1){
0083                     return data[key][key1];
0084                 });
0085                 return mnum_monthly_status;
0086             });
0087             draw_chartist(g_types, group_types_name, chartist_name, labels, num_monthly);
0088         } else {
0089             var num_monthly = Object.keys(data[select_option]).map(function(key){
0090                 return data[select_option][key];
0091             });
0092             num_monthly = [num_monthly];
0093             draw_chartist([select_option], group_types_name, chartist_name, labels, num_monthly);
0094         }
0095     }
0096 
0097 
0098     function draw_chartist_status(data) {
0099 
0100         // alert(Object.keys(data.month_acc_status.Total));

0101         var labels = Object.keys(data.month_acc_status.Total);
0102         draw_chartist1(labels, data.month_acc_status, '#view_chartist_labels', '#view_chartist', "#view_chartist_labels_select");
0103    }
0104 
0105     var sparklineLogin = function () {
0106         var iddsAPI_request = appConfig.iddsAPI_request;
0107         var iddsAPI_transform = appConfig.iddsAPI_transform;
0108         var iddsAPI_processing = appConfig.iddsAPI_processing;
0109 
0110         $.getJSON(iddsAPI_processing, function(data){
0111             $('#totalprocessings span').text(data.total);
0112             draw_chartist_status(data);
0113 
0114             // alert(Object.keys(data.month_status.Total));

0115             var month_requests = Object.keys(data.month_status.Total).map(function(key){
0116                 return data.month_status.Total[key];
0117             });
0118             // alert(month_requests);

0119             $('#totalprocessingslinedash').sparkline(month_requests, {
0120                 type: 'bar',
0121                 height: '30',
0122                 barWidth: '4',
0123                 resize: true,
0124                 barSpacing: '5',
0125                 barColor: '#7ace4c'
0126             });
0127         });
0128     }
0129 
0130     var sparkResize;
0131     $(window).on("resize", function (e) {
0132         clearTimeout(sparkResize);
0133         sparkResize = setTimeout(sparklineLogin, 500);
0134     });
0135     sparklineLogin();
0136 
0137     $("select").on("change", function() {
0138         // alert( "Handler for .change() called." );

0139         sparklineLogin();
0140     });
0141 
0142 });
0143 
0144