|
@@ -7,10 +7,12 @@ import AdminUsersContainer from '../../../services/AdminUsersContainer';
|
|
|
import { withUnstatedContainers } from '../../UnstatedUtils';
|
|
import { withUnstatedContainers } from '../../UnstatedUtils';
|
|
|
|
|
|
|
|
const SendInvitationEmailButton = (props) => {
|
|
const SendInvitationEmailButton = (props) => {
|
|
|
- const { appContainer, user } = props;
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ appContainer, user, isInvitationEmailSended, updateIsInvitationEmailSended,
|
|
|
|
|
+ } = props;
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
- const textColor = !user.isInvitationEmailSended ? 'text-danger' : '';
|
|
|
|
|
|
|
+ const textColor = !isInvitationEmailSended ? 'text-danger' : '';
|
|
|
|
|
|
|
|
const onClickSendInvitationEmailButton = async() => {
|
|
const onClickSendInvitationEmailButton = async() => {
|
|
|
try {
|
|
try {
|
|
@@ -19,6 +21,7 @@ const SendInvitationEmailButton = (props) => {
|
|
|
if (failedToSendEmail == null) {
|
|
if (failedToSendEmail == null) {
|
|
|
const msg = `Email has been sent<br>・${user.email}`;
|
|
const msg = `Email has been sent<br>・${user.email}`;
|
|
|
toastSuccess(msg);
|
|
toastSuccess(msg);
|
|
|
|
|
+ updateIsInvitationEmailSended();
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
const msg = { message: `email: ${failedToSendEmail.email}<br>reason: ${failedToSendEmail.reason}` };
|
|
const msg = { message: `email: ${failedToSendEmail.email}<br>reason: ${failedToSendEmail.reason}` };
|
|
@@ -33,8 +36,8 @@ const SendInvitationEmailButton = (props) => {
|
|
|
return (
|
|
return (
|
|
|
<button className={`dropdown-item ${textColor}`} type="button" onClick={() => { onClickSendInvitationEmailButton() }}>
|
|
<button className={`dropdown-item ${textColor}`} type="button" onClick={() => { onClickSendInvitationEmailButton() }}>
|
|
|
<i className="icon-fw icon-envelope"></i>
|
|
<i className="icon-fw icon-envelope"></i>
|
|
|
- {user.isInvitationEmailSended && (<>{t('admin:user_management.user_table.resend_invitation_email')}</>)}
|
|
|
|
|
- {!user.isInvitationEmailSended && (<>{t('admin:user_management.user_table.send_invitation_email')}</>)}
|
|
|
|
|
|
|
+ {isInvitationEmailSended && (<>{t('admin:user_management.user_table.resend_invitation_email')}</>)}
|
|
|
|
|
+ {!isInvitationEmailSended && (<>{t('admin:user_management.user_table.send_invitation_email')}</>)}
|
|
|
</button>
|
|
</button>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
@@ -44,6 +47,8 @@ const SendInvitationEmailButtonWrapper = withUnstatedContainers(SendInvitationEm
|
|
|
SendInvitationEmailButton.propTypes = {
|
|
SendInvitationEmailButton.propTypes = {
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
user: PropTypes.object.isRequired,
|
|
user: PropTypes.object.isRequired,
|
|
|
|
|
+ isInvitationEmailSended: PropTypes.bool.isRequired,
|
|
|
|
|
+ updateIsInvitationEmailSended: PropTypes.func.isRequired,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default SendInvitationEmailButtonWrapper;
|
|
export default SendInvitationEmailButtonWrapper;
|