var params = {"iopath":".\/ordernew2\/io.php","path":".\/ordernew2\/","imagepath":".\/ordernew2\/images\/","preordertime":30,"main_city":"\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433","show_partner_crews":false,"enable_sms_check":false,"show_captcha":0,"instant_calc":true,"showtariff":"select","ordertariffs":[{"name":"\u042d\u043a\u043e\u043d\u043e\u043c","tariff_id":20,"crew_group_id":39,"orderparams":[8,25,7,10,25,28],"comment":"\u041f\u043e\u0434\u0430\u0447\u0430: \u043e\u0442 5 \u043c\u0438\u043d","img":"\/ordernew21\/ordernew2\/img\/ac\/taxi.png"},{"name":"\u041a\u043e\u043c\u0444\u043e\u0440\u0442","tariff_id":21,"crew_group_id":44,"orderparams":[8,25,7,10,28],"comment":"\u041f\u043e\u0434\u0430\u0447\u0430: \u043e\u0442 10 \u043c\u0438\u043d","img":"\/ordernew21\/ordernew2\/img\/ac\/taxi2.png"},{"name":"\u0411\u0438\u0437\u043d\u0435\u0441","tariff_id":22,"crew_group_id":44,"orderparams":[4,6,7,8,10,24,25,26,28],"comment":"\u041f\u043e\u0434\u0430\u0447\u0430: \u043e\u0442 30 \u043c\u0438\u043d","img":"\/ordernew21\/ordernew2\/img\/ac\/taxi3.png"},{"name":"\u041c\u0438\u043d\u0438\u0432\u0435\u043d","tariff_id":30,"crew_group_id":29,"orderparams":[],"comment":"\u041f\u043e\u0434\u0430\u0447\u0430: \u043e\u0442 30 \u043c\u0438\u043d","img":"\/ordernew21\/ordernew2\/img\/ac\/taxi4.png"},{"name":"\u041c\u0438\u043a\u0440\u043e\u0430\u0432\u0442\u043e\u0431\u0443\u0441","tariff_id":31,"crew_group_id":30,"orderparams":[],"comment":"\u041f\u043e\u0434\u0430\u0447\u0430: \u043e\u0442 60 \u043c\u0438\u043d","img":"\/ordernew21\/ordernew2\/img\/ac\/taxi5.png"}],"orderparamstrings":[{"id":4,"name":"\u041a\u043e\u043d\u0434\u0438\u0446\u0438\u043e\u043d\u0435\u0440","comment":"\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0430\u0448\u0438\u043d\u0430 \u0441 \u043a\u043e\u043d\u0434\u0438\u0446\u0438\u043e\u043d\u0435\u0440\u043e\u043c","sum":100,"percent":0},{"id":6,"name":"\u041f\u0435\u0440\u0435\u0432\u043e\u0437\u043a\u0430 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0445","comment":"\u0415\u0441\u043b\u0438 \u0412\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0435\u0437\u0434\u043a\u0430 \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0438\u043b\u0438 \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u043c \u043f\u0438\u0442\u043e\u043c\u0446\u0435\u043c. \u041f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u0443 \u043f\u0440\u0438 \u0441\u0435\u0431\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0438\u043b\u043a\u0443 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0436\u0438\u0432\u043e\u0442\u043d\u043e\u0433\u043e.","sum":50,"percent":0},{"id":7,"name":"\u041a\u0443\u0437\u043e\u0432 \"\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\"","comment":"","sum":150,"percent":0},{"id":8,"name":"\u0414\u0435\u0442\u0441\u043a\u043e\u0435 \u043a\u0440\u0435\u0441\u043b\u043e","comment":"","sum":100,"percent":0},{"id":10,"name":"\u041a\u043b\u0438\u0435\u043d\u0442 \u0441 \u0431\u0430\u0433\u0430\u0436\u043e\u043c","comment":"\u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u0431\u0430\u0433\u0430\u0436\u043d\u0438\u043a\u043e\u043c","sum":10,"percent":0},{"id":24,"name":"\u041d\u0435\u043a\u0443\u0440\u044f\u0449\u0438\u0439 \u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c","comment":"","sum":50,"percent":0},{"id":26,"name":"\u0411\u0435\u0437 \u0437\u043d\u0430\u043a\u043e\u0432 \u0442\u0430\u043a\u0441\u0438","comment":"","sum":0,"percent":0},{"id":28,"name":"\u0421\u0420\u041e\u0427\u041d\u041e","comment":"","sum":0,"percent":50},{"id":33,"name":"\u041a\u0423\u0420\u042f\u0429\u0418\u0419 \u0412\u041e\u0414\u0418\u0422\u0415\u041b\u042c","comment":"\u0421\u0440\u0435\u0434\u0438 \u043f\u0430\u0441\u0441\u0430\u0436\u0438\u0440\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u0442\u0438 \u0434\u043e 12 \u043b\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043a\u043e\u043b-\u0432\u043e \u0434\u0435\u0442\u0435\u0439 \u0438 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.","sum":0,"percent":0},{"id":38,"name":"\u0411\u0443\u0434\u043a\u0430","comment":"\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u043e\u043c\u0430\u0440\u043a\u0430 \u043d\u0435 \u0441\u0442\u0430\u0440\u0448\u0435 5 \u043b\u0435\u0442.","sum":0,"percent":0},{"id":45,"name":"+100","comment":"\u041a\u0432\u0438\u0442\u0430\u043d\u0446\u0438\u044f \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u0435\u0437\u0434\u043a\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430","sum":100,"percent":0},{"id":46,"name":"+150","comment":"\u0415\u0441\u043b\u0438 \u0412\u044b \u043d\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438\u043c \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435\u043c, \u0437\u0430 \u0412\u0430\u0441 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0412\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.","sum":150,"percent":0},{"id":48,"name":"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0447\u0435\u043a","comment":"\u0421\u0440\u043e\u0447\u043d\u0430\u044f \u043f\u043e\u0434\u0430\u0447\u0430 \u043c\u0430\u0448\u0438\u043d\u044b, \u0434\u0430\u0436\u0435 \u0432 \u0447\u0430\u0441 \u043f\u0438\u043a.","sum":50,"percent":0},{"id":49,"name":"\u0411\u0435\u0437 \u0427\u0435\u043a\u0430","comment":"\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043d\u043e\u043c\u0430\u0440\u043a\u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u043a\u043b\u0430\u0441\u0441\u0430.","sum":0,"percent":0}]}; /* Форма онлайн-заказа для Такси Мастер*/ /* (С) codedog 2015 */ /*Вспомогательные функции*/ (function(window,$){ function addZero(i) { return (i < 10) ? "0" + i : i; } ; function split(val) { return val.split(/,\s*/); } function extractLast(term) { return split(term).pop(); } function replaceAll(string, find, replace) { return string.replace(new RegExp(escapeRegExp(find), 'g'), replace); } ; //Добавили ф-цию String.prototype.replaceAll = function (search, replace) { return this.split(search).join(replace); } function clone(obj) { if (obj == null || typeof (obj) != 'object') return obj; var temp = new obj.constructor(); for (var key in obj) temp[key] = clone(obj[key]); return temp; } //AddressComplete $.widget("custom.addresscomplete", $.ui.autocomplete, { _create: function () { this._super(); this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)"); }, _renderMenu: function (ul, items) { var that = this, currentCategory = "", newCategory = ''; if (items[0].kind == 'message') { ul.append("
  • " + items[0].label + "
  • "); } else { $.each(items, function (index, item) { var li; if (item.kind == 'message') { ul.append("
  • " + item.label + "
  • "); } var uicity = $(that.element[0]).data('city'); if (uicity != null) { if (item.city != uicity) { newCategory = 'Другие'; } else newCategory = uicity; } else { if (item.city != params.main_city) { newCategory = 'Область'; } else newCategory = params.main_city; } if (item.kind == 'crossing') newCategory = 'Перекрёстки'; if (item.kind == 'point') newCategory = 'Места'; if (/*item.city*/ newCategory != currentCategory) { ul.append("
  • " + newCategory/*item.city*/ + "
  • "); currentCategory = newCategory;//'Область';//item.city; } li = that._renderItemData(ul, item); if (item.city) { li.attr("aria-label", item.city + " : " + item.label); } }) } }, _renderItem: function (ul, item) { var words = this.term.trim().split(' '); var cls = 'autocomplete-highlight';//this.options.highlightClass; //var template = "$1"; var template = "$1"; var label = item.label; for (var i = 0; i < words.length; i++) { var re = new RegExp("(" + words[i] + ")", "gi"); label = label.replace(re, template); } var $li = $("
  • ").appendTo(ul); $("
  • ') }) this.$el.first().attr("selected", "selected"); this.doSelect(0); return this; } }); TMOButtonsetTariffView = TMOBaseTariffView.extend({ el:$('
    '), render:function(){ // this.$el.html(this.template()); // this.$el.on('click','.tariffbtn',this.onClick); // this.$el.on('change',this.onClick); var that=this; $.each(params.ordertariffs,function(i,e){ var t=_.template(TaxiBTNTemplate); var btn=$(t({value:i,name:e.name,img:e.img,comment:e.comment})); that.$el.append(btn); }) this.$el.buttonset(); this.$el.find('label').eq(0).trigger('click');//prop("checked", true); // this.doSelect(0); return this; } }); /* TMOTariffView2 = Backbone.View.extend({ el:$('
    '), template:_.template(TMOTariffViewTmpl), tariffs:TMOrder.tariffs, render:function(){ this.$el.html(this.template()); // this.$el.on('click','.tariffbtn',this.onClick); this.$el.on('change',this.onClick); var that=this; $.each(params.ordertariffs,function(i,e){ var t=_.template(TaxiBTNTemplate); var btn=$(t({value:i,name:e.name,img:e.img,comment:e.comment})); that.$el.append(btn); }) this.$el.buttonset(); return this; }, onClick:function(e){ var n=$(e.target).val(); var p=params.ordertariffs[n].orderparams; $('.orderparam').parent().hide(); $.each(p,function(i,e){ $('.orderparam[value='+e+']').parent().show(); }) TMOrder.tariff_id=params.ordertariffs[n].tariff_id; TMOrder.crew_group_id=params.ordertariffs[n].crew_group_id; TMOrder.trigger('changeOrder'); } }); */ TMOParamsView= Backbone.View.extend({ el:$('
    '), //template:_.template(TMOTariffViewTmpl), tariffs:TMOrder.tariffs, events:{ //'click .tariffbtn':'onClick', 'change ':'onClick' }, render:function(){ //this.$el.html(this.template()); var that=this; var ids=[]; $.each(params.ordertariffs,function(i,e){ _.union(ids,e.orderparams); }); $.each(ids,function(i,e){ // this.$el.append('