import {useTranslation} from "react-i18next";

export function ConfirmDialog({title, message, onConfirm = () => {}, onCancel = () => {}, id = "confirm-delete"}) {
    const {t} = useTranslation();
    return <div className="modal fade" id={id} tabIndex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div className="modal-dialog">
            <div className="modal-content">
                <div className="modal-header">
                    {title && <h4 className="modal-title" id="myModalLabel">{title}</h4>}
                </div>
                <div className="modal-body">
                    {message}
                </div>
                <div className="modal-footer">
                    <button type="button" className="btn btn-default" data-dismiss="modal"  data-bs-dismiss="modal" onClick={onCancel}>{t('button.annuler')}</button>
                    <a className="btn btn-danger btn-ok"  data-bs-dismiss="modal" onClick={onConfirm}>{t('button.confirmer')}</a>
                </div>
            </div>
        </div>
    </div>
}
