var EXPO = EXPO || {}; //isolated namespace EXPO.registration = EXPO.registration || {}; if (EXPO.registration.completion) { console.warn('WARNING: EXPO.registration..completion is already defined!'); } else { EXPO.registration.completion = (function () { /** * private (visible inside this module only) variables */ /** * @type {Object} - module API interafce realization */ var that = {}, /** * fires when data is sended and response recieved * @param {Object} data - data recieved from server */ registrationSuccess = function (data) { if (data.success) { location.reload(); } else { console.log(data); } }, placeInput = function (width) { $('#id_country').val('159').select2({ placeholder: "Ваша страна", width: width }); $('#id_city').select2({ placeholder: "Ваш город", width: width, ajax: { url: "/city/get-city/", dataType: "json", quietMillis: 200, data: function(term, page, country){ var country = $('#id_country').val() return {term: term, page: page, country: country}; }, results: function (data) { var results = []; $.each(data, function(index, item){ results.push({ id: item.id, text: item.label }); }); return {results: results}; } }, initSelection : function(element, callback) { var id= $(element).val(); var text = $(element).attr('data-init-text'); callback({id: id, text:text}); } }); }; /** * @type {Object} default setting */ that.opt = {}; /** * dependencies.Place where you can switch on dependencies for module * @type {EXPO.common|*} - mostly used in project functions and data (block.common.js) */ var com = EXPO.common; $(function () { $('body').addClass('body-fixed').append('