OneCompiler

Siiuuuuuuuuuuuuuuu

1657
<div class="update-container"> <h2>Update Tracking Status</h2> <select id="newTrackingStatus" class="dropdown"> <option value="Ordered">Ordered</option> <option value="Dispatched">Dispatched</option> <option value="In Transit">In Transit</option> <option value="Out for Delivery">Out for Delivery</option> <option value="Delivered">Delivered</option> </select> <button class="submit-btn">Update Status</button> </div> .update-container { margin-top: 20px; padding: 20px; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 10px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); max-width: 400px; margin-left: auto; margin-right: auto; }

.update-container h2 {
font-size: 1.5em;

margin-bottom: 15px;
text-align: center;
color: #333;

}

.dropdown {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 20px;
font-size: 1em;
background-color: #fff;
}

.submit-btn {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
font-size: 1em;
cursor: pointer;
transition: background-color 0.3s ease;
}

.submit-btn:hover {
backgrou
nd-color: #45a049;
}

const currentStatus = "In Transit"; // This value would be dynamically provided by your backend

function populateStatusOptions() {
const dropdown = document.getElementById("newTrackingStatus");

const allStatuses = ["Ordered", "Dispatched", "In Transit", "Out for Delivery", "Delivered"];
const currentStatusIndex = allStatuses.indexOf(currentStatus);

// Clear any existing options
dropdown.innerHTML = '';

// Populate only the next statuses based on the current status
for (let i = currentStatusIndex + 1; i < allStatuses.length; i++) {
    const option = document.createElement("option");
    option.value = allStatuses[i];
    option.text = allStatuses[i];
    dropdown.appendChild(option);
}

}

// Call this function to populate options when the page loads
populateStatusOptions();

<div id="message" class="success-message"> Updated Successfully! </div> /* Message.css */ .success-message { width: 100%; padding: 10px; background-color: #4CAF50; /* Green background */ color: white; /* White text */ text-align: center; font-size: 18px; font-family: Arial, sans-serif; border-radius: 5px; margin-top: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); opacity: 0; transition: opacity 0.5s ease-in-out; }

/* To make the message visible */
.success-message.show {
opacity: 1;
}