1(function ($, Drupal) { 2 $(document).ready(function () { 3 $("#pension-calculator-custom-form .button").click(function (e) { 4 console.log("custompd.js loaded"); 5 e.preventDefault(); 6 // add loader 7 $("#pension-calculator-custom-form").append( 8 '<div class="loader">Loading ....</div>' 9 ); 10 // alert('Button clicked'); 11 12 var dob = $("#edit-pension-date-of-birth").val(); 13 var subscriberSector = $("#edit-pension-sector-type").val(); 14 var schemePreference = $("#edit-pension-scheme").val(); 15 var monthlyContribution = $("#edit-pension-contribute-month").val(); 16 var existingNPSCorpus = $("#pensionCorpus").val(); 17 var annuityPurchase = $("#pensioncustomRange4").val(); 18 19 // ajax call with post method 20 21 // var url = "http://192.168.0.91:8089/excel/getNPSData"; 22 var url = "https://nps.php-staging.com/pension-calculate"; 23 /* var data = { 24 dob: dob, 25 subscriberSector: subscriberSector, 26 schemePreference: schemePreference, 27 monthlyContribution: monthlyContribution, 28 existingNPSCorpus: existingNPSCorpus, 29 annuityPurchase: annuityPurchase 30 }; */ 31 32 var data = { 33 userType: "New", 34 pranDetails: "", 35 dob: "30-07-2005", 36 subscriberSector: "NPS Vatsalya", 37 existingNPSCorpus: "100000", 38 monthlyContribution: "5000", 39 schemePreference: "AC", 40 equity: "50", 41 corporateDebt: "30", 42 governmentBond: "20", 43 alternateAssets: "0", 44 annuityPurchase: "40.00", 45 }; 46 47 $.ajax({
48 url: url, 49 type: "POST", 50 data: data, 51 success: function (response) { 52 console.log("SUCCESS"); 53 console.log(response); 54 var obj = JSON.parse(response); 55 var retirementAge = obj.retirementAge.toString(); 56 var withdrawalAge = obj.withdrawalAge.toString(); 57 var corpusAtRetirement = obj.corpusAtRetirement 58 .toString() 59 .replace(/,/g, ""); 60 $("#edit-pension-corpus-retirement").val(corpusAtRetirement); 61 var totalInvestment = obj.totalInvestment 62 .toString() 63 .replace(/,/g, ""); 64 var totalGain = obj.totalGain.toString().replace(/,/g, ""); 65 var corpusInvestedAnnuity = obj.corpusInvestedAnnuity 66 .toString() 67 .replace(/,/g, ""); 68 var lumpsumAmount = obj.lumpsumAmount.toString().replace(/,/g, ""); 69 var monthlyPensionAtRetirement = obj.monthlyPensionAtRetirement 70 .toString() 71 .replace(/,/g, ""); 72 $("#pensionMonthly").val(monthlyPensionAtRetirement); 73 chrtRightTop(totalInvestment, corpusInvestedAnnuity, totalGain); 74 75 chrtRightBottom(corpusInvestedAnnuity, lumpsumAmount); 76 // remove loader 77 $(".loader").remove(); 78 }, 79 error: function (error) { 80 console.log("ERROR"); 81 console.log(error); 82 // remove loader 83 84 $(".loader").remove(); 85 }, 86 }); 87 }); 88 89 function chrtRightTop(totalinv, totalcorpus_txt, differinv) { 90 var total_inv = "[" + totalinv + "]"; 91 var total_corpus_txt = "[" + totalcorpus_txt + "]"; 92 var differ_inv = "[" + differinv + "]"; 93 var chartData = 94 '[{"name": "Total Investment", "data": ' + 95 total_inv + 96 ', "color": "#c5c8eb"}, {"name": "Total Gain","data": ' + 97 differ_inv + 98 ', "color": "#fab884"}, {"name": "Total Corpus","data": ' + 99 total_corpus_txt + 100 ', "color": "#c1e5a7"}]'; 101 chartData = JSON.parse(chartData); 102 103 // console.log(chartData); 104 105 function formatNumber(value) { 106 return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); 107 } 108 109 Highcharts.chart("status-of-your-pension-account-at-retirement", { 110 chart: { 111 type: "column", 112 width: null, 113 height: "200", 114 }, 115 credits: { 116 enabled: false, 117 }, 118 title: { 119 text: "", 120 }, 121 subtitle: { 122 text: "", 123 }, 124 xAxis: { 125 categories: [""], 126 crosshair: false, 127 }, 128 yAxis: { 129 gridLineWidth: 0, 130 minorGridLineWidth: 0, 131 tickInterval: 45000000, 132 133 min: 0, 134 title: { 135 text: "", 136 }, 137 labels: { 138 formatter: function () { 139 return formatNumber(this.value); // Add commas to y-axis labels 140 }, 141 }, 142 }, 143 exporting: { 144 enabled: false, 145 }, 146 accessibility: { 147 announceNewData: { 148 enabled: true, 149 }, 150 }, 151 tooltip: { 152 headerFormat: 153 '<span style="font-size:10px">{point.key}</span><table>', 154 pointFormat: 155 '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + 156 '<td style="padding:0"><b>â¹ ' + 157 formatNumber("{point.y}") + 158 "</b></td></tr>", 159 footerFormat: "</table>", 160 shared: false, 161 useHTML: true, 162 formatter: function () { 163 return this.series.name + ": <b>â¹ " + formatNumber(this.y) + "</b>"; // Format tooltip value 164 }, 165 }, 166 plotOptions: { 167 series: { 168 column: { 169 pointPadding: 0.2, 170 borderWidth: 0, 171 }, 172 dataLabels: { 173 y: -25, 174 enabled: true, 175 formatter: function () { 176 return "â¹ " + formatNumber(this.y); // Add commas to data labels 177 }, 178 }, 179 }, 180 }, 181 series: chartData, 182 }); 183 } 184 185 function formatIndianNumber(num) { 186 console.log(numStr); 187 var numStr = num.toString(); 188 var lastThree = numStr.slice(-3); 189 var otherNumbers = numStr.slice(0, -3);
190 if (otherNumbers !== "") { 191 lastThree = "," + lastThree; 192 } 193 var result = 194 otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; 195 console.log(result); 196 return result; 197 } 198 function chrtRightBottom(annuity, lumpsum) { 199 // function formatNumber(value) { 200 // return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); 201 // } 202 console.log("chrtRightBottom"); 203 // console.log(annuity); 204 // console.log(lumpsum); 205 var annuityValue = annuity.toString().replace(/,/g, ""); 206 var lumpSumValue = lumpsum.toString().replace(/,/g, ""); 207 // console.log(annuityValue); 208 // console.log(lumpSumValue); 209 var annuityValue = Math.round(annuityValue); 210 var lumpSumValue = Math.round(lumpSumValue); 211 212 var chartData1 = [ 213 { 214 name: "Annuity value", 215 y: annuityValue, 216 color: "#95d8f2", 217 }, 218 { 219 name: "Lump sum value", 220 y: lumpSumValue, 221 color: "#dc86a3", 222 sliced: true, 223 selected: true, 224 }, 225 ]; 226 227 console.log(chartData1); 228 229 Highcharts.setOptions({ 230 lang: { 231 thousandsSep: ",", 232 }, 233 }); 234 235 // Function to format numbers in Indian style 236 237 Highcharts.chart("my-pension-corpus-at-retirement", { 238 chart: {
239 plotBackgroundColor: null, 240 type: "pie", 241 options3d: { 242 enabled: true, 243 alpha: 45, 244 }, 245 height: 200, 246 }, 247 credits: { 248 enabled: false, 249 }, 250 title: { 251 text: "", 252 }, 253 tooltip: { 254 pointFormatter: function() { 255 return this.series.name + ': <b>â¹ ' + formatIndianNumber(this.y) + '</b><br>(' + this.percentage.toFixed(1) + '%)'; 256 }, 257 }, 258 plotOptions: { 259 pie: { 260 allowPointSelect: true, 261 cursor: "pointer", 262 depth: 35, 263 dataLabels: { 264 enabled: true, 265 formatter: function() { 266 return this.point.name + ':<br><b>â¹ ' + formatIndianNumber(this.y) + '</b><br>(' + this.percentage.toFixed(1) + '%)'; 267 }, 268 }, 269 }, 270 }, 271 series: [ 272 { 273 name: "Value", 274 colorByPoint: true, 275 data: chartData1, 276 }, 277 ], 278 exporting: { 279 enabled: false, 280 }, 281 }); 282 } 283 }); 284})(jQuery, Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.