| Server IP : 162.214.74.102 / Your IP : 216.73.217.46 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 _L */
var _url = $("#_url").val();
$(function () {
$("#type_id").select2({
theme: "bootstrap",
placeholder: '',
});
$('body').on("change", '#type_id', function (event) {
$(".linha_listing").addClass("hide");
var mostra = true;
$("#type_id option:selected").each(function (event) {
if ($(this).val() != null) {
$(".type_unity_" + $(this).val()).removeClass("hide");
mostra = false;
}
});
if (mostra) {
$(".linha_listing").removeClass("hide");
}
});
$('body').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);
}
});
$('body').find('.check_all_serach_listing').on("click", function (event) {
if ($("#check_all_serach_listing").prop("checked") == true) {
$("#check_all_serach_listing").prop("checked", false);
$('body').find(".all_check_listing").prop("checked", false);
} else {
$("#check_all_serach_listing").prop("checked", true);
$('body').find(".all_check_listing").prop("checked", true);
}
});
$('body').find('#finish_review').on("click", function (event) {
var id = $(this).data("proposal-id");
bootbox.dialog({
message: _L['module imobles confirm finish review'],
buttons: {
'cancel': {
label: "Cancelar"
},
'confirm': {
label: "Confirmo",
callback: function () {
$('#listing_view_processing').show();
$.post(_url + "module_imobles/proposal/finsihReview", {proposal_id: id})
.done(function (data) {
location.reload();
});
}
}
}
});
});
$('body').find('#estimate').on("click", function (event) {
event.preventDefault();
var selecionados = false;
$("#form_send_data").html("");
$("#form_send_data").append(
'<input type="hidden" name="type" value="listing">');
$('body').find(".all_check_listing:checked").each(function (event) {
if ($(this).data('estimate') == 1) {
selecionados = true;
$("#form_send_data").append(
'<input type="hidden" name="id[]" value="' + $(this).data('id') + '">'
);
}
});
if (selecionados) {
$("#form_send_data").append(
'<input type="hidden" name="proposal_id" value="' + $(this).data('proposal-id') + '">'
);
$.post(_url + "module_imobles/proposal/estimateView", $("#form_send_data").serialize())
.done(function (data) {
$("body").unblock();
$("#form_send_data").html("");
var ajaxModal2 = $('#ajax-modal');
ajaxModal2.html(data);
ajaxModal2.modal();
ajaxModal2.find('#submit-estimate-listing').on("click", function (event) {
$("body").block({message: block_msg});
$.post(_url + "module_imobles/proposal/postEstimate", $("#estimate_view").serialize())
.done(function (data) {
$("body").unblock();
var data = JSON.parse(data);
ajaxModal2.modal("hide");
// window.location.replace(_url + "module_imobles/listings/listAll/");
toastr.success(data.msg);
//chamada para limpar msg
$('body').find(".all_check_listing:checked").each(function (e) {
if ($(this).data('estimate') == 1) {
$(".td_" + $(this).data("id")).attr("data-content", data.obs);
$(".td_" + $(this).data("id")).attr("data-title", data.review_desc);
$(".td_" + $(this).data("id")).html(data.review_desc);
$(this).data('estimate', 0);
}
});
});
});
});
} else {
toastr.error(_L['select one listing not estimate']);
}
});
$('body').find('#review_listings').on("click", function (event) {
event.preventDefault();
var selecionados = false;
$("#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('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 ajaxModal2 = $('#ajax-modal');
ajaxModal2.html(data);
ajaxModal2.modal();
ajaxModal2.find("#other_id").select2({
theme: "bootstrap",
placeholder: '',
});
ajaxModal2.find('#submit-review-enteprise').on("click", function (event) {
$("body").block({message: block_msg});
//VERIFICA PARA ADICIONAR O ID DO SELECIONADO AQUI
val = "";
if (ajaxModal2.find('.entreprise_radio_selected:checked').val() >= 1) {
val = ajaxModal2.find('.entreprise_radio_selected:checked').val();
}
if (ajaxModal2.find('.entreprise_radio_selected:checked').val() == -1) {
if (ajaxModal2.find('#other_id').val() > 0) {
val = ajaxModal2.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);
ajaxModal2.modal("hide");
// window.location.replace(_url + "module_imobles/listings/listAll/");
toastr.success(data.msg);
//chamada para limpar msg
$.get($("#_url").val() + 'module_imobles/ajax/view', function (j) {
});
});
});
ajaxModal2.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']);
}
});
$('body').find('.msg_whats_listing').on("click", function (event)
{
// var _msg_whats = $("#_msg_whats").val();
var _msg_whats = "Olá, tudo bem? Me chamo {{USER_NAME}}, sou Consultor de Vendas na myside.com.br\n\nTenho um cliente interessado na unidade do seu anúncio:\n"
+ "{{LISTING_LINK}}\n\n"
+ "Essa unidade está disponível? Você tem interesse em uma parceria para essa venda? Grato pelo retorno! Abraço!";
var ib_form_bootbox = "<form class=\"form-horizontal push-10\" method=\"post\" onsubmit=\"return false;\">\n\
<div class=\"row\"><div class=\"col-xs-12\"><div class=\"\"><label for=\"msg_whats\"><b>" + _L['module imobles text msg whats'] + "</b></label><textarea class=\"form-control\" id=\"msg_whats\" name=\"msg_whats\" style=\"height: 225px;\">" + _msg_whats + "</textarea></div></div></div>\n\n</form>";
event.preventDefault();
var selecionados = false;
$("#form_send_msg").html("");
$('body').find(".all_check_listing:checked").each(function (event) {
selecionados = true;
$("#form_send_msg").append(
'<input type="hidden" name="id[]" value="' + $(this).data('id') + '">'
+ '<input type="hidden" name="crawler_listing_id[]" value="' + $(this).data('crawler_listing_id') + '">'
+ '<input type="hidden" name="name[]" value="' + $(this).data('name') + '">'
+ '<input type="hidden" name="whatsapp[]" value="' + $(this).data('whatsapp') + '">'
);
});
if (selecionados) {
// bootbox.dialog({
// title: "Enviar mensagem pelo Mande Um Zap",
// message: "Tem certeza que deseja enviar uma mensagem para esses anunciantes?",
// buttons: {
// 'cancel': {
// label: "Cancelar"
// },
// 'confirm': {
// label: "Enviar",
// callback: function () {
bootbox.dialog({
title: _L['module imobles text title msg whats'],
message: ib_form_bootbox,
buttons: {
cancel: {
label: $("#_msg_cancel").val(),
},
success: {
label: $("#_msg_send").val(),
className: "btn-primary",
callback: function () {
$('#listing_view_processing').show();
$("#form_send_msg").append("<textarea name='msg'>" + $("#msg_whats").val() + "</textarea>");
$.post(_url + "module_imobles/crawler/mandeUmZapListings", $("#form_send_msg").serialize())
.done(function (retorno) {
var data = JSON.parse(retorno);
if (data.status == 'ok') {
if (data.muz != undefined && data.muz.length > 0) {
for (i = 0; i < data.muz.length; i++) {
$("#form_send_msg").append(
'<input type="hidden" name="muz_msg_id_' + data.muz[i].listing_id + '" value="' + data.muz[i].muz_msg_id + '">'
);
}
}
$.post(_url + "module_imobles/typeunity/saveMandeUmZap", $("#form_send_msg").serialize())
.done(function (data) {
var data = JSON.parse(data);
if (data.status == 'ok') {
bootbox.alert(_L['send success']);
} else {
bootbox.alert(_L['fail send']);
}
});
} else {
bootbox.alert(_L['fail send']);
}
$('#listing_view_processing').hide();
});
}
}
}
});
} else {
toastr.error(_L['select one listing']);
}
});
$('body').find('#table-listing-search').DataTable({
"paging": false,
"ordering": true,
"info": false,
"filter": false,
"columnDefs": [{"targets": 0,
"orderable": false
},
{"targets": 1,
"orderable": false
},
{"targets": 7,
"orderable": false
},
{"targets": 8,
"orderable": false
}, {"targets": 9,
"orderable": false
}, ],
"language": {
"url": $("#app_url").val() + "/ui/lib/dataTables/" + $("#_lan").val() + "_1.json"
}, });
$('body').find(".popoverDetailListing").popover({
trigger: 'manual',
container: 'body',
html: true
});
$('body').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();
$(this).popover('show');
});
$(document).on('mouseleave', '.popover', function () {
$('body').find(".popover").remove();
});
$('body').find('.bxslider').bxSlider({
mode: 'horizontal',
moveSlides: 1,
slideMargin: 10,
infiniteLoop: true,
slideWidth: 215,
minSlides: 1,
maxSlides: 1,
speed: 800,
});
$('body').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;
}
}
});
});
});