mirror of https://gitlab.com/ceda_ei/sonzai.git
Compare commits
No commits in common. "7425b566d53793a37581da6361816075f9814e30" and "e151e51eb05fe835e9c6f3ab512357a38a3fe9ff" have entirely different histories.
7425b566d5
...
e151e51eb0
|
@ -2,7 +2,6 @@ import React from "react";
|
|||
import PropTypes from "prop-types";
|
||||
import {
|
||||
Portal,
|
||||
Text,
|
||||
} from "react-native-paper";
|
||||
import { createStackNavigator } from "@react-navigation/stack";
|
||||
|
||||
|
@ -13,17 +12,6 @@ const Stack = createStackNavigator();
|
|||
|
||||
export default function Timetable({ addTimetableEntry, removeTimetableEntry, timetable, subjects }) {
|
||||
const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
||||
if (subjects.length === 0) {
|
||||
return (
|
||||
<Text
|
||||
style={{
|
||||
textAlign: "center",
|
||||
marginTop: 12,
|
||||
}}
|
||||
>
|
||||
No Subjects added. Add Subjects first.
|
||||
</Text>);
|
||||
}
|
||||
return (
|
||||
<Portal.Host><Stack.Navigator headerMode="none">
|
||||
<Stack.Screen name="Timetable">
|
||||
|
|
|
@ -47,22 +47,19 @@ function AddEntry({addTimetableEntry, days, day, subjects, navigation }) {
|
|||
}
|
||||
|
||||
function submit() {
|
||||
let message = "";
|
||||
if (subject.id === null)
|
||||
message = "Missing Subject";
|
||||
else if (start === null)
|
||||
message = "Missing start time.";
|
||||
else if (end === null)
|
||||
message = "Missing end time.";
|
||||
else if (count === 0)
|
||||
message = "Missing count.";
|
||||
|
||||
if (message !== "") {
|
||||
setSnackbar({visible: true, message: message});
|
||||
setTimeout(() => setSnackbar({ visible: false, message: null }), 2000);
|
||||
if (subject.id === null) {
|
||||
setSnackbar({ visible: true, message: "Missing subject." });
|
||||
return;
|
||||
} else if (start === null) {
|
||||
setSnackbar({ visible: true, message: "Missing start time." });
|
||||
return;
|
||||
} else if (end === null) {
|
||||
setSnackbar({ visible: true, message: "Missing end time." });
|
||||
return;
|
||||
} else if (count === 0) {
|
||||
setSnackbar({ visible: true, message: "Missing count." });
|
||||
return;
|
||||
}
|
||||
|
||||
addTimetableEntry(day, {
|
||||
sub_id: subject.id,
|
||||
count,
|
||||
|
|
Loading…
Reference in New Issue