724 lines
23 KiB
JavaScript
724 lines
23 KiB
JavaScript
|
|
$(document).ready(function () {
|
||
|
|
|
||
|
|
$("#block-images-container input[type='file']").change(function(){
|
||
|
|
$("#block-images-container").css({"background":"url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
if(!$("iframe").is("[name='upload-block-images-frame']")) {
|
||
|
|
$("#block-images-form").append('<iframe name="upload-block-images-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#block-images-form").attr("target","upload-block-images-frame");
|
||
|
|
$("#block-images-form").attr("action","/admin/ajax/uploadBlockImages.php");
|
||
|
|
$("#block-images-form").submit();
|
||
|
|
$("#block-images-container input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.deleteBlockImage', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
var that = $(this);
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/deleteBlockImage.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
that.parent().remove();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
//Ожидание-реальность
|
||
|
|
$("#block-real-images-container input[type='file']").change(function(){
|
||
|
|
$("#block-real-images-container").css({"background":"url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
if(!$("iframe").is("[name='upload-block-real-images-frame']")) {
|
||
|
|
$("#block-real-images-form").append('<iframe name="upload-block-real-images-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#block-real-images-form").attr("target", "upload-block-real-images-frame");
|
||
|
|
$("#block-real-images-form").attr("action","/admin/ajax/uploadBlockRealImages.php");
|
||
|
|
$("#block-real-images-form").submit();
|
||
|
|
$("#block-real-images-container input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
//Ход строительства (фото)
|
||
|
|
$("#block-progress-images-container input[type='file']").change(function(){
|
||
|
|
$("#block-progress-images-container").css({"background":"url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
if(!$("iframe").is("[name='upload-block-progress-images-frame']")) {
|
||
|
|
$("#block-progress-images-form").append('<iframe name="upload-block-progress-images-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#block-progress-images-form").attr("target", "upload-block-progress-images-frame");
|
||
|
|
$("#block-progress-images-form").attr("action","/admin/ajax/uploadBlockProgressImages.php");
|
||
|
|
$("#block-progress-images-form").submit();
|
||
|
|
$("#block-progress-images-container input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
//Изображения для Видео
|
||
|
|
$('body').on ('change', ".block-video-images-container input[type='file']", function(){
|
||
|
|
var id = $(this).data("id");
|
||
|
|
$("#block-video-images-container_"+id).css({"background":"url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
if(!$("#block-video-images-form_"+id+" iframe").is("[name='upload-block-video-images-frame']")) {
|
||
|
|
$("#block-video-images-form_"+id).append('<iframe name="upload-block-video-images-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#block-video-images-form_"+id).attr("target", "upload-block-video-images-frame");
|
||
|
|
$("#block-video-images-form_"+id).attr("action","/admin/ajax/uploadBlockVideoImages.php");
|
||
|
|
$("#block-video-images-form_"+id).submit();
|
||
|
|
$("#block-video-images-container_"+id+" input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
//Рекомендованные видео
|
||
|
|
$('body').on('change', ".recommended_video", function(){
|
||
|
|
var id = $(this).data("id");
|
||
|
|
var recommended = 0;
|
||
|
|
if($(this).prop('checked')){
|
||
|
|
recommended = 1;
|
||
|
|
}
|
||
|
|
$.post("/admin/ajax/update_recommended_video.php", {video_id: id, recommended: recommended}, function(res){
|
||
|
|
console.log(res);
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
$("body").on('click', '.goToRootDocsFolder', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
var target_id = $(this).attr('data-targetid');
|
||
|
|
var target_type = $(this).attr('data-targettype');
|
||
|
|
|
||
|
|
var markupToUpdate = "documentsContent" + target_type;
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/updateFiles.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"target_type": target_type,
|
||
|
|
"target_id": target_id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$('#' + markupToUpdate).html(data);
|
||
|
|
$(".doc-loader").css({"background": ""});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.deleteDocsFolder, .deleteDocsFile', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var target_id = $(this).attr('data-targetid');
|
||
|
|
var target_type = $(this).attr('data-targettype');
|
||
|
|
var doc_id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#deleteModal_fTargetId').val(target_id);
|
||
|
|
$('#deleteModal_fTargetType').val(target_type);
|
||
|
|
$('#deleteModal_fid').val(doc_id);
|
||
|
|
|
||
|
|
$("#delete_confirm_bg").fadeIn(500);
|
||
|
|
|
||
|
|
$("#delete_confirm").toggle(10);
|
||
|
|
|
||
|
|
$("body").addClass("lock");
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.towork', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/reservationToWork.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.sell', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/reservationSell.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.remove', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/reservationDelete.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.cancel', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/reservationCancel.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.admin-view-reservation', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationForm.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$("#flat-booking").html(data);
|
||
|
|
$("#flat-booking__bg").fadeIn(500);
|
||
|
|
$("#flat-booking").toggle(10);
|
||
|
|
$("body").addClass("lock");
|
||
|
|
$('#action_loader_' + id).hide();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.admin-note-reservation', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationNote.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$("#saveReservationNote").attr('data-id', id);
|
||
|
|
$("#reservation_note").val(data);
|
||
|
|
$("#note_data_bg").fadeIn(500);
|
||
|
|
$("#note_data").toggle(10);
|
||
|
|
$("body").addClass("lock");
|
||
|
|
$('#action_loader_' + id).hide();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '#saveReservationNote', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
var note = $("#reservation_note").val();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/saveReservationNote.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id,
|
||
|
|
"note": note
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
hideNoteDataMessage();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '#viewAdminApartmentsButton', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
var num = $(this).attr('data-flatnum');
|
||
|
|
|
||
|
|
openReservationFlat(id, num);
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.update-block-from-fs', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#action_loader_' + id).show();
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/copyDataFromFlatshop.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"blockId": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$('#action_loader_' + id).hide();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
function openReservationFlat(reservationId, flatNum) {
|
||
|
|
$('#flat_info_tab').html('<div class="preloader" style="height: 26px; width: 26px;"></div>');
|
||
|
|
$('#block_info_tab').html('<div class="preloader" style="height: 26px; width: 26px;"></div>');
|
||
|
|
$('#conditions_info_tab').html('<div class="preloader" style="height: 26px; width: 26px;"></div>');
|
||
|
|
$('#banks_info_tab').html('<div class="preloader" style="height: 26px; width: 26px;"></div>');
|
||
|
|
$('#docs_info_tab').html('<div class="preloader" style="height: 26px; width: 26px;"></div>');
|
||
|
|
$('#flat_info_tab .preloader').css({"background":"url(/images/ajax_preloader.gif) no-repeat center center", "background-size": "26px 26px"});
|
||
|
|
$('#block_info_tab .preloader').css({"background":"url(/images/ajax_preloader.gif) no-repeat center center", "background-size": "26px 26px"});
|
||
|
|
$('#conditions_info_tab .preloader').css({"background":"url(/images/ajax_preloader.gif) no-repeat center center", "background-size": "26px 26px"});
|
||
|
|
$('#banks_info_tab .preloader').css({"background":"url(/images/ajax_preloader.gif) no-repeat center center", "background-size": "26px 26px"});
|
||
|
|
$('#docs_info_tab .preloader').css({"background":"url(/images/ajax_preloader.gif) no-repeat center center", "background-size": "26px 26px"});
|
||
|
|
$("#flat_modal_title").html("Квартира №" + flatNum);
|
||
|
|
|
||
|
|
$("#flatModalTabs").jwTabs();
|
||
|
|
$("#flat__bg").fadeIn(500);
|
||
|
|
$("#flat").toggle(10);
|
||
|
|
$("body").addClass("lock");
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationFlatInfoTabData.php?id='+reservationId,
|
||
|
|
success:function(data) {
|
||
|
|
$('#flat_info_tab').html(data);
|
||
|
|
$('.flat-flat-plan, .flat-etag-plan').viewer(
|
||
|
|
{
|
||
|
|
navbar: false,
|
||
|
|
toolbar : false,
|
||
|
|
rotatable : false,
|
||
|
|
scalable : false,
|
||
|
|
transition : false,
|
||
|
|
keyboard : false,
|
||
|
|
zIndex: 100000
|
||
|
|
});
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationBlockInfoTabData.php?id='+reservationId,
|
||
|
|
success:function(data) {
|
||
|
|
$('#block_info_tab').html(data);
|
||
|
|
$('#block_info_tab .fotorama').fotorama();
|
||
|
|
ymaps.ready(onYandexMapInit);
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationFlatConditionsTabData.php?id='+reservationId,
|
||
|
|
success:function(data) {
|
||
|
|
$('#conditions_info_tab').html(data);
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationBlockBanksInfoTabData.php?id='+reservationId,
|
||
|
|
success:function(data) {
|
||
|
|
$('#banks_info_tab').html(data);
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationBlockDocumentsInfoTabData.php?id='+reservationId,
|
||
|
|
success:function(data) {
|
||
|
|
$('#docs_info_tab').html(data);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
$("body").on('click', '.reservationUser', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/getReservationUserData.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$('#user_data_block').html(data);
|
||
|
|
$("#user_data_bg").fadeIn(500);
|
||
|
|
$("#user_data").toggle(10);
|
||
|
|
$("body").addClass("lock");
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.switch-newbuildings', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/switchAgencyNewbuildings.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.switch-wazzap', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/switchAgencyWazzap.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"id": id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
window.location.reload(true);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.closer', function(e){
|
||
|
|
|
||
|
|
if ($(this).hasClass('event-modal-closer')) {
|
||
|
|
$("#flat-booking").hide(10);
|
||
|
|
$("#flat-booking__bg").hide(10);
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
}
|
||
|
|
|
||
|
|
return false;
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.goToDocsFolder', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
var target_id = $(this).attr('data-targetid');
|
||
|
|
var target_type = $(this).attr('data-targettype');
|
||
|
|
var dir_id = $(this).attr('data-dirid');
|
||
|
|
|
||
|
|
var markupToUpdate = "documentsContent" + target_type;
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/updateFiles.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"target_type": target_type,
|
||
|
|
"target_id": target_id,
|
||
|
|
"dir_id": dir_id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
$('#' + markupToUpdate).html(data);
|
||
|
|
$(".doc-loader").css({"background": ""});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$("body").on('click', '.renameDocsFolder, .renameDocsFile', function (e) {
|
||
|
|
e.stopPropagation();
|
||
|
|
|
||
|
|
var target_id = $(this).attr('data-targetid');
|
||
|
|
var target_type = $(this).attr('data-targettype');
|
||
|
|
var doc_id = $(this).attr('data-id');
|
||
|
|
var name = $(this).attr('data-name');
|
||
|
|
|
||
|
|
$('#doc_target_id').val(target_id);
|
||
|
|
$('#doc_target_type').val(target_type);
|
||
|
|
$('#doc_id').val(doc_id);
|
||
|
|
$('#newDocName').val(name);
|
||
|
|
|
||
|
|
$("#renameDoc_bg").fadeIn(500);
|
||
|
|
|
||
|
|
$("#renameDoc").toggle(10);
|
||
|
|
|
||
|
|
$("body").addClass("lock");
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#renameSaveButton').click(function () {
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
var target_id = $('#doc_target_id').val();
|
||
|
|
var target_type = $('#doc_target_type').val();
|
||
|
|
var doc_id = $('#doc_id').val();
|
||
|
|
var name = $('#newDocName').val();
|
||
|
|
|
||
|
|
var markupToUpdate = "documentsContent" + target_type;
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/renameDocument.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"target_type": target_type,
|
||
|
|
"target_id": target_id,
|
||
|
|
"doc_id": doc_id,
|
||
|
|
"name": name
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
hideRename();
|
||
|
|
$('#' + markupToUpdate).html(data);
|
||
|
|
$(".doc-loader").css({"background": ""});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#deleteMessageButton').click(function () {
|
||
|
|
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
var target_id = $('#deleteModal_fTargetId').val();
|
||
|
|
var target_type = $('#deleteModal_fTargetType').val();
|
||
|
|
var doc_id = $('#deleteModal_fid').val();
|
||
|
|
|
||
|
|
var markupToUpdate = "documentsContent" + target_type;
|
||
|
|
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/deleteDocument.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"target_type": target_type,
|
||
|
|
"target_id": target_id,
|
||
|
|
"doc_id": doc_id
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
hideDeleteMessage();
|
||
|
|
$('#' + markupToUpdate).html(data);
|
||
|
|
$(".doc-loader").css({"background": ""});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#upload-docs-button').click(function () {
|
||
|
|
document.getElementById('upload-docs-button').disabled = true;
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
if (!$("iframe").is("[name='upload-doc-frame']")) {
|
||
|
|
$("#upload-docs-form").append('<iframe name="upload-doc-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#upload-docs-form").attr("target", "upload-doc-frame");
|
||
|
|
$("#upload-docs-form").attr("action", "/admin/loadBlockFiles.php");
|
||
|
|
$("#upload-docs-form").submit();
|
||
|
|
$("#upload-docs-form input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#upload-progress-button').click(function () {
|
||
|
|
document.getElementById('upload-docs-button').disabled = true;
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
if (!$("iframe").is("[name='upload-progress-frame']")) {
|
||
|
|
$("#upload-progress-form").append('<iframe name="upload-progress-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#upload-progress-form").attr("target", "upload-progress-frame");
|
||
|
|
$("#upload-progress-form").attr("action", "/admin/loadBlockFiles.php");
|
||
|
|
$("#upload-progress-form").submit();
|
||
|
|
$("#upload-progress-form input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#upload-plus-button').click(function () {
|
||
|
|
document.getElementById('upload-docs-button').disabled = true;
|
||
|
|
$(".doc-loader").css({"background": "url(/images/ajax_preloader.gif) center center no-repeat"});
|
||
|
|
|
||
|
|
if (!$("iframe").is("[name='upload-plus-frame']")) {
|
||
|
|
$("#upload-plus-form").append('<iframe name="upload-plus-frame"></iframe>');
|
||
|
|
}
|
||
|
|
$("#upload-plus-form").attr("target", "upload-plus-frame");
|
||
|
|
$("#upload-plus-form").attr("action", "/admin/loadBlockFiles.php");
|
||
|
|
$("#upload-plus-form").submit();
|
||
|
|
$("#upload-plus-form input[type='file']").prop('value', "");
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#createFolderButton, #createProgressFolderButton, #createPlusFolderButton').click(function () {
|
||
|
|
var target_id = $(this).attr('data-targetid');
|
||
|
|
var target_type = $(this).attr('data-targettype');
|
||
|
|
var dir_id = $(this).attr('data-id');
|
||
|
|
|
||
|
|
$('#newFolderError').html("");
|
||
|
|
$('#newFolderName').val("");
|
||
|
|
|
||
|
|
$("#newFolder_bg").fadeIn(500);
|
||
|
|
|
||
|
|
$("#newFolder").toggle(10);
|
||
|
|
|
||
|
|
$("body").addClass("lock");
|
||
|
|
|
||
|
|
$('input[name="newFolder_target_id"]').val(target_id);
|
||
|
|
$('input[name="newFolder_target_type"]').val(target_type);
|
||
|
|
$('input[name="newFolder_dir_id"]').val(dir_id);
|
||
|
|
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
$('#newFolderSaveButton').click(function () {
|
||
|
|
var target_id = $('input[name="newFolder_target_id"]').val();
|
||
|
|
var target_type = $('input[name="newFolder_target_type"]').val();
|
||
|
|
var dir_id = $('input[name="newFolder_dir_id"]').val();
|
||
|
|
|
||
|
|
var name = $('#newFolderName').val();
|
||
|
|
|
||
|
|
var markupToUpdate = "documentsContent" + target_type;
|
||
|
|
|
||
|
|
if (name && $.trim(name)) {
|
||
|
|
$('#newFolderError').html("");
|
||
|
|
$.ajax({
|
||
|
|
url: '/admin/ajax/createFolder.php',
|
||
|
|
method: "post",
|
||
|
|
data: {
|
||
|
|
"dir_id": dir_id,
|
||
|
|
"target_type": target_type,
|
||
|
|
"target_id": target_id,
|
||
|
|
"name": name
|
||
|
|
},
|
||
|
|
success: function (data) {
|
||
|
|
hideFileFolderName();
|
||
|
|
$('#' + markupToUpdate).html(data);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
$('#newFolderError').html("Необходимо ввести название новой папки");
|
||
|
|
}
|
||
|
|
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
$('body').on('click', '#metategs_block .medium-button', function(){
|
||
|
|
var param = {};
|
||
|
|
|
||
|
|
param.block_meta_id = $('#block_meta_id').val();
|
||
|
|
param.title = $('#titlezhk').val();
|
||
|
|
param.description = $('#desc_block').val();
|
||
|
|
param.keywords = $('#keywords_block').val();
|
||
|
|
|
||
|
|
$.post("/admin/ajax/block_meta_save.php", param, function(res){
|
||
|
|
//console.log(res);
|
||
|
|
if(res == 1){
|
||
|
|
$('#metategs_block .block').text("Сохранено!");
|
||
|
|
} else {
|
||
|
|
$('#metategs_block .block').text(res);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
function hideFileFolderName() {
|
||
|
|
|
||
|
|
$("#newFolder_bg").hide(10);
|
||
|
|
|
||
|
|
$("#newFolder").hide(10);
|
||
|
|
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function hideNoteDataMessage() {
|
||
|
|
|
||
|
|
$("#note_data_bg").hide(10);
|
||
|
|
|
||
|
|
$("#note_data").hide(10);
|
||
|
|
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
}
|
||
|
|
|
||
|
|
function hideRename() {
|
||
|
|
|
||
|
|
$("#renameDoc_bg").hide(10);
|
||
|
|
|
||
|
|
$("#renameDoc").hide(10);
|
||
|
|
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function hideDeleteMessage() {
|
||
|
|
|
||
|
|
$("#delete_confirm_bg").hide(10);
|
||
|
|
|
||
|
|
$("#delete_confirm").hide(10);
|
||
|
|
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
function hideUserDataMessage() {
|
||
|
|
$("#user_data_bg").hide(10);
|
||
|
|
|
||
|
|
$("#user_data").hide(10);
|
||
|
|
|
||
|
|
$("body").removeClass("lock");
|
||
|
|
}
|