AnonSec Shell
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/marisol/application/plugins/module_med_scheduling/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/marisol/application/plugins/module_med_scheduling/assets/js/calendar.js
/* global parseFloat, _L, $rowNumTab */

$(function () {

    var _url = $("#_url").val();

    var $calendar_wrap = $("#calendar_wrap");
    var renderDataTableFinalizar = false;
    
    $('#queue_number').mask('999');

    var carregou=true;

//$('#calendar').fullCalendar( 'gotoDate', date )
    var render = 0;
    var ib_calendar_options = {
        customButtons: {
            custom1: {
                text: _L['Structured List'],
                click: function (e) {
//                    $('#structured_list').toggleClass('hidden');
//                    $('#calendar').find('.fc-view-container').toggleClass('hidden');
//                    console.log(e);
                    if ($(this).hasClass('btn-checked-calendar')) {
                        document.cookie = "erp_list_view=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
                    } else {
                        setCookie("erp_list_view", "Y", 365);
                    }

                    verifyCookie();
                }
            },
            datePickerButton: {
                //  icon: 'down-triangle',
                text: _L['Date'],
                click: function () {
                    var $btnCustom = $('.fc-datePickerButton-button');
                    $btnCustom.datepicker({
                        language: $("#_lan").val(),
                        autoclose: true
                    });
                    $btnCustom.datepicker('show')
                            .on("changeDate", function (e, v) {
                                $('#calendar').fullCalendar('gotoDate', moment(e.date).format());
                                $btnCustom.datepicker('hide');
                            });
                }
            }
        },
      
        eventAfterAllRender: function (  ) {
            renderDataTableFinalizar = true;
            var view = $('#calendar').fullCalendar('getView');
            console.log(view.name);

            if (view.name == 'agendaDay')
            {
                $(".date_list_info").addClass("hide");
            } else {
                $(".date_list_info").removeClass("hide");
            }
            $('#structured_list').footable();
                 
       //     $('.footable').data('footable-sort').doSort(1, true);
        },
        header: {
            left: 'prev,next today datePickerButton',
            center: 'title',
            right: 'custom1 agendaDay agendaWeek month  listYear'
        },
        eventResize: function (event, delta, revertFunc, jsEvent, ui, view) {
            bootbox.confirm(_L['Scheduling Do you want to change the appointment schedule?'] + "<br/>" + event.title + "<br/>" + _L['Scheduling Hour Start'] + " : <b>" + event.start.format($("#_formatDate").val().toUpperCase() + ' HH:mm') + '</b><br/>' + _L['Scheduling Hour Finish'] + " : <b>" + event.end.format($("#_formatDate").val().toUpperCase() + ' HH:mm') + "</b>", function (result) {
                if (result) {
                    $.post(_url + 'module_med_scheduling/scheduling/postEditShedulling/', {id: event.id, hour_start: event.start.format('HH:mm'), hour_finish: event.end.format('HH:mm'), date: event.end.format($("#_formatDate").val().toUpperCase())})
                            .done(function (data) {
                                if (data == 'OK') {
                                    toastr.success(_L['edit_successful']);
                                } else {
                                    toastr.error(data);
                                    revertFunc();
                                }
                            });
                } else {
                    revertFunc();
                }
            });

        },
        eventDrop: function (event, delta, revertFunc, jsEvent, ui, view) {
            $(".popover ").addClass('hide');
            bootbox.confirm(_L['Scheduling Do you want to change the appointment schedule?'] + "<br/>" + event.title + "<br/>" + _L['Scheduling Hour Start'] + " : <b>" + event.start.format($("#_formatDate").val().toUpperCase() + ' HH:mm') + '</b><br/>' + _L['Scheduling Hour Finish'] + " : <b>" + event.end.format($("#_formatDate").val().toUpperCase() + ' HH:mm') + "</b>",
                    function (result) {
                        if (result) {
                            $.post(_url + 'module_med_scheduling/scheduling/postEditShedulling/', {id: event.id, hour_start: event.start.format('HH:mm'), hour_finish: event.end.format('HH:mm'), date: event.end.format($("#_formatDate").val().toUpperCase())})
                                    .done(function (data) {
                                        if (data == 'OK') {
                                            toastr.success(_L['edit_successful']);
                                        } else {
                                            toastr.error(data);
                                            revertFunc();
                                        }
                                    });
                        } else {
                            revertFunc();
                        }
                    }
            );
        },
        loading: function (isLoading, view) {
            if (isLoading) {
                $calendar_wrap.block({message: block_msg});
            } else {
                $calendar_wrap.unblock();
                $('[data-toggle="tooltip"]').tooltip();
            }
            $('#structured_list > tbody').empty();
          
        },
        defaultView: ib_list_calendar,
        navLinks: true,
        editable: true,
        droppable: true,
        minTime: minTime,//'07:00:00',
        maxTime: maxTime,// '19:00:00',
        slotDuration: interval,//"00:20:00",
        eventLimit: false,
        lang: ib_lang,
        isRTL: ib_rtl,
        eventSources: [{
                url: _url + 'module_med_scheduling/scheduling/dataCalendar/',
                type: 'GET',
                error: function () {
                    bootbox.alert("Unable to load data.");
                }
            }],
        eventRender: function (event, element) {
          
            element.attr('title', event.account);
            element.attr('onclick', event.onclick);
            element.attr('data-toggle', 'tooltip');
            var observation = '';
            if (event.observation)
            {
                observation = '<br/>Obs: ' + event.observation;
            };
            
            var contatos = '';
            if (event.contacts)
            {
                contatos = '<br/>' + event.contacts;
            };
            contatos = ''+contatos.substring(0, contatos.length - 5);
            
            // Trato os procedimentos
            var procedures = '';
            $.each(event.procedures, function (index, value) {
                procedures = procedures + '<br/>'+value.description;
            });
//            procedures = ''+procedures.substring(0, procedures.length - 5);
            element.popover({
                content: _L["Diary_Diary"] + ': ' + event.diary + procedures +  observation + contatos + '<br/>' + _L["Scheduling Created by"] + ' ' + event.useradmin_name,
                trigger: 'hover',
                placement: 'auto',
                container: 'body',
                html: true
            });
            if (!event.url) {
                element.click(function () {
                    view_event(event.id);
                });
            }
            ;
            //limpa
            if (renderDataTableFinalizar) {
                $('#structured_list > tbody').empty();
                renderDataTableFinalizar = false;
            }
            var style = 'style="color:#FFF; background-color:' + event.color + '"';
            var date_view = "<td " + style + " class='date_list_info'  data-sort-value ='"+event.date_view_order+"'>" + event.date_view + "</td>";
            
            // Adiciono o agendamento na tabela do dia
            $("#structured_list").find('tbody')
                    .append('<tr  ' + style + '  class="' + render + '"><td ' + style + '>' + event.option + '</td><td ' + style + '>' + event.queue_number + '</td>' + date_view + '<td ' + style + '>' + event.hour_start.substr(0,5) + '</td><td  ' + style + '>' + event.diary + '</td><td data-toggle="tooltip" id="shed_'+event.id+'" ' + style + '><a style="color:#FFF; text-decoration:underline" href="' + _url + 'contacts/view/' + event.patient_id + '/summary/">' + event.account + '</a></td><td ' + style + '>' + event.desc_status + '</td><td ' + style + '>' + event.professional_name + '</td></td><td ' + style + '>' + event.agreement_company_name + '</td>\n\
                    <td '+(event.saldoPatient==0?style:'style="color:#FFF; background-color:#ec8e00"')+'>'+$("#_curr_code").val() + " " + formatMonetary(parseFloat(event.saldoPatient).toFixed(2) + "")+'</td></tr>');
           
            $("#shed_"+event.id).popover({
                content: _L["Diary_Diary"] + ': ' + event.diary + procedures +  observation + contatos + '<br/>' + _L["Scheduling Created by"] + ' ' + event.useradmin_name,
                trigger: 'hover',
                placement: 'auto',
                container: 'body',
                html: true
            });
        },
        dayClick: function (date) {

            //   $modal.modal('show');
            date = date.format();
            var $modal = $('#ajax-modal');
            $modal.load(_url + 'module_med_scheduling/scheduling/add/modal', {date: date}, function () {
                $modal.modal();
                $("#diary_id").html($("#diary_option_selected").html());
                initScheduling();
                $("[data-toggle='toggle']").bootstrapToggle();  
                $("#hour_start").trigger("blur");
            });
            return false;
        },
        firstDay: parseInt(ib_calendar_first_day),
        defaultDate: moment(ib_date_calendar),
        timeFormat: 'HH:mm',
        slotLabelFormat: ['HH:mm'],
        height: 'auto',
        allDaySlot: false,
//        agendaEventMinHeight: 200,

//    eventDrop: function(event, delta, revertFunc) {
//
//        alert(event.title + " was dropped on " + event.start.format());
//
//        if (!confirm("Are you sure about this change?")) {
//            revertFunc();
//        }
//
//    }
    
    };


    $('#calendar').fullCalendar(ib_calendar_options);


    function view_event(id) {
        var $modal = $('#ajax-modal');
        $modal.load(_url + 'module_med_scheduling/scheduling/edit/' + id + "/modal", "", function () {
            $modal.modal();
            initScheduling();
            $("[data-toggle='toggle']").bootstrapToggle();  
     
            $(".emsgbody-occurrence-edit").addClass("hide");
            $(".table-occurrence").html("");
            $(".table-occurrence").load($("#_url").val() + "module_med_scheduling/scheduling/listOcurrence/" + id);

        });
    }

            $('#ajax-modal').on('click', '#register_occurrence', function (e) {
                e.preventDefault();
                $.post($("#_url").val() + "module_med_scheduling/scheduling/postOcurrence/", {obs: $("#occurrence_obs").val(), date: $("#occurrence_date").val(), status: $("#occurrence_status").val(), module_med_scheduling_id: $("#id").val()})
                    .done(function (data) {
                        if (data == "OK") {
                            $("#occurrence_obs").val("");
                            $("#ajax-modal .emsgbody-occurrence").addClass("hide");
                            $(".table-occurrence").html();
                            $(".table-occurrence").load($("#_url").val() + "module_med_scheduling/scheduling/listOcurrence/" + $('#id').val());
                        } else {
                            bootbox.alert(data);
                        }
                    });
            });


    //verifica o cookie para setar a visualização
    verifyCookie();

    function verifyCookie() {
        var erp_list_view = getCookie("erp_list_view");
        if (erp_list_view != "") {
            $(".fc-custom1-button").addClass("btn-checked-calendar");
            $('#structured_list').removeClass('hidden');
            $('#calendar').find('.fc-view-container').addClass('hidden');
        } else {
            $(".fc-custom1-button").removeClass("btn-checked-calendar");
            $('#structured_list').addClass('hidden');
            $('#calendar').find('.fc-view-container').removeClass('hidden');
        }
    }


   $("#structured_list").on("click", ".edit_shedulling", function (e) {
        view_event($(this).data("id"));
    });

  
    var $modal = $('#ajax-modal');
 

 $("#structured_list").on("click", ".update_status", function (e) {
    $('#modal_status #modal_status_desc').html( $(this).attr("data-text"));
    $('#modal_status #modal_status_status').val($(this).attr("data-value"));
    $('#modal_status #modal_status_obs').val("");
    $('#modal_status #modal_status_module_med_scheduling_id').val($(this).attr("data-id"));
    $("#emsgModalAlterStatus").addClass("hide");
    $('#modal_status').modal('show');
    
    
});
    $("#modal_status").on('click','#update_status', function (e){
        $.post($("#_url").val() + "module_med_scheduling/scheduling/postOcurrence/", $("#formUpdateStatus").serialize())
           .done(function (data) {
               if (data=="OK") {
                    $('#modal_status').modal('hide');
                    $('#ajax-modal-2').modal("hide");  
                    
                    $('#calendar').fullCalendar('removeEvents');
                    $('#calendar').fullCalendar('refetchEvents');
                   
               } else {
                   var body = $("html, body");
                   body.animate({scrollTop:0}, '1000', 'swing');
                   $("#emsgbodyModalAlterStatus").html(data);
                   $("#emsgModalAlterStatus").removeClass("hide");
                   $("#emsgModalAlterStatus").show("slow");
               }
           });
    });      




    $("#structured_list").on("click", ".occurrence", function (e) {
        $('#modal_occurrence #modal_occurrence_status').val($(this).attr("data-status"));
        $('#modal_occurrence #modal_occurrence_obs').val("");
        $('#modal_occurrence #modal_occurrence_module_med_scheduling_id').val($(this).attr("data-id"));
        $("#modal_occurrence #emsg-occurrence").addClass("hide");
        $('#modal_occurrence').modal('show');
        $("#modal_occurrence_table-occurrence").load($("#_url").val() + "module_med_scheduling/scheduling/listOcurrence/" + $(this).attr("data-id"));
    });  

    $("#structured_list").on("click", ".tab_autorization", function (e) {
        var $modal = $('#ajax-modal');
        idShedulling= $(this).data("id");
         $modal.load(_url + 'module_med_scheduling/scheduling/modal_add_autorization/' +idShedulling, '', function () {
                    $modal.modal();

                    if ($('.date')[0]) {
                        $(document).ready(function () {
                            $(".date").datepicker();

                        });
                    }
                    findDataSelect(".agreement_select",'module_med_scheduling/ajax/agreement/', "");
                    findDataSelectNotIn(".procedure_select",'module_med_scheduling/ajax/procedureByScheduling/'+idShedulling,"", ".procedure_select");
                       
                   
                    $rowNumTab=$("#rowNumTab").val();
                     $("#autorization_items").on("click", ".delete_tab", function (e) {
                        $(this).closest('tr').remove();
                    });
         });
       
   });
   
        
    $('#ajax-modal').on('click','.add_tab', function () {
         $("#autorization_items").find('tbody')
                 .append(
                 '<tr >\n\
                     <td ><input type="hidden" name="row[]" value="'+$rowNumTab+'">\n\
                         <div class="row">\n\
                             <div class="col-md-3 col-xs-12">\n\
                                 <label>'+_L['Scheduling tab number']+" "+_L['*']+'</label>\n\
                                 <input type="text" class="form-control" name="tab_number_'+$rowNumTab+'" value="">'
                     +'</div>'
                     +'<div class="col-md-3 col-xs-12">'
                         +'<label>'+_L['Scheduling authorization code']+" "+_L['*']+'</label>'
                           +'<input type="text" class="form-control" name="authorization_code_'+$rowNumTab+'" value="">'
                     +'</div>'
                     +'<div class="col-md-3 col-xs-12">'
                         +'<label>'+_L['Scheduling date authorization']+" "+_L['*']+'</label>'
                         +'<input type="text" class="form-control date_authorization" name="date_authorization_'+$rowNumTab+'" id="date_authorization_'+$rowNumTab+'"'
                             +'value="">'
                     +'</div>'
                     +'<div class="col-md-3 col-xs-12">'
                         +'<label>'+_L['Scheduling validaty']+" "+_L['*']+'</label>'
                         +'<input type="text" class="form-control " name="date_validate_'+$rowNumTab+'"  id="date_validate_'+$rowNumTab+'"'
                             +'value="">'
                     +'</div>'

                 +'</div>'
                 +'<div class="row">'
                 +'<div class="col-md-3 col-xs-12">'
                         +'<label>'+_L['Scheduling_Agreement_Module']+" "+_L['*']+'</label>'
                         +'<select  data-row="'+$rowNumTab+'"   name="agreement_'+$rowNumTab+'"  class="form-control agreement_select_'+$rowNumTab+'">'
                          +'</select>'
                     +'</div>'
                     +'<div class="col-md-9 col-xs-12">'
                         +'<label>'+_L['Scheduling_Procedure_Module']+" "+_L['*']+'</label>'
                         +'<select  data-row="'+$rowNumTab+'" multiple  name="procedures_'+$rowNumTab+'[]" id="procedures_'+$rowNumTab+'"  class="form-control procedure_select">'
                          +'</select>'
                     +'</div>'
               +'</div>'  
                +'</td>'

        +'<td class="middle col-xs-1"> <span class="btn btn-danger btn-xs delete_tab" ><i class="fa fa-trash"></i> </span></td></tr>'
                         );
         $("#date_authorization_" + $rowNumTab).datepicker({
             language: $("#_lan").val(),
             autoclose: true,
             dateFormat: $("#_formatDate").val()
         });
         $("#date_validate_" + $rowNumTab).datepicker({
             language: $("#_lan").val(),
             autoclose: true,
             dateFormat: $("#_formatDate").val()
         });

         findDataSelect(".agreement_select_"+$rowNumTab,'module_med_scheduling/ajax/agreement/', "");
         findDataSelectNotIn("#procedures_"+$rowNumTab,'module_med_scheduling/ajax/procedureByScheduling/'+idShedulling,"", ".procedure_select");
         $rowNumTab++;

     });

    

     $('#ajax-modal').on('click', '.submit_autorization', function (e) {
        e.preventDefault();
            $.post($("#_url").val() + "module_med_scheduling/scheduling/post_autorization/",$("#form_autorization").serialize())
                .done(function (retorno) {
                    var data =JSON.parse(retorno);
                    if (data.status == "success") {
                         $modal.modal("hide");
                         $('#calendar').fullCalendar('removeEvents');
                         $('#calendar').fullCalendar('refetchEvents');
                         bootbox.alert(_L['Scheduling  autorized procedures']);
                    } else {
                        $("#ajax-modal #emsgbodyModalAutorization").html(data.msg);
                        $("#ajax-modal #emsgModalAutorization").removeClass("hide");
                        $("#ajax-modal #emsgModalAutorization").show("slow");
                    }
            });
    });

    
    $('#modal_occurrence').on('click', '#modal_register_occurrence', function (e) {
        e.preventDefault();
            $.post($("#_url").val() + "module_med_scheduling/scheduling/postOcurrence/", {alter_status:"Y",obs: $("#modal_occurrence_obs").val(),  status: $("#modal_occurrence_status").val(), module_med_scheduling_id: $("#modal_occurrence_module_med_scheduling_id").val()})
                .done(function (data) {
                    if (data == "OK") {
                        $("#modal_occurrence_obs").val("");
                        $("#emsgModalAlterStatus").addClass("hide");
                        $("#modal_occurrence_table-occurrence").load($("#_url").val() + "module_med_scheduling/scheduling/listOcurrence/" + $('#modal_occurrence_module_med_scheduling_id').val());
                        $('#calendar').fullCalendar('removeEvents');
                        $('#calendar').fullCalendar('refetchEvents');
                    } else {
                        $("#modal_occurrence #emsgbody-occurrence").html(data);
                        $("#modal_occurrence #emsg-occurrence").removeClass("hide");
                        $("#modal_occurrence #emsg-occurrence").show("slow");
                    }
            });
    });

    $("#structured_list").on("click", ".view", function (e) {

        var $modal = $('#ajax-modal-2');
        var id=$(this).attr("data-id");
        $modal.load(_url + 'module_med_scheduling/scheduling/modal_view_shedulling/' + id, '', function () {
            $modal.modal();
            $(".table-occurrence").load($("#_url").val() + "module_med_scheduling/scheduling/listOcurrence/" + id+"/1");

        });
        
        $('#ajax-modal-2').on("click", ".update_status", function (e) {
            $('#modal_status #modal_status_desc').html( $(this).attr("data-text"));
            $('#modal_status #modal_status_status').val($(this).attr("data-value"));
            $('#modal_status #modal_status_obs').val("");
            $('#modal_status #modal_status_module_med_scheduling_id').val($(this).attr("data-id"));
            $('#modal_status').modal('show');
        });

     
        
    });

    $("#btn_add_scheduling").on("click", function (e) {

            //   $modal.modal('show');
            var data = new Date();
            var ano    = data.getFullYear(); 
            var dia     = data.getDate();           // 1-31
            var mes     = data.getMonth();          // 0-11 (zero=janeiro)
            var date = ano+'-'+(mes+1)+'-'+dia;  
            console.log(date);
            var $modal = $('#ajax-modal');
            $modal.load(_url + 'module_med_scheduling/scheduling/add/modal', {date: date}, function () {
                $modal.modal();
                $("#diary_id").html($("#diary_option_selected").html());
                initScheduling();
                $("[data-toggle='toggle']").bootstrapToggle();  
     
            });
            $('#hour_start').val('');
            return false;
        });



});



Anon7 - 2022
AnonSec Team