HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/zaklada/wp-content/plugins/dinamo-foundation-plugin/includes/js/main.js
jQuery(document).ready(function () {

  jQuery("body").on('click', '#SearchEntriesButton', function (e) {

      e.preventDefault();

      link = jQuery("#SearchEntriesButton").attr('data-link');
      var val = jQuery("#SearchEntriesText").val();


      var url = new URL(link);

        // If your expected result is "http://foo.bar/?x=1&y=2&x=42"
      url.searchParams.set('search', val);

      location.href = url.href;


  });

  // Approve/Disapprove message
  jQuery("body").on('click', '.approve-message', function (e) {

    var clicked_message_id = jQuery(e.currentTarget).attr('data-message-id');
      jQuery.ajax({
          url: ajaxurl,
          type: "POST",
          data: {
              "action": "change_message_status",
              "clicked_message_id": clicked_message_id,
          }
      }).done(function (data) {
          location.reload();

      });

  });

  // Delete Message
  jQuery("body").on('click', '.delete-message', function (e) {
    var clicked_message_id = jQuery(e.currentTarget).attr('data-message-id');
    if (confirm('Are you sure you want to delete this message?')){
      jQuery.ajax({
          url: ajaxurl,
          type: "POST",
          data: {
              "action": "delete_message",
              "clicked_message_id": clicked_message_id,
          },
      }).done(function (data) {
          location.reload();
      });
    }
  });

});

// When the user clicks the button, open the modal
function ShowModal(id) {
    jQuery('#myModal-' + id).show();
}

// When the user clicks the button, closes the modal
function closeEdit(id) {
    jQuery('#myModal-' + id).hide();
    jQuery('#alert-' + id).hide();
    setTimeout(function () {
        location.reload()
    }, 300);
}


function edit(id) {
  jQuery(document).ready(function () {
      var msg_id = id;
      var msg = jQuery('textarea.msgId-' + msg_id).val();

      if (!msg.length) {
          alert("Message can not be empty.");
          return;
      } else if (confirm('Are you sure you want to save the new message?')) {
          jQuery.ajax({
              type: "POST",
              dataType: "json",
              url: ajaxurl,
              data: {
                  action: "order_message_edit",
                  id: msg_id,
                  message: msg
              },
              success: function success(data) {
                  if (data.success) {
                      // jQuery('#alert-'+ id).show();
                      // jQuery('#alert-'+ id).html('The message has been updated.');
                      jQuery('#wpbody-content').prepend('<div class="notice-success notice"><p>The message has been updated.</p></div>');
                      closeEdit(msg_id);
                  }
              }
          });
      } else {
          jQuery('#alert-' + id).show();
          jQuery('#alert-' + id).html('No changes has been made.');

      }
  });
}