|
@@ -52,22 +52,27 @@ export default class extends Component {
|
|
|
this.setState({ answer });
|
|
|
}
|
|
|
|
|
|
- showConfirm(title, desc, cb) {
|
|
|
- this.showModal('confirm', title, desc, cb);
|
|
|
+ showConfirm(title, desc, width, cb) {
|
|
|
+ this.showModal('confirm', title, desc, width, cb);
|
|
|
}
|
|
|
|
|
|
- showToast(title, desc, cb) {
|
|
|
- this.showModal('toast', title, desc, cb);
|
|
|
+ showToast(title, desc, width, cb) {
|
|
|
+ this.showModal('toast', title, desc, width, cb);
|
|
|
}
|
|
|
|
|
|
- showModal(type, title, desc, cb) {
|
|
|
- this.setState({ modal: { type, title, desc, cb } });
|
|
|
+ showModal(type, title, desc, width, cb) {
|
|
|
+ this.setState({ modal: { type, title, desc, width, cb } });
|
|
|
+ }
|
|
|
+
|
|
|
+ timeOut(cb) {
|
|
|
+ this.showToast('Time Expired', 'Time has expired for this section. \n Click OK to continue.', 440, cb);
|
|
|
}
|
|
|
|
|
|
checkAnswer() {
|
|
|
const { question } = this.props;
|
|
|
const { answer } = this.state;
|
|
|
let result = null;
|
|
|
+ if (!answer) return this.showToast('Answer Required', 'You can not continue with this question unanswered. ', 430);
|
|
|
if (question.questionType === 'awa' && !answer.awa) result = 'Please answer the question first.';
|
|
|
if (result) return this.showToast(null, result);
|
|
|
return true;
|
|
@@ -113,8 +118,10 @@ export default class extends Component {
|
|
|
const { flow } = this.props;
|
|
|
const { answer } = this.state;
|
|
|
if (this.checkAnswer()) {
|
|
|
- flow.submit(answer).then(() => {
|
|
|
- flow.next();
|
|
|
+ this.showConfirm('Answer Confirmation', 'Click Yes to confirm your answer and continue to the next \n question. ', 560, () => {
|
|
|
+ flow.submit(answer).then(() => {
|
|
|
+ flow.next();
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -505,7 +512,7 @@ export default class extends Component {
|
|
|
return (
|
|
|
<div className="modal">
|
|
|
<div className="mask" />
|
|
|
- <div className="body">
|
|
|
+ <div style={{ width: modal.width }} className="body">
|
|
|
<div className="title">{modal.title}</div>
|
|
|
<div className="desc">{modal.desc}</div>
|
|
|
{modal.type === 'confirm' ? (
|