diff --git a/templates/client/accounts/feed.html b/templates/client/accounts/feed.html index 65cd841f..b68a6bb0 100644 --- a/templates/client/accounts/feed.html +++ b/templates/client/accounts/feed.html @@ -74,94 +74,98 @@ + + {% include 'includes/exposition/exposition_list.html' with object_list=object_list %} {% include 'includes/catalog_paginator.html' with page_obj=page_obj %} -{% endblock %} -{% block scripts %} - - - - + + + - filter: { - wrapperId:'"events-filter-wrap"', - bodyId:'events-filter', - buttonId:'filter-show-button' +{% endblock %} - }, - modal:{ - id:'filter-modal', - wrapClass:'search-modal-wrap', - size:{ - 'filter-pwSubj':{ - width:640, - height:514 - }, - 'filter-pwPlace':{ - width:640, - height:460 - } - } - } - }); - -{% endblock %} diff --git a/templates/client/popups/period.html b/templates/client/popups/period.html index 38832e76..4d7e1ba5 100644 --- a/templates/client/popups/period.html +++ b/templates/client/popups/period.html @@ -7,11 +7,11 @@
-
+
{{ search_form.fr }}
-
+
{{ search_form.to }}
diff --git a/templates/client/static_client/css/main.css b/templates/client/static_client/css/main.css index 05504c4d..b14d71e3 100644 --- a/templates/client/static_client/css/main.css +++ b/templates/client/static_client/css/main.css @@ -11112,18 +11112,9 @@ hr + .rq-note { @media only screen and (min-width: 1260px) { - /*.page-wrap > header .logo, - .page-wrap .layout .layout-wrap aside { - width: 21%; - } - - .page-wrap .layout.mp-announces .layout-wrap .mcl { - width: 73.1%; - }*/ .header-body .header-top { - padding-right: 510 - px; + padding-right: 510px; } .header-body .header-top .ht-main { @@ -11608,7 +11599,7 @@ hr + .rq-note { .map_info_block { width: 100%;font-family: 'dindisplay_pro', sans-serif;} -.map_info_block tr th { text-align: left; vertical-align: top; width: 15%; font-weight: 500px; color: #a2a2a2; font-size: 14px; padding: 9px 0 0 0;} +.map_info_block tr th { text-align: left; vertical-align: top; width: 15%; font-weight: 500; color: #a2a2a2; font-size: 14px; padding: 9px 0 0 0;} .map_info_block tr td { text-align: left; vertical-align: top; border-bottom: 1px dotted #ccc; padding: 8px 0; font-size: 16px; color: #424242; font-weight: 500;} .map_info_block tr td.width_1 { width: 35%;} .map_info_block tr td p { padding: 1px 0; margin: 0 0 0 0;} @@ -12128,8 +12119,6 @@ hr + .rq-note { color: #ff6600; } .events-filter .col{ - /*width: 48%;*/ - /*float: left;*/ margin-left: 2%; -moz-box-sizing: border-box; box-sizing: border-box; @@ -12258,6 +12247,11 @@ hr + .rq-note { .in-search-form .clear-all-button:active, .search-form-wrap .clear-all-button:active{ background-position: -385px -89px; } + .in-search-form .pw-period .pwf-field.err input{ + border-width: 2px; + border-color: #D80000; + } + /******************************\ # form validation \******************************/ diff --git a/templates/client/static_client/js/_modules/block.search.js b/templates/client/static_client/js/_modules/block.search.js index 24e6becc..93ac7402 100644 --- a/templates/client/static_client/js/_modules/block.search.js +++ b/templates/client/static_client/js/_modules/block.search.js @@ -1626,24 +1626,33 @@ if (EXPO.searchBlock){ thatVal, thatValInt, bfr; - if(itId == self.opt.dateFrom){ - thatId = $dateTo[0].getAttribute('id'); - thatVal = $dateTo[0].value; - }else { - thatId = $dateFrom[0].getAttribute('id'); - thatVal = $dateFrom[0].value; - } - thatValInt = Date.parse(thatVal); - if(thatValInt > itValInt && thatValInt != 0 && thatValInt){ - bfr = document.getElementById(itId).value; - document.getElementById(itId).value = document.getElementById(thatId).value; - document.getElementById(thatId).value = bfr; - }else if(thatValInt < itValInt && thatValInt != 0 && thatValInt){ - bfr = document.getElementById(thatId).value; - document.getElementById(thatId).value = document.getElementById(itId).value; - document.getElementById(itId).value = bfr; - } + /** + * check if it is a valid date + */ + if (self.validate()){ + $(it).parent('.pwf-field').removeClass('err'); + if(itId == self.opt.dateFrom){ + thatId = $dateTo[0].getAttribute('id'); + thatVal = $dateTo[0].value; + }else { + thatId = $dateFrom[0].getAttribute('id'); + thatVal = $dateFrom[0].value; + } + thatValInt = Date.parse(thatVal); + /** + * swap values between date fields + */ + if(thatValInt > itValInt && thatValInt != 0 && thatValInt){ + bfr = document.getElementById(itId).value; + document.getElementById(itId).value = document.getElementById(thatId).value; + document.getElementById(thatId).value = bfr; + }else if(thatValInt < itValInt && thatValInt != 0 && thatValInt){ + bfr = document.getElementById(thatId).value; + document.getElementById(thatId).value = document.getElementById(itId).value; + document.getElementById(itId).value = bfr; + } + } }; this.$dateFrom = $dateFrom; @@ -1711,6 +1720,37 @@ if (EXPO.searchBlock){ this.$dateTo.val(''); this.$modalTrigger.text(this.$modalTrigger.attr('data-default')); + }, + /** + * checks input fields to have valid date values, if not - adds err class to its container + * @returns {boolean} + */ + validate: function () { + var toVal = this.$dateTo.val(), + fromVal = this.$dateFrom.val(), + toValArr = toVal.split('.'), + fromValArr = fromVal.split('.'), + timestamps =[], + validationResult = true; + timestamps[0] = Date.parse(toValArr[1]+'.'+toValArr[0]+'.'+toValArr[2]); + timestamps[1] = Date.parse(fromValArr[1]+'.'+fromValArr[0]+'.'+fromValArr[2]); + + if (!timestamps[0] && $.trim(toVal) != ''){ + this.$dateTo.parent('.pwf-field').addClass('err'); + validationResult = false; + }else{ + this.$dateTo.parent('.pwf-field').removeClass('err'); + } + + if (!timestamps[1] && $.trim(fromVal) != ''){ + this.$dateFrom.parent('.pwf-field').addClass('err'); + validationResult = false; + }else{ + this.$dateFrom.parent('.pwf-field').removeClass('err'); + + } + return validationResult; + }, applyHandler: function (it) { } @@ -1970,10 +2010,7 @@ if (EXPO.searchBlock){ if ( item.cat != currentCategory && item.cat) { ul.append( "
  • " + item.cat + "
  • " ); currentCategory = item.cat; - }/*else if(item.url){ - ul.append( "
  • " + item.label + "
  • " ); - - }*/ + } that._renderItemData( ul, item ); }); } @@ -2059,8 +2096,11 @@ if (EXPO.searchBlock){ this.modalWindow = new common.Modal(self.settings.modal); this.periodModal.applyHandler = function () { - $waiter.show(); - $(self.DOMform).submit(); + if(this.validate()){ + $waiter.show(); + $(self.DOMform).submit(); + } + }; this.placesModal.applyHandler = function () { $waiter.show(); @@ -2079,6 +2119,7 @@ if (EXPO.searchBlock){ self.modalWindow.open(); return false; }); + // заполнение полей предыдущими значениями $(function () { if(self.previousSearch){ diff --git a/templates/client/static_client/js_min/_modules/block.search.min.js b/templates/client/static_client/js_min/_modules/block.search.min.js index e92efbb6..cf064854 100644 --- a/templates/client/static_client/js_min/_modules/block.search.min.js +++ b/templates/client/static_client/js_min/_modules/block.search.min.js @@ -1 +1 @@ -var EXPO=EXPO||{};EXPO.searchBlock?console.warn("WARNING: EXPO.searchBlock is already defined!"):EXPO.searchBlock=function(){var e={};e.settings={place:{id:"pw-place",selectedItemTemplate:"csb-selected",ajaxUrl:"http://hit.expomap.ru/search-form/"},subject:{id:"pw-subj",ajaxUrl:"http://hit.expomap.ru/search-form/"}},e.lang={};var t=EXPO.common,i=function(e){var t=Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&");return"?"+t},n=function(e,t,i){e||(e=""),$.ajax({type:"GET",url:t,data:e,success:function(e){return"function"!=typeof i?e:void i(e)}})},a=function(e,t,i){return e.hasOwnProperty(t)&&(e[i]=e[t]),this},s=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},l=function(e,t){var i=$("#"+e),n="",a=EXPO.searchBlock.settings.closerText,s=EXPO.searchBlock.settings.closerTextSingle,l="";return $element=i.find(".csbs-text"),$element.length>2?$element.eq(0).text().length2&&d?(n({term:t,form:o},l.opt.autoCompleteUrl,u),d=!1):0!=t.length||d||l.$inputFilter.hasClass("ui-autocomplete-input")&&(l.$inputFilter.autocomplete("destroy"),d=!0),!1}).click(function(){return!1})},_renderSublist:function(e,t,i){var n=this,a=0,s=t+"-sub",l=function(e){if(e.length){for(n.sublist[s]={},a;aT;T++)for(o=_[T],w=0;x>w;w++)o==C[w]&&D(a[w]);for(T=0;y>T;T++)o=_[T],o==S&&D(i)}else for(T=0;y>T;T++)o=_[T],o==S&&D(S)},D=function(e){var t=e.getAttribute("id");i._destroyTag(t),O()},M=function(e){var a=t.closest(e,n),s=a.querySelector("."+u),l=s.innerHTML,r=e.getAttribute("id"),o={id:r,text:l};i._addTag(r,o),O()},O=function(){o.find("."+h).length&&"~~id~~"!=o.find("."+h)[0].getAttribute(m)?o.addClass("visible"):o.removeClass("visible")},P=function(){var t=$(k).children("li").children("."+e).find("."+l+":checked");t.each(function(){M(this)})},q=function(){var t=$(k).children("li").children("."+e).find("."+l+":checked");t.each(function(){D(this)})};this.checked?(B()?(S(this),w(this),A(v),M(v),q(k),v.getAttribute("id")!=_.getAttribute("id")||_.checked||(w(_),A(_),M(_))):(w(this),A(this),M(this)),b&&y(this),b&&"~~id~~"!=$(b).find("."+l)[0].value&&A(this)):(F()?(T(this),I(this),A(v),D(v),P(k),_.checked&&(I(_),A(_),D(_))):(I(this),A(this),D(this)),b&&(x(this),A(this))),p()}),$(".csbs-del",o).on("click",function(){var e=$(this).attr("data-checkbox-id"),t=$("#"+e);return t.prop("checked",!1),t.trigger("change"),dna.destroy(i.itemsSelected[e]),o.children(".dna-clone").length||o.removeClass("visible"),!1}),$(".clear",a).on("click",function(){return i.resetList(),!1}),$(".q-sel a",a).on("click",function(){var e=$(this),t=e.attr("data-name"),a=e.attr("data-id"),s={name:t,id:a},l=function(e){i._loadParentTree(e,function(){i._checkCheckBox(a)})};return n(s,i.opt.getParentUrl,l),!1}),$("."+h,a).on("click",function(){return i.applyHandler(this),!1}),d.siblings("."+i.opt.clearAllButtonClass).on("click",function(){i.resetList()})})};c.prototype={_getAjax:function(e,t){var i=this;e||(e=""),$.ajax({type:"GET",url:i.opt.ajaxUrl,data:e,success:function(e){return"function"!=typeof t?(i.rawData=e,e):(i.rawData=e,void t(e))}})},_renderSublist:function(e,t,i){var n=this,a=0,s=t+"-sub",l=function(e){if(e.length){for(n.curDNA[s]={},a;a2&&o?(n({term:t,form:l},s.opt.autoCompleteUrl,d),o=!1):0!=t.length||o||s.$inputFilter.hasClass("ui-autocomplete-input")&&(s.$inputFilter.autocomplete("destroy"),o=!0),!1}).click(function(){return!1})},_loadParentTree:function(e,t,i){var n,a,l,o,c=this,d=e,h=$("#id_"+d.id),u=function(e){var n=$("#id_"+d.id),h=function(){r.hide(),i||0===i?t(i):t()};r.hide(),n.length&&s(c.curDNA[a+"-sub"])==e&&(l={name:d.name,id:d.id},r.show(),o=$("#id_"+d.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderNested(l,h,o,d.id))},p=function(){r.hide(),i||0===i?t(i):t()};r.show(),d.hasOwnProperty("parent")?h.length?(l={name:d.name,id:d.id},o=h.closest(".level").children(".trigger").attr("data-template-id"),c._renderNested(l,function(){r.hide(),t()},o,d.id)):(n={name:d.parent.name,id:d.parent.id},a=$("#id_"+d.parent.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderSublist(n,a,u)):(n={name:d.name,id:d.id},a=$("#id_"+d.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderSublist(n,a,p))},applyHandler:function(){}};var d=function(e){this.opt=e;var t=this,i=$("#"+t.opt.dateFrom),n=$("#"+t.opt.dateTo),a=$("#"+t.opt.id),s=$("#"+t.opt.modalTrigger),l=t.opt.applyBtnClass,r=function(){var e="",t=s.data("lng-to"),a=s.data("lng-from"),l=$.trim(n.val()),r=$.trim(i.val());return""!=l&&""!=r?e=a+": "+r+" "+t+": "+l+".":""!=l&&""==r?e=t+": "+l+".":""==l&&""!=r&&(e=a+": "+r+"."),e},o=function(e){""!=e?(s.text(e).siblings(".trigger-label").addClass("hidden"),s.siblings("."+t.opt.clearAllButtonClass).addClass("active")):(s.text(s.data("default")).siblings(".trigger-label").removeClass("hidden"),s.siblings("."+t.opt.clearAllButtonClass).removeClass("active"))},c=function(e){var a,s,l,r,o=e.getAttribute("id"),c=e.value,d=Date.parse(c);o==t.opt.dateFrom?(a=n[0].getAttribute("id"),s=n[0].value):(a=i[0].getAttribute("id"),s=i[0].value),l=Date.parse(s),l>d&&0!=l&&l?(r=document.getElementById(o).value,document.getElementById(o).value=document.getElementById(a).value,document.getElementById(a).value=r):d>l&&0!=l&&l&&(r=document.getElementById(a).value,document.getElementById(a).value=document.getElementById(o).value,document.getElementById(o).value=r)};this.$dateFrom=i,this.$dateTo=n,this.$modalTrigger=s,$(function(){$.datepicker.setDefaults($.datepicker.regional.ru),i.datepicker({dateFormat:"dd.mm.yy",showOn:"button",showOtherMonths:!0,constrainInput:!0,onClose:function(e){n.datepicker("option","minDate",e)}}).inputmask("99.99.9999",{showMaskOnHover:!1,oncomplete:function(){c(this)}}),n.datepicker({dateFormat:"dd.mm.yy",showOn:"button",showOtherMonths:!0,constrainInput:!0,onClose:function(e){i.datepicker("option","maxDate",e)}}).inputmask("99.99.9999",{showMaskOnHover:!1,oncomplete:function(){c(this)}}),$('input[type="text"]',a).on("change",function(){var e=r();o(e)}),$("."+l,a).on("click",function(){return t.applyHandler(this),!1}),s.siblings("."+t.opt.clearAllButtonClass).on("click",function(){$(this).removeClass("active"),t.resetList()})})};d.prototype={resetList:function(){this.$dateFrom.val(""),this.$dateTo.val(""),this.$modalTrigger.text(this.$modalTrigger.attr("data-default"))},applyHandler:function(){}};var h=function(e){this.opt=e,this.opt.anyChar=!1;var i=this,s=!0;this.$field=$("#"+i.opt.id),this.DOMcompleteWrap=document.getElementById(i.opt.autoCompleteWrapId),this.afterClear,this.rawData={items:[],set:function(e){this.items=e,this._rawDataChange()},get:function(){return this.items},_rawDataChange:function(){var e,t=this;for(e=0;e2?n(a,i.opt.autoCompleteUrl,function(e){i.$field.hasClass("ui-autocomplete-input")&&i.$field[i.completeName]("destroy"),i.rawData.set(e),i._initAutoComplete(),i.showList("")}):0===text.length&&i.$field.hasClass("ui-autocomplete-input")&&(i.$field[i.completeName]("destroy"),t.removeClass(i.DOMcompleteWrap,"full-visible"),i._resetmodals(i.afterClear)):text.length>2&&s?(n(a,i.opt.autoCompleteUrl,function(e){i.rawData.set(e),i._initAutoComplete(),i.showList("")}),s=!1):0!=text.length||s?i.$field.hasClass("ui-autocomplete-input")&&i.showList(text):i.$field.hasClass("ui-autocomplete-input")&&(i.$field[i.completeName]("destroy"),t.removeClass(i.DOMcompleteWrap,"full-visible"),i._resetmodals(i.afterClear),s=!0),!1}).click(function(){return!1})};return h.prototype={_initAutoComplete:function(){var e=this;e.$field[e.completeName]({source:e.rawData.get(),minLength:0,appendTo:e.DOMcompleteWrap,select:function(t,i){e._afterSelect(t,i)},close:function(){t.removeClass(e.DOMcompleteWrap,"full-visible")},open:function(){t.addClass(e.DOMcompleteWrap,"full-visible")}})},_afterSelect:function(e,t){var i=this;e.preventDefault(),t.item.url?window.location=t.item.url:t.item.label.length&&(i.$field[0].value=t.item.label,i.selectCheckBoxes(t.item.id,t.item.name))},_resetmodals:function(e){return e?void e():0},selectHandler:function(){},selectCheckBoxes:function(){},showList:function(e){self=this,this.$field[self.completeName]("search",e)},pullData:function(){}},e.init=function(e){$.extend(this.lang,e.lang),e.lang=null,$.extend(this.settings,e);var i=this,a=function(){$(i.DOMform).find('input[name="~~name~~"]').remove()};"None"!=this.settings.searchData&&this.settings.searchData&&(this.previousSearch=JSON.parse(this.settings.searchData)),this.DOMform=document.getElementById(this.settings.formId),$(this.DOMform).on("submit",function(){a()}),$.widget("custom.exibitionComplete",$.ui.autocomplete,{_renderMenu:function(e,t){var i=this,n="";$.each(t,function(t,a){a.cat!=n&&a.cat&&(e.append("
  • "+a.cat+"
  • "),n=a.cat),i._renderItemData(e,a)})}}),this.exhibitionField=new h(i.settings.firstField),this.exhibitionField.completeName="exibitionComplete",this.exhibitionField.opt.anyChar=!0,this.placesModal=new c(i.settings.place),this.subjModal=new o(i.settings.subject),this.periodModal=new d(i.settings.period),this.exhibitionField.selectCheckBoxes=function(e,t){var i,a,s=this,l=t;"th"==t?i=document.getElementById(s.opt.prefix+e):"tg"==t&&(i=document.getElementById(s.opt.prefixInner+e),l="th"),r.show(),i?(r.hide(),$(i).prop("checked",!0),$(i).trigger("change")):(a={name:t,id:e},n(a,EXPO.searchBlock.subjModal.opt.getParentUrl,function(i){EXPO.searchBlock.subjModal._loadParentTree(i,function(){EXPO.searchBlock.subjModal._checkCheckBox(e,t)})}))},this.placesField=new h(i.settings.placeField),this.placesField.dataForm=EXPO.searchBlock.placesModal.$inputFilter.attr("data-form"),this.placesField.selectCheckBoxes=function(e,t){var i,a,s=this;i=document.getElementById(s.opt.prefix+e),i?(r.hide(),$(i).prop("checked",!0),$(i).trigger("change")):(a={name:t,id:e},n(a,EXPO.searchBlock.placesModal.opt.getParentUrl,function(i){EXPO.searchBlock.placesModal._loadParentTree(i,function(){EXPO.searchBlock.placesModal._checkCheckBox(e,t)})}))},this.exhibitionField.afterClear=function(){i.subjModal.resetList()},this.placesField.afterClear=function(){i.placesModal.resetList()},this.modalWindow=new t.Modal(i.settings.modal),this.periodModal.applyHandler=function(){r.show(),$(i.DOMform).submit()},this.placesModal.applyHandler=function(){r.show(),$(i.DOMform).submit()},this.subjModal.applyHandler=function(){r.show(),$(i.DOMform).submit()},$("."+i.settings.modalTriggerClass).on("click",function(e){return e.preventDefault(),i.modalWindow.pullData(this.getAttribute("href")),i.modalWindow.open(),!1}),$(function(){if(i.previousSearch)for(var e=0;e2?$element.eq(0).text().length2&&d?(n({term:t,form:o},l.opt.autoCompleteUrl,u),d=!1):0!=t.length||d||l.$inputFilter.hasClass("ui-autocomplete-input")&&(l.$inputFilter.autocomplete("destroy"),d=!0),!1}).click(function(){return!1})},_renderSublist:function(e,t,i){var n=this,a=0,s=t+"-sub",l=function(e){if(e.length){for(n.sublist[s]={},a;aT;T++)for(o=_[T],w=0;x>w;w++)o==C[w]&&A(a[w]);for(T=0;y>T;T++)o=_[T],o==S&&A(i)}else for(T=0;y>T;T++)o=_[T],o==S&&A(S)},A=function(e){var t=e.getAttribute("id");i._destroyTag(t),O()},M=function(e){var a=t.closest(e,n),s=a.querySelector("."+u),l=s.innerHTML,r=e.getAttribute("id"),o={id:r,text:l};i._addTag(r,o),O()},O=function(){o.find("."+h).length&&"~~id~~"!=o.find("."+h)[0].getAttribute(m)?o.addClass("visible"):o.removeClass("visible")},P=function(){var t=$(k).children("li").children("."+e).find("."+l+":checked");t.each(function(){M(this)})},q=function(){var t=$(k).children("li").children("."+e).find("."+l+":checked");t.each(function(){A(this)})};this.checked?(B()?(S(this),w(this),D(v),M(v),q(k),v.getAttribute("id")!=_.getAttribute("id")||_.checked||(w(_),D(_),M(_))):(w(this),D(this),M(this)),b&&y(this),b&&"~~id~~"!=$(b).find("."+l)[0].value&&D(this)):(F()?(T(this),I(this),D(v),A(v),P(k),_.checked&&(I(_),D(_),A(_))):(I(this),D(this),A(this)),b&&(x(this),D(this))),p()}),$(".csbs-del",o).on("click",function(){var e=$(this).attr("data-checkbox-id"),t=$("#"+e);return t.prop("checked",!1),t.trigger("change"),dna.destroy(i.itemsSelected[e]),o.children(".dna-clone").length||o.removeClass("visible"),!1}),$(".clear",a).on("click",function(){return i.resetList(),!1}),$(".q-sel a",a).on("click",function(){var e=$(this),t=e.attr("data-name"),a=e.attr("data-id"),s={name:t,id:a},l=function(e){i._loadParentTree(e,function(){i._checkCheckBox(a)})};return n(s,i.opt.getParentUrl,l),!1}),$("."+h,a).on("click",function(){return i.applyHandler(this),!1}),d.siblings("."+i.opt.clearAllButtonClass).on("click",function(){i.resetList()})})};c.prototype={_getAjax:function(e,t){var i=this;e||(e=""),$.ajax({type:"GET",url:i.opt.ajaxUrl,data:e,success:function(e){return"function"!=typeof t?(i.rawData=e,e):(i.rawData=e,void t(e))}})},_renderSublist:function(e,t,i){var n=this,a=0,s=t+"-sub",l=function(e){if(e.length){for(n.curDNA[s]={},a;a2&&o?(n({term:t,form:l},s.opt.autoCompleteUrl,d),o=!1):0!=t.length||o||s.$inputFilter.hasClass("ui-autocomplete-input")&&(s.$inputFilter.autocomplete("destroy"),o=!0),!1}).click(function(){return!1})},_loadParentTree:function(e,t,i){var n,a,l,o,c=this,d=e,h=$("#id_"+d.id),u=function(e){var n=$("#id_"+d.id),h=function(){r.hide(),i||0===i?t(i):t()};r.hide(),n.length&&s(c.curDNA[a+"-sub"])==e&&(l={name:d.name,id:d.id},r.show(),o=$("#id_"+d.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderNested(l,h,o,d.id))},p=function(){r.hide(),i||0===i?t(i):t()};r.show(),d.hasOwnProperty("parent")?h.length?(l={name:d.name,id:d.id},o=h.closest(".level").children(".trigger").attr("data-template-id"),c._renderNested(l,function(){r.hide(),t()},o,d.id)):(n={name:d.parent.name,id:d.parent.id},a=$("#id_"+d.parent.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderSublist(n,a,u)):(n={name:d.name,id:d.id},a=$("#id_"+d.id).closest(".level").children(".trigger").attr("data-template-id"),c._renderSublist(n,a,p))},applyHandler:function(){}};var d=function(e){this.opt=e;var t=this,i=$("#"+t.opt.dateFrom),n=$("#"+t.opt.dateTo),a=$("#"+t.opt.id),s=$("#"+t.opt.modalTrigger),l=t.opt.applyBtnClass,r=function(){var e="",t=s.data("lng-to"),a=s.data("lng-from"),l=$.trim(n.val()),r=$.trim(i.val());return""!=l&&""!=r?e=a+": "+r+" "+t+": "+l+".":""!=l&&""==r?e=t+": "+l+".":""==l&&""!=r&&(e=a+": "+r+"."),e},o=function(e){""!=e?(s.text(e).siblings(".trigger-label").addClass("hidden"),s.siblings("."+t.opt.clearAllButtonClass).addClass("active")):(s.text(s.data("default")).siblings(".trigger-label").removeClass("hidden"),s.siblings("."+t.opt.clearAllButtonClass).removeClass("active"))},c=function(e){var a,s,l,r,o=e.getAttribute("id"),c=e.value,d=Date.parse(c);t.validate()&&($(e).parent(".pwf-field").removeClass("err"),o==t.opt.dateFrom?(a=n[0].getAttribute("id"),s=n[0].value):(a=i[0].getAttribute("id"),s=i[0].value),l=Date.parse(s),l>d&&0!=l&&l?(r=document.getElementById(o).value,document.getElementById(o).value=document.getElementById(a).value,document.getElementById(a).value=r):d>l&&0!=l&&l&&(r=document.getElementById(a).value,document.getElementById(a).value=document.getElementById(o).value,document.getElementById(o).value=r))};this.$dateFrom=i,this.$dateTo=n,this.$modalTrigger=s,$(function(){$.datepicker.setDefaults($.datepicker.regional.ru),i.datepicker({dateFormat:"dd.mm.yy",showOn:"button",showOtherMonths:!0,constrainInput:!0,onClose:function(e){n.datepicker("option","minDate",e)}}).inputmask("99.99.9999",{showMaskOnHover:!1,oncomplete:function(){c(this)}}),n.datepicker({dateFormat:"dd.mm.yy",showOn:"button",showOtherMonths:!0,constrainInput:!0,onClose:function(e){i.datepicker("option","maxDate",e)}}).inputmask("99.99.9999",{showMaskOnHover:!1,oncomplete:function(){c(this)}}),$('input[type="text"]',a).on("change",function(){var e=r();o(e)}),$("."+l,a).on("click",function(){return t.applyHandler(this),!1}),s.siblings("."+t.opt.clearAllButtonClass).on("click",function(){$(this).removeClass("active"),t.resetList()})})};d.prototype={resetList:function(){this.$dateFrom.val(""),this.$dateTo.val(""),this.$modalTrigger.text(this.$modalTrigger.attr("data-default"))},validate:function(){var e=this.$dateTo.val(),t=this.$dateFrom.val(),i=e.split("."),n=t.split("."),a=[],s=!0;return a[0]=Date.parse(i[1]+"."+i[0]+"."+i[2]),a[1]=Date.parse(n[1]+"."+n[0]+"."+n[2]),a[0]||""==$.trim(e)?this.$dateTo.parent(".pwf-field").removeClass("err"):(this.$dateTo.parent(".pwf-field").addClass("err"),s=!1),a[1]||""==$.trim(t)?this.$dateFrom.parent(".pwf-field").removeClass("err"):(this.$dateFrom.parent(".pwf-field").addClass("err"),s=!1),s},applyHandler:function(){}};var h=function(e){this.opt=e,this.opt.anyChar=!1;var i=this,s=!0;this.$field=$("#"+i.opt.id),this.DOMcompleteWrap=document.getElementById(i.opt.autoCompleteWrapId),this.afterClear,this.rawData={items:[],set:function(e){this.items=e,this._rawDataChange()},get:function(){return this.items},_rawDataChange:function(){var e,t=this;for(e=0;e2?n(a,i.opt.autoCompleteUrl,function(e){i.$field.hasClass("ui-autocomplete-input")&&i.$field[i.completeName]("destroy"),i.rawData.set(e),i._initAutoComplete(),i.showList("")}):0===text.length&&i.$field.hasClass("ui-autocomplete-input")&&(i.$field[i.completeName]("destroy"),t.removeClass(i.DOMcompleteWrap,"full-visible"),i._resetmodals(i.afterClear)):text.length>2&&s?(n(a,i.opt.autoCompleteUrl,function(e){i.rawData.set(e),i._initAutoComplete(),i.showList("")}),s=!1):0!=text.length||s?i.$field.hasClass("ui-autocomplete-input")&&i.showList(text):i.$field.hasClass("ui-autocomplete-input")&&(i.$field[i.completeName]("destroy"),t.removeClass(i.DOMcompleteWrap,"full-visible"),i._resetmodals(i.afterClear),s=!0),!1}).click(function(){return!1})};return h.prototype={_initAutoComplete:function(){var e=this;e.$field[e.completeName]({source:e.rawData.get(),minLength:0,appendTo:e.DOMcompleteWrap,select:function(t,i){e._afterSelect(t,i)},close:function(){t.removeClass(e.DOMcompleteWrap,"full-visible")},open:function(){t.addClass(e.DOMcompleteWrap,"full-visible")}})},_afterSelect:function(e,t){var i=this;e.preventDefault(),t.item.url?window.location=t.item.url:t.item.label.length&&(i.$field[0].value=t.item.label,i.selectCheckBoxes(t.item.id,t.item.name))},_resetmodals:function(e){return e?void e():0},selectHandler:function(){},selectCheckBoxes:function(){},showList:function(e){self=this,this.$field[self.completeName]("search",e)},pullData:function(){}},e.init=function(e){$.extend(this.lang,e.lang),e.lang=null,$.extend(this.settings,e);var i=this,a=function(){$(i.DOMform).find('input[name="~~name~~"]').remove()};"None"!=this.settings.searchData&&this.settings.searchData&&(this.previousSearch=JSON.parse(this.settings.searchData)),this.DOMform=document.getElementById(this.settings.formId),$(this.DOMform).on("submit",function(){a()}),$.widget("custom.exibitionComplete",$.ui.autocomplete,{_renderMenu:function(e,t){var i=this,n="";$.each(t,function(t,a){a.cat!=n&&a.cat&&(e.append("
  • "+a.cat+"
  • "),n=a.cat),i._renderItemData(e,a)})}}),this.exhibitionField=new h(i.settings.firstField),this.exhibitionField.completeName="exibitionComplete",this.exhibitionField.opt.anyChar=!0,this.placesModal=new c(i.settings.place),this.subjModal=new o(i.settings.subject),this.periodModal=new d(i.settings.period),this.exhibitionField.selectCheckBoxes=function(e,t){var i,a,s=this,l=t;"th"==t?i=document.getElementById(s.opt.prefix+e):"tg"==t&&(i=document.getElementById(s.opt.prefixInner+e),l="th"),r.show(),i?(r.hide(),$(i).prop("checked",!0),$(i).trigger("change")):(a={name:t,id:e},n(a,EXPO.searchBlock.subjModal.opt.getParentUrl,function(i){EXPO.searchBlock.subjModal._loadParentTree(i,function(){EXPO.searchBlock.subjModal._checkCheckBox(e,t)})}))},this.placesField=new h(i.settings.placeField),this.placesField.dataForm=EXPO.searchBlock.placesModal.$inputFilter.attr("data-form"),this.placesField.selectCheckBoxes=function(e,t){var i,a,s=this;i=document.getElementById(s.opt.prefix+e),i?(r.hide(),$(i).prop("checked",!0),$(i).trigger("change")):(a={name:t,id:e},n(a,EXPO.searchBlock.placesModal.opt.getParentUrl,function(i){EXPO.searchBlock.placesModal._loadParentTree(i,function(){EXPO.searchBlock.placesModal._checkCheckBox(e,t)})}))},this.exhibitionField.afterClear=function(){i.subjModal.resetList()},this.placesField.afterClear=function(){i.placesModal.resetList()},this.modalWindow=new t.Modal(i.settings.modal),this.periodModal.applyHandler=function(){this.validate()&&(r.show(),$(i.DOMform).submit())},this.placesModal.applyHandler=function(){r.show(),$(i.DOMform).submit()},this.subjModal.applyHandler=function(){r.show(),$(i.DOMform).submit()},$("."+i.settings.modalTriggerClass).on("click",function(e){return e.preventDefault(),i.modalWindow.pullData(this.getAttribute("href")),i.modalWindow.open(),!1}),$(function(){if(i.previousSearch)for(var e=0;e