', { 'class': 'edit-sportingevent-bg' })); $('.edit-sportingevent-bg').show(); if ($('.edit-sportingevent-popup').length == 0) $('body').append($('
', { 'class': 'edit-sportingevent-popup' })); $.ajax({ url: "/ajax/editsportingevent?v=" + ISCommon.GetV(), data: { Id: Id }, cache: true, success: function (d) { $('.edit-sportingevent-popup').html(d.View); ISSportingEventEdit.EditShowInit(); } }); }, EditShowInit: function () { $('.search-sportingevent-popup').hide(); if ($('.edit-sportingevent-form #SportingEventId').val() != '0') $('.edit-sportingevent-popup .heading .messages p').text('Корректировка записи в базе МЕРОПРИЯТИЙ'); else $('.edit-sportingevent-popup .heading .messages p').text('Новая запись в базе МЕРОПРИЯТИЙ'); var newWidth = ($("#container").width() < 1000) ? $("#container").width() : 1000; $('.edit-sportingevent-bg').css({ top: 0, height: $(document).outerHeight() }); $('.edit-sportingevent-popup').css({ top: $(window).scrollTop(), width: newWidth, marginLeft: 0 - (newWidth / 2) }); $('.edit-sportingevent-popup .heading a.close').unbind('click'); $('.edit-sportingevent-popup .heading a.close').click(function () { ISSportingEventEdit.EditHide(); return false; }); $(".edit-sportingevent-form select").not(".ex").chosen(); $(".edit-sportingevent-form #Text, .edit-sportingevent-form #Intro").ckeditor({ height: 140, width: 723, toolbar: [['Source', 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', 'RemoveFormat', 'SpellChecker', 'Scayt', '-', 'NumberedList', 'BulletedList', 'Table'], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Link', 'Unlink'], ["Maximize", "Image"]] }) .ckeditor(function () { ISSportingEventEdit.DataForForm = ISSportingEventEdit.GetDataFromForm(); $('.edit-sportingevent-popup').show(); }); $(".edit-sportingevent-form #DateStart").datepicker({ addClass: 'edit-person', language: "ru", format: "dd.mm.yyyy", onRender: function (date) { return ''; } }).on('changeDate', function (ev) { var e2 = $(".edit-sportingevent-form #DateEnd").val() == ""; var dtDateEnd = $(".edit-sportingevent-form #DateEnd").datepicker('getDate'); if (dtDateEnd == 'Invalid Date') { dtDateEnd = new Date(); } if (ev.date.valueOf() > dtDateEnd.valueOf() || e2) { var newDate = new Date(ev.date) newDate.setDate(newDate.getDate()); $(".edit-sportingevent-form #DateEnd").datepicker('setDate', newDate); $(".edit-sportingevent-form #DateEnd").data('datepicker').setValue(newDate); } else { var newDate = new Date($(".edit-sportingevent-form #DateEnd").data('datepicker').date) $(".edit-sportingevent-form #DateEnd").data('datepicker').setValue(newDate); } if ("days" == ev.viewMode) $(".edit-sportingevent-form #DateStart").data('datepicker').hide(); if (e2) { var newDate = new Date(ev.date) newDate.setDate(newDate.getDate()); $(".edit-sportingevent-form #DateEnd").datepicker({ defaultDate: newDate }); $(".edit-sportingevent-form #DateEnd").val(''); } }).data('datepicker'); $(".edit-sportingevent-form #DateEnd").datepicker({ addClass: 'edit-person', language: "ru", format: "dd.mm.yyyy", onRender: function (date) { return date.valueOf() < $(".edit-sportingevent-form #DateStart").datepicker('getDate').valueOf() ? 'disabled' : ''; //return date.valueOf() < $(".edit-sportingevent-form #DateStart").data('datepicker').date.valueOf() ? 'disabled' : ''; } }).on('changeDate', function (ev) { if ("days" == ev.viewMode) $(".edit-sportingevent-form #DateEnd").data('datepicker').hide(); }).data('datepicker'); /* $(".edit-sportingevent-form #DateStart, .edit-sportingevent-form #DateEnd") .datepicker({ addClass: 'edit-person', language: "ru", format: "dd.mm.yyyy" }); */ $('.edit-sportingevent-form .form-actions a.button').unbind('click'); $('.edit-sportingevent-form .form-actions a.button').click(function () { ISSportingEventEdit.Save(); return false; }); $(".edit-sportingevent-form .control-group.upload-photo #fileupload").unbind('change'); $(".edit-sportingevent-form .control-group.upload-photo #fileupload").change(function () { $('.edit-sportingevent-form').ajaxSubmit({ url: '/ajax/uploadsportingevent', success: function (d) { if ('yes' == d.Result) { $('.control-group.upload-photo #Logo').val(d.FileNameGuid); $('.control-group.upload-photo #FileName').val(d.FileName); $(".control-group.upload-photo .controls.image").html('
'); } else if (d.Message != null && d.Message != '') $(".edit-sportingevent-form .control-group.upload-photo .messages").text(d.Message); } }); }); $('.edit-sportingevent-popup .heading .messages a').unbind('click'); $('.edit-sportingevent-popup .heading .messages a').click(function () { $('.registration-sportingevent-popup').css({ top: $(window).scrollTop() }); $('.registration-sportingevent-popup').css({ 'z-index': '1200' }); $('.registration-sportingevent-popup').show(); $('.registration-sportingevent-popup .inside_popup').hide(); $('.registration-sportingevent-popup .mesageforremove').show(); return false; }); $('.edit-sportingevent-popup #SportsIdsList').change(function () { if ($(this).val()) { $.ajax({ url: "/ajax/filteredbysports?v=" + ISCommon.GetV(), data: { filter: JSON.stringify($(this).val()) }, success: function (d) { var selected = $("#DisciplinesIdsList").val(); $("#DisciplinesIdsList").empty(); $.each(d, function () { if ($.inArray(this.Id.toString(), selected) > -1) $("#DisciplinesIdsList").append($("