| 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 ind_mil, curr_code, ind_decimal */
$(document).ready(function ()
{
initFormTypeUnit();
});
function initFormTypeUnit() {
var _url = $("#_url").val();
$("#emsg").hide();
findDataSelect("#module_imobles_task_category_id", 'module_imobles/ajax/task_category', '');
//
// $(".decimal").maskMoney({
// thousands: ".",
// decimal: ","
// });
//
// $(".integer").maskMoney({
// thousands: "",
// decimal: "",
// precision: 0
// });
$("#submit_task").click(function (e) {
$.ajax(
{
type: 'POST',
url: _url + "module_imobles/task/post",
data: new FormData($("#form-tasks")[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");
}
}
});
});
//dropzone
//
if ($('#upload_container_attachment')[0]) {
Dropzone.autoDiscover = false;
var $ib_form_submit = $("#submit");
var ib_file = new Dropzone("#upload_container_attachment",
{
url: $("#_url").val() + "module_imobles/task/add_attach/" + $("#id").val(),
//maxFiles: 1000,
acceptedFiles: "image/*",
// autoProcessQueue: false,
maxFilesize: 5,
// acceptedFiles: 'image/*,application/pdf',
addRemoveLinks: true,
dictRemoveFile: _L["Remove"],
dictCancelUpload: _L["Cancel"],
// maxfilesexceeded: function (file) {
// toastr.error(_L["Limit 10 Files"]);
// var _ref;
// return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
// },
removedfile: function (file) {
var id = file.id;
bootbox.confirm(_L['module_imobles Delete Attach?'], function (result) {
if (result)
{
$.ajax({
type: 'POST',
url: $("#_url").val() + "module_imobles/task/delete_attach/",
data: "id=" + file.id+"&file="+file.file,
dataType: 'html'
}).done(function (data) {
//se ok remove
//remove com uma vírgula caso encontre o id
var obj = JSON.parse(data);
toastr.success(obj.msg);
if (obj.status == 'Yes') {
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}
});
}
});
}
}
);
ib_file.on("sending", function () {
$ib_form_submit.prop('disabled', true);
});
ib_file.on("success", function (file, response) {
$ib_form_submit.prop('disabled', false);
upload_resp = response;
if (upload_resp.success == 'Yes') {
$('#attachment').val(function (i, val) {
return val + (!val ? '' : ',') + upload_resp.id;
});
file.id = upload_resp.id;
file.file = upload_resp.file;
file.url = upload_resp.url;
file._downloadLink = Dropzone.createElement("<a class=\"dz-remove\" target=\"_blank\" href='" + file.url + "');\" title=\"Baixar\" ><i class=\"fa fa-eye\"></i> " + _L['View'] + "</a>");
file.previewElement.appendChild(file._downloadLink);
file.previewElement.classList.add("dz-success");
toastr.success(upload_resp.msg);
} else {
toastr.error(upload_resp.msg);
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}
});
ib_file.on("addedfile", function (file) {
//aqui para quando já tem arquivo no dropzone, para colocar o baixar
if (file.url !== undefined) {
file._downloadLink = Dropzone.createElement("<a class=\"dz-remove\" target=\"_blank\" href='" + file.url + "');\" title=\"Baixar\" ><i class=\"fa fa-eye\"></i> " + _L['View'] + "</a>");
file.previewElement.appendChild(file._downloadLink);
file.previewElement.classList.add("dz-success");
}
});
//Add existing files into dropzone arquivos existentes
for (i = 0; i < existingFiles.length; i++) {
ib_file.emit("addedfile", existingFiles[i]);
ib_file.createThumbnailFromUrl(existingFiles[i], existingFiles[i].url);
ib_file.emit("complete", existingFiles[i]);
}
}
//NOVO AMENITES
var _msg_add_new_task_amenities = $("#_msg_add_new_task_amenities").val();
var _msg_task_amenities_name = $("#_msg_task_amenities_name").val();
var _msg_edit = $("#_msg_edit").val();
var _msg_ok = $("#_msg_ok").val();
var _msg_cancel = $("#_msg_cancel").val();
var ib_form_bootbox_amenities_amenities = "<form class=\"form-horizontal push-10\" method=\"post\" onsubmit=\"return false;\">\n <div class=\"form-task_amenities row\">\n <div class=\"col-xs-12\">\n <div class=\"form-material floating\">\n <input class=\"form-control\" task_amenities=\"text\" id=\"task_amenities_name\" name=\"task_amenities_name\">\n <label for=\"task_amenities_name\">" + _msg_task_amenities_name + "</label>\n </div>\n </div>\n </div>\n\n</form>";
$("#add_new_task_amenities").click(function (e) {
e.preventDefault();
var box_amenities = bootbox.dialog({
title: _msg_add_new_task_amenities,
message: ib_form_bootbox_amenities_amenities,
buttons: {
success: {
label: $("#_msg_save").val(),
className: "btn-primary",
callback: function () {
var task_amenities_name_val = $('#task_amenities_name').val();
$.post(_url + "module_imobles/typeunitsamenities/post/", {name: task_amenities_name_val})
.done(function (data) {
if (data == 'OK') {
toastr.success($('#_msg_saved').val());
} else {
bootbox.alert(data);
}
});
}
}
},
show: false
}
);
box_amenities.modal('show');
});
$('#description').redactor(
{
minHeight: 200,
}
);
}