diff --git a/app.js b/app.js
index 8d0aa84..2dd080b 100644
--- a/app.js
+++ b/app.js
@@ -133,6 +133,23 @@ async function fetchTrips() {
var logInner = document.getElementById("log").innerHTML
+
+// Request permission for notifications
+document.addEventListener('DOMContentLoaded', function() {
+ if (Notification.permission !== "granted") {
+ Notification.requestPermission();
+ }
+});
+
+function sendNotification(title, body) {
+ if (Notification.permission === "granted") {
+ new Notification(title, {
+ body: body,
+ icon: 'tcdd-cli.png'
+ });
+ }
+}
+
function checkTrip(trip) {
let seatType = document.getElementById('seatType').value;
let disabled_seat_count = 0;
@@ -162,6 +179,7 @@ function checkTrip(trip) {
♿ Disabled: ${disabled_seat_count}
`;
found = true;
audio.play();
+ sendNotification('Economy seats available', `${tripDate}, ${tripTime} - Economy: ${economy_seat_count}`);
} else if (seatType === "business" && business_seat_count > 0) {
document.getElementById("status").innerHTML
+= `
Business seats available for:
@@ -171,6 +189,8 @@ function checkTrip(trip) {
♿ Disabled: ${disabled_seat_count}
`;
found = true;
audio.play();
+ sendNotification('Business seats available', `${tripDate}, ${tripTime} - Business: ${business_seat_count}`);
+
}
}
diff --git a/index.html b/index.html
index 5222e57..3aaf4df 100644
--- a/index.html
+++ b/index.html
@@ -4,6 +4,7 @@
+