1//***** aic prototype controls by Piter Gavrinev 25.11.2025. v7.6.1 2//need moment.js 3 4function div(className, id) { 5 if (typeof id !== "undefined") { 6 return $("<div class=\"" + className + "\" id=\"" + id + "\" />"); 7 } else { 8 return $("<div class=\"" + className + "\" />"); 9 } 10} 11/** 12 * ÐеÑеклÑÑаÑÐµÐ»Ñ 13 * @param {string} Title 14 */ 15var AIC_Switch = function (Title, isChecked) { 16 var checked = false; 17 if (typeof isChecked !== "undefined") { 18 checked = (isChecked.toString()?.toLowerCase?.() === 'true'); 19 }; 20 21 22 23 this.IsDisable = false; 24 var control_obj = this; 25 this._delegateClickFunction = null; 26 this._rootEl = div("filter filter-switch"); 27 this._rootEl.attr("data-filter", "switch"); 28 this._rootEl.uniqueId(); 29 30 let input = $("<input type=\"checkbox\">"); 31 input.uniqueId(); 32 let label = $("<label class=\"filter_title\" for=\"" + input.prop("id") + "\" title=\"" + Title + "\" />"); 33 let span = $("<div class=\"filter-switch_text\">" + Title + "</div><span class=\"filter-switch_icon\"></span>"); 34 label.append(span); 35 this._rootEl.append(input); 36 this._rootEl.append(label); 37 input.prop('checked', checked); 38 39 input.click(function () { 40 if ($.isFunction(control_obj._delegateClickFunction)) { 41 control_obj._delegateClickFunction($(this).is(":checked")); 42 }; 43 }); 44} 45 46AIC_Switch.prototype.val = function () { 47 return this._rootEl.children("input").is(":checked"); 48}; 49 50AIC_Switch.prototype.Disable = function (IsDisable) { 51 this.IsDisable = IsDisable; 52 if (IsDisable) { 53 this._rootEl.children("input").attr("disabled", "disabled"); 54 } else { 55 this._rootEl.children("input").removeAttr("disabled"); 56 } 57} 58 59AIC_Switch.prototype.click = function (callbackFunction) { 60 this._delegateClickFunction = callbackFunction; 61}; 62 63AIC_Switch.prototype.AppendTo = function (object) { 64 object.append(this._rootEl); 65 this._rootEl.trigger('new-html'); 66 67}; 68 69AIC_Switch.prototype.valueOf = function () { 70 return this._rootEl; 71}; 72 73/** 74 * ÐÑÑппа ÑекбокÑов 75 * @param {string} Title 76 * @param {string} PlaceHolderName 77 * @param {string} SelectButtonName 78 */ 79var AIC_CheckBoxes = function (Title, PlaceHolderName, SelectButtonName) { 80 this.IsDisable = false; 81 this.IsLoadingState = false; 82 this._rootEl = div("filter"); 83 this._rootEl.attr("data-filter", "checkboxes"); 84 this._rootEl.uniqueId(); 85 var control_obj = this; 86 this._delegateClickFunction = null; 87 88 if (typeof PlaceHolderName !== "undefined") { 89 this._rootEl.append($(" <div class=\"filter_placeholder _hide\">" + PlaceHolderName + "</div>")); 90 } 91 92 if (typeof SelectButtonName == "undefined") { 93 SelectButtonName = "ÐÑимениÑÑ"; 94 } 95 96 97 const button = $("<button class=\"filter_title\" type=\"button\" data-filter-title=\"\" title=\"" + Title + "\" >" + Title + "<span class=\"filter_title_counter\" data-filter-counter=\"\"></span></button>"); 98 this._rootEl.append(button); 99 let filter_content = div("filter_content"); 100 filter_content.attr("data-filter-content", ""); 101 let filter_content_top = div("filter_content_top"); 102 let filter_content_close = div("filter_content_close"); 103 filter_content_close.attr("data-filter-close", ""); 104 filter_content_top.append(filter_content_close); 105 filter_content.append(filter_content_top); 106 this._rootEl.append(filter_content); 107 108 this._content = div("filter-checkboxes"); 109 filter_content.append(this._content); 110 111 let filter_checkboxes_bottom = div("filter-checkboxes_bottom"); 112 113 const ApplayButton = $("<button class=\"filter-checkboxes_btn\" type=\"button\" data-filter-btn=\"\">" + SelectButtonName + "</button>"); 114 115 filter_checkboxes_bottom.append(ApplayButton); 116 filter_content.append(filter_checkboxes_bottom); 117 118 119 ApplayButton.click(function () { 120 if (this.IsLoadingState) return; 121 if ($.isFunction(control_obj._delegateClickFunction)) { 122 var RetArray = control_obj.val(); 123 control_obj._delegateClickFunction(RetArray); 124 } 125 });
126 127 128} 129 130AIC_CheckBoxes.prototype.val = function () { 131 var RetArray = []; 132 var inputs = this._content.find("input"); 133 inputs.each(function () { 134 const isChecked = $(this).is(":checked"); 135 const dataId = $(this).data("id"); 136 RetArray.push({ id: dataId, IsChecked: isChecked }); 137 }); 138 return RetArray; 139}; 140 141AIC_CheckBoxes.prototype.Disable = function (IsDisable) { 142 this.IsDisable = IsDisable; 143 if (IsDisable) { 144 this._rootEl.children("button").attr("disabled", "disabled"); 145 } else { 146 this._rootEl.children("button").removeAttr("disabled"); 147 } 148} 149 150 151AIC_CheckBoxes.prototype.SetLoadding = function (IsLoadingState) { 152 this.IsLoadingState = IsLoadingState; 153 if (IsLoadingState) { 154 this._rootEl.children("button").addClass("_loading"); 155 } else { 156 this._rootEl.children("button").removeClass("_loading"); 157 } 158} 159 160 161AIC_CheckBoxes.prototype.click = function (callbackFunction) { 162 this._delegateClickFunction = callbackFunction; 163}; 164 165 166AIC_CheckBoxes.prototype.Clear = function () { 167 this._content.empty(); 168}; 169 170 171AIC_CheckBoxes.prototype.SetCheckBox = function (Id, IsChecked) { 172 var ret = false; 173 var inputs = this._content.find("input"); 174 if (inputs.length > 0) { 175 inputs.each(function () { 176 const dataId = $(this).data("id"); 177 if (dataId == Id) { 178 $(this).prop("checked", IsChecked); 179 ret = true; 180 } 181 }); 182 } 183 return ret; 184} 185 186/** 187 * @param {string} Id 188 * @param {string} Name 189 * @param {boolean} IsChecked 190 */ 191AIC_CheckBoxes.prototype.AddCheckbox = function (Id, Name, IsChecked) { 192 193 if (typeof IsChecked == "undefined") { 194 IsChecked = false; 195 } 196 197 var item = div("filter-checkboxes_item"); 198 var input = $("<input type=\"checkbox\" />"); 199 input.data("id", Id); 200 input.prop("checked", IsChecked); 201 input.uniqueId(); 202 var lbl = $("<label for=\"" + input.attr("id") + "\">" + Name + "</label>"); 203 item.append(input); 204 item.append(lbl); 205 this._content.append(item); 206}; 207 208AIC_CheckBoxes.prototype.AppendTo = function (object) { 209 object.append(this._rootEl); 210 this._rootEl.trigger('new-html'); 211 212}; 213 214AIC_CheckBoxes.prototype.valueOf = function () { 215 return this._rootEl; 216}; 217 218 219 220 221/** 222 * поле поиÑка 223 * @param {boolean} _isEng 224 * @param {string} PlaceHolderName 225 */ 226var AIC_SearchTextField = function (_isEng, PlaceHolderName) { 227 this.IsLoadingState = false; 228 const pls = (typeof PlaceHolderName !== "undefined" ? PlaceHolderName : "ÐоиÑк по ÑазделÑ"); 229 var control_obj = this; 230 this._rootEL = div("search"); 231 232 const sf = div("search_field"); 233 const sf_input = $("<input placeholder=\"" + pls + "\" type=\"text\" value=\"\" />"); 234 sf.append(sf_input); 235 this._rootEL.append(sf); 236 237 const sb = div("search_btn"); 238 const sb_btn = $("<button type=\"button\" class=\"b-btn _blue\">" + (_isEng ? "Search" : "ÐÑкаÑÑ") + "</button>"); 239 240 sf_input.on('keydown', function (e) { 241 if (this.IsLoadingState) return; 242 if (e.keyCode == 13) { 243 e.preventDefault(); 244 if ($.isFunction(control_obj._delegateClickFunction)) { 245 control_obj._delegateClickFunction(sf_input.val()); 246 }; 247 } 248 }); 249 this._rootEL.clickFunction = 250 251 sb_btn.click(function (event) { 252 if (this.IsLoadingState) return; 253 event.preventDefault(); 254 if ($.isFunction(control_obj._delegateClickFunction)) { 255 control_obj._delegateClickFunction(sf_input.val()); 256 }; 257 }); 258 259 sb.append(sb_btn); 260 261 this._rootEL.append(sb); 262 263 264} 265 266AIC_SearchTextField.prototype.val = function (val) { 267 if (val) { 268 this._rootEL.find("input").val(val); 269 } 270 return this._rootEL.find("input").val(); 271}; 272 273AIC_SearchTextField.prototype.click = function (callbackFunction) { 274 this._delegateClickFunction = callbackFunction; 275}; 276 277 278AIC_SearchTextField.prototype.AppendTo = function (object) { 279 object.append(this._rootEL); 280 this._rootEL.trigger('new-html'); 281};
282 283AIC_SearchTextField.prototype.valueOf = function () { 284 return this._rootEL; 285}; 286 287 288AIC_SearchTextField.prototype.SetLoadding = function (IsLoadingState) { 289 this.IsLoadingState = IsLoadingState; 290 if (IsLoadingState) { 291 this._rootEL.find("button").addClass("_loading"); 292 } else { 293 this._rootEL.find("button").removeClass("_loading"); 294 } 295} 296 297 298/** 299 * ÐагинаÑÐ¾Ñ 300 * @param {number} totalPages 301 * @param {boolean} isEng 302 */ 303var AIC_Pager = function (totalPages, isEng) { 304 this._isEng = isEng || false; 305 this._currentObject = null; 306 this._totalPages = totalPages; 307 308 this._rootEl = div("col-md-18 offset-md-4 pagination"); 309 this.SetCurrentPage(0); 310}; 311 312AIC_Pager.prototype.click = function (callbackFunction) { 313 this._delegateClickFunction = callbackFunction; 314}; 315 316/** 317 * УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð²ÑидимоÑÑÑ ÑÑÑаниÑÑ Ð¿Ð¾ номеÑÑ 318 * @param {any} currentPage 319 */ 320AIC_Pager.prototype.SetCurrentPage = function (currentPage) { 321 var control_obj = this; 322 var windowSize = 5; 323 var startpage = Math.floor((currentPage) / windowSize); 324 325 this._rootEl.empty(); 326 327 var starti = (startpage * windowSize); 328 var prevObj = $("<a data-num=\"" + (starti) + "\" class=\"pagination-link _start " + (currentPage < windowSize ? " _disabled" : "") + "\">" + (this._isEng ? "First" : 329 330 "РнаÑало") + "</a>"); 331 if (currentPage >= windowSize) { 332 prevObj.attr("href", "#"); 333 prevObj.click(function (event) { 334 event.preventDefault(); 335 if ($.isFunction(control_obj._delegateClickFunction)) { 336 control_obj._delegateClickFunction(starti - 1); 337 }; 338 }); 339 } 340 341 this._rootEl.append(prevObj); 342 for (var i = starti; (i < starti + windowSize) && i <= this._totalPages; i++) { 343 var pageObj = $("<a data-num=\"" + i + "\" class=\"pagination-num" + (i === currentPage ? " _active" : "") + "\">" + (i + 1) + "</a>"); 344 if (i !== currentPage) pageObj.attr("href", "#"); 345 pageObj.click(function (event) { 346 event.preventDefault(); 347 var num = $(this).data("num"); 348 if ($.isFunction(control_obj._delegateClickFunction)) { 349 control_obj._delegateClickFunction(num); 350 }; 351 }); 352 this._rootEl.append(pageObj); 353 } 354 var endObj = $("<a href=\"#\" data-num=\"" + (starti + windowSize) + "\" class=\"pagination-link" + (currentPage >= (this._totalPages - windowSize) ? " _disabled" : "") + " \">" + (this._isEng ? "next" : "далÑÑе") + "</a>"); 355 356 endObj.click(function (event) { 357 event.preventDefault(); 358 if ($.isFunction(control_obj._delegateClickFunction)) { 359 control_obj._delegateClickFunction(starti + windowSize); 360 }; 361 }); 362 363 this._rootEl.append(endObj); 364 365 if (this._currentObject !== null) { 366 this._currentObject.trigger('new-html'); 367 } 368 369}; 370 371AIC_Pager.prototype.AppendTo = function (object) { 372 373 object.append(this._rootEl); 374 this._currentObject = object; 375 376}; 377 378AIC_Pager.prototype.valueOf = function () { 379 return this._rootEl; 380}; 381 382 383/** 384 * СпиÑок Ñ Ð¿Ð¾Ð´ÑÑовнÑми Ñипа дÑево 385 * @param {boolean} isEng 386 * @param {string} Title 387 * @param {string} AnyThematicName 388 */ 389var AIC_LevelControl = function (isEng, Title, AnyThematicName) { 390 this.IsDisable = false; 391 this.IsLoadingState = false; 392 this._value = null; 393 this._title = null; 394 let lt = this._isEng ? "Show all" : "ÐÑÐ±Ð°Ñ ÑемаÑика"; 395 if (typeof AnyThematicName !== "undefined") lt = AnyThematicName; 396 397 this._defaultThematicName = AnyThematicName; 398 this._isEng = isEng || false; 399 this._rootEl = $("<div class=\"filter\" data-filter=\"select\" />"); 400 this._rootEl.uniqueId(); 401 402 if (typeof Title !== "undefined") this._rootEl.append($("<div class=\"filter_placeholder\">" + Title + "</div>")); 403 this._rootEl.append($("<button class=\"filter_title\" type=\"button\" data-filter-title=\"\">" + lt + " <input type=\"text\"/></button>")); 404 405 var control_container = $("<div class=\"filter_content\" data-filter-content=\"\" />"); 406 control_container.append($("<div class=\"filter_content_top\">" + 407 "<div class=\"filter_content_close\" data-filter-close=\"\"></div>" + 408 "</div>")); 409 410 var _control = $("<div class='filter-select filter-select-with-search'/>"); 411 _control.append($("<div class= \"filter-select_search\">" + 412 "<input type=\"text\" placeholder=\"" + (this._isEng ? "Search" : "ÐоиÑк") + "\" value=\"\" /></div>" + 413 "<div class=\"filter-select_search_empty\"> " + (this._isEng ? "Data not found" : "ÐиÑего не найдено") + "</div>")); 414 control_container.append(_control); 415 416 this._levels = $("<div class='filter-select_options levels'/>"); 417 _control.append(this._levels); 418 419 this._rootEl.append(control_container); 420 if (typeof AnyThematicName !== "undefined") { 421 this.AddLevel(-1, 0, lt); 422 } 423 424}; 425 426AIC_LevelControl.prototype.Disable = function (IsDisable) { 427 this.IsDisable = IsDisable; 428 if (IsDisable) { 429 this._rootEl.children("button").attr("disabled", "disabled"); 430 } else { 431 this._rootEl.children("button").removeAttr("disabled"); 432 } 433} 434 435 436AIC_LevelControl.prototype.SetLoadding = function (IsLoadingState) { 437 this.IsLoadingState = IsLoadingState; 438 if (IsLoadingState) { 439 this._rootEl.children("button").addClass("_loading"); 440 } else { 441 this._rootEl.children("button").removeClass("_loading"); 442 } 443} 444 445 446AIC_LevelControl.prototype.Clear = function () { 447 this._value = null; 448 this._title = null; 449 this._rootEl.children("button").off('click'); 450 this._levels.empty(); 451 452 if (typeof this._defaultThematicName !== "undefined") { 453 this._rootEl.children("button").text(this._defaultThematicName); 454 this._rootEl.children("button").attr("title", this._defaultThematicName); 455 this.AddLevel(-1, 0, this._defaultThematicName); 456 } 457 //this.ReInit(); 458}; 459 460AIC_LevelControl.prototype.ReInit = function () { 461 this._rootEl.trigger('new-html'); 462};
463 464 465AIC_LevelControl.prototype.AppendTo = function (object) { 466 467 object.append(this._rootEl); 468 this._rootEl.trigger('new-html'); 469}; 470 471// register callback 472AIC_LevelControl.prototype.click = function (callbackFunction) { 473 if (this.IsLoadingState) return; 474 this._delegateClickFunction = callbackFunction; 475}; 476 477 478/** 479 * Ðобавление ÑÑÐ¾Ð²Ð½Ñ 480 * @param {string} Id 481 * @param {string} parentId 482 * @param {string} Title 483 * @param {boolean} NotClikable 484 */ 485AIC_LevelControl.prototype.AddLevel = function (Id, parentId, Title, NotClikable) { 486 487 488 var rootId = this._rootEl.attr("id"); 489 var section = $("<div class=\"filter-select_option\" />"); 490 491 if (NotClikable) { 492 var label_control = $("<label class=\"filter-select_options_title\" name=\"filter_" + rootId + "_" + Id + "\" id=\"filter_" + rootId + "_" + Id + "\">" + Title + "</label>"); 493 section.append(label_control); 494 } else { 495 var input_control = $("<input type=\"radio\" name=\"filter_single" + rootId + "\" id=\"filter_" + rootId + "_" + Id + "\" value=\"" + (Id === -1 ? "all" : Id) + "\"/>"); 496 var label_control = $("<label for=\"filter_" + rootId + "_" + Id + "\">" + Title + "</label>"); 497 input_control.data("Id", Id); 498 input_control.data("Title", Title); 499 var control_obj = this; 500 input_control.click(function () { 501 if ($.isFunction(control_obj._delegateClickFunction)) { 502 control_obj._value = $(this).data("Id"); 503 control_obj._title = $(this).data("Title"); 504 control_obj._delegateClickFunction(control_obj._value, control_obj._title); 505 } 506 507 }); 508 section.append(input_control); 509 section.append(label_control); 510 } 511 var ParentElement = this._levels.find("[id='filter_" + rootId + "_" + parentId + "']"); 512 if (ParentElement.length > 0) { 513 514 var childLevel = ParentElement.parent().next(); 515 if (childLevel.attr("class") !== "level") { 516 childLevel = $("<div class='level'/>"); 517 childLevel.append(section); 518 childLevel.insertAfter(ParentElement.parent()); 519 } else { 520 childLevel.append(section); 521 } 522 523 524 } else { 525 526 this._levels.append(section); 527 } 528}; 529 530 531//************************************* 532/** 533 * ÐÑÐ±Ð¾Ñ Ð¿ÐµÑиода Ð¼ÐµÐ¶Ð´Ñ Ð´Ð²ÑÐ¼Ñ Ð³Ð¾Ð´Ð°Ð¼Ð¸ 534 * @param {number} minYear 535 * @param {number} maxYear 536 * @param {boolean} isEng 537 * @param {string} Title 538 */ 539var AIC_YearToYearCalendarControl = function (minYear, maxYear, isEng, Title, YearFrom, YearTo) { 540 var control_obj = this; 541 this.IsLoadingState = false; 542 this.minYearVal = minYear; 543 this.maxYearVal = maxYear; 544 this.fromYear = YearFrom; 545 this.toYear = YearTo; 546 this._isEng = isEng || false; 547 this.IsDisable = false; 548 this.ClickEvent = function () { 549 if (this.IsLoadingState) return; 550 if ($.isFunction(control_obj._delegateClickFunction)) { 551 control_obj.fromYear = fromValueControl.val(); 552 control_obj.toYear = toValueControl.val(); 553 control_obj._delegateClickFunction(fromValueControl.val(), toValueControl.val()); 554 } 555 } 556 this._rootEl = $("<div class=\"filter\" />"); 557 var datepiker = $("<div class=\"datepicker-filter\" data-yearpicker-period-filter data-min-date=\"" + minYear + "\" data-max-date=\"" + maxYear + "\" />"); 558 559 if (typeof Title !== "undefined") { 560 datepiker.append($(" <div class=\"datepicker-filter_placeholder\">" + Title + "</div>")); 561 } 562 563 var fromValueControl = $("<input class=\"datepicker-filter_input-from\" type=\"hidden\" />"); 564 var toValueControl = $("<input class=\"datepicker-filter_input-to\" type=\"hidden\" />"); 565 566 if (typeof YearFrom !== "undefined") { 567 fromValueControl.val(YearFrom); 568 }; 569 if (typeof YearTo !== "undefined") { 570 toValueControl.val(YearTo); 571 } 572 datepiker.append(fromValueControl); 573 datepiker.append(toValueControl); 574 datepiker.append($("<button class=\"datepicker-filter_button\" type=\"button\">" + (this._isEng ? (YearFrom + " Year - " + YearTo + " Year") : (YearFrom + " Ðод - " + YearTo + " Ðод")) + "</button>")); 575 576 var modal = $(" <div class=\"datepicker-filter_modal\" />"); 577 modal.append($("<div class=\"datepicker-filter_head\"><div class=\"datepicker-filter_close\"></div></div>")); 578 modal.append($("<div class=\"datepicker-filter_tabs\"><div class=\"datepicker-filter_tab-from\"></div> - <div class=\"datepicker-filter_tab-to\"></div></div>")); 579 580 modal.append($("<div class=\"datepicker-filter_body\">" + 581 " <div class=\"datepicker-filter_datepicker-from yearpicker-custom\"></div>" + 582 " <div class=\"datepicker-filter_datepicker-to yearpicker-custom\"></div>" + 583 "</div>")); 584 var footer = $("<div class=\"datepicker-filter_footer\" />"); 585 var button = $("<button class=\"datepicker-filter_apply-btn\" type=\"button\">" + (this._isEng ? "Apply" : "ÐÑимениÑÑ") + "</button>"); 586 button.click(this.ClickEvent); 587 footer.append(button); 588 modal.append(footer); 589 datepiker.append(modal); 590 this._rootEl.append(datepiker); 591};
592 593AIC_YearToYearCalendarControl.prototype.Disable = function (IsDisable) { 594 this.IsDisable = IsDisable; 595 if (IsDisable) { 596 this._rootEl.find("button, input").attr("disabled", "disabled"); 597 } else { 598 this._rootEl.find("button, input").removeAttr("disabled"); 599 } 600}; 601 602AIC_YearToYearCalendarControl.prototype.SetLoadding = function (IsLoadingState) { 603 this.IsLoadingState = IsLoadingState; 604 if (IsLoadingState) { 605 this._rootEl.children("button").addClass("_loading"); 606 } else { 607 this._rootEl.children("button").removeClass("_loading"); 608 } 609} 610 611 612AIC_YearToYearCalendarControl.prototype.click = function (callbackFunction) { 613 this._delegateClickFunction = callbackFunction; 614}; 615 616AIC_YearToYearCalendarControl.prototype.AppendTo = function (object) { 617 618 object.append(this._rootEl); 619 this._rootEl.trigger('new-html'); 620 var button = this._rootEl.find("button.datepicker-filter_apply-btn"); 621 button.click(this.ClickEvent); 622}; 623 624AIC_YearToYearCalendarControl.prototype.Remove = function () { 625 this._rootEl.Remove(); 626}; 627 628AIC_YearToYearCalendarControl.prototype.SetYears = function (YearFrom, YearTo) { 629 this._rootEl.find(".datepicker-filter_input-from").val(YearFrom); 630 this._rootEl.find(".datepicker-filter_input-to").val(YearTo); 631 this.fromYear = YearFrom; 632 this.toYear = YearTo; 633}; 634 635 636AIC_YearToYearCalendarControl.prototype.SetMxMinYears = function (YearFrom, YearTo) { 637 this._rootEl.children(".datepicker-filter").attr("data-min-date", YearFrom); 638 this._rootEl.children(".datepicker-filter").data("min-date", YearFrom); 639 this._rootEl.children(".datepicker-filter").attr("data-max-date", YearTo); 640 this._rootEl.children(".datepicker-filter").data("max-date", YearTo); 641 this.minYearVal = YearFrom; 642 this.maxYearVal = YearTo; 643} 644 645 646 647 648 649AIC_YearToYearCalendarControl.prototype.ReInit = function () { 650 this._rootEl.children(".datepicker-filter").removeClass("_changed"); 651 this._rootEl.find(".datepicker-filter_datepicker-from").empty(); 652 this._rootEl.find(".datepicker-filter_datepicker-to").empty(); 653 this._rootEl.trigger('new-html'); 654 var button = this._rootEl.find("button.datepicker-filter_apply-btn"); 655 button.click(this.ClickEvent); 656}; 657 658 659/** 660 * вÑÐ±Ð¾Ñ Ð¸Ð· ÑпиÑка 661 * var someTheme = IsEng ? "Any theme" : "ÐÑÐ±Ð°Ñ Ñема"; 662 * @param {string} someTheme 663 * @param {string} Title 664 * @param {boolean} WithSearch 665 * @param {boolean} IsEng 666 */ 667var AIC_ListControl = function (someTheme, Title, WithSearch, IsEng) { 668 this._value = null; 669 this._title = null; 670 this.IsDisable = false; 671 this._isEng = IsEng || false; 672 this._WithSearch = WithSearch || false; 673 var control_obj = this; 674 this._delegateClickFunction = null; 675 this._rootEl = $("<div class=\"filter\" data-filter=\"select\" />"); 676 this._rootEl.uniqueId(); 677 var rootId = this._rootEl.attr("id"); 678 679 if (typeof Title !== "undefined") { 680 this._rootEl.append($(" <div class=\"datepicker-filter_placeholder\">" + Title + "</div>")); 681 } 682 this._rootEl.append($("<button class=\"filter_title\" type=\"button\" data-filter-title=\"\" >" + someTheme + "</button>")); 683 var filter_content = $("<div class=\"filter_content\" data-filter-content=\"\" />"); 684 filter_content.append($("<div class=\"filter_content_top\"><div class=\"filter_content_close\" data-filter-close=\"\"></div></div>")); 685 686 687 this.selector = div("filter-select_options"); 688 var all_option_el = $("<div class=\"filter-select_option\" />"); 689 var ch_radio_all = $("<input type=\"radio\" name=\"filter_single" + rootId + "\" id=\"filter_1_1" + rootId + "\" checked=\"\" value=\"1\" />"); 690 all_option_el.append(ch_radio_all); 691 ch_radio_all.click(function () { 692 if ($.isFunction(control_obj._delegateClickFunction)) { 693 control_obj._value = null; 694 control_obj._title = null; 695 control_obj._delegateClickFunction(-1); 696 } 697 }); 698 699 700 all_option_el.append($("<label for=\"filter_1_1" + rootId + "\">" + someTheme + "</label>")); 701 this.selector.append(all_option_el); 702 // загÑÑжаем вÑе ÑÐµÐ¼Ñ 703 704 var filter_select = div("filter-select"); 705 if (this._WithSearch) { 706 filter_select = div("filter-select filter-select-with-search"); 707 var fss = div("filter-select_search"); 708 fss.append($("<input type=\"text\" placeholder=\"" + (this._isEng ? "Search" : "ÐоиÑк") + "\" value=\"\" />")); 709 filter_select.append(fss); 710 var fsse = div("filter-select_search_empty"); 711 fsse.text(this._isEng ? "Data not found" : "ÐиÑего не найдено"); 712 filter_select.append(fsse); 713 } 714 715 filter_select.append(this.selector); 716 filter_content.append(filter_select); 717 this._rootEl.append(filter_content); 718 719}; 720 721AIC_ListControl.prototype.AppendTo = function (object) { 722 object.append(this._rootEl); 723 this._rootEl.trigger('new-html'); 724};
725 726 727AIC_ListControl.prototype.click = function (callbackFunction) { 728 this._delegateClickFunction = callbackFunction; 729}; 730 731AIC_ListControl.prototype.Clear = function () { 732 this.selector.empty(); 733}; 734 735AIC_ListControl.prototype.ReInit = function () { 736 this._rootEl.trigger('new-html'); 737}; 738 739 740 741AIC_ListControl.prototype.Disable = function (IsDisable) { 742 this.IsDisable = IsDisable; 743 if (IsDisable) { 744 this._rootEl.find("button, input").attr("disabled", "disabled"); 745 } else { 746 this._rootEl.find("button, input").removeAttr("disabled"); 747 } 748}; 749 750AIC_ListControl.prototype.AddOption = function (Id, Title, isSelected) { 751 var control_obj = this; 752 var rootId = this._rootEl.attr("id"); 753 var option_el = $("<div class=\"filter-select_option\" />"); 754 var ch_radio = $("<input type=\"radio\" name=\"filter_single" + rootId + "\" id=\"filter_" + rootId + Id + "\" value=\"" + Id + "\" />"); 755 ch_radio.click(function (noClick) { 756 var CurrentThemaID = $(this).val(); 757 var title = $(this).parent().children("label").text(); 758 if (noClick === true) return; 759 if ($.isFunction(control_obj._delegateClickFunction)) { 760 control_obj._value = CurrentThemaID; 761 control_obj._title = title; 762 control_obj._delegateClickFunction(CurrentThemaID, title); 763 } 764 }); 765 option_el.append(ch_radio); 766 option_el.append($("<label for=\"filter_" + rootId + Id + "\">" + Title + "</label>")); 767 this.selector.append(option_el); 768 if (isSelected === true) { 769 ch_radio.click(); 770 } 771}; 772 773 774 775 776/** 777 * ÐÑÐ±Ð¾Ñ Ð´Ð¸Ð°Ð¿Ð°Ð·Ð¾Ð½Ð° Ð¼ÐµÐ¶Ð´Ñ Ð´Ð²ÑÐ¼Ñ Ð´Ð°Ñами календаÑÑми 778 * @param {boolean} IsEng 779 */ 780var AIC_TwoDateControl = function (IsEng, minDate, maxDate, currentDateF, currentDateT) { 781 782 783 784 785 this._from_date_val = currentDateF ? moment(currentDateF).format("DD.MM.YYYY") : ''; 786 this._to_date_val = currentDateT ? moment(currentDateT).format("DD.MM.YYYY") : ''; 787 this._minDate_val = minDate ? moment(minDate).format("DD.MM.YYYY") : ''; 788 this._maxDate_val = maxDate ? moment(maxDate).format("DD.MM.YYYY") : ''; 789 this.IsDisable = false; 790 this.IsLoadingState = false; 791 this._isEng = IsEng || false; 792 var control_obj = this; 793 this._delegateClickFunction = null; 794 795 this._rootEl = $("<div class=\"filter\" />"); 796 var root_control = $(" <div class=\"datepicker-filter\" data-datepicker-period-filter=\"data-datepicker-period-filter\"" + 797 "data-min-date=\"\"" + 798 "data-max-date=\"\"" + 799 "data-default-value-from=\"\"" + 800 "data-default-value-to=\"\">"); 801 802 803 804 root_control.data("min-date", this._minDate_val); 805 root_control.data("max-date", this._maxDate_val); 806 root_control.data("default-value-from", this._from_date_val); 807 root_control.data("default-value-to", this._to_date_val); 808 809 810 this.control_from = $("<input class=\"datepicker-filter_input-from\" type=\"hidden\" />"); 811 if (this._from_date_val!='') this.control_from.val(this._from_date_val); 812 this.control_to = $("<input class=\"datepicker-filter_input-to\" type=\"hidden\" />"); 813 if (this._to_date_val != '') this.control_to.val(this._to_date_val); 814 this.control_from.uniqueId(); 815 this.control_from.attr("name", "datepicker-from-" + this.control_from[0].id); 816 this.control_to.uniqueId(); 817 this.control_to.attr("name", "datepicker-to-" + this.control_to[0].id); 818 819 var vontrol_button = $("<button class=\"datepicker-filter_button\" type=\"button\">" + (this._isEng ? "DD.ÐMM.YYYY — DD.MM.YYYY" : "ÐÐ.ÐÐ.ÐÐÐÐ — ÐÐ.ÐÐ.ÐÐÐÐ") + "</button>"); 820 root_control.append(this.control_from); 821 root_control.append(this.control_to); 822 root_control.append(vontrol_button); 823 824 825 826 var filter_modal = div("datepicker-filter_modal"); 827 828 var fhead = div("datepicker-filter_head"); 829 fhead.append(div("datepicker-filter_close")); 830 filter_modal.append(fhead); 831 832 var ftabs = div("datepicker-filter_tabs"); 833 ftabs.append($("<div class=\"datepicker-filter_tab-from\"></div> - <div class=\"datepicker-filter_tab-to\"></div>")); 834 filter_modal.append(ftabs); 835 836 837 if (this._from_date_val!='' && this._to_date_val!='') { 838 vontrol_button.html(this._from_date_val + " — " + this._to_date_val); 839 root_control.addClass("_changed"); 840 841 } 842 843 var fbody = div("datepicker-filter_body"); 844 fbody.append(div("datepicker-filter_datepicker-from datepicker-custom")); 845 fbody.append(div("datepicker-filter_datepicker-to datepicker-custom")); 846 filter_modal.append(fbody); 847 848 var footer = $("<div class=\"datepicker-filter_footer _right\" />"); 849 var resetButton = $("<button class=\"datepicker-filter_clear-btn\" type=\"button\">" + (this._isEng ? "Reset" : "СбÑоÑиÑÑ") + "</button>"); 850 resetButton.uniqueId(); 851 var applyButton = $(" <button class=\"datepicker-filter_apply-btn\" type=\"button\">" + (this._isEng ? "Apply" : "ÐÑимениÑÑ") + "</button>"); 852 applyButton.uniqueId(); 853 854 this._rootEl.applyClickFunction = function () { 855 if (this.IsLoadingState) return; 856 from_date_val = moment(control_obj.control_from.val(), "DD.MM.YYYY").format("YYYY-MM-DD"); 857 to_date_val = moment(control_obj.control_to.val(), "DD.MM.YYYY").format("YYYY-MM-DD"); 858 if ($.isFunction(control_obj._delegateClickFunction)) { 859 control_obj._from_date_val = from_date_val; 860 control_obj._to_date_val = to_date_val; 861 control_obj._delegateClickFunction(from_date_val, to_date_val); 862 } 863 864 }; 865 866 applyButton.click(this._rootEl.applyClickFunction); 867 868 869 this._rootEl.resetClickFunction = function () { 870 if ($.isFunction(control_obj._delegateClickFunction)) { 871 control_obj._from_date_val = null; 872 control_obj._to_date_val = null; 873 control_obj._delegateClickFunction(null, null); 874 } 875 }; 876 resetButton.click(this._rootEl.resetClickFunction); 877 878 879 footer.append(resetButton); 880 footer.append(applyButton); 881 filter_modal.append(footer); 882 root_control.append(filter_modal); 883 884 this.UpdateDatapicker = function (controlId, SETdateFrom, SETdateTo, currentDate) { 885 886 $(controlId).data('datepickerElement').datepicker("option", "maxDate", moment(SETdateTo).toDate()); 887 $(controlId).data('datepickerElement').datepicker("option", "minDate", moment(SETdateFrom).toDate()); 888 if (currentDate) { 889 $(controlId).data('datepickerElement').datepicker("option", "setDate", moment(currentDate).toDate()); 890 $(controlId).val(moment(currentDate).format("DD.MM.YYYY"));
891 } 892 893 }; 894 895 this._rootEl.append(root_control); 896}; 897 898 899AIC_TwoDateControl.prototype.Disable = function (IsDisable) { 900 this.IsDisable = IsDisable; 901 if (IsDisable) { 902 this._rootEl.find("button.datepicker-filter_button").attr("disabled", "disabled"); 903 } else { 904 this._rootEl.find("button.datepicker-filter_button").removeAttr("disabled"); 905 } 906}; 907 908 909AIC_TwoDateControl.prototype.SetLoadding = function (IsLoadingState) { 910 this.IsLoadingState = IsLoadingState; 911 if (IsLoadingState) { 912 this._rootEl.children("button.datepicker-filter_button").addClass("_loading"); 913 } else { 914 this._rootEl.children("button.datepicker-filter_button").removeClass("_loading"); 915 } 916} 917 918 919/** 920 * 921 * @param {string} minDate даÑа наÑала 922 * @param {string} maxDate даÑа конÑа пеÑиода 923 * @param {string} currentDate ÑÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð²ÑбÑаннÑÑ Ð´Ð°ÑÑ Ð² календаÑе 924 */ 925AIC_TwoDateControl.prototype.SetDatesRange = function (minDate, maxDate, currentDateF, currentDateT) { 926 var cd_f = currentDateF || maxDate; 927 var cd_t = currentDateT || maxDate; 928 929 if (currentDateF && currentDateT) { 930 var _fd_str = moment(currentDateF).format("DD.MM.YYYY"); 931 var _td_str = moment(currentDateT).format("DD.MM.YYYY"); 932 this._rootEl.find("button.datepicker-filter_button").text(_fd_str + ' - ' + _td_str); 933 this._rootEl.find("div.datepicker-filter").prop("data-default-value-from", _fd_str); 934 this._rootEl.find("div.datepicker-filter").prop("data-default-value-to", _td_str); 935 936 var _tabs = this._rootEl.find("div.datepicker-filter_tabs"); 937 _tabs.children("div.datepicker-filter_tab-from").text(_fd_str); 938 _tabs.children("div.datepicker-filter_tab-to").text(_fd_str); 939 940 } 941 942 this.UpdateDatapicker(this.control_from, minDate, maxDate, cd_f, this._isEng); 943 this.UpdateDatapicker(this.control_to, minDate, maxDate, cd_t, this._isEng); 944}; 945 946AIC_TwoDateControl.prototype.AppendTo = function (object) { 947 object.append(this._rootEl); 948 this._rootEl.trigger('new-html'); 949 this._rootEl.find("button.datepicker-filter_apply-btn").click(this._rootEl.applyClickFunction); 950 this._rootEl.find("button.datepicker-filter_clear-btn").click(this._rootEl.resetClickFunction); 951 952}; 953 954 955AIC_TwoDateControl.prototype.click = function (callbackFunction) { 956 this._delegateClickFunction = callbackFunction; 957}; 958 959AIC_TwoDateControl.prototype.valueOf = function () { 960 return this._rootEl; 961}; 962 963//------------- AIC dates choise control EXT ------ 964 965/** 966 * ÐÑÐ±Ð¾Ñ Ð´Ð¸Ð°Ð¿Ð°Ð·Ð¾Ð½Ð° Ð¼ÐµÐ¶Ð´Ñ Ð´Ð²ÑÐ¼Ñ Ð´Ð°Ñами календаÑÑми (Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑÑ Ð²ÑбоÑа за вÑе вÑемÑ) 967 * @param {any} IsEng 968 * @param {any} Title 969 */ 970var AIC_TwoDateControlEXT = function (IsEng, Title, minDate, maxDate, currentDateF, currentDateT) { 971 this._from_date_val = currentDateF; 972 this._to_date_val = currentDateT; 973 this._minDate_val = minDate; 974 this._maxDate_val = maxDate; 975 976 this.IsDisable = false; 977 this._isEng = IsEng || false; 978 var control_obj = this; 979 this._delegateSubcontrolClickFunction = null; 980 981 this._rootEl = $('<div class="filter-select-with-date" data-select-with-date=""/>'); 982 var filter_el = $('<div class="filter" data-filter="select"/>'); 983 if (typeof Title !== "undefined") { 984 filter_el.append($(" <div class=\"datepicker-filter_placeholder\">" + Title + "</div>")); 985 } 986 987 filter_el.append($('<button class="filter_title" type="button" data-filter-title="" title="' + (this._isEng ? 'Show all' : 'Ðа вÑе вÑемÑ') + '">' + (this._isEng ? 'Show all' : 'Ðа вÑе вÑемÑ') + '</button>')); 988 var subc = $('<div class="filter_content" data-filter-content="" style="display: none;"/>'); 989 subc.append($('<div class="filter_content_top"><div class="filter_content_close" data-filter-close=""></div></div >')); 990 var filter_select = $('<div class="filter-select"/>'); 991 var fo = $('<div class="filter-select_option"/>'); 992 var reset_button = $('<input type="radio" checked="" value="1"/>'); 993 reset_button.uniqueId(); 994 reset_button.attr("name", 'nm_' + reset_button.attr('id')); 995 996 fo.append(reset_button); 997 fo.append($(' <label for="' + reset_button.attr('id') + '">' + (this._isEng ? 'Show all' : ' Ðа вÑе вÑемÑ') + '</label>')); 998 filter_select.append(fo); 999 1000 var filter_select_option = div("filter-select_option"); 1001 var inp = $('<input type="radio" value="4" data-select-date=""/>'); 1002 inp.uniqueId(); 1003 1004 inp.attr("name", 'nm_' + reset_button.attr('id')); 1005 1006 1007 var lbl = $('<label for="' + inp.attr('id') + '">
1007' + (this._isEng ? 'Choose period' : 'ÐÑбÑаÑÑ Ð¿ÐµÑиод') + '</label>'); 1008 filter_select_option.append(lbl); 1009 filter_select_option.append(inp); 1010 filter_select.append(filter_select_option); 1011 subc.append(filter_select); 1012 filter_el.append(subc); 1013 1014 this._rootEl.append(filter_el); 1015 this.DatesControl = new AIC_TwoDateControl(IsEng, minDate, maxDate, currentDateF, currentDateT); 1016 1017 1018 this._rootEl.DatesControlClickFunction = function (fdate, tdate) { 1019 if ($.isFunction(control_obj._delegateSubcontrolClickFunction)) { 1020 control_obj._from_date_val = fdate; 1021 control_obj._to_date_val = tdate; 1022 control_obj._delegateSubcontrolClickFunction(fdate, tdate); 1023 } 1024 }; 1025 1026 this.DatesControl.click(this._rootEl.DatesControlClickFunction); 1027 this._rootEl.append(this.DatesControl._rootEl); 1028 1029} 1030 1031 1032 1033AIC_TwoDateControlEXT.prototype.click = function (callbackFunction) { 1034 this._delegateSubcontrolClickFunction = callbackFunction; 1035}; 1036 1037AIC_TwoDateControlEXT.prototype.AppendTo = function (object) { 1038 object.append(this._rootEl); 1039 this._rootEl.trigger('new-html'); 1040 this.DatesControl._rootEl.find("button.datepicker-filter_apply-btn").click(this.DatesControl._rootEl.applyClickFunction); 1041 this.DatesControl._rootEl.find("button.datepicker-filter_clear-btn").click(this.DatesControl._rootEl.resetClickFunction); 1042 this.DatesControl.click(this._rootEl.DatesControlClickFunction); 1043 1044 if (this._from_date_val && this._to_date_val) { 1045 this._rootEl.children(".filter").trigger("select-date", [null, true]); 1046 } 1047 1048}; 1049 1050AIC_TwoDateControlEXT.prototype.valueOf = function () { 1051 return this._rootEl; 1052}; 1053 1054AIC_TwoDateControlEXT.prototype.SetDatesRange = function (minDate, maxDate, currentDateFrom, currentDateTo) { 1055 1056 this.DatesControl.SetDatesRange(minDate, maxDate, currentDateFrom, currentDateTo); 1057 1058 if (currentDateFrom && currentDateTo) { 1059 this._rootEl.children(".filter").trigger("select-date", [null, true]); 1060 } 1061 1062 1063}; 1064 1065 1066//************************ AIC Two Quartal choise control *************************** 1067// 1068/** 1069 * ÐÑÐ±Ð¾Ñ Ð´Ð¸Ð°Ð¿Ð°Ð·Ð¾Ð½Ð° Ð¼ÐµÐ¶Ð´Ñ Ð´Ð²ÑÐ¼Ñ ÐºÐ²Ð°ÑÑалами 1070 * @param {string} minQDate 1071 * @param {string} maxQDate 1072 * @param {boolean} IsEng 1073 * @param {string} Title 1074 */ 1075var AIC_TwoQuartalDateControl = function (minQDate, maxQDate, IsEng, Title) { 1076 this._from_date_val = null; 1077 this._to_date_val = null; 1078 this._isEng = IsEng || false; 1079 var control_obj = this; 1080 this._delegateClickFunction = null; 1081 1082 this._rootEl = div("filter"); 1083 this.filter_el = $('<div class="datepicker-filter" data-quarterpicker-period-filter="data-quarterpicker-period-filter" data-min-date="' + moment(minQDate).format('MM.YYYY') + '" data-max-date="' + moment(maxQDate).format('MM.YYYY') + '" />'); 1084 this.filter_el.data("min-date", moment(minQDate).format('MM.YYYY')); 1085 this.filter_el.data("max-date", moment(maxQDate).format('MM.YYYY')); 1086 1087 if (typeof Title !== "undefined") { 1088 this.filter_el.append($(" <div class=\"datepicker-filter_placeholder\">" + Title + "</div>")); 1089 } 1090 this.control_from = $('<input class="datepicker-filter_input-from" type="hidden" name="quarterpicker-10-from" />'); 1091 this.filter_el.append(this.control_from); 1092 this.control_to = $('<input class="datepicker-filter_input-to" type="hidden" name="quarterpicker-10-to" />'); 1093 this.filter_el.append(this.control_to); 1094 1095 this.filter_el.append($('<button class="datepicker-filter_button" type="button">' + (this._isEng ? "QQ.YYYY — QQ.YYYY" : "ÐваÑÑал Ðод — ÐваÑÑал Ðод") + '</button>')); 1096 1097 1098 1099 var filter_modal = div("datepicker-filter_modal"); 1100 filter_modal.append(div("datepicker-filter_head").append(div("datepicker-filter_close"))); 1101 var tabs = div("datepicker-filter_tabs"); 1102 tabs.append($("<div class=\"datepicker-filter_tab-from\"></div> - <div class=\"datepicker-filter_tab-to\"></div>")); 1103 filter_modal.append(tabs); 1104 var body = div("datepicker-filter_body"); 1105 body.append(div("datepicker-filter_datepicker-from quarterpicker-custom")); 1106 body.append(div("datepicker-filter_datepicker-to quarterpicker-custom")); 1107 filter_modal.append(body); 1108 var footer = div("datepicker-filter_footer _right"); 1109 var resetButton = $("<button class=\"datepicker-filter_clear-btn\" type=\"button\">" + (this._isEng ? "Reset" : "СбÑоÑиÑÑ") + "</button>"); 1110 var applyButton = $(" <button class=\"datepicker-filter_apply-btn\" type=\"button\">" + (this._isEng ? "Apply" : "ÐÑимениÑÑ") + "</button>"); 1111 1112 this._rootEl.applyClickFunction = function () { 1113 from_date_val = moment(control_obj.control_from.val(), "MM.YYYY").format("YYYY-MM-DD"); 1114 to_date_val = moment(control_obj.control_to.val(), "MM.YYYY").format("YYYY-MM-DD"); 1115 if ($.isFunction(control_obj._delegateClickFunction)) { 1116 control_obj._from_date_val = from_date_val; 1117 control_obj._to_date_val = to_date_val; 1118 control_obj._delegateClickFunction(from_date_val, to_date_val); 1119 } 1120 1121 } 1122 1123 applyButton.click(this._rootEl.applyClickFunction); 1124 1125 1126 this._rootEl.resetClickFunction = function () { 1127 if ($.isFunction(control_obj._delegateClickFunction)) { 1128 control_obj._from_date_val = null; 1129 control_obj._to_date_val = null; 1130 control_obj._delegateClickFunction(null, null); 1131 } 1132 }; 1133 resetButton.click(this._rootEl.resetClickFunction); 1134 1135 1136 footer.append(resetButton); 1137 footer.append(applyButton); 1138 filter_modal.append(footer); 1139 this.filter_el.append(filter_modal); 1140 1141 this._rootEl.append(this.filter_el); 1142} 1143 1144AIC_TwoQuartalDateControl.prototype.SetDatesRange = function (minDate, maxDate) { 1145 1146 this.control_from.val(moment(minDate).format("MM.YYYY"));
1147 this.control_to.val(moment(maxDate).format("MM.YYYY")); 1148 1149}; 1150 1151AIC_TwoQuartalDateControl.prototype.AppendTo = function (object) { 1152 object.append(this._rootEl); 1153 this._rootEl.trigger('new-html'); 1154 this._rootEl.find("button.datepicker-filter_apply-btn").click(this._rootEl.applyClickFunction); 1155 this._rootEl.find("button.datepicker-filter_clear-btn").click(this._rootEl.resetClickFunction); 1156 1157}; 1158 1159 1160AIC_TwoQuartalDateControl.prototype.click = function (callbackFunction) { 1161 this._delegateClickFunction = callbackFunction; 1162}; 1163 1164AIC_TwoQuartalDateControl.prototype.valueOf = function () { 1165 return this._rootEl; 1166};
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.