| 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 : |
var _url = $("#_url").val();
function filter() {
// Situation
// $('#filter-status a').on('click', function (event) {
// event.preventDefault();
// var situation = $(this).data('val');
// $("input[name=status]").val(situation);
// $('#form-filter').submit();
// });
$('#crawler_type_id').on('change', function (event) {
event.preventDefault();
$('#form-filter').submit();
});
findDataSelect("#crawler_type_id", 'module_imobles/ajax/crawler', '');
// Advanced
$('#items_per_page').on('change', function (event) {
event.preventDefault();
var items = $(this).find('option:selected').val();
$("input[name=items_per_page]").val(items);
$('#form-filter').submit();
});
// Clear
$('#filter-clear').on('click', function (event) {
event.preventDefault();
$(".list_address").html("");
$("input[name=search]").val('');
$("input[name=status]").val('');
$("#source").val('');
$("#enterprise_type").val('');
$("#module_imobles_enterprise_standard_id").val('');
$("#clear_filter").val(1);
$('#form-filter').submit();
$("#module_imobles_enterprise_amenities").val('');
});
// $('#source').on('change', function (event) {
// event.preventDefault();
// $('#form-filter').submit();
// });
// $('#enterprise_type').on('change', function (event) {
// event.preventDefault();
// $('#form-filter').submit();
// });
//remove o endereço adicionado no bloco
$('.list_address').on('click', '.delete_address', function (event) {
$(this).parent("div").parent("div").remove();
});
$('body').on('click', '#filter-post', function (event) {
event.preventDefault();
$('#form-filter').submit();
});
$('body').on('click', '.dropdown-toggle', function (event) {
event.preventDefault();
$(".group-data").toggleClass("open");
});
$('body').on('click', '.dropdown-toggle', "keydown", function (e) {
if (e.which == 13 || e.which == 32) {
e.preventDefault();
$(".group-data").toggleClass("open");
}
});
$(".enterSubmit").on('keydown', function (event) {
if (event.keyCode == 13) {
$('#form-filter').submit();
}
});
$('#module_imobles_enterprise_amenities').on('change', function (event) {
event.preventDefault();
$('#form-filter').submit();
});
// $('#module_imobles_enterprise_standard_id').on('change', function (event) {
// event.preventDefault();
// $('#form-filter').submit();
// });
findDataSelect("#module_imobles_enterprise_standard_id", 'module_imobles/ajax/enterprise_standard', '');
findDataSelect("#module_imobles_enterprise_amenities", 'module_imobles/ajax/enterprise_amenities', '');
$('body').on('click', ".alter_enable", function (event) {
event.preventDefault();
var id = $(this).data("id");
$.post(_url + "module_imobles/enterprises/alterenable", {id: $(this).data("id"), value: $(this).data("value")})
.done(function (result) {
var data = JSON.parse(result);
if (data.status == "OK") {
toastr.success(data.msg);
$(".alter_table_" + id).toggleClass("hide");
} else {
var body = $("html, body");
body.animate({scrollTop: 0}, '1000', 'swing');
$("#emsgbody").html(data.msg);
$("#emsg").show("slow");
}
});
});
}
$(function () {
filter();
$('body').find('.select_enterprise').on("click", function (event) {
if ($("#listing_enterprise_" + $(this).data('id')).prop("checked") == true) {
$("#listing_enterprise_" + $(this).data('id')).prop("checked", false);
} else {
$("#listing_enterprise_" + $(this).data('id')).prop("checked", true);
}
});
$('body').find('.check_all_enterprise').on("click", function (event) {
if ($("#check_all_enterprise").prop("checked") == true) {
$("#check_all_enterprise").prop("checked", false);
$('body').find(".all_check_enterprise").prop("checked", false);
} else {
$("#check_all_enterprise").prop("checked", true);
$('body').find(".all_check_enterprise").prop("checked", true);
}
});
$('#table-enterprise').on('click', '.open_listing', function (event) {
event.preventDefault();
var $modal = $('#ajax-modal-listing');
$("body").block({message: block_msg});
$modal.load(_url + 'module_imobles/enterprises/data_listing/' + $(this).data("id"), '', function () {
$('body').unblock();
$modal.modal();
$modal.find('.select_listing').on("click", function (event) {
if ($("#listing_" + $(this).data('id')).prop("checked") == true) {
$("#listing_" + $(this).data('id')).prop("checked", false);
} else {
$("#listing_" + $(this).data('id')).prop("checked", true);
}
});
$modal.find('.check_all').on("click", function (event) {
if ($("#check_all").prop("checked") == true) {
$("#check_all").prop("checked", false);
$modal.find(".all_check_listing").prop("checked", false);
} else {
$("#check_all").prop("checked", true);
$modal.find(".all_check_listing").prop("checked", true);
}
});
$modal.find('.review_listings').on("click", function (event) {
event.preventDefault();
var selecionados = false;
$("#form_send_data").html("");
$('body').find(".all_check_listing:checked").each(function (event) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data('enterprise-id') + '">'
);
});
if (selecionados) {
$.post(_url + "module_imobles/typeunity/viewReviewListing", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
$("#form_send_data").html("");
$("#form_send_data").append(
'<input type="hidden" name="type" value="listing">');
$('body').find(".all_check_listing:checked").each(function (event) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data('id') + '">'
);
});
var $modal2 = $('#ajax-modal');
$modal2.html(data);
$modal2.modal();
$modal2.find("#other_id").select2({
theme: "bootstrap",
placeholder: '',
});
$modal2.find('#submit-review-enteprise').on("click", function (event) {
$("body").block({message: block_msg});
//VERIFICA PARA ADICIONAR O ID DO SELECIONADO AQUI
val = "";
if ($modal2.find('.entreprise_radio_selected:checked').val() >= 1) {
val = $modal2.find('.entreprise_radio_selected:checked').val();
}
if ($modal2.find('.entreprise_radio_selected:checked').val() == -1) {
if ($modal2.find('#other_id').val() > 0) {
val = $modal2.find('#other_id').val();
}
}
if (val != "") {
$("#form_send_data").append(
'<input type="hidden" name="enterprise_id" value="' + val + '">'
);
}
$.post(_url + "module_imobles/crawler/CheckListings", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
var data = JSON.parse(data);
$modal2.modal("hide");
toastr.success(data.msg);
});
});
$modal2.find('.table').on("click", 'td', function (event) {
if (event.target.tagName != 'INPUT' && $(this).find(".entreprise_radio_selected")) {
if ($(this).find(".entreprise_radio_selected").prop("checked") == false) {
$(this).find(".entreprise_radio_selected").prop("checked", true).trigger("change");
}
}
});
});
} else {
toastr.error(_L['select one listing']);
}
});
$modal.find(".popoverDetailListing").popover({
trigger: 'manual',
placement: 'top',
container: 'body',
html: true
});
$modal.find(".popoverDetailListing").on('show.bs.popover', function (event) {
// do something…
$('body').find(".popover").remove();
});
$(document).on('click', function (event) {
$('body').find(".popover").remove();
});
$(document).on('mouseover', '.popoverDetailListing', function () {
$('body').find(".popover").remove();
$('.popoverDetailListing_' + $(this).data("id")).popover('show');
});
$(document).on('mouseleave', '.popover', function () {
$('body').find(".popover").remove();
});
$modal.find('.bxslider').bxSlider({
mode: 'horizontal',
moveSlides: 1,
slideMargin: 10,
infiniteLoop: true,
slideWidth: 215,
minSlides: 1,
maxSlides: 1,
speed: 800,
});
$modal.find('.desactive_listing').on("click", function (event) {
event.preventDefault();
var id = $(this).data('id');
var tr = $(this).closest('tr');
var dialog = bootbox.confirm({
message: _L['module_imobles desactive listing?'] + "<br/>" + $(this).data("text"),
buttons: {
confirm: {
label: _L['Yes'],
className: "btn-primary"
},
cancel: {
label: _L['No'],
className: "btn-danger"
}
},
callback: function (result) {
if (result == true) {
$("body").block({message: block_msg});
$.post(_url + "module_imobles/typeunity/desactive_listing", {id: id})
.done(function (retorno) {
var data = JSON.parse(retorno);
$("body").unblock();
if (data.status == "OK") {
tr.remove();
datatableSearch.ajax.reload(null, false);
toastr.success(data.msg);
} else {
toastr.error(data.msg);
}
});
} else {
dialog.modal('hide');
return false;
}
}
});
});
});
});
$('body').find('#review_enterprise').on("click", function (event) {
event.preventDefault();
var selecionados = false;
$("#form_send_data").html("");
$("#form_send_data").append(
'<input type="hidden" name="type" value="enterprise">');
$('body').find(".all_check_enterprise:checked").each(function (event) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data('id') + '">'
);
});
if (selecionados) {
$.post(_url + "module_imobles/typeunity/viewReviewListing", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
var $modal2 = $('#ajax-modal');
$modal2.html(data);
$modal2.modal();
$modal2.find("#other_id").select2({
theme: "bootstrap",
placeholder: '',
});
// $modal2.find('.entreprise_radio_selected').on("change", function (event) {
// if ($(this).val() == -1) {
// $(".select_other").removeClass("hide");
// } else {
// $(".select_other").addClass("hide");
// }
// });
$modal2.find('#submit-review-enteprise').on("click", function (event) {
$("body").block({message: block_msg});
//VERIFICA PARA ADICIONAR O ID DO SELECIONADO AQUI
val = "";
if ($modal2.find('.entreprise_radio_selected:checked').val() >= 1) {
val = $modal2.find('.entreprise_radio_selected:checked').val();
}
if ($modal2.find('.entreprise_radio_selected:checked').val() == -1) {
if ($modal2.find('#other_id').val() > 0) {
val = $modal2.find('#other_id').val();
}
}
if (val != "") {
$("#form_send_data").append(
'<input type="hidden" name="enterprise_id" value="' + val + '">'
);
}
$.post(_url + "module_imobles/crawler/CheckListings", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
var data = JSON.parse(data);
console.log(data);
window.location.replace(_url + "module_imobles/listings/listAll/");
$modal2.modal("hide");
});
});
$modal2.find('.table').on("click", 'td', function (event) {
if (event.target.tagName != 'INPUT' && $(this).find(".entreprise_radio_selected")) {
if ($(this).find(".entreprise_radio_selected").prop("checked") == false) {
$(this).find(".entreprise_radio_selected").prop("checked", true).trigger("change");
}
}
});
});
} else {
toastr.error(_L['module imobles select one enterprise']);
}
});
$("#group_entreprise").click(function (event) {
event.preventDefault();
var selecionados = false;
$("body").block({message: block_msg});
$("#form_send_data").html("");
$("#table-enterprise").find(".select_enterprise:checked").each(function (event) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data("id") + '">'
);
});
if (selecionados) {
$.post(_url + "module_imobles/typeunity/viewGroupByEnterprise", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
if (data.includes("Error:")){
toastr.error(data.replace("Error:", ""));
} else {
var $modal = $('#ajax-modal');
$modal.html(data);
$modal.modal();
$modal.find("#other_id").select2({
theme: "bootstrap",
placeholder: '',
});
$modal.find('.entreprise_radio_selected').on("change", function (event) {
if ($(this).val() == -1) {
$(".select_other").removeClass("hide");
} else {
$(".select_other").addClass("hide");
}
});
$modal.find('#submit-group-enteprise').on("click", function (event) {
if ($modal.find('.entreprise_radio_selected:checked').val() == -1 || $modal.find('.entreprise_radio_selected:checked').val() > 1) {
$("body").block({message: block_msg});
$.post(_url + "module_imobles/typeunity/postGroupByEnterprise/1", $("#group_enterprises-form").serialize())
.done(function (data) {
$("body").unblock();
toastr.success(_L['module imobles group successfull']);
bottom_find = true;
location.reload();
});
} else {
toastr.error(_L['module imobles select one enterprise']);
}
});
$modal.find('.table').on("click", 'td', function (event) {
if (event.target.tagName != 'INPUT' && $(this).find(".entreprise_radio_selected")) {
if ($(this).find(".entreprise_radio_selected").prop("checked") == false) {
$(this).find(".entreprise_radio_selected").prop("checked", true).trigger("change");
}
}
});
}
});
} else {
$("body").unblock();
toastr.error(_L['module imobles select one enterprise']);
}
});
$('body').find('#delete_enterprises').on("click", function (event) {
event.preventDefault();
var selecionados = false;
$("#form_send_data").html("");
$("#form_send_data").append(
'<input type="hidden" name="type" value="enterprise">');
$('body').find(".all_check_enterprise:checked").each(function (event) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data('id') + '">'
);
});
if (selecionados) {
bootbox.dialog({
message: _L['module imobles delete enteprises'],
buttons: {
'cancel': {
label: "Cancelar"
},
'confirm': {
label: "Enviar",
callback: function () {
$('#listing_view_processing').show();
$('.table-bordered').hide();
$.post(_url + "module_imobles/enterprises/deleteEnterprisesBatch", $("#form_send_data").serialize())
.done(function (data) {
var data = JSON.parse(data);
console.log(data);
$('#listing_view_processing').hide();
$('.table-bordered').show();
toastr.success(_L['module imobles delete successfull']);
// Oculto os empreendimentos na tabela
$('body').find(".all_check_enterprise:checked").each(function (event) {
$(this).parent().parent().hide();
});
// window.location.replace(_url + "module_imobles/enterprises/listAll/");
});
}
}
}
});
} else {
toastr.error(_L['module imobles select one enterprise']);
}
});
$('body').on('click', '.alter_oruloID', function (event) {
$.post(_url + "module_imobles/enterprises/alterOruloID/", {id: $(this).data('id')})
.done(function (data) {
$("body").unblock();
var $modal = $('#ajax-modal');
$modal.html(data);
$modal.modal();
$modal.find(".integer").maskMoney({
thousands: "",
decimal: "",
precision: 0
});
$modal.find('#submit-alter_oruloID').on("click", function (event) {
$("body").block({message: block_msg});
$.post(_url + "module_imobles/enterprises/postAlterOruloID", $("#alter_enterprise-form").serialize())
.done(function (data) {
$("body").unblock();
toastr.success(_L['module imobles alter enterprise successfull'] + data);
location.reload();
$modal.modal("hide");
});
});
});
});
});