Skip to content

Commit

Permalink
late night update (toggle, email, psi, incidents)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuamartin273 committed Nov 8, 2016
1 parent 80867ea commit 7d06db4
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 63 deletions.
7 changes: 4 additions & 3 deletions client/main.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<head>
<title>CZ3003App</title>
<title>CMS Singapore - CACAD</title>
<link rel="icon" href="/images/icon.png">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>

Expand Down Expand Up @@ -67,10 +68,10 @@
{{#if isInRole 'Admin'}}
<li class="sublist"><a href="/category/0/0">NEW</a></li>
{{/if}}
</ul>
</ul>
</li>
<li>
<a href="#">REPORTS</a>
<a href="#">INCIDENTS</a>
<ul type="disc">
<li class="sublist"><a href="/reports/view">VIEW</a></li>
{{#if isInRole 'Admin, Operator'}}
Expand Down
67 changes: 11 additions & 56 deletions imports/ui/map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ class GoogleMap extends React.Component {
DengueControlDiv.index = 1;
TrafficControlDiv.index = 1;
GasControlDiv.index = 1;
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(PSIControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(WeatherControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(ShelterControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(FireControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(DengueControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(TrafficControlDiv);
mapi.controls[google.maps.ControlPosition.TOP_CENTER].push(GasControlDiv);

mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(PSIControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(WeatherControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(ShelterControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(DengueControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(TrafficControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(FireControlDiv);
mapi.controls[google.maps.ControlPosition.RIGHT_CENTER].push(GasControlDiv);
this.setState({
ready : true
})
Expand All @@ -182,9 +183,9 @@ class GoogleMap extends React.Component {
controlUI.style.borderRadius = '3px';
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
controlUI.style.cursor = 'pointer';
controlUI.style.marginBottom = '22px';
controlUI.style.marginBottom = '3px';
controlUI.style.textAlign = 'center';
controlUI.title = 'Click to show PSI Markers';
controlUI.title = 'Click to show markers';
controlDiv.appendChild(controlUI);

// Set CSS for the control interior.
Expand Down Expand Up @@ -311,63 +312,17 @@ class GoogleMap extends React.Component {
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][4] + '</td>' +
'</tr>' +
'<tr>' +
'<td>1-hr NO2 concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][5] + '</td>' +
'</tr>' +
'<tr>' +
'<td>24-hrs PM10 concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][6] + '</td>' +
'</tr>' +
'<tr>' +
'<td>24-hrs PM2.5 concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][7] + '</td>' +
'</tr>' +
'<tr>' +
'<td>24-hrs SO2 concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][8] + '</td>' +
'</tr>' +
'<tr>' +
'<td>8-hrs CO concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][9] + '</td>' +
'</tr>' +
'<tr>' +
'<td>8-hrs O3 concentration</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][10] + '</td>' +
'</tr>' +
'<tr>' +
'<td>CO sub-index</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][11] + '</td>' +
'</tr>' +
'<tr>' +
'<td>O3 sub-index</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][12] + '</td>' +
'</tr>' +
'<tr>' +
'<td>PM10 sub-index</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][13] + '</td>' +
'</tr>' +
'<tr>' +
'<td>PM2.5 sub-index</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][14] + '</td>' +
'</tr>' +
'<tr>' +
'<td>SO2 sub-index</td>'+
'<td>:</td>'+
'<td class="mapContent">' + markerlist[i][15] + '</td>' +
'</tr>' +
'</table>'+

'</div>'+
'</div>';
//detail of each marker
Expand Down Expand Up @@ -412,7 +367,7 @@ renderShelterMarkers() {
}
var arrayofMarkers = []
var icon = {
url: 'images/logo.png',
url: 'images/shelter.png',
scaledSize: new google.maps.Size(30,30),
origin: new google.maps.Point(0,0),
anchor: new google.maps.Point(0,0)}
Expand Down
4 changes: 2 additions & 2 deletions imports/ui/reports_edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ development of incidents! &lt;website link&gt;</div>"

if(Roles.userIsInRole(Meteor.userId(), ['Admin', 'Operator'])) {
return (<div>
<h2>Report Page</h2>
<h2>Incident Page</h2>
<form name="reportCase" onSubmit={this.handleSubmit.bind(this)}>
<fieldset id="reportCaseFieldSet">
<table width="100%" border="0">
Expand Down Expand Up @@ -312,7 +312,7 @@ development of incidents! &lt;website link&gt;</div>"
</form>
{this.state.ready ? this.renderReportItem() : null}
<br/>
<Link to = "/reports/view" activeClassName="active">← Back to list of reports</Link>
<Link to = "/reports/view" activeClassName="active">← Back to list of incidents</Link>
</div>
)
}
Expand Down
Binary file added public/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ Meteor.setInterval(function() {
console.log("INSIDE INTERVAL")
incidentTypes = ["Fire", "Gas Leak"]
counter = {"Fire":{"Active":0, "Handled":0, "Resolved":0}, "Gas Leak":{"Active":0, "Handled":0, "Resolved":0}}
email = "<div><h2 style='color:#056571;'>Summary</h2><table style='width:700px; font-family:roboto, sans-serif; color:#414141;'><tr><th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='20%'>Category</th><th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff; 'width='50%'>Active</th><th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='15%'>Handled</th><th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='15%'>Resolved</th></tr>"
email = "<p>Dear Mr Prime Minister, <br/><br/><br/>"+
"The following is the latest development on the current incidents in Singapore.<br/><br/></p>"+
"<div>"+
"<h2 style='color:#056571;'>Summary</h2>"+
"<table style='width:700px; font-family:roboto, sans-serif; color:#414141;'>"+
"<tr>"+
"<th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='20%'>Category</th>"+
"<th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff; 'width='15%'>Active</th>"+
"<th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='15%'>Handled</th>"+
"<th style='text-align: left; background-color: #056571; font-weight:bold; color:#ffffff;' width='15%'>Resolved</th></tr>"
incidents = "<div>"
for(i = 0;i<incidentTypes.length;++i) {
var reports =Meteor.call('reports.getByType', incidentTypes[i])
Expand All @@ -30,10 +39,14 @@ Meteor.setInterval(function() {
email = email + "</div>"
incidents = incidents + "</div>"

incidents = incidents + "<br/><p>We hope the information we provided could help you monitor the status of incidents and therefore make informed decisions accordingly.<br/></p>"+
"<p>That is the end of our half-hourly report summary.</p>"+
"<p>Should you need further information for any purposes, you may navigate to our website, cacadcmssingapore.scalingo.io<br/></p>"+
"<p>Thank you very much.<br/><br/>Best regards,<br/>CMS Singapore"
// console.log(incidents)

// Meteor.call('sendEmail', "[email protected]", "PM Update", email + incidents);
// Meteor.call('sendEmail', "[email protected]", "PM Update", incidents);
// Meteor.call('sendEmail', "[email protected]", "PM Update", email + incidents);
}, 5000);
function GetMinuteDiff(a, b) {
var diff = a - b;
Expand Down

0 comments on commit 7d06db4

Please sign in to comment.