Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend treatment form #228

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions static/css/drawer.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,23 @@
}

#treatmentDrawer label.left-column span {
width: 110px;
width: 90px;
display: inline-block;
}

#treatmentDrawer label.left-column input, #treatmentDrawer label.left-column select {
width: 140px;
width: 160px;
}

#treatmentDrawer label.left-column.amount-when input {
width: 70px;
}

#treatmentDrawer label.left-column.amount-when select {
width: 90px;
}


#treatmentDrawer #glucoseValue {
width: 230px;
}
Expand Down
51 changes: 41 additions & 10 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h1 class="customTitle">Nightscout</h1>
<dd><input type="radio" name="units-browser" id="mgdl-browser" value="mg/dl" checked /><label for="mgdl-browser">mg/dL</label><br />
<dd><input type="radio" name="units-browser" id="mmol-browser" value="mmol" /><label for="mmol-browser">mmol/L</label>
</dl>
<dl class="radio">
<dl class="radio">
<dt>Date format</dt>
<dd><input type="radio" name="timeformat-browser" id="12-browser" value="12" checked /><label for="12-browser">12 hours</label><br />
<dd><input type="radio" name="timeformat-browser" id="24-browser" value="24" /><label for="24-browser">24 hours</label>
Expand Down Expand Up @@ -138,7 +138,9 @@ <h1 class="customTitle">Nightscout</h1>
<option value="Meal Bolus">Meal Bolus</option>
<option value="Correction Bolus">Correction Bolus</option>
<option value="Carb Correction">Carb Correction</option>
<option value="Question">Note or Question</option>
<option value="Temp Basal">Temp Basal</option>
<option value="Note">Note</option>
<option value="Question">Question</option>
<option value="Exercise">Exercise</option>
<option value="Site Change">Pump Site Change</option>
<option value="Sensor Start">Dexcom Sensor Start</option>
Expand All @@ -149,7 +151,7 @@ <h1 class="customTitle">Nightscout</h1>
<fieldset>
<legend>Glucose Reading</legend>
<input type="number" step="any" id="glucoseValue" />
<label><br>Measurement Method:<br></label>
<label><br>Method:</label>
<label for="meter">
<input type="radio" name="glucoseType" id="meter" value="Finger"/>
<span>Meter</span>
Expand All @@ -159,16 +161,45 @@ <h1 class="customTitle">Nightscout</h1>
<span>Sensor<br></span>
</label>
</fieldset>
<label for="carbsGiven" class="left-column short-label">
<span>Carbs Given:</span>
<input type="number" step="any" min="0" id="carbsGiven" placeholder="Amount in grams" />
<label for="carbsGiven" class="left-column short-label amount-when">
<span>Carbs:</span>
<input type="number" step="any" min="0" id="carbsGiven" placeholder="in grams" />
<select id="carbsWhen">
<option value="+20m">In 20m</option>
<option value="+10m">In 10m</option>
<option value="0" selected="selected">NOW</option>
<option value="-5m">5m Ago</option>
<option value="-10m">10m Ago</option>
<option value="-15m">15m Ago</option>
<option value="-20m">20m Ago</option>
<option value="-30m">30m Ago</option>
</select>
</label>
<label for="insulinGiven" class="left-column short-label amount-when">
<span>Insulin:</span>
<input type="number" step="any" min="0" id="insulinGiven" placeholder="in units"/>
<select id="insulinWhen">
<option value="+20m">In 20m</option>
<option value="+10m">In 10m</option>
<option value="0" selected="selected">NOW</option>
<option value="-5m">5m Ago</option>
<option value="-10m">10m Ago</option>
<option value="-15m">15m Ago</option>
<option value="-20m">20m Ago</option>
<option value="-30m">30m Ago</option>
</select>
</label>
<br/>
<label for="duration" class="left-column short-label">
<span>Duration:</span>
<input type="number" step="any" min="0" id="duration" placeholder="in minutes"/>
</label>
<label for="insulinGiven" class="left-column short-label">
<span>Insulin Given:</span>
<input type="number" step="any" min="0" id="insulinGiven" placeholder="Amount in units"/>
<label for="percent" class="left-column short-label">
<span>Percent:</span>
<input type="number" step="any" min="0" id="percent" placeholder="+/- %"/>
</label>
<!-- Label and textarea -->
<label for="notes"><br>Additional Notes, Comments:<br></label>
<label for="notes"><br/>Additional Notes, Comments:<br/></label>
<textarea id="notes"></textarea><br>
<button type="submit">Submit Form</button>
</fieldset>
Expand Down
20 changes: 15 additions & 5 deletions static/js/ui-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,13 @@ function openTreatmentDrawer() {
$('#enteredBy').val(browserStorage.get("enteredBy") || '');
$('#eventType').val('BG Check');
$('#glucoseValue').val('').attr('placeholder', 'Value in ' + browserSettings.units);
$('#meter').prop('checked', true)
$('#meter').prop('checked', true);
$('#carbsGiven').val('');
$('#carbsWhen').val(0);
$('#insulinGiven').val('');
$('#insulinWhen').val(0);
$('#duration').val('');
$('#percent').val('');
$('#notes').val('');
}

Expand Down Expand Up @@ -273,7 +277,11 @@ function treatmentSubmit(event) {
data.glucose = document.getElementById("glucoseValue").value;
data.glucoseType = $('#treatment-form input[name=glucoseType]:checked').val();
data.carbs = document.getElementById("carbsGiven").value;
data.carbsWhen = document.getElementById("carbsWhen").value;
data.insulin = document.getElementById("insulinGiven").value;
data.insulinWhen = document.getElementById("insulinWhen").value;
data.duration = document.getElementById("duration").value;
data.percent = document.getElementById("percent").value;
data.notes = document.getElementById("notes").value;

var dataJson = JSON.stringify(data, null, " ");
Expand All @@ -284,8 +292,10 @@ function treatmentSubmit(event) {
'\nEvent type: ' + data.eventType +
'\nBlood glucose: ' + data.glucose +
'\nMethod: ' + data.glucoseType +
'\nCarbs Given: ' + data.carbs +
'\nInsulin Given: ' + data.insulin +
'\nCarbs: ' + data.carbs + (data.carbsWhen != 0 ? ' (' + data.carbsWhen + ')' : '') +
'\nInsulin: ' + data.insulin + (data.insulinWhen != 0 ? ' (' + data.insulinWhen + ')' : '') +
'\nDuration: ' + data.duration +
'\nPercent: ' + data.percent +
'\nNotes: ' + data.notes);

if (ok) {
Expand Down Expand Up @@ -393,7 +403,7 @@ $("input#save").click(function() {
"alarmLow": $("#alarmlow-browser").prop("checked"),
"nightMode": $("#nightmode-browser").prop("checked"),
"customTitle": $("input#customTitle").prop("value"),
"theme": $("input:radio[name=theme-browser]:checked").val(),
"theme": $("input:radio[name=theme-browser]:checked").val(),
"timeFormat": $("input:radio[name=timeformat-browser]:checked").val()
}, browserStorage);

Expand Down Expand Up @@ -424,7 +434,7 @@ $(function() {
fade: true,
gravity: "n",
opacity: 0.75
}
};

if (querystring.notify) {
showNotification(querystring.notify, querystring.notifytype);
Expand Down