

export const alertConfirmationDelete = (title, type = "primary") => {
  return Swal.fire({
    title: '¿Está seguro?',
    text: "Esta acción es irreversible.",
    icon: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Sí',
    cancelButtonText: 'Cancelar',
    customClass: {
      confirmButton: 'btn btn-danger me-1',
      cancelButton: 'btn btn-label-secondary'
    },
    buttonsStyling: false
  })
}
export const alertConfirmAction = (title, type = "primary") => {
  return Swal.fire({
    title: '¿Está seguro?',
    text: title,
    icon: 'info',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Sí',
    cancelButtonText: 'Cancelar',
    customClass: {
      confirmButton: 'btn btn-success me-1',
      cancelButton: 'btn btn-label-secondary'
    },
    buttonsStyling: false
  })
}
export const alertSuccessMessage = (title, type = "primary", options = {}) => {
  return Swal.fire({
    showCancelButton: false,
    showConfirmButton: false,
    title: title,
    text: title,
    icon: "success",
    timer: 2000,
     ...options,
  })
}

export const alertWarningMessage = (title, message, type = "primary",options = {}) => {
  return Swal.fire({
    title: title,
    text: message,
    icon: "warning",
    customClass: {
      confirmButton: 'btn btn-primary'
    },
    buttonsStyling: false
  })
}

export const toastPresupuestoSummary = (value, target = 'body') => {
  return Swal.mixin({
    toast: true,
    position: 'bottom-end',
    html: `
    <div class="d-flex flex-column p-0 m-0">
       <p class="m-0">Total presupuesto</p>
       <span class="badge badge-label-primary fs-small autonumeric-resumen-currency">${value}</span>
    </div>`,
    customClass: {
      popup: 'bg-primary text-white',
    },
    target: target,
    width: "200px",
    padding: '1px',
    allowEscapeKey: false,
    showConfirmButton: false,
    timer: 0,
    timerProgressBar: false,
    stopKeydownPropagation: false,
  })
}
export const alertSuccess = (value, target = 'body',options = {}) => {
  return Swal.mixin({
    toast: true,
    position: 'bottom-end',
    html: `<span class="text-sm-left text-wrap">${value}</span>`,
    customClass: {
      popup: 'bg-success text-white',
    },
    icon: 'success',
    iconColor: 'white',
    target: target,
    showConfirmButton: false,
    timer: 6000,
    timerProgressBar: true,
    ...options,
  })
}
export const alertError = (value, target = 'body',options = {}) => {
  return Swal.mixin({
    toast: true,
    position: 'bottom-end',
    html: `<span class="text-sm-left text-wrap">${value}</span>`,
    customClass: {
      popup: 'bg-danger text-white',
    },
    icon: 'error',
    iconColor: 'white',
    target: target,
    showConfirmButton: false,
    timer: 6000,
    timerProgressBar: true,
    ...options
  })
}
export const alertWarning = (value, target = 'body',options = {}) => {
  return Swal.mixin({
    toast: true,
    position: 'bottom-end',
    html: `<span class="text-sm-left text-wrap">${value}</span>`,
    customClass: {
      popup: 'bg-warning text-white',
    },
    icon: 'warning',
    iconColor: 'white',
    target: target,
    showConfirmButton: false,
    timer: 6000,
    timerProgressBar: true,
    ...options
  })
}