Send blast notif

Muncul confirm sebelum di kirim
mail@pastecode.io avatar
unknown
javascript
a month ago
2.7 kB
4
Indexable
Never
$.confirm({
      title: "Confirm before sending",
      content:
        `<table class='table table-hover table-bordered'>
          < tr >
            <td>Segments</td>
            <td>${segment}</td>
          </tr>
          <tr>
            <td>Title</td>
            <td>${subject}</td>
          </tr>
          <tr>
            <td>Contents</td>
            <td>${content}</td>
          </tr>
          <tr>
            <td>Scheduled For</td>
            <td>${schedule}</td>
          </tr>
        </table > Are you sure will send this notification ? `,
      draggable: false,
      animation: "zoom",
      closeAnimation: "zoom",
      animateFromElement: false,
      buttons: {
        close: {
          text: "Cancel", // With spaces and symbols
          btnClass: "btn-secondary",
        },
        confirm: {
          text: "Send Message", // With spaces and symbols
          btnClass: "btn-primary",
          action: function () {
            if (clickblock == 1) {
              window.clickblock = 2;
              $("#btn_submit").attr("disabled", true);
              $("#progress").show();

              var formdata = new FormData();
              formdata.append(
                "<?= $this->security->get_csrf_token_name() ?>",
                "<?= $this->security->get_csrf_hash() ?>"
              );
              formdata.append('token', '<?= $this->security->get_csrf_hash() ?>');
              formdata.append("notification_all", all);
              formdata.append("recipient", to);
              formdata.append("notification_title", subject);
              formdata.append("notification_content", content);
              formdata.append("notification_send_time", date);
              formdata.append("notification_delivery", delivery);
              formdata.append("module", "news");
              formdata.append("id", newsId);

              $.ajax({
                url: "<?= base_url(); ?>cms_new/managements/notification/saveNotif",
                type: "POST",
                data: formdata,
                contentType: false,
                cache: false,
                processData: false,
                success: function (data) {
                  $("#progress").hide();
                  //close modal
                  $("#modalNotif").modal("hide");
                  $("#btn_submit").attr("disabled", false);
                  //reload table
                  // table.ajax.reload(null,false);
                  loadPaginationNews(0);
                },
              });
            }
          },
        },
      },
    });
Leave a Comment