diff --git a/components/form/ConfirmModal.jsx b/components/form/ConfirmModal.jsx
index 7f3ecc2..328d376 100644
--- a/components/form/ConfirmModal.jsx
+++ b/components/form/ConfirmModal.jsx
@@ -7,26 +7,61 @@ import {
faArrowLeft,
faTrashAlt
} from "@fortawesome/free-solid-svg-icons";
-import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Row, Col } from "reactstrap";
+import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Label, Input } from "reactstrap";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-const ConfirmModal = ({ tabIndex, title, candidates, grades, isTimeLimited, start, finish, emails, restrictResult, className, confirmCallback }) => {
+const ConfirmModal = ({ CreateElection, handleRestrictResultCheck, handleIsTimeLimited, tabIndex, title, candidates, grades, isTimeLimited, start, finish, emails, restrictResult, className, confirmCallback }) => {
const [visibled, setVisibility] = useState(false);
const { t } = useTranslation();
const toggle = () => setVisibility(!visibled)
+ const isValidDate = (date) => date instanceof Date && !isNaN(date);
+ const getOnlyValidDate = (date) => (isValidDate(date) ? date : new Date());
+
+ // Convert a Date object into YYYY-MM-DD
+ const dateToISO = (date) =>
+ getOnlyValidDate(date).toISOString().substring(0, 10);
+
+
+ // Retrieve the current hour, minute, sec, ms, time into a timestamp
+ const hours = (date) => getOnlyValidDate(date).getHours() * 3600 * 1000;
+ const minutes = (date) => getOnlyValidDate(date).getMinutes() * 60 * 1000;
+ const seconds = (date) => getOnlyValidDate(date).getSeconds() * 1000;
+ const ms = (date) => getOnlyValidDate(date).getMilliseconds();
+ const time = (date) =>
+ hours(getOnlyValidDate(date)) +
+ minutes(getOnlyValidDate(date)) +
+ seconds(getOnlyValidDate(date)) +
+ ms(getOnlyValidDate(date));
+
+ // Retrieve the time part from a timestamp and remove the day. Return a int.
+ const timeMinusDate = (date) => time(getOnlyValidDate(date));
+
+ // Retrieve the day and remove the time. Return a Date
+ const dateMinusTime = (date) =>
+ new Date(getOnlyValidDate(date).getTime() - time(getOnlyValidDate(date)));
+
+ const displayClockOptions = () =>
+ Array(24)
+ .fill(1)
+ .map((x, i) => (
+
+ ));
+console.log(isTimeLimited);
return (
-
-
+ className={"componentMobile btn-confirm-mobile mb-5" + className}
+ onClick={toggle}
+ tabIndex={tabIndex}>
+
+ {t("Valider")}
+
- {t("Le vote")}
+ {t("Le vote")}
+ {t("Confirmation du vote")}
-
-
- {t("Question of the election")}
-
-
-
- {title}
-
-
-
-
- {t("Candidates/Proposals")}
-
-
-
-
-
- {candidates.map((candidate, i) => {
- if (candidate.label !== "") {
- return (
- -
- {candidate.label}
-
-
- );
- } else {
- return ;
- }
- })}
-
-
-
+
+
+
+ {t("Question of the election")}
+
+
+
+ {title}
+
+
+
+
+
+
+
+ {t("Candidates/Proposals")}
+
+
+
+
+
+ {candidates.map((candidate, i) => {
+ if (candidate.label !== "") {
+ return (
+ -
+ {candidate.label}
+
+
+ );
+ } else {
+ return ;
+ }
+ })}
+
+
+
+
-
- {t("Les paramètres")}
+
+ {t("Les paramètres")}
-
+
+
+
+
+
+
+
+
+
+
+ {/*
{t("Dates")}
@@ -110,50 +183,167 @@ const ConfirmModal = ({ tabIndex, title, candidates, grades, isTimeLimited, star
{finish.toLocaleTimeString()}
-
-
-
- {t("Grades")}
-
-
- {grades.map((mention, i) => {
- return i < grades.length ? (
-
- {mention.label}
-
+
*/}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - {t("Starting date")}
+
+
+ {
+ setStart(
+ new Date(
+ timeMinusDate(start) +
+ new Date(e.target.valueAsNumber).getTime()
+ )
+ );
+ }}
+ />
+
+
+
+
+
+
+
+
+
+ {
+ setFinish(
+ new Date(
+ timeMinusDate(finish) +
+ new Date(e.target.valueAsNumber).getTime()
+ )
+ );
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+ {t("Grades")}
+
+
+ {grades.map((mention, i) => {
+ return i < grades.length ? (
+
+ {mention.label}
+
+ ) : (
+
+ );
+ })}
+
+
+
+
+
+ {t("Voters' list")}
+
+
+ {emails.length > 0 ? (
+ emails.join(", ")
) : (
-
- );
- })}
-
-
-
- {t("Voters' list")}
-
-
- {emails.length > 0 ? (
- emails.join(", ")
- ) : (
-
- {t("The form contains no address.")}
-
-
- {t(
- "The election will be opened to anyone with the link"
- )}
-
-
- )}
-
-
- {restrictResult ? (
+
+ {t("The form contains no address.")}
+
+
+ {t(
+ "The election will be opened to anyone with the link"
+ )}
+
+
+ )}
+
+
+ {/* {restrictResult ? (
@@ -182,14 +372,15 @@ const ConfirmModal = ({ tabIndex, title, candidates, grades, isTimeLimited, star
- )}
+ )} */}
+
-
-
+
+
diff --git a/pages/new/index.js b/pages/new/index.js
index 9398312..2d862c3 100644
--- a/pages/new/index.js
+++ b/pages/new/index.js
@@ -242,6 +242,7 @@ const CreateElection = (props) => {
changeDisplay();
};
+
return (
diff --git a/styles/scss/_newVote.scss b/styles/scss/_newVote.scss
index a044956..260778a 100644
--- a/styles/scss/_newVote.scss
+++ b/styles/scss/_newVote.scss
@@ -432,7 +432,7 @@ line-height: 24px;
margin: auto;
}
.recap-vote {
- background-color: white;
+
font-weight: bold;
}
.recap-vote .row {
@@ -460,7 +460,7 @@ line-height: 24px;
border-top: none;
}
-.confirmation-divider {
+.confirmation-divider, .confirmation-divider-mobile {
width: 100%;
border-top: solid 1px #0A004C;
}
@@ -600,8 +600,11 @@ line-height: 24px!important;
}
.form-control {
color: #0A004C;
-}
+}
+.time-container .form-control {
+ width: fit-content!important;
+}
.mobile-title {
display: none;
}
@@ -613,6 +616,9 @@ line-height: 24px!important;
}
.trashIcon {
color: #FF3E37!important;
+}
+.rightColumn {
+ padding-left: 15px;
}
@media screen and (min-width: 619px) and (max-width: 1120px) {
.btn-return-candidates {
@@ -671,10 +677,10 @@ line-height: 24px!important;
.modal-header-settings {
justify-content: flex-start;
}
- .settings-modal-body > .row {
+ .settings-modal-body > .row, .confirm-modal-body > .row {
padding: 15px 15px 0px;
}
- .settings-modal-body {
+ .settings-modal-body, .confirm-modal-body, .settings-modal > .modal-content {
background: transparent;
width: 100%;
}
@@ -705,7 +711,7 @@ line-height: 24px!important;
padding: 12px;
}
- .settings-divider {
+ .settings-divider, .confirmation-divider {
display: none;
}
@@ -785,6 +791,21 @@ color: #2400FD;
color: white;
margin-bottom: 10px;
}
+ .recap-vote > div {
+ margin: 15px auto;
+ }
+ .recap-vote .row {
+ padding: 0px 15px;
+ }
+ .recap-vote-label {
+ padding-top: 15px!important;
+ }
+ .time-container .form-control {
+ margin: auto;
+ }
+ .rightColumn {
+ padding: 0px;
+ }
}
@media screen and (max-width: 375px) {
.removeAddButtons {