-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMechanical_Dashboard.html
146 lines (127 loc) · 3.25 KB
/
Mechanical_Dashboard.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html>
<head>
<title>Mechanic Dashboard</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
.mechanic-info {
background-color: #fff;
max-width: 500px;
margin: 0 auto;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.mechanic-info h2 {
text-align: center;
color: #333;
}
label {
display: block;
margin-bottom: 6px;
color: #666;
}
input[type="text"],
input[type="checkbox"],
textarea,
button {
width: calc(100% - 12px);
padding: 8px;
margin-bottom: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
}
input[type="checkbox"] {
width: auto;
}
button {
background-color: #4caf50;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
/* Table styles */
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
.busy {
color: red;
}
.free {
color: green;
}
</style>
</head>
<body>
<div class="mechanic-info">
<h2>Mechanic Dashboard</h2>
<label for="mechanicName">Name:</label>
<input type="text" id="mechanicName"><br>
<label for="mechanicSalary">Salary:</label>
<input type="text" id="mechanicSalary"><br>
<label for="mechanicSkill">Skill:</label>
<input type="text" id="mechanicSkill"><br>
<label for="mechanicMobile">Mobile Number:</label>
<input type="text" id="mechanicMobile"><br>
<label for="mechanicStatus">Working Status:</label>
<label class="switch">
<input type="checkbox" id="mechanicStatus">
<span class="slider"></span>
</label><br>
<label for="mechanicAddress">Address:</label>
<textarea id="mechanicAddress"></textarea><br>
<button onclick="saveMechanic()">Save</button>
</div>
<table id="mechanicTable">
<tr>
<th>Name</th>
<th>Salary</th>
<th>Skill</th>
<th>Mobile Number</th>
<th>Status</th>
<th>Address</th>
</tr>
</table>
<script>
function saveMechanic() {
const mechanicName = document.getElementById('mechanicName').value;
const mechanicSalary = document.getElementById('mechanicSalary').value;
const mechanicSkill = document.getElementById('mechanicSkill').value;
const mechanicMobile = document.getElementById('mechanicMobile').value;
const mechanicStatus = document.getElementById('mechanicStatus').checked ? 'Free' : 'Busy';
const mechanicAddress = document.getElementById('mechanicAddress').value;
const table = document.getElementById('mechanicTable');
const newRow = table.insertRow(-1);
const statusClass = mechanicStatus === 'Busy' ? 'busy' : 'free';
newRow.innerHTML = `
<td>${mechanicName}</td>
<td>${mechanicSalary}</td>
<td>${mechanicSkill}</td>
<td>${mechanicMobile}</td>
<td class="${statusClass}">${mechanicStatus}</td>
<td>${mechanicAddress}</td>
`;
}
</script>
</body>
</html>