-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbr.html
93 lines (81 loc) · 3.86 KB
/
br.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kitchen Room</title>
<link rel="stylesheet" href="lrc.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="styles.css">
<link rel="shortcut icon" href="./images/logo.png" type="image/x-icon">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="m-0 p-0">
<div id="nav" class="h-16 w-full fixed top-0 z-10 left-0 p-1">
<a href="./index.html" style="text-decoration: none;">
<h2 id="sustarch" class="absolute top-1/2 -translate-y-1/2 left-10 font-semibold text-base md:text-2xl text-white">Sustainable Home Automation</h2>
</a>
<div id="right" class="absolute right-0 top-1/2 -translate-y-1/2 mr-10 flex items-center gap-4 md:gap-6">
<a href="./aboutus.html" class="hidden md:visible">
<h4>About us</h4>
</a>
<h4 id="btn1" class="p-2 h-10 w-20 cursor-pointer border-white border-2 hidden items-center justify-center rounded-md md:flex">
<a href="./signin.html">Sign in</a>
</h4>
<i class="fa-solid fa-bell cursor-pointer text-base md:text-xl"></i>
</div>
</div>
<div id="page1" class="h-screen w-screen mt-16 flex justify-center items-center bg-gray-100">
<h1>Kitchen Room</h1>
<div id="page1dev" class="w-full max-w-md p-6 bg-white shadow-lg rounded-lg text-center">
<h2 class="text-xl font-semibold text-gray-800">IoT Device Management</h2>
<!-- Device List -->
<div id="deviceList" class="mt-4 space-y-3">
<!-- Devices will be added dynamically here -->
</div>
<!-- Add Device Form -->
<div class="mt-6">
<h3 class="text-lg font-medium text-gray-700 mb-2">Add New Device</h3>
<input id="deviceName" type="text" placeholder="Device Name" class="w-full p-2 border rounded mb-2">
<!-- Connectivity Options -->
<select id="deviceConnection" class="w-full p-2 border rounded mb-3">
<option value="WiFi">WiFi</option>
<option value="Bluetooth">Bluetooth</option>
</select>
<button onclick="addDevice()" class="w-full bg-blue-500 text-white py-2 rounded hover:bg-blue-600">
Add Device
</button>
</div>
</div>
</div>
<script>
function addDevice() {
let name = document.getElementById("deviceName").value.trim();
let connection = document.getElementById("deviceConnection").value;
if (name === "") {
alert("Please enter a device name.");
return;
}
let deviceList = document.getElementById("deviceList");
let deviceCard = document.createElement("div");
deviceCard.className = "p-4 bg-gray-200 rounded flex justify-between items-center";
deviceCard.innerHTML = `
<div>
<p class="font-medium">${name} (${connection})</p>
<p class="text-sm text-gray-600">Usage: <span class="usage">0</span> kWh</p>
</div>
<button onclick="removeDevice(this)" class="bg-red-500 text-white px-3 py-1 rounded hover:bg-red-600">
Remove
</button>
`;
deviceList.appendChild(deviceCard);
document.getElementById("deviceName").value = "";
}
function removeDevice(button) {
if (confirm("Are you sure you want to remove this device?")) {
button.parentElement.remove();
}
}
</script>
</body>
</html>