-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.min.js
1 lines (1 loc) · 18.7 KB
/
app.min.js
1
function imgError(e){return e.onerror="",e.src="../images/no.gif",!0}function loadMessages(){$.ajax({url:"/messages/count",success:function(e){return 0==e?!1:void $("#newmessages").html(" "+e+" New Message's").parent().removeClass("low-opacity").addClass("red")}})}function hire(e,t){$.ajax({url:"/api/hireUserForProject",method:"POST",data:{hire_project_id:e,hire_provider_id:t},complete:function(){swal({title:"Contractor Hired",text:"Contact us if any problem",type:"success",showCancelButton:!1,closeOnConfirm:!1},function(){window.location.reload()})}})}function endContract(e){inst.open(),$.ajax({url:"/jobs/end",method:"POST",data:{rating:rate,project_id:$(".endContract").data("project"),provider_id:$(".endContract").data("provider")},success:function(){swal({title:"Contractor Ended",text:"Contact us if any problem",type:"success",showCancelButton:!1,closeOnConfirm:!1},function(){window.location.reload()})}}),e.preventDefault()}function setArray(e){$.ajax("/image",function(){}),1==$(e).data("subcategory")&&$(e).attr("src","null")}var EasyAutocomplete=function(e){return e.Configuration=function(e){function t(){if("xml"===e.dataType&&(e.getValue||(e.getValue=function(e){return $(e).text()}),e.list||(e.list={}),e.list.sort||(e.list.sort={}),e.list.sort.method=function(t,n){return t=e.getValue(t),n=e.getValue(n),n>t?-1:t>n?1:0},e.list.match||(e.list.match={}),e.list.match.method=function(t,n){return t=e.getValue(t),n=e.getValue(n),t===n?!0:!1}),void 0!==e.categories&&e.categories instanceof Array){for(var t=[],n=0,i=e.categories.length;i>n;n+=1){var a=e.categories[n];for(var o in s.categories[0])void 0===a[o]&&(a[o]=s.categories[0][o]);t.push(a)}e.categories=t}}function n(){function t(e,n){var i=e||{};for(var a in e)void 0!==n[a]&&null!==n[a]&&("object"!=typeof n[a]||n[a]instanceof Array?i[a]=n[a]:t(e[a],n[a]));return void 0!==n.data&&null!==n.data&&"object"==typeof n.data&&(i.data=n.data),i}s=t(s,e)}function i(){if("list-required"!==s.url&&"function"!=typeof s.url){var t=s.url;s.url=function(){return t}}if(void 0!==s.ajaxSettings.url&&"function"!=typeof s.ajaxSettings.url){var t=s.ajaxSettings.url;s.ajaxSettings.url=function(){return t}}if("string"==typeof s.listLocation){var n=s.listLocation;s.listLocation="XML"===s.dataType.toUpperCase()?function(e){return $(e).find(n)}:function(e){return e[n]}}if("string"==typeof s.getValue){var i=s.getValue;s.getValue=function(e){return e[i]}}void 0!==e.categories&&(s.categoriesAssigned=!0)}function a(){s.ajaxSettings=void 0!==e.ajaxSettings&&"object"==typeof e.ajaxSettings?e.ajaxSettings:{}}function o(e){return void 0!==s[e]&&null!==s[e]?!0:!1}function r(e,t){function n(t,a){for(var o in a)void 0===t[o]&&e.log("Property '"+o+"' does not exist in EasyAutocomplete options API."),"object"!=typeof t[o]||i(o)||n(t[o],a[o])}function i(e){var t=["ajaxSettings","template"];return Array.prototype.contains=function(e){for(var t=this.length;t--;)if(this[t]===e)return!0;return!1},t.contains(e)}n(s,t)}var s={data:"list-required",url:"list-required",dataType:"json",listLocation:function(e){return e},xmlElementName:"",getValue:function(e){return e},autocompleteOff:!0,placeholder:!1,ajaxCallback:function(){},matchResponseProperty:!1,list:{sort:{enabled:!1,method:function(e,t){return e=s.getValue(e),t=s.getValue(t),t>e?-1:e>t?1:0}},maxNumberOfElements:6,hideOnEmptyPhrase:!0,match:{enabled:!1,caseSensitive:!1,method:function(e,t){return e=s.getValue(e),t=s.getValue(t),e===t?!0:!1}},showAnimation:{type:"normal",time:400,callback:function(){}},hideAnimation:{type:"normal",time:400,callback:function(){}},onClickEvent:function(){},onSelectItemEvent:function(){},onLoadEvent:function(){},onChooseEvent:function(){},onKeyEnterEvent:function(){},onMouseOverEvent:function(){},onMouseOutEvent:function(){},onShowListEvent:function(){},onHideListEvent:function(){}},highlightPhrase:!0,theme:"",cssClasses:"",minCharNumber:0,requestDelay:0,adjustWidth:!0,ajaxSettings:{},preparePostData:function(e){return e},loggerEnabled:!0,template:"",categoriesAssigned:!1,categories:[{maxNumberOfElements:4}]};this.get=function(e){return s[e]},this.equals=function(e,t){return o(e)&&s[e]===t?!0:!1},this.checkDataUrlProperties=function(){return"list-required"===s.url&&"list-required"===s.data?!1:!0},this.checkRequiredProperties=function(){for(var e in s)if("required"===s[e])return logger.error("Option "+e+" must be defined"),!1;return!0},this.printPropertiesThatDoesntExist=function(e,t){r(e,t)},t(),n(),s.loggerEnabled===!0&&r(console,e),a(),i()},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.Logger=function(){this.error=function(e){},this.warning=function(e){}},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.Constans=function(){var e={CONTAINER_CLASS:"easy-autocomplete-container",CONTAINER_ID:"eac-container-",WRAPPER_CSS_CLASS:"easy-autocomplete"};this.getValue=function(t){return e[t]}},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.ListBuilderService=function(e,t){function n(t,n){function i(){var i,a={};return void 0!==t.xmlElementName&&(a.xmlElementName=t.xmlElementName),void 0!==t.listLocation?i=t.listLocation:void 0!==e.get("listLocation")&&(i=e.get("listLocation")),void 0!==i?"string"==typeof i?a.data=$(n).find(i):"function"==typeof i&&(a.data=i(n)):a.data=n,a}function a(){var e={};return void 0!==t.listLocation?"string"==typeof t.listLocation?e.data=n[t.listLocation]:"function"==typeof t.listLocation&&(e.data=t.listLocation(n)):e.data=n,e}var o={};if(o="XML"===e.get("dataType").toUpperCase()?i():a(),void 0!==t.header&&(o.header=t.header),void 0!==t.maxNumberOfElements&&(o.maxNumberOfElements=t.maxNumberOfElements),void 0!==e.get("list").maxNumberOfElements&&(o.maxListSize=e.get("list").maxNumberOfElements),void 0!==t.getValue)if("string"==typeof t.getValue){var r=t.getValue;o.getValue=function(e){return e[r]}}else"function"==typeof t.getValue&&(o.getValue=t.getValue);else o.getValue=e.get("getValue");return o}function i(t){var n=[];return void 0===t.xmlElementName&&(t.xmlElementName=e.get("xmlElementName")),$(t.data).find(t.xmlElementName).each(function(){n.push(this)}),n}this.init=function(t){var n=[],i={};return i.data=e.get("listLocation")(t),i.getValue=e.get("getValue"),i.maxListSize=e.get("list").maxNumberOfElements,n.push(i),n},this.updateCategories=function(t,i){if(e.get("categoriesAssigned")){t=[];for(var a=0;a<e.get("categories").length;a+=1){var o=n(e.get("categories")[a],i);t.push(o)}}return t},this.convertXml=function(t){if("XML"===e.get("dataType").toUpperCase())for(var n=0;n<t.length;n+=1)t[n].data=i(t[n]);return t},this.processData=function(n,i){for(var a=0,o=n.length;o>a;a+=1)n[a].data=t(e,n[a],i);return n},this.checkIfDataExists=function(e){for(var t=0,n=e.length;n>t;t+=1)if(void 0!==e[t].data&&e[t].data instanceof Array&&e[t].data.length>0)return!0;return!1}},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.proccess=function(e,t,n){function i(t,n){var i=[],a="";if(e.get("list").match.enabled)for(var o=0,r=t.length;r>o;o+=1)a=e.get("getValue")(t[o]),e.get("list").match.caseSensitive||("string"==typeof a&&(a=a.toLowerCase()),n=n.toLowerCase()),a.search(n)>-1&&i.push(t[o]);else i=t;return i}function a(e){return void 0!==t.maxNumberOfElements&&e.length>t.maxNumberOfElements&&(e=e.slice(0,t.maxNumberOfElements)),e}function o(t){return e.get("list").sort.enabled&&t.sort(e.get("list").sort.method),t}var r=t.data,s=n;return r=i(r,s),r=a(r),r=o(r)},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.Template=function(e){var t={basic:{type:"basic",method:function(e){return e}},description:{type:"description",fields:{description:"description"},method:function(e){return e+" - description"},cssClass:"eac-description"},iconLeft:{type:"iconLeft",fields:{icon:""},method:function(e){return e},cssClass:"eac-icon-left"},iconRight:{type:"iconRight",fields:{iconSrc:""},method:function(e){return e},cssClass:"eac-icon-right"},links:{type:"links",fields:{link:""},method:function(e){return e}},custom:{type:"custom",method:function(){}}},n=function(e){var n=e.fields;if("description"===e.type){var i=function(e,t){return e+" - <span>"+t[n.description]+"</span>"};return i}if("iconRight"===e.type){var i="";return"string"==typeof n.iconSrc?i=function(e,t){return e+"<img class='eac-icon' src='"+t[n.iconSrc]+"' />"}:"function"==typeof n.iconSrc&&(i=function(e,t){return e+"<img class='eac-icon' src='"+n.iconSrc(t)+"' />"}),i}if("iconLeft"===e.type){var i="";return"string"==typeof n.iconSrc?i=function(e,t){return"<img class='eac-icon' src='"+t[n.iconSrc]+"' />"+e}:"function"==typeof n.iconSrc&&(i=function(e,t){return"<img class='eac-icon' src='"+n.iconSrc(t)+"' />"+e}),i}if("links"===e.type){var i="";return"string"==typeof n.link?i=function(e,t){return"<a href='"+t[n.link]+"' >"+e+"</a>"}:"function"==typeof n.link&&(i=function(e,t){return"<a href='"+n.link(t)+"' >"+e+"</a>"}),i}return"custom"===e.type?e.method:t.basic.method},i=function(e){return e&&e.type&&e.type&&t[e.type]?n(e):t.basic.method},a=function(e){var n=function(){return""};return e&&e.type&&e.type&&t[e.type]?function(){var n=t[e.type].cssClass;return function(){return n}}():n};this.getTemplateClass=a(e),this.build=i(e)},e}(EasyAutocomplete||{}),EasyAutocomplete=function(e){return e.main=function(t,n){function i(){return 0===C.length?void h.error("Input field doesn't exist."):p.checkDataUrlProperties()?p.checkRequiredProperties()?(a(),void r()):void h.error("Will not work without mentioned properties."):void h.error("One of options variables 'data' or 'url' must be defined.")}function a(){function e(){var e=$("<div>"),n=m.getValue("WRAPPER_CSS_CLASS");p.get("theme")&&""!==p.get("theme")&&(n+=" eac-"+p.get("theme")),p.get("cssClasses")&&""!==p.get("cssClasses")&&(n+=" "+p.get("cssClasses")),""!==v.getTemplateClass()&&(n+=" "+v.getTemplateClass()),e.addClass(n),C.wrap(e),p.get("adjustWidth")===!0&&t()}function t(){var e=C.outerWidth();C.parent().css("width",e)}function n(){C.unwrap()}function i(){var e=$("<div>").addClass(m.getValue("CONTAINER_CLASS"));e.attr("id",o()).prepend($("<ul>")),function(){e.on("show",function(){switch(p.get("list").showAnimation.type){case"slide":var t=p.get("list").showAnimation.time,n=p.get("list").showAnimation.callback;e.find("ul").slideDown(t,n);break;case"fade":var t=p.get("list").showAnimation.time,n=p.get("list").showAnimation.callback;e.find("ul").fadeIn(t),n;break;default:e.find("ul").show()}p.get("list").onShowListEvent()}).on("hide",function(){switch(p.get("list").hideAnimation.type){case"slide":var t=p.get("list").hideAnimation.time,n=p.get("list").hideAnimation.callback;e.find("ul").slideUp(t,n);break;case"fade":var t=p.get("list").hideAnimation.time,n=p.get("list").hideAnimation.callback;e.find("ul").fadeOut(t,n);break;default:e.find("ul").hide()}p.get("list").onHideListEvent()}).on("selectElement",function(){e.find("ul li").removeClass("selected"),e.find("ul li").eq(A).addClass("selected"),p.get("list").onSelectItemEvent()}).on("loadElements",function(t,n,i){var a="",o=e.find("ul");o.empty().detach(),S=[];for(var s=0,c=0,l=n.length;l>c;c+=1){var f=n[c].data;if(0!==f.length){void 0!==n[c].header&&n[c].header.length>0&&o.append("<div class='eac-category' >"+n[c].header+"</div>");for(var d=0,g=f.length;g>d&&s<n[c].maxListSize;d+=1)a=$("<li><div class='eac-item'></div></li>"),function(){var e=d,t=s,o=n[c].getValue(f[e]);a.find(" > div").on("click",function(){C.val(o).trigger("change"),A=t,u(t),p.get("list").onClickEvent(),p.get("list").onChooseEvent()}).mouseover(function(){A=t,u(t),p.get("list").onMouseOverEvent()}).mouseout(function(){p.get("list").onMouseOutEvent()}).html(v.build(r(o,i),f[e]))}(),o.append(a),S.push(f[d]),s+=1}}e.append(o),p.get("list").onLoadEvent()})}(),C.after(e)}function a(){C.next("."+m.getValue("CONTAINER_CLASS")).remove()}function r(e,t){return p.get("highlightPhrase")&&""!==t?c(e,t):e}function s(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function c(e,t){var n=s(t);return(e+"").replace(new RegExp("("+n+")","gi"),"<b>$1</b>")}C.parent().hasClass(m.getValue("WRAPPER_CSS_CLASS"))&&(a(),n()),e(),i(),b=$("#"+o()),p.get("placeholder")&&C.attr("placeholder",p.get("placeholder"))}function o(){var e=C.attr("id");if(void 0===e||null===e){var t="";do t=g.shortcut+"-"+Math.floor(1e4*Math.random());while(0!==$("#"+t).length);e=m.getValue("CONTAINER_ID")+t,C.attr("id",t)}else e=m.getValue("CONTAINER_ID")+e;return e}function r(){function e(){E("autocompleteOff",!0)&&r(),t(),n(),i(),a(),o()}function t(){C.off("keyup").keyup(function(e){function t(e){function t(){var e={},t=p.get("ajaxSettings")||{};for(var n in t)e[n]=t[n];return e}function n(e,t){return p.get("matchResponseProperty")!==!1?"string"==typeof p.get("matchResponseProperty")?t[p.get("matchResponseProperty")]===e:"function"==typeof p.get("matchResponseProperty")?p.get("matchResponseProperty")(t)===e:!0:!0}if(!(e.length<p.get("minCharNumber"))){if("list-required"!==p.get("data")){var i=p.get("data"),a=y.init(i);a=y.updateCategories(a,i),a=y.processData(a,e),l(a,e),s()}var o=t();(void 0===o.url||""===o.url)&&(o.url=p.get("url")),(void 0===o.dataType||""===o.dataType)&&(o.dataType=p.get("dataType")),void 0!==o.url&&"list-required"!==o.url&&(o.url=o.url(e),o.data=p.get("preparePostData")(o.data),$.ajax(o).done(function(t){var i=y.init(t);i=y.updateCategories(i,t),i=y.convertXml(i),n(e,t)&&(i=y.processData(i,e),l(i,e)),y.checkIfDataExists(i)&&s(),p.get("ajaxCallback")()}).fail(function(){h.warning("Fail to load response data")}).always(function(){}))}}switch(e.keyCode){case 27:c(),f();break;case 38:e.preventDefault(),S.length>0&&A>0&&(A-=1,C.val(p.get("getValue")(S[A])),u(A));break;case 40:e.preventDefault(),S.length>0&&A<S.length-1&&(A+=1,C.val(p.get("getValue")(S[A])),u(A));break;default:if(e.keyCode>40||8===e.keyCode){var n=C.val();p.get("list").hideOnEmptyPhrase!==!0||8!==e.keyCode||""!==n?p.get("requestDelay")>0?(void 0!==d&&clearTimeout(d),d=setTimeout(function(){t(n)},p.get("requestDelay"))):t(n):c()}}})}function n(){C.on("keydown",function(e){e=e||window.event;var t=e.keyCode;return 38===t?(suppressKeypress=!0,!1):void 0}).keydown(function(e){13===e.keyCode&&A>-1&&(C.val(p.get("getValue")(S[A])),A=-1,c(),p.get("list").onKeyEnterEvent(),p.get("list").onChooseEvent(),e.preventDefault())})}function i(){C.off("keypress")}function a(){C.focus(function(){""!==C.val()&&S.length>0&&(A=-1,s())})}function o(){C.blur(function(){setTimeout(function(){A=-1,c()},250)})}function r(){C.attr("autocomplete","off")}e()}function s(){b.trigger("show")}function c(){b.trigger("hide")}function u(e){b.trigger("selectElement",e)}function l(e,t){b.trigger("loadElements",[e,t])}function f(){C.trigger("blur")}var d,g={name:"EasyAutocomplete",shortcut:"eac"},m=new e.Constans,p=new e.Configuration(n),h=new e.Logger,v=new e.Template(n.template),y=new e.ListBuilderService(p,e.proccess),E=p.equals,C=t,b="",S=[],A=-1;this.getConstants=function(){return m},this.getConfiguration=function(){return p},this.getContainer=function(){return b},this.getSelectedItemIndex=function(){return A},this.getItemData=function(e){return S.length<e||void 0===S[e]?-1:S[e]},this.getSelectedItemData=function(){return this.getItemData(A)},this.build=function(){a()},this.init=function(){i()}},e}(EasyAutocomplete||{});$.fn.easyAutocompleteHandles=[],$.fn.easyAutocomplete=function(e){var t=new EasyAutocomplete.main(this,e);t.init(),$.fn.easyAutocompleteHandles[$(this).attr("id")]=t},$.fn.getSelectedItemIndex=function(){var e=$(this).attr("id");return void 0!==e&&void 0!==$.fn.easyAutocompleteHandles[e]?$.fn.easyAutocompleteHandles[e].getSelectedItemIndex():-1},$.fn.getItemData=function(e){var t=$(this).attr("id");return void 0!==t&&e>-1&&void 0!==$.fn.easyAutocompleteHandles[t]?$.fn.easyAutocompleteHandles[t].getItemData(e):-1},$.fn.getSelectedItemData=function(){var e=$(this).attr("id");return void 0!==e&&void 0!==$.fn.easyAutocompleteHandles[e]?$.fn.easyAutocompleteHandles[e].getSelectedItemData():-1};var rate="";!function(){$.ajaxSetup({headers:{"X-CSRF-Token":$('meta[name="_token"]').attr("content")}})}();var arr;setArray(),$("document").ready(function(){if($("#phone").length>0&&$("#phone").mask("9 (999) 999-999"),$(".website").length>0){var e=new RegExp("^(https?://)?([da-z.-]+).([a-z.]{2,6})([/w .-]*)*/?$");$(".website").keyup(function(){var t=$(this).val();e.test(t)?$(".website").css("background","rgb(192,234,252)"):$(".website").css("background","rgb(255,255,255)")})}$img=$(".myimage"),$img.on("load",function(){setArray($(this))}),$(".endContract").click(function(e){e.preventDefault(),$("div.rateme").raty({click:function(e,t){rate=e}}),inst.open()}),$(".remodal-confirm").click(function(e){e.preventDefault(),0==rate||""==rate?$(".rate_error").show():(inst.destroy(),endContract())});var t=setInterval(loadMessages,1e3);$(document).ajaxError(function(e,n,i,a){401==n.status&&clearInterval(t)});var n={finishedMsg:"<div class='end-msg'>No More Pages</div>",msgText:"<div class='center'>Loading Please Wait...</div>",img:"/images/ajax-loader.gif"};$(".pages").infinitescroll({loading:n,navSelector:".pager",nextSelector:".pager a:last",itemSelector:".pageitem",debug:!1,dataType:"html",path:function(e){return"?page="+e}}),$(".pageitem").hover(function(){$(this).find(".overlay-link").show()},function(){$(this).find(".overlay-link").hide()}),$("#postal").on("keyup",function(){var e=$(this).val().substring(0,5);5==e.length&&/^[0-9]+$/.test(e)&&$.ajax({url:"/zip",dataType:"json",type:"GET",data:{zipcode:$(this).val()},success:function(e){$.each(e.addresses,function(t,n){$("#zip").val(e.zip_code),"undefined"==n.city?($("#current_place").val(n.placename),$("#city").val(n.placename)):($("#current_place").val(n.city),$("#city").val(n.city)),$("#state").val(n.state_name),$("#country").val(e.country_name),$("#latitude").val(n.latitude),$("#longitude").val(n.longitude),"undefined"==n.city?$(".iaddress").html(e.country_name+", "+n.place+", "+n.state_id):$(".iaddress").html(e.country_name+", "+n.city+", "+n.state_id)})}})}),$('[data-toggle="tooltip"]').tooltip()}),$(function(){$.ajaxSetup({cache:!0});var e="",t="",n={url:function(e){return"/api/search?query="+$("#search").val()},listLocation:function(e){return e.hits.hits},getValue:function(e){var t=e._source.title+" <small style='color: #00b0e8'>Category : "+e._source.name+"</small>";return t},list:{maxNumberOfElements:6,onChooseEvent:function(){window.location.href="/search?query="+$("#search").getSelectedItemData()._source.name},onSelectItemEvent:function(){var t=$("#search").getSelectedItemData()._source.name;$("#search").val(t).trigger("change"),e=t},onKeyEnterEvent:function(){return""==e||null==e?!1:void $("#search").val(e)}},placeholder:"Do you need any help ?",ajaxSettings:{dataType:"json",method:"GET",cache:!0,beforeSend:function(){$(".load").show(),e=""},complete:function(){$(".load").hide(),e=""}},requestDelay:0};$("#search").easyAutocomplete(n),$("#search").keydown(function(n){if(t=$(this).val(),13==n.keyCode){if(""==e||null==e||"undefined"==e)return!0;window.location.href="/search?query="+encodeURIComponent($(this).val())}})});