| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/leo/application/plugins/module_imobles/assets/js/ |
Upload File : |
/* global bootbox, ind_decimal */
var _url = $("#_url").val();
var heightOrig;
var widthOrig;
var pendingCrop = false;
$(function () {
findDataSelect("#filterTags", 'module_imobles/ajax/tags_' + $("#type_form").val(), '');
$('#filterTags').on('change', function (event) {
event.preventDefault();
$('#form-filter').submit();
});
$(".edit_image").click(function (e) {
var type = $(this).data("type");
e.preventDefault();
var $modal = $('#ajax-modal-images');
$modal.load(_url + 'module_imobles/enterprises/editImage/' + $(this).data("id"), function () {
$modal.modal();
heightOrig = parseInt($("#height").val());
widthOrig = parseInt($("#width").val());
$("#sizecrop").on("change", function (e) {
if ($(this).val() == -1) {
$(".area_crop_insert").removeClass("hide");
} else if ($(this).val() == 0) {
$(".area_crop_insert").addClass("hide");
$(".cropImgWrapper").css('width', parseInt(widthOrig) + "px");
cropperHeader.objW = parseInt(widthOrig);
pendingCrop = false;
cropperHeader.objH = parseInt(heightOrig);
$(".cropImgWrapper").css('height', parseInt(heightOrig) + "px");
} else {
$(".area_crop_insert").addClass("hide");
var wid = $("#sizecrop option:selected").data("width");
var heig = $("#sizecrop option:selected").data("height");
if (parseInt(wid) < widthOrig) {
$(".cropImgWrapper").css('width', parseInt(wid) + "px");
cropperHeader.objW = parseInt(wid);
pendingCrop = true;
}
if (parseInt(heig) < heightOrig) {
cropperHeader.objH = parseInt(heig);
$(".cropImgWrapper").css('height', parseInt(heig) + "px");
pendingCrop = true;
}
}
});
$("#width").on("blur", function (e) {
if (parseInt($(this).val()) < widthOrig) {
$(".cropImgWrapper").css('width', parseInt($(this).val()) + "px");
cropperHeader.objW = parseInt($(this).val());
pendingCrop = true;
} else {
$(this).val(widthOrig);
}
});
$(".cropControlCrop").on("click", function (e) {
pendingCrop = true;
});
$("#height").on("blur", function (e) {
if (parseInt($(this).val()) < heightOrig) {
$(".cropImgWrapper").css('height', parseInt($(this).val()) + "px");
cropperHeader.objH = parseInt($(this).val());
pendingCrop = true;
} else {
$(this).val(heightOrig);
}
});
$("#mark_water").bootstrapToggle();
$('.number').mask("9?9");
$('.size').mask("9?999");
tinymce.init({
selector: "#description",
menubar: false,
toolbar: "bold",
statusbar: false,
force_br_newlines: false,
force_p_newlines: false,
forced_root_block: '',
setup: function (editor) {
editor.on('change', function () {
tinymce.triggerSave();
});
},
});
findDataSelect("#ajax-modal-images #tags", 'module_imobles/ajax/tags_' + type, '');
var cropperOptions = {
cropUrl: _url + 'sys_imgcrop/crop_temp/',
outputUrlId: "new_image",
loadPicture: $("#image_orig").val(),
rotateControls: false,
onReset: resetCrop,
onAfterImgCrop: cropImg,
}
cropperHeader = new Croppic('img-cropie', cropperOptions);
});
});
function cropImg() {
heightOrig = ($("#height").val());
widthOrig = ($("#width").val());
pendingCrop = false;
}
function resetCrop() {
($("#height").val(heightOrig));
($("#width").val(widthOrig));
pendingCrop = false;
}
$('#ajax-modal-images').bind('hidden', function () {
tinymce.remove();
});
$('body').on('click', '.submit_edit_image', function () {
if (pendingCrop) {
toastr.error("E necessário realizar ou cancelar o crop da imagem");
return;
}
$.post(_url + "module_imobles/enterprises/postEditImage/" + $(this).data("type"), $("#form-post-edit-image").serialize())
.done(function (data) {
location.reload();
});
});
//tag backend
var _msg_add_new_enterprise_img_backend_tags = $("#_msg_add_new_enterprise_img_backend_tags").val();
var _msg_enterprise_img_backend_tags_name = $("#_msg_enterprise_img_backend_tags_name").val();
var _msg_edit = $("#_msg_edit").val();
var _msg_ok = $("#_msg_ok").val();
var _msg_cancel = $("#_msg_cancel").val();
var ib_form_bootboxboxbackend = "<form class=\"form-horizontal push-10\" method=\"post\" onsubmit=\"return false;\">\n <div class=\"form-enterprise_img_backend_tags row\">\n <div class=\"col-xs-12\">\n <div class=\"form-material floating\">\n <input class=\"form-control\" enterprise_img_backend_tags=\"text\" id=\"enterprise_img_backend_tags_name\" name=\"enterprise_img_backend_tags_name\">\n <label for=\"enterprise_img_backend_tags_name\">" + _msg_enterprise_img_backend_tags_name + "</label>\n </div>\n </div>\n </div>\n\n</form>";
var boxbackend;
var cropperHeader;
$('body').on('click', "#add_new_enterprise_img_backend_tags", function (e) {
e.preventDefault();
boxbackend = bootbox.dialog({
title: _msg_add_new_enterprise_img_backend_tags,
message: ib_form_bootboxboxbackend,
buttons: {
success: {
label: $("#_msg_save").val(),
className: "btn-primary",
callback: function () {
var enterprise_img_backend_tags_name_val = $('#enterprise_img_backend_tags_name').val();
$.post(_url + "module_imobles/enterpriseimgtagsbackend/post/", {name: enterprise_img_backend_tags_name_val})
.done(function (data) {
if (data == 'OK') {
toastr.success("Tag adicionada");
// location.reload();
} else {
bootbox.alert(data);
}
});
}
}
},
show: false
}
);
boxbackend.modal('show');
boxbackend.on("shown.bs.modal", function () {
var enterprise_img_backend_tags_name = $('#enterprise_img_backend_tags_name');
setTimeout(function () {
enterprise_img_backend_tags_name.focus();
}, 1000);
});
});
//box listing
var _msg_add_new_enterprise_img_listing_tags = $("#_msg_add_new_enterprise_img_listing_tags").val();
var _msg_enterprise_img_listing_tags_name = $("#_msg_enterprise_img_listing_tags_name").val();
var _msg_edit = $("#_msg_edit").val();
var _msg_ok = $("#_msg_ok").val();
var _msg_cancel = $("#_msg_cancel").val();
var ib_form_bootbox = "<form class=\"form-horizontal push-10\" method=\"post\" onsubmit=\"return false;\">\n <div class=\"form-enterprise_img_listing_tags row\">\n <div class=\"col-xs-12\">\n <div class=\"form-material floating\">\n <input class=\"form-control\" enterprise_img_listing_tags=\"text\" id=\"enterprise_img_listing_tags_name\" name=\"enterprise_img_listing_tags_name\">\n <label for=\"enterprise_img_listing_tags_name\">" + _msg_enterprise_img_listing_tags_name + "</label>\n </div>\n </div>\n </div>\n\n</form>";
var box;
$('body').on('click', "#add_new_enterprise_img_listing_tags", function (e) {
e.preventDefault();
box = bootbox.dialog({
title: _msg_add_new_enterprise_img_listing_tags,
message: ib_form_bootbox,
buttons: {
success: {
label: $("#_msg_save").val(),
className: "btn-primary",
callback: function () {
var enterprise_img_listing_tags_name_val = $('#enterprise_img_listing_tags_name').val();
$.post(_url + "module_imobles/enterpriseimgtagslisting/post/", {name: enterprise_img_listing_tags_name_val})
.done(function (data) {
if (data == 'OK') {
toastr.success("Tag adicionada com sucesso")
} else {
bootbox.alert(data);
}
});
}
}
},
show: false
}
);
box.modal('show');
box.on("shown.bs.modal", function () {
var enterprise_img_listing_tags_name = $('#enterprise_img_listing_tags_name');
setTimeout(function () {
enterprise_img_listing_tags_name.focus();
}, 1000);
});
});
$(".edit_tags_lot").click(function (e) {
e.preventDefault();
$.post(_url + "module_imobles/enterprises/editTags", $(".img_selected").serialize())
.done(function (data) {
var $modal = $('#ajax-modal');
$modal.html(data);
$modal.modal();
findDataSelect("#tags-add-modal", 'module_imobles/ajax/tags_' + $("#type_form").val(), '');
});
});
$('body').on("click", '.submit_edit_image_tags_selected', function () {
if ($(".img_selected:checked").length == 0) {
toastr.error(_L['module imobles select one image']);
return;
}
$.post(_url + "module_imobles/enterprises/saveEditTags", $("#form-post-edit-image-tags").serialize())
.done(function (data) {
location.reload();
});
});
$(".select_all").click(function (e) {
e.preventDefault();
$('.img_selected').prop('checked', true);
});
});
function confirmDeleteImageLot() {
if ($(".img_selected:checked").length == 0) {
toastr.error(_L['module imobles select one image']);
return;
}
var dialog = bootbox.confirm({
message: _L['module_imobles Delete Images?'],
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$.post(_url + "module_imobles/enterprises/deleteImageLot", $(".img_selected").serialize())
.done(function (data) {
if (data == "OK") {
$(".img_selected:checked").each(function () {
$(".div_image_" + $(this).val()).remove();
});
toastr.success(_L['module_imobles images delete success']);
} else {
var body = $("html, body");
body.animate({scrollTop: 0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
}
function confirmDeleteImage(id) {
var dialog = bootbox.confirm({
message: _L['module_imobles Delete Image?'],
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$.post(_url + "module_imobles/enterprises/deleteImage", {id: id})
.done(function (data) {
if (data == "OK") {
$(".div_image_" + id).remove();
toastr.success(_L['module_imobles image delete success']);
} else {
var body = $("html, body");
body.animate({scrollTop: 0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
}
function uploadArquivo() {
$.ajax(
{
type: 'POST',
url: $("#_url").val() + "module_imobles/enterprises/postImages",
data: new FormData($("#form-enterprises-images")[0]),
processData: false,
contentType: false,
success: function (data) {
// if (data == "OK") {
location.reload();
// } else {
// var body = $("html, body");
// body.animate({scrollTop: 0}, '1000', 'swing');
// $("#emsgbody").html(data);
// $("#emsg").show("slow");
// }
}
});
}
function uploadReplaceFile() {
$.ajax({
type: 'POST',
url: $("#_url").val() + "module_imobles/enterprises/postReplaceImages",
data: new FormData($("#form-replace-images")[0]),
processData: false,
contentType: false,
success: function (data) {
location.reload();
}
});
}