Appointments+ UX: Replace .alert() with .swal()

Hi there,
Appointments+ looks and feels like 2000's era tech. Please replace the .alert() calls with sweetalerts

  • uxwebtech

    @dubajicp1 can you get the devs on this?
    Here's how you change this:
    enqueue sweetalert from CDN or include in plugin files and enqueue,
    replace includes/shortcodes/class-app-shortcode-my-appointments.php:236 with

    $ret .= '<td><input class="app-my-appointments-cancel" type="button" value="Cancel" name="app_cancel['.$r->ID.']" '.$is_readonly.'></td>';

    replace includes/shortcodes/class-app-shortcode-my-appointments.php:283-327 with

    $appointments->add2footer( '
    			  dateFormat: "'.$dateformat.'",
    			  headers: {
    			    2: {
    			      sorter: "'.$sorter.'"
    			$(".app-my-appointments-cancel").click(function() {
    			  var cancel_id = $(this).attr("name").replace("app_cancel[", "").replace("]", "");
    			      title: "Are you sure?",
    			      text: "Do you want to cancel this appointment?",
    			      type: "warning",
    			      showCancelButton: "true",
    			      allowOutsideClick: true,
    			      confirmButtonColor: "#3085d6",
    			      cancelButtonColor: "#d33",
    			      confirmButtonText: "Yes, Cancel it!",
    			      cancelButtonText: "No, Keep it!",
    			      confirmButtonClass: "confirm-class",
    			      cancelButtonClass: "cancel-class",
    			      closeOnConfirm: false,
    			      closeOnCancel: true,
    			    function(isConfirm) {
    			      if (isConfirm) {
    			        if (cancel_id) {
    			          var cancel_data = {
    			            action: "cancel_app",
    			            app_id: cancel_id,
    			            cancel_nonce: "'. wp_create_nonce() .'"
    			          $.post(_appointments_data.ajax_url, cancel_data, function(response) {
    			            if (response && response.error) {
    			              swal("Error", "An unknown error has occured", "error");
    			              swal("Nevermind!", "Your appointment is still booked :)", "error");
    			            } else {
    			                  title: "Cancelled",
    			                  text: "Your appointment has been cancelled.",
    			                  type: "success"
    			                function() {
    		return $ret;

    replace includes/shortcodes/js/app-confirmation.js:147,154,161,168,175,184 with
    swal("Warning", app_warning_text, "error");
    replace includes/shortcodes/js/app-confirmation.js:198 with

                            title: "Thanks!",
                            text: app_confirmation_text,
                            type: "success"},

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.