init
This commit is contained in:
133
views/admin.ejs
Normal file
133
views/admin.ejs
Normal file
@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Panel</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background-color: #1e1e1e;
|
||||
color: #f1f1f1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #2c2c2c;
|
||||
border-radius: 15px;
|
||||
padding: 40px 60px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 36px;
|
||||
color: #f1f1f1;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin: 10px 0;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #444;
|
||||
background-color: #444;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: #777;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 12px;
|
||||
width: 100%;
|
||||
background-color: #4caf50;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 18px;
|
||||
color: #ddd;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.message a {
|
||||
color: #4caf50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.package-list {
|
||||
margin-top: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.package-item {
|
||||
background-color: #333;
|
||||
padding: 10px;
|
||||
margin: 5px 0;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.package-item strong {
|
||||
color: #4caf50;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Admin Panel</h1>
|
||||
|
||||
<% if (!packages) { %>
|
||||
<% if (error) { %><p style="color:red;"><%= error %></p><% } %>
|
||||
<form method="POST" action="/admin">
|
||||
<input name="password" type="password" placeholder="Password" />
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
<% } else { %>
|
||||
<form method="POST" action="/update">
|
||||
<input name="password" type="hidden" value="<%= process.env.ADMIN_PASSWORD %>">
|
||||
<input name="id" placeholder="Tracking ID" required />
|
||||
<input name="progress" type="number" placeholder="Progress %" required />
|
||||
<input name="status" placeholder="Status" required />
|
||||
<button type="submit">Update</button>
|
||||
</form>
|
||||
|
||||
<h3>Packages</h3>
|
||||
<div class="package-list">
|
||||
<% packages.forEach(p => { %>
|
||||
<div class="package-item">
|
||||
<strong><%= p.id %></strong><br>
|
||||
<% if (p.updates && p.updates.length > 0) { %>
|
||||
<%= p.updates[p.updates.length - 1].status %> —
|
||||
<%= p.updates[p.updates.length - 1].progress %>%
|
||||
<% } else { %>
|
||||
<em>No updates yet</em>
|
||||
<% } %>
|
||||
</div>
|
||||
<% }) %>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
148
views/track.ejs
Normal file
148
views/track.ejs
Normal file
@ -0,0 +1,148 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Track Your Package</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background-color: #1e1e1e;
|
||||
color: #f1f1f1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #2c2c2c;
|
||||
border-radius: 15px;
|
||||
padding: 40px 60px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 36px;
|
||||
color: #f1f1f1;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.status {
|
||||
background-color: #333;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.status h3 {
|
||||
margin: 0;
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.status p {
|
||||
margin: 5px 0;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.status .progress-bar {
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
background-color: #444;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.progress {
|
||||
height: 100%;
|
||||
background-color: #4caf50;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.history {
|
||||
text-align: left;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
background-color: #444;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.history li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 18px;
|
||||
color: #ddd;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.message a {
|
||||
color: #4caf50;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 12px;
|
||||
width: 100%;
|
||||
background-color: #4caf50;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Metsamarja Vedu</h1>
|
||||
|
||||
<% if (package) { %>
|
||||
<div class="status">
|
||||
<h3>Package ID: <%= package.id %></h3>
|
||||
<p>Status: <%= latest.status %></p>
|
||||
<p>Progress: <%= latest.progress %>%</p>
|
||||
|
||||
<!-- Progress Bar -->
|
||||
<div class="progress-bar">
|
||||
<div class="progress" style="width: <%= latest.progress + '%' %>"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Estimated Delivery Time -->
|
||||
<div class="status">
|
||||
<h3>Estimated Delivery Time</h3>
|
||||
<p><%= estimatedDeliveryTime %></p>
|
||||
</div>
|
||||
|
||||
<!-- Tracking History -->
|
||||
<div class="history">
|
||||
<h4>Tracking History:</h4>
|
||||
<ul>
|
||||
<% history.forEach(u => { %>
|
||||
<li><strong><%= u.time %>:</strong> <%= u.status %> – <%= u.progress %>%</li>
|
||||
<% }) %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="message">
|
||||
<p>Want to track another package? <a href="/">Go back to Home</a></p>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="message">
|
||||
<p>Package not found. <a href="/">Try again</a></p>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user