Skip to content

Commit

Permalink
Version 2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
webapps-sptech committed Jan 17, 2023
1 parent c4442ed commit 75434fe
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ Will hide the element if the event name doesn't contain "service"
### labelTitle
Special case for if the event is a service. This will populate the label title based on what service team they are apart of
```<h1 id="labelTitle"></h1>```
### computedAge
Populate the computed age of the contact from "dob"
```<d id="computedAge"></d>```

# Development
## Dependencies
Expand Down
19 changes: 19 additions & 0 deletions fluroHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,25 @@ module.exports = {
* Contact Information
*/

// Populate the computedAge tag
if (html.querySelector("#computedAge") != null) {
pushSelector("contact");
callbacks.push(function (result) {
try {
const today = new Date();
const dob = new Date(result.contact.dob);
const monthDiff = today.getMonth() - dob.getMonth();
let computedAge = today.getFullYear() - dob.getFullYear();
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < dob.getDate()))
computedAge--;
html.querySelector("#computedAge").innerHTML = computedAge;
}
catch (e) {
if (!isNaN(result.contact.age) && result.contact.age >= 0)
html.querySelector("#computedAge").innerHTML = result.contact.age;
}
});
}
//Populate the name tag notes
if (html.querySelector("#nameTagNotes") != null) {
pushSelector("contact");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kardinia-kiosk-checkin",
"version": "2.4.2",
"version": "2.4.3",
"description": "Kardinia Checkin Kiosk",
"main": "app.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ First stable release.
## v2.4.1
* Added support for the Brother QL-700
## v2.4.2
* Fixed a typo which was stopping a printer from being shown
* Fixed a typo which was stopping a printer from being shown
## v2.4.3
* Added extra functionality to provide age from contact's dob as #computedAge

0 comments on commit 75434fe

Please sign in to comment.