1"use strict"; 2var numberOfReportinCart = 0; 3var productList=[]; 4var addCart=true; 5var selectedOption=[]; 6var globalNewRef; 7var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 9function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } 10 11function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12 13var SelectPure = function () { 14 "use strict"; 15 var t = { value: "data-value", disabled: "data-disabled", class: "class", type: "type" }; 16 var e = function () { 17 function e(t) { 18 var _e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 19 20 var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 21 22 _classCallCheck(this, e); 23 24 return this._node = t instanceof HTMLElement ? t : document.createElement(t), this._config = { i18n: s }, this._setAttributes(_e), _e.textContent && this._setTextContent(_e.textContent), this; 25 } 26 27 _createClass(e, [{ 28 key: "get", 29 value: function get() { 30 return this._node; 31 } 32 }, { 33 key: "append", 34 value: function append(t) { 35 return this._node.appendChild(t), this; 36 } 37 }, { 38 key: "addClass", 39 value: function addClass(t) { 40 return this._node.classList.add(t), this; 41 } 42 }, { 43 key: "removeClass", 44 value: function removeClass(t) { 45 return this._node.classList.remove(t), this; 46 } 47 }, { 48 key: "toggleClass", 49 value: function toggleClass(t) { 50 return this._node.classList.toggle(t), this; 51 } 52 }, { 53 key: "addEventListener", 54 value: function addEventListener(t, e) { 55 return this._node.addEventListener(t, e), this; 56 } 57 }, { 58 key: "removeEventListener", 59 value: function removeEventListener(t, e) { 60 return this._node.removeEventListener(t, e), this; 61 } 62 }, { 63 key: "setText", 64 value: function setText(t) { 65 return this._setTextContent(t), this; 66 } 67 }, { 68 key: "getHeight", 69 value: function getHeight() { 70 return window.getComputedStyle(this._node).height; 71 } 72 }, { 73 key: "setTop", 74 value: function setTop(t) { 75 return this._node.style.top = t + "px", this; 76 } 77 }, { 78 key: "focus", 79 value: function focus() { 80 return this._node.focus(), this; 81 } 82 }, { 83 key: "_setTextContent", 84 value: function _setTextContent(t) { 85 this._node.textContent = t; 86 } 87 }, { 88 key: "_setAttributes", 89 value: function _setAttributes(e) { 90 for (var _s in e) { 91 t[_s] && e[_s] && this._setAttribute(t[_s], e[_s]); 92 } 93 } 94 }, { 95 key: "_setAttribute", 96 value: function _setAttribute(t, e) { 97 this._node.setAttribute(t, e); 98 } 99 }]); 100 101 return e; 102 }(); 103 104 var s = Object.assign || function (t) { 105 for (var e = 1; e < arguments.length; e++) { 106 var s = arguments[e];for (var i in s) { 107 Object.prototype.hasOwnProperty.call(s, i) && (t[i] = s[i]); 108 } 109 }return t; 110 };return function () { 111 function _class(t, i) { 112 _classCallCheck(this, _class); 113 114 this._config = s({}, i), this._state = { opened: !1 }, this._icons = [], this._boundHandleClick = this._handleClick.bind(this), this._boundUnselectOption = this._unselectOption.bind(this), this._boundSortOptions = this._sortOptions.bind(this), this._body = new e(document.body), this._create(t), this._setValue(); 115 } 116 117 _createClass(_class, [{ 118 key: "_create", 119 value: function _create(t) { 120 var s = "string" == typeof t ? document.querySelector(t) : t;this._parent = new e(s), this._select = new e("div", { class: "select-pure__select" }), this._label = new e("span", { class: "select-pure__label" }), this._optionsWrapper = new e("div", { class: "select-pure__options" }), this._config.multiple && this._select.addClass("select-pure__select--multiple"), this._options = this._generateOptions(), this._select.addEventListener("click", this._boundHandleClick), this._select.append(this._label.get()), this._select.append(this._optionsWrapper.get()), this._parent.append(this._select.get()); 121 } 122 }, { 123 key: "_generateOptions", 124 value: function _generateOptions() { 125 var _this = this; 126 127 return this._config.autocomplete && (this._autocomplete = new e("input", { class: "select-pure__autocomplete", type: "text" }), this._autocomplete.addEventListener("input", this._boundSortOptions), this._optionsWrapper.append(this._autocomplete.get())), this._config.options.map(function (t) { 128 var s = new e("div", { class: "select-pure__option", value: t.value, textContent: t.label, disabled: t.disabled });return _this._optionsWrapper.append(s.get()), s; 129 }); 130 } 131 }, { 132 key: "_handleClick", 133 value: function _handleClick(t) { 134 var newRef=this; 135 globalNewRef=this; 136 if (t.stopPropagation(), "select-pure__autocomplete" !== t.target.className) { 137 if (this._state.opened && localStorage.getItem("maxCapValue")===null) { 138 if(t.target.getAttribute('data-value') != null){ 139 var dataValue=t.target.getAttribute('data-value').split(","); 140 var dataInfo=t.target.getAttribute('data-value'); 141 var fd = new FormData(); 142 fd.append('companyCode',dataValue[1]); 143 $('.loader-page-icon-brochure-download').show(); 144 $.ajax({
145 url : '/bin/crisil/insertCrrProductServlet', 146 type : 'POST', 147 contentType : false, 148 processData : false, 149 data : fd, 150 success : function(response) { 151 $('.loader-page-icon-brochure-download').hide(); 152 if(response == 1 || response == 2) 153 { 154 $('.lbContent .form-error-msg').remove(''); 155 $('.lbContent .form-success-msg').remove(''); 156 var htmlErrorText = ''; 157 htmlErrorText += '<div class="form-error-msg">'; 158 htmlErrorText += '<h3><span class="errorIcon"></span></span>Error</h3>'; 159 htmlErrorText += '<p> Unable to Add to the Cart.</p>'; 160 htmlErrorText += '</div>'; 161 formReset(); 162 $('.lbContent').append(htmlErrorText); 163 lightboxbtn(); 164 var _e2 = newRef._options.find(function (e) { 165 return e.get() === undefined; 166 });return _e2 && newRef._setValue(_e2.get().getAttribute("data-value"), !0), newRef._select.removeClass("select-pure__select--opened"), newRef._body.removeEventListener("click", newRef._boundHandleClick), newRef._select.addEventListener("click", newRef._boundHandleClick), void (newRef._state.opened = !1); 167 168 $('.loader-page-icon-brochure-download').hide(); 169 170 } else if(response == 0){ 171 $('#selectedReportList').append('<li industryId="'+currentIndustryId+'">'+dataValue[4]+'<span id="'+dataValue[0]+'" detailsInfo="'+dataInfo+'"></span></li>'); 172 var productId="CRR_"+dataValue[0]; 173 productList.push(productId); 174 var totalBaseAmount=0; 175 numberOfReportinCart=$('#selectedReportList li').size(); 176 repBasePrice=parseInt($('#maxCapValue').val()); 177 selectedOption.push(t.target); 178 if(repBasePrice && numberOfReportinCart>0){ 179 $.ajax({
180 url : '/bin/crisil/calculateTotalPrice', 181 type : 'GET', 182 dataType : "JSON", 183 contentType : "application/json", 184 data : { 185 'totalBaseAmount' : totalBaseAmount, 186 'numberOfReports' : numberOfReportinCart 187 }, 188 success : function(response) { 189 if(response) 190 { 191 removeData(); 192 $('#totalPrice').append('<b>Total Amount: â¹ '+response.totalPrice+'</b>') 193 $('#basePrice').html('Base Price: â¹ '+response.basePrice); 194 $('#gstAmount').html('GST: â¹ '+response.gstAmount); 195 $('#discount').html('Disounts: â¹ '+response.discountAmount); 196 } 197 var _e2 = newRef._options.find(function (e) { 198 return e.get() === t.target; 199 });return _e2 && newRef._setValue(_e2.get().getAttribute("data-value"), !0), newRef._select.removeClass("select-pure__select--opened"), newRef._body.removeEventListener("click", newRef._boundHandleClick), newRef._select.addEventListener("click", newRef._boundHandleClick), void (newRef._state.opened = !1); 200 201 $('.loader-page-icon-brochure-download').hide(); 202 } 203 }); 204 }else{ 205 removeData(); 206 $('#totalPrice').append('<b>Total Amount: â¹ 0</b>') 207 $('#basePrice').html('Base Price: â¹ 0'); 208 $('#discount').html('Disounts: â¹ 0'); 209 $('#gstAmount').html('GST: â¹ 0'); 210 } 211 } else{ 212 $('.lbContent .form-error-msg').remove(''); 213 $('.lbContent .form-success-msg').remove(''); 214 var htmlErrorText = ''; 215 htmlErrorText += '<div class="form-error-msg">'; 216 htmlErrorText += '<h3><span class="errorIcon"></span></span>Error</h3>'; 217 htmlErrorText += '<p> Unable to Add to the Cart.</p>'; 218 htmlErrorText += '</div>'; 219 formReset(); 220 $('.lbContent').append(htmlErrorText); 221 lightboxbtn(); 222 var _e2 = newRef._options.find(function (e) { 223 return e.get() === undefined; 224 });return _e2 && newRef._setValue(_e2.get().getAttribute("data-value"), !0), newRef._select.removeClass("select-pure__select--opened"), newRef._body.removeEventListener("click", newRef._boundHandleClick), newRef._select.addEventListener("click", newRef._boundHandleClick), void (newRef._state.opened = !1); 225 226 $('.loader-page-icon-brochure-download').hide(); 227 } 228 }, 229 error: function(response){ 230 $('.loader-page-icon-brochure-download').hide(); 231 console.log("Something went wrong"); 232 } 233 }); 234 }else{ 235 var _e2 = this._options.find(function (e) { 236 return e.get() === undefined; 237 });return _e2 && this._setValue(_e2.get().getAttribute("data-value"), !0), this._select.removeClass("select-pure__select--opened"), this._body.removeEventListener("click", this._boundHandleClick), this._select.addEventListener("click", this._boundHandleClick), void (this._state.opened = !1); 238 } 239 }else if(this._state.opened && localStorage.getItem("maxCapValue")!==null){ 240 var _e2 = this._options.find(function (e) { 241 return e.get() === undefined; 242 });return _e2 && this._setValue(_e2.get().getAttribute("data-value"), !0), this._select.removeClass("select-pure__select--opened"), this._body.removeEventListener("click", this._boundHandleClick), this._select.addEventListener("click", this._boundHandleClick), void (this._state.opened = !1); 243 }t.target.className !== this._config.icon && (this._select.addClass("select-pure__select--opened"), this._body.addEventListener("click", this._boundHandleClick), this._select.removeEventListener("click", this._boundHandleClick), this._state.opened = !0, this._autocomplete && this._autocomplete.focus()); 244 } 245 } 246 }, { 247 key: "_setValue", 248 value: function _setValue(t, e, s) { 249 var _this2 = this; 250 251 if (t && !s && (this._config.value = this._config.multiple ? this._config.value.concat(t) : t), t && s && (this._config.value = t), this._options.forEach(function (t) { 252 t.removeClass("select-pure__option--selected"); 253 }), this._config.multiple) { 254 var _t = this._config.value.map(function (t) { 255 var e = _this2._config.options.find(function (e) { 256 return e.value === t; 257 });return _this2._options.find(function (t) { 258 return t.get().getAttribute("data-value") === e.value.toString(); 259 }).addClass("select-pure__option--selected"), e; 260 });return void this._selectOptions(_t, e); 261 }var i = this._config.value ? this._config.options.find(function (t) { 262 return t.value.toString() === _this2._config.value; 263 }) : this._config.options[0];this._options.find(function (t) { 264 return t.get().getAttribute("data-value") === i.value.toString(); 265 }).addClass("select-pure__option--selected"), this._selectOption(i, e); 266 } 267 },{ 268 key: "_selectOption", 269 value: function _selectOption(t, e) { 270 this._selectedOption = t, this._label.setText(t.label), this._config.onChange && e && this._config.onChange(t.value); 271 } 272 }, { 273 key: "_selectOptions", 274 value: function _selectOptions(t, s) { 275 var _this3 = this; 276 277 this._label.setText(""), this._icons = t.map(function (t) { 278 var s = new e("span", { class: "select-pure__selected-label", textContent: t.label }), 279 i = new e("i", { class: _this3._config.icon, value: t.value });return i.addEventListener("click", _this3._boundUnselectOption), s.append(i.get()), _this3._label.append(s.get()), i.get(); 280 }), s && this._optionsWrapper.setTop(Number(this._select.getHeight().split("px")[0]) + 5), this._config.onChange && s && this._config.onChange(this._config.value); 281 } 282 }, { 283 key: "_unselectOption", 284 value: function _unselectOption(t) { 285 for(var i=0;i<selectedOption.length;i++){
286 var dataDetails=selectedOption[i]; 287 if(dataDetails.getAttribute("data-value")===t.target.getAttribute("data-value")){ 288 var dataDetailsIndex=selectedOption.indexOf(selectedOption[i]); 289 if(dataDetailsIndex > -1){ 290 selectedOption.splice(dataDetailsIndex, 1); 291 } 292 } 293 } 294 localStorage.removeItem('maxCapValue'); 295 var numberOfReportinCart = 0; 296 var dataValue = t.target.getAttribute("data-value"); 297 $('#selectedReportList li').each(function() { 298 if (t.target.getAttribute("id") !== "cgblrRepot") { 299 var dataInfo = $(this).find('span').attr('detailsInfo'); 300 if (dataValue == dataInfo) { 301 var productDetails = dataInfo.split(","); 302 var productId = "CRR_" + productDetails[0] 303 var index = productList.indexOf(productId); 304 if (index > -1) { 305 productList.splice(index, 1); 306 } 307 $(this).remove(); 308 } 309 } 310 }); 311 var totalBaseAmount = 0; 312 numberOfReportinCart = $('#selectedReportList li').size(); 313 repBasePrice = parseInt($('#maxCapValue').val()); 314 if (repBasePrice && numberOfReportinCart > 0) { 315 $('.loader-page-icon-brochure-download').show(); 316 $.ajax({
317 url: '/bin/crisil/calculateTotalPrice', 318 type: 'GET', 319 dataType: "JSON", 320 contentType: "application/json", 321 data: { 322 'totalBaseAmount': totalBaseAmount, 323 'numberOfReports': numberOfReportinCart 324 }, 325 success: function(response) { 326 if (response) { 327 removeData(); 328 $('#totalPrice').append('<b>Total Amount: â¹ ' + response.totalPrice + '</b>') 329 $('#basePrice').html('Base Price: â¹ ' + response.basePrice); 330 $('#gstAmount').html('GST: â¹ ' + response.gstAmount); 331 $('#discount').html('Disounts: â¹ ' + response.discountAmount); 332 $('.loader-page-icon-brochure-download').hide(); 333 } 334 } 335 }); 336 } else { 337 removeData(); 338 $('#totalPrice').append('<b>Total Amount: â¹ 0</b>') 339 $('#basePrice').html('Base Price: â¹ 0'); 340 $('#discount').html('Disounts: â¹ 0'); 341 $('#gstAmount').html('GST: â¹ 0'); 342 } 343 var e = [].concat(_toConsumableArray(this._config.value)), 344 s = e.indexOf(t.target.getAttribute("data-value"));-1 !== s && e.splice(s, 1), this._setValue(e, !0, !0); 345 } 346 }, { 347 key: "_sortOptions", 348 value: function _sortOptions(t) { 349 this._options.forEach(function (e) { 350 e.get().textContent.toLowerCase().startsWith(t.target.value.toLowerCase()) ? e.removeClass("select-pure__option--hidden") : e.addClass("select-pure__option--hidden"); 351 }); 352 } 353 }]); 354 355 return _class; 356 }(); 357}();
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.