bug fix for Schedule Meetings and Call Group

This commit is contained in:
CodeServer 2022-03-31 01:45:08 +01:00
parent eca6fba645
commit f008abe473
2 changed files with 180 additions and 142 deletions

View File

@ -4,6 +4,7 @@ import {
Dialog, Dialog,
DialogActions, DialogActions,
DialogContent, DialogContent,
DialogContentText,
DialogTitle, DialogTitle,
FormControlLabel, FormControlLabel,
FormGroup, FormGroup,
@ -33,6 +34,7 @@ const CallFavouritesDialog: React.FC<Props> = ({
const [group, setGroup] = useState<string>("Favorites"); const [group, setGroup] = useState<string>("Favorites");
const [inputText, setInputText] = useState<string>(""); const [inputText, setInputText] = useState<string>("");
const [checkedUuids, setCheckedUuids] = useState<string[]>([]); const [checkedUuids, setCheckedUuids] = useState<string[]>([]);
const [urlDialog, seturlDialog] = useState({ open: false, url: "" });
const handleCheck = (uuid: string, checked: boolean) => { const handleCheck = (uuid: string, checked: boolean) => {
if (checked) { if (checked) {
@ -58,8 +60,11 @@ const CallFavouritesDialog: React.FC<Props> = ({
const auth = useAuth(); const auth = useAuth();
const handleCall = async(e: React.SyntheticEvent) => { const handleCall = async(e: React.SyntheticEvent) => {
const start = new Date().toISOString();
let newStart = start.split('.')[0];
newStart += start.includes("Z") ? "Z" : "";
const newMeeting: NewMeeting ={ const newMeeting: NewMeeting ={
startTime: new Date().toISOString(), startTime: newStart,
duration: 60, duration: 60,
topic: "Quick Call to Group", topic: "Quick Call to Group",
registrantIds: checkedUuids registrantIds: checkedUuids
@ -70,10 +75,12 @@ const CallFavouritesDialog: React.FC<Props> = ({
); );
const meeting: DetailedMeeting = response?.data; const meeting: DetailedMeeting = response?.data;
console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration); console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration);
seturlDialog({ open: true, url: meeting.joinUrl });
handleClose(); handleClose();
}; };
return ( return (
<>
<Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm"> <Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm">
<DialogTitle>Select who to call:</DialogTitle> <DialogTitle>Select who to call:</DialogTitle>
<DialogContent> <DialogContent>
@ -127,6 +134,18 @@ const CallFavouritesDialog: React.FC<Props> = ({
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<Dialog
open={urlDialog.open}
onClose={() => {
seturlDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{urlDialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</>
); );
}; };

View File

@ -4,6 +4,7 @@ import {
Dialog, Dialog,
DialogActions, DialogActions,
DialogContent, DialogContent,
DialogContentText,
DialogTitle, DialogTitle,
FormControlLabel, FormControlLabel,
FormGroup, FormGroup,
@ -28,7 +29,7 @@ import {
handleClose: () => void; handleClose: () => void;
} }
const CallFavouritesDialog: React.FC<Props> = ({ const CallScheduledMeetingDialog: React.FC<Props> = ({
open, open,
handleClose, handleClose,
}: Props) => { }: Props) => {
@ -39,6 +40,7 @@ import {
const [group, setGroup] = useState<string>("Favorites"); const [group, setGroup] = useState<string>("Favorites");
const [inputText, setInputText] = useState<string>(""); const [inputText, setInputText] = useState<string>("");
const [checkedUuids, setCheckedUuids] = useState<string[]>([]); const [checkedUuids, setCheckedUuids] = useState<string[]>([]);
const [urlDialog, seturlDialog] = useState({ open: false, url: "" });
const handleCheck = (uuid: string, checked: boolean) => { const handleCheck = (uuid: string, checked: boolean) => {
if (checked) { if (checked) {
@ -69,8 +71,11 @@ import {
const auth = useAuth(); const auth = useAuth();
const handleCall = async(e: React.SyntheticEvent) => { const handleCall = async(e: React.SyntheticEvent) => {
const start = meetingStartDate ? meetingStartDate.toISOString() : new Date().toISOString();
let newStart = start.split('.')[0];
newStart += start.includes("Z") ? "Z" : "";
const newMeeting: NewMeeting ={ const newMeeting: NewMeeting ={
startTime: meetingStartDate ? meetingStartDate.toISOString() : new Date().toISOString(), startTime: newStart,
duration: meetingDuration, duration: meetingDuration,
topic: meetingTopic, topic: meetingTopic,
registrantIds: checkedUuids registrantIds: checkedUuids
@ -81,10 +86,12 @@ import {
); );
const meeting: DetailedMeeting = response?.data; const meeting: DetailedMeeting = response?.data;
console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration); console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration);
seturlDialog({ open: true, url: meeting.joinUrl });
handleClose(); handleClose();
}; };
return ( return (
<>
<Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm"> <Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm">
<DialogTitle>Schedule A Meeting</DialogTitle> <DialogTitle>Schedule A Meeting</DialogTitle>
<DialogContent dividers> <DialogContent dividers>
@ -172,7 +179,19 @@ import {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<Dialog
open={urlDialog.open}
onClose={() => {
seturlDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{urlDialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</>
); );
}; };
export default CallFavouritesDialog; export default CallScheduledMeetingDialog;