mirror of https://gitlab.com/ceda_ei/sonzai.git
Auto close snackbar.
This commit is contained in:
parent
e151e51eb0
commit
265485acb1
|
@ -47,19 +47,22 @@ function AddEntry({addTimetableEntry, days, day, subjects, navigation }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit() {
|
function submit() {
|
||||||
if (subject.id === null) {
|
let message = "";
|
||||||
setSnackbar({ visible: true, message: "Missing subject." });
|
if (subject.id === null)
|
||||||
return;
|
message = "Missing Subject";
|
||||||
} else if (start === null) {
|
else if (start === null)
|
||||||
setSnackbar({ visible: true, message: "Missing start time." });
|
message = "Missing start time.";
|
||||||
return;
|
else if (end === null)
|
||||||
} else if (end === null) {
|
message = "Missing end time.";
|
||||||
setSnackbar({ visible: true, message: "Missing end time." });
|
else if (count === 0)
|
||||||
return;
|
message = "Missing count.";
|
||||||
} else if (count === 0) {
|
|
||||||
setSnackbar({ visible: true, message: "Missing count." });
|
if (message !== "") {
|
||||||
|
setSnackbar({visible: true, message: message});
|
||||||
|
setTimeout(() => setSnackbar({ visible: false, message: null }), 2000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addTimetableEntry(day, {
|
addTimetableEntry(day, {
|
||||||
sub_id: subject.id,
|
sub_id: subject.id,
|
||||||
count,
|
count,
|
||||||
|
|
Loading…
Reference in New Issue