-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added report page and partially send sms page
- Loading branch information
Showing
7 changed files
with
191 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
import React from "react"; | ||
import React, { useEffect } from "react"; | ||
import { Table } from "react-bootstrap"; | ||
|
||
export default function Report() { | ||
return( | ||
<div>testing</div> | ||
); | ||
export default function Report({ activeKey, requestSMSData, smsData }) { | ||
|
||
useEffect(() => { | ||
if (activeKey && !smsData) { | ||
requestSMSData(); | ||
} | ||
}); | ||
|
||
if (smsData) { | ||
return ( | ||
<> | ||
<Table striped bordered hover> | ||
<thead> | ||
<tr> | ||
<th>Time</th> | ||
<th>From</th> | ||
<th>To</th> | ||
<th>Message</th> | ||
<th>Status</th> | ||
</tr> | ||
</thead> | ||
<tbody>{smsData.map((dataRow, key) => ( | ||
<tr key={key}> | ||
<td>{dataRow.dateTime}</td> | ||
<td>{dataRow.origin}</td> | ||
<td>{dataRow.destination}</td> | ||
<td>{dataRow.message}</td> | ||
<td>{dataRow.status}</td> | ||
</tr>))} | ||
</tbody> | ||
</Table> | ||
</> | ||
|
||
); | ||
} else { | ||
return ( | ||
<div> still rendering reports page</div> | ||
); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,58 @@ | ||
import React from "react"; | ||
import { Form, Button, Container } from "react-bootstrap"; | ||
|
||
export default function SendSMS() { | ||
return( | ||
<div>testing send sms</div> | ||
export default function SendSMS({ sendSMSRequest }) { | ||
|
||
function handleChange(element){ | ||
// console.log(element.target.value.length) | ||
let messageLength = element.target.value.length | ||
let statusElement = document.getElementById("charCounter") | ||
let message; | ||
if(messageLength < 160){ | ||
message = `${messageLength}/160 used`; | ||
} else { | ||
message = `A multiple of <strong>${Math.ceil(messageLength/160)}</strong> messages`; | ||
} | ||
|
||
statusElement.innerHTML = message | ||
} | ||
|
||
|
||
return ( | ||
<><Container | ||
style={{ | ||
width: "800px", | ||
display: "block", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}}> | ||
<Form style={{ | ||
width: "400px", | ||
display: "block", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}}> | ||
<Form.Group className="mb-3" controlId="formBasicFrom"> | ||
<Form.Label>Use this form to send SMS</Form.Label> | ||
<Form.Control required type="text" placeholder="from" /> | ||
</Form.Group> | ||
|
||
<Form.Group className="mb-3" controlId="formBasicTo"> | ||
<Form.Control type="text" placeholder="To" /> | ||
</Form.Group> | ||
<Form.Group className="mb-3" controlId="formBasicTO"> | ||
<Form.Control as="textarea" type="textarea" placeholder="Message" onChange={handleChange}/> | ||
<Form.Text className="text-muted" id="charCounter"> | ||
We will count your characters | ||
</Form.Text> | ||
</Form.Group> | ||
|
||
<Button variant="primary" type="submit"> | ||
Send | ||
</Button> | ||
</Form> | ||
</Container> | ||
</> | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters