How to use the sweetalert2.fire function in sweetalert2

To help you get started, we’ve selected a few sweetalert2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aces / Loris / modules / imaging_uploader / jsx / UploadForm.js View on Github external
};

      let hasError = {
        mriFile: true,
        candID: false,
        pSCID: false,
        visitLabel: false,
      };

      this.setState({errorMessage, hasError});
      return;
    }

    if (data.IsPhantom === 'N') {
      if (!data.candID || !data.pSCID || !data.visitLabel) {
        swal.fire({
          title: 'Incorrect file name!',
          text: 'Could not determine PSCID, CandID and Visit Label '
                + 'based on the filename!\n',
          type: 'error',
          confirmButtonText: 'OK',
        });
        return;
      }
    }

    // Checks if a file with a given fileName has already been uploaded
    const mriFile = this.props.mriList.find(
      (mriFile) => mriFile.fileName.indexOf(fileName) > -1
    );

    // New File
github mifi / lossless-cut / src / util.js View on Github external
async function promptTimeOffset(inputValue) {
  const { value } = await swal.fire({
    title: 'Set custom start time offset',
    text: 'Instead of video apparently starting at 0, you can offset by a specified value (useful for viewing/cutting videos according to timecodes)',
    input: 'text',
    inputValue: inputValue || '',
    showCancelButton: true,
    inputPlaceholder: '00:00:00.000',
  });

  if (value === undefined) {
    return undefined;
  }

  const duration = parseDuration(value);
  // Invalid, try again
  if (duration === undefined) return promptTimeOffset(value);
github chamilo / chamilo-lms / assets / js / app.js View on Github external
$('.delete-swal').click(function (e) {
    e.preventDefault(); // Prevent the href from redirecting directly
    var url = $(this).attr("href");
    var title = $(this).attr("title");

    Swal.fire({
      title: title,
      text: '',
      icon: 'warning',
      showCancelButton: true,
      cancelButtonText: 'Cancel',
      confirmButtonColor: '#3085d6',
      cancelButtonColor: '#d33',
      confirmButtonText: 'Yes',
    }).then((result) => {
      if (result.value) {
        /*Swal.fire(
            'Deleted!',
            'Your file has been deleted.',
            'success'
        )*/
        window.location.href = url;
github aces / Loris / modules / issue_tracker / jsx / attachments / attachmentsList.js View on Github external
.then((data) => {
        if (data.success) {
          window.location.href = this.props.baseURL
            + '/issue_tracker/issue/'
            + this.props.issue;
        } else {
          swal.fire('Permission denied', '', 'error');
        }
      }).catch((error) => {
        console.error(error);
github aces / Loris / modules / data_release / jsx / managePermissionsForm.js View on Github external
.then((response) => {
      if (response.ok) {
        swal.fire({
          text: 'Permission Update Success!',
          title: '',
          type: 'success',
        });
        this.props.fetchData();
        return Promise.resolve();
      } else {
        let msg = response.statusText ?
          response.statusText : 'Submission Error!';
        swal.fire(msg, '', 'error');
        console.error(msg);
        return Promise.reject();
      }
    });
  }
github aces / Loris / modules / imaging_uploader / jsx / UploadForm.js View on Github external
}, function(isConfirm) {
        if (isConfirm) {
          this.uploadFile(true);
        } else {
          swal.fire('Cancelled', 'Your upload has been cancelled.', 'error');
        }
      }.bind(this));
    }
github yalla-coop / connect5 / v2 / client / src / components / pages / SessionDetails / SessionSurveys / SurveyContent.js View on Github external
onInfoClick = () => {
    Swal.fire({
      title: 'Info',
      text:
        'Please copy and send the survey link to all participants. You will see the survey results for your session as soon as they are being submitted',
      type: 'info',
      confirmButtonText: 'Ok',
    });
  };
github aces / Loris / modules / publication / jsx / viewProject.js View on Github external
success: function() {
        swal.fire('Edit Successful!', '', 'success');
      },
      error: function(jqXHR) {
github yalla-coop / connect5 / v2 / client / src / components / common / EditEmail / index.js View on Github external
let selection;
    if (document.body.createTextRange) {
      range = document.body.createTextRange();
      range.moveToElementText(copyText);
      range.select();
    } else if (window.getSelection) {
      selection = window.getSelection();
      range = document.createRange();
      range.selectNodeContents(copyText);
      selection.removeAllRanges();
      selection.addRange(range);
    }

    try {
      document.execCommand('copy');
      Swal.fire({
        title: 'Success',
        text: 'Link copied!',
        type: 'success',
        timer: 2000,
        confirmButtonText: 'Ok',
      });
    } catch (err) {
      Swal.fire({
        title: 'Error',
        text: 'Unable to cop the Link',
        type: 'error',
        timer: 2000,
        confirmButtonText: 'Ok',
      });
    }
  };
github alirizaadiyahsi / Nucleus / src / Nucleus.Web.Vue / src / shared / application / nucleus-component-base.ts View on Github external
protected swalToast(duration: number, type: string, title: string) {
        Swal.fire({
            toast: true,
            position: 'bottom-end',
            showConfirmButton: false,
            timer: duration,
            type,
            title
        } as any);
    }