|
@@ -1,5 +1,5 @@ |
|
|
import Swal from "sweetalert2"; |
|
|
import Swal from "sweetalert2"; |
|
|
import "./sweetalert2.css" |
|
|
|
|
|
|
|
|
import "./sweetalert2.css"; |
|
|
|
|
|
|
|
|
export const msg = (text) => { |
|
|
export const msg = (text) => { |
|
|
Swal.mixin({ |
|
|
Swal.mixin({ |
|
@@ -28,8 +28,8 @@ export const successDialog = (text, t) => { |
|
|
title: text, |
|
|
title: text, |
|
|
confirmButtonText: t("Confirm"), |
|
|
confirmButtonText: t("Confirm"), |
|
|
showConfirmButton: true, |
|
|
showConfirmButton: true, |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const successDialogWithContent = (title, text, t) => { |
|
|
export const successDialogWithContent = (title, text, t) => { |
|
|
return Swal.fire({ |
|
|
return Swal.fire({ |
|
@@ -38,8 +38,8 @@ export const successDialogWithContent = (title, text, t) => { |
|
|
html: text, |
|
|
html: text, |
|
|
confirmButtonText: t("Confirm"), |
|
|
confirmButtonText: t("Confirm"), |
|
|
showConfirmButton: true, |
|
|
showConfirmButton: true, |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const errorDialog = (text, t) => { |
|
|
export const errorDialog = (text, t) => { |
|
|
return Swal.fire({ |
|
|
return Swal.fire({ |
|
@@ -47,18 +47,18 @@ export const errorDialog = (text, t) => { |
|
|
title: text, |
|
|
title: text, |
|
|
confirmButtonText: t("Confirm"), |
|
|
confirmButtonText: t("Confirm"), |
|
|
showConfirmButton: true, |
|
|
showConfirmButton: true, |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const errorDialogWithContent = (title, text, t) => { |
|
|
|
|
|
|
|
|
export const errorDialogWithContent = (title, text, t) => { |
|
|
return Swal.fire({ |
|
|
return Swal.fire({ |
|
|
icon: "error", |
|
|
icon: "error", |
|
|
title: title, |
|
|
title: title, |
|
|
html: text, |
|
|
html: text, |
|
|
confirmButtonText: t("Confirm"), |
|
|
confirmButtonText: t("Confirm"), |
|
|
showConfirmButton: true, |
|
|
showConfirmButton: true, |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const warningDialog = (text, t) => { |
|
|
export const warningDialog = (text, t) => { |
|
|
return Swal.fire({ |
|
|
return Swal.fire({ |
|
@@ -66,13 +66,17 @@ export const warningDialog = (text, t) => { |
|
|
title: text, |
|
|
title: text, |
|
|
confirmButtonText: t("Confirm"), |
|
|
confirmButtonText: t("Confirm"), |
|
|
showConfirmButton: true, |
|
|
showConfirmButton: true, |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const submitDialog = async (confirmAction, t, {...props} = { |
|
|
|
|
|
title: t("Do you want to submit?"), |
|
|
|
|
|
confirmButtonText: t("Submit"), |
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
|
export const submitDialog = async ( |
|
|
|
|
|
confirmAction, |
|
|
|
|
|
t, |
|
|
|
|
|
{ ...props } = { |
|
|
|
|
|
title: t("Do you want to submit?"), |
|
|
|
|
|
confirmButtonText: t("Submit"), |
|
|
|
|
|
} |
|
|
|
|
|
) => { |
|
|
// console.log(props) |
|
|
// console.log(props) |
|
|
// const { t } = useTranslation("common") |
|
|
// const { t } = useTranslation("common") |
|
|
const result = await Swal.fire({ |
|
|
const result = await Swal.fire({ |
|
@@ -90,13 +94,17 @@ export const submitDialog = async (confirmAction, t, {...props} = { |
|
|
if (result.isConfirmed) { |
|
|
if (result.isConfirmed) { |
|
|
confirmAction(); |
|
|
confirmAction(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const submitDialogWithWarning = async (confirmAction, t, {...props} = { |
|
|
|
|
|
title: t("Do you want to submit?"), |
|
|
|
|
|
text: t("Warning!"), |
|
|
|
|
|
confirmButtonText: t("Submit"), |
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
|
export const submitDialogWithWarning = async ( |
|
|
|
|
|
confirmAction, |
|
|
|
|
|
t, |
|
|
|
|
|
{ ...props } = { |
|
|
|
|
|
title: t("Do you want to submit?"), |
|
|
|
|
|
text: t("Warning!"), |
|
|
|
|
|
confirmButtonText: t("Submit"), |
|
|
|
|
|
} |
|
|
|
|
|
) => { |
|
|
// console.log(props) |
|
|
// console.log(props) |
|
|
// const { t } = useTranslation("common") |
|
|
// const { t } = useTranslation("common") |
|
|
const result = await Swal.fire({ |
|
|
const result = await Swal.fire({ |
|
@@ -115,7 +123,7 @@ export const submitDialogWithWarning = async (confirmAction, t, {...props} = { |
|
|
if (result.isConfirmed) { |
|
|
if (result.isConfirmed) { |
|
|
confirmAction(); |
|
|
confirmAction(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
export const deleteDialog = async (confirmAction, t) => { |
|
|
export const deleteDialog = async (confirmAction, t) => { |
|
|
// const { t } = useTranslation("common") |
|
|
// const { t } = useTranslation("common") |
|
@@ -134,4 +142,4 @@ export const deleteDialog = async (confirmAction, t) => { |
|
|
if (result.isConfirmed) { |
|
|
if (result.isConfirmed) { |
|
|
confirmAction(); |
|
|
confirmAction(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |