| Server IP : 162.214.74.102 / Your IP : 216.73.217.80 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/public_html/lrsys_apps/dialogo/ui/lib/orders/ |
Upload File : |
var _url = $("#_url").val();
$(function () {
$('.footable').footable();
$(".progress").hide();
$("#emsg").hide();
$(".cdelete").click(function (e) {
e.preventDefault();
var oid = this.id;
bootbox.confirm(_L['are_you_sure'], function(result) {
if(result){
window.location.href = _url + "delete/order/" + oid + '/';
}
});
});
$(".create_invoice").click(function (e) {
e.preventDefault();
var id=$(this).attr("data-id");
$("#form_modal_payment")[0].reset();
$("#form_modal_payment #sys_order_id").val(id);
$("#form_modal_payment #account").val($(this).attr("data-sys_accounts_id")).trigger("change");
$("#form_modal_payment #pmethod").val($(this).attr("data-p_methods_id")).trigger("change");
$('#modal_payment').modal('show');
$("#modal_payment #option").on('change', function (e){
if($("#form_modal_payment #option").val()=='billing'){
$("#cahs_flow_data").addClass("hide");
}else{
$("#cahs_flow_data").removeClass("hide");
}
});
$("#modal_payment #create_invoice").on('click', function (e){
e.preventDefault();
if($("#form_modal_payment #option").val()=='billing'){
window.location=_url+"orders/convert_invoice/"+$("#form_modal_payment #sys_order_id").val();
}else{
window.location=_url+"orders/convert_invoice/"+$("#form_modal_payment #sys_order_id").val()
+"/"+$("#form_modal_payment #option").val()
+"/"+$("#form_modal_payment #pmethod").val()
+"/"+$("#form_modal_payment #account").val();
}
});
});
});
$(".occurrence").on('click', function (e){
$('#modal_occurrence #sys_order_id').val($(this).attr("data-id"));
$('#modal_occurrence #status').val($(this).attr("data-status"));
$("#modal_occurrence #emsg-occurrence").hide();
$('#modal_occurrence').modal('show');
$("#modal_occurrence #table-occurrence").load($("#_url").val() + "orders/list_occurrences/"+$(this).attr("data-id"));
$("#modal_occurrence #register_occurrence").on('click', function (e){
e.preventDefault();
$.post($("#_url").val() + "orders/update_status/", $("#form-occurrence").serialize())
.done(function (data) {
if ($.isNumeric(data)) {
$("#modal_occurrence #table-occurrence").load($("#_url").val() + "orders/list_occurrences/"+ $('#modal_occurrence #sys_order_id').val());
} else {
$("#modal_occurrence #emsgbody-occurrence").html(data);
$("#modal_occurrence #emsg-occurrence").show("slow");
}
});
});
$('#modal_occurrence').on('hidden', function () {
location.reload();
});
});
$(".update_status").on('click', function (e){
$('#modal_status #sys_order_id').val($(this).attr("data-id"));
$('#modal_status #desc_status').html($(this).attr("data-status"));
$('#modal_status #status').val($(this).attr("data-value"));
$('#modal_status #obs').val($(this).attr("data-text"));
$('#modal_status').modal('show');
$("#modal_status #update_status").on('click', function (e){
e.preventDefault();
$.post($("#_url").val() + "orders/update_status/", $("#formUpdateStatus").serialize())
.done(function (data) {
if ($.isNumeric(data)) {
location.reload();
} else {
var body = $("html, body");
body.animate({scrollTop:0}, '1000', 'swing');
$("#emsgbody").html(data);
$("#emsg").show("slow");
}
});
});
});
//DROPZONE, FLOW_CASH
$(document).ready(function () {
Dropzone.autoDiscover = false;
var upload_resp;
var _url = $("#_url").val();
var $ib_form_submit = $("#submit");
var ib_file = new Dropzone("#upload_container",
{
url: _url + "transactions/handle_attachment/",
maxFiles: 1,
acceptedFiles: "image/*,application/pdf"
}
);
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'){
toastr.success(upload_resp.msg);
// $file_link.val(upload_resp.file);
// files.push(upload_resp.file);
//
// console.log(files);
$('#modal_payment #attachments').val(function(i,val) {
return val + (!val ? '' : ',') + upload_resp.file;
});
}
else{
toastr.error(upload_resp.msg);
}
});
});
//FILTROS
$(document).ready(function () {
$('.dropdown-advanced').click(function (event) {
event.stopPropagation();
});
$('.dropdown-period').click(function (event) {
event.stopPropagation();
});
$('#filter-situation a').on('click', function(event) {
event.preventDefault();
var situation = $(this).data('val');
$("input[name=situation]").val(situation);
$('#form-filter').submit();
});
// Period all, day, week, month
$('#filter-period a').on('click', function(event) {
event.preventDefault();
var period = $(this).data('val');
$("input[name=period]").val(period);
$('#form-filter').submit();
});
// Period interval datepicker close on selected
$('input[name=p_ini]').on('change', function() {
$(this).datepicker('hide');
});
$('input[name=p_end]').on('change', function() {
$(this).datepicker('hide');
});
// Period interval
$('#period-filter-interval').on('click', function(event) {
event.preventDefault();
var ini = $('input[name=p_ini]').val();
$("input[name=period_ini]").val(ini.split('/').reverse().join('-'));
var end = $('input[name=p_end]').val();
$("input[name=period_end]").val(end.split('/').reverse().join('-'));
if(ini.length > 0 || end.length > 0){
$("input[name=period]").val('interval');
}
$('#form-filter').submit();
});
// Advanced
$('#advanced-filter').on('click', function(event) {
event.preventDefault();
var id_payment_method = $('#payment_methods').find('option:selected').val();
$("input[name=id_payment_method]").val(id_payment_method);
$('#form-filter').submit();
});
$('#search').blur(function (event) {
event.preventDefault();
$('#form-filter').submit();
});
// Clear
$('#filter-clear').on('click', function(event) {
event.preventDefault();
$("input[name=search]").val('');
$("input[name=situation]").val('');
$("input[name=period]").val('');
$("input[name=period_ini]").val('');
$("input[name=period_end]").val('');
$("input[name=id_payment_method]").val('');
$('#form-filter').submit();
});
});