NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<!DOCTYPE html>
<html>
<head>
<title>Consignment Tracker</title>
<style>
.tab { display: none; }
.tooltip {
position: relative;
cursor: pointer;
}
.tooltip .tooltiptext {
visibility: hidden;
position: absolute;
bottom: 125%; left: 50%;
margin-left: -60px;
width: 120px;
text-align: center;
border-radius: 3px;
padding: 5px;
background-color: black;
color: #fff;
z-index: 1;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}

@keyframes rainbow {
0% { color: red; }
14% { color: orange; }
28% { color: yellow; }
42% { color: green; }
57% { color: blue; }
71% { color: indigo; }
85% { color: violet; }
100% { color: red; }
}

h1 {
animation: rainbow 5s infinite linear;
}

/* Calendar Styles */
#calendar {
display: none;
}

#calendar-container {
display: flex;
flex-wrap: wrap;
max-width: 600px;
margin: 0 auto;
}

.day-box {
width: calc(100% / 7);
border: 1px solid #ccc;
padding: 5px;
box-sizing: border-box;
}

.day-box:hover {
background-color: #f0f0f0;
}

.notes-input {
width: 100%;
}

/* Appointments Tab Styles */
#appointments-tab {
display: flex;
justify-content: space-between;
align-items: center;
}

#current-month {
font-weight: bold;
font-size: 1.2em;
}

#current-day {
font-size: 1.2em;
}

/* View Consignments Styles */
.remove-button {
color: red;
cursor: pointer;
}

/* Previous Consignments Tab Styles */
#previous-consignments {
display: none;
}

#previous-consignments-table {
border-collapse: collapse;
width: 100%;
}

#previous-consignments-table th, #previous-consignments-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

#previous-consignments-table th {
background-color: #f2f2f2;
}
</style>
</head>
<body>

<h1>Consignment Tracker πŸ“‹</h1>
<button onclick="showTab('add')">Add Consignment βž•</button>
<button onclick="showTab('view')">View Consignments πŸ‘€</button>
<button onclick="showTab('appointments')">Appointments πŸ—“οΈ</button>
<button onclick="showTab('previousConsignments')">Previous Consignments πŸ“¦</button> <!-- New Previous Consignments Tab -->

<div id="add" class="tab">
<form id="consignForm">
<label for="shop_name">Shop Name πŸͺ:</label>
<input type="text" id="shop_name" required><br>
<label for="earnings">Earnings πŸ’΅:</label>
<input type="number" id="earnings" required><br>
<label for="dropoff_time">Drop-off Time πŸ•’:</label>
<input type="datetime-local" id="dropoff_time" required><br>
<label for="pickup_time">Pick-up Time πŸ•“:</label>
<input type="datetime-local" id="pickup_time" required><br>
<label for="side_note">Side Note πŸ—’:</label>
<input type="text" id="side_note"><br>

<!-- Added multiple Item Names inputs -->
<label for="item_names">Item Names πŸ“¦:</label><br>
<div id="item_names">
<!-- Will be filled by JavaScript -->
</div>

<input type="submit" value="Add Consignment">
</form>
</div>

<div id="view" class="tab">
<label for="sortSelect">Sort By:</label>
<select id="sortSelect" onchange="sortConsignments()">
<option value="nameAZ">Name A-Z πŸͺ</option>
<option value="pickup">Closest Pickup πŸ•“</option>
<option value="input">Input Order πŸ“₯</option>
</select>
<table border="1" id="consignTable">
<tr>
<th>ID</th>
<th>Shop Name πŸͺ</th>
<th>Item πŸ“¦</th>
<th>Earnings πŸ’΅</th>
<th>Drop-off πŸ•’</th>
<th>Pick-up πŸ•“</th>
<th>Actions</th> <!-- New Actions Column -->
</tr>
</table>
</div>

<!-- New Appointments Tab -->
<div id="appointments" class="tab">
<div id="appointments-tab">
<div>
<span id="current-month"></span>
<span id="current-day"></span>
</div>
<button onclick="showCalendar()">Show Calendar πŸ“…</button>
</div>
<div id="calendar">
<div id="calendar-container"></div>
</div>
</div>

<!-- New Previous Consignments Tab -->
<div id="previousConsignments" class="tab">
<label for="previousSortSelect">Sort By:</label>
<select id="previousSortSelect" onchange="sortPreviousConsignments()">
<option value="nameAZ">Name A-Z πŸͺ</option>
<option value="earnings">Earnings πŸ’΅</option>
<option value="input">Input Order πŸ“₯</option>
</select>
<button onclick="sumEarnings()">Sum Earnings</button>
<table id="previous-consignments-table">
<tr>
<th>ID</th>
<th>Shop Name πŸͺ</th>
<th>Item πŸ“¦</th>
<th>Earnings πŸ’΅</th>
<th>Drop-off πŸ•’</th>
<th>Pick-up πŸ•“</th>
<th>Actions</th>
</tr>
</table>
</div>

<script>
// Create 25 input fields for items
for (let i = 1; i <= 25; i++) {
let input = document.createElement('input');
input.type = "text";
input.id = "item_name_" + i;
document.getElementById('item_names').appendChild(input);
document.getElementById('item_names').appendChild(document.createElement('br'));
}

let consignments = JSON.parse(localStorage.getItem('consignments')) || [];
let id = consignments.length ? consignments[consignments.length - 1].id : 0;

document.getElementById('consignForm').addEventListener('submit', function(event) {
event.preventDefault();
let item_names = Array.from({length: 25}, (_, i) => document.getElementById(`item_name_${i + 1}`).value);
let shop_name = document.getElementById('shop_name').value;
let earnings = document.getElementById('earnings').value;
let dropoff_time = document.getElementById('dropoff_time').value;
let pickup_time = document.getElementById('pickup_time').value;
let side_note = document.getElementById('side_note').value;
consignments.push({
id: ++id,
item_names,
shop_name,
earnings,
dropoff_time,
pickup_time,
side_note
});
localStorage.setItem('consignments', JSON.stringify(consignments));
updateTable();
showTab('view');
});

function showTab(tabName) {
document.querySelectorAll('.tab').forEach(tab => tab.style.display = 'none');
document.getElementById(tabName).style.display = 'block';
if (tabName === 'view') updateTable();
if (tabName === 'previousConsignments') showPreviousConsignments();
}

function sortByName() {
consignments.sort((a, b) => a.shop_name.localeCompare(b.shop_name));
updateTable();
}

function sortByDate() {
const now = new Date();
consignments.sort((a, b) => {
const aDate = new Date(a.pickup_time);
const bDate = new Date(b.pickup_time);
return Math.abs(now - aDate) - Math.abs(now - bDate);
});
updateTable();
}

function updateTable() {
let table = document.getElementById('consignTable');
table.innerHTML = `<tr>
<th>ID</th>
<th>Shop Name πŸͺ</th>
<th>Item πŸ“¦</th>
<th>Earnings πŸ’΅</th>
<th>Drop-off πŸ•’</th>
<th>Pick-up πŸ•“</th>
<th>Actions</th>
</tr>`;
consignments.forEach(consignment => {
table.innerHTML += `<tr>
<td>${consignment.id}</td>
<td class="tooltip">${consignment.shop_name}<span class="tooltiptext">${consignment.side_note}</span></td>
<td>${consignment.item_names ? consignment.item_names.join(', ') : ''}</td>
<td>${consignment.earnings}</td>
<td>${consignment.dropoff_time}</td>
<td>${consignment.pickup_time}</td>
<td><span class="remove-button" onclick="removeConsignment(${consignment.id})">X</span></td>
</tr>`;
});
}

function removeConsignment(id) {
const index = consignments.findIndex(consignment => consignment.id === id);
if (index !== -1) {
const removedConsignments = consignments.splice(index, 1);
updateTable();
storePreviousConsignments(removedConsignments);
}
}

function storePreviousConsignments(removedConsignments) {
let previousConsignments = JSON.parse(localStorage.getItem('previousConsignments')) || [];
previousConsignments = previousConsignments.concat(removedConsignments);
localStorage.setItem('previousConsignments', JSON.stringify(previousConsignments));
}

function showPreviousConsignments() {
let previousConsignments = JSON.parse(localStorage.getItem('previousConsignments')) || [];
let table = document.getElementById('previous-consignments-table');
table.innerHTML = `<tr>
<th>ID</th>
<th>Shop Name πŸͺ</th>
<th>Item πŸ“¦</th>
<th>Earnings πŸ’΅</th>
<th>Drop-off πŸ•’</th>
<th>Pick-up πŸ•“</th>
<th>Actions</th>
</tr>`;
previousConsignments.forEach(consignment => {
table.innerHTML += `<tr>
<td>${consignment.id}</td>
<td>${consignment.shop_name}</td>
<td>${consignment.item_names ? consignment.item_names.join(', ') : ''}</td>
<td>${consignment.earnings}</td>
<td>${consignment.dropoff_time}</td>
<td>${consignment.pickup_time}</td>
<td><span class="remove-button" onclick="removePreviousConsignment(${consignment.id})">X</span></td>
</tr>`;
});
}

// Calendar JavaScript
function showCalendar() {
document.getElementById('calendar').style.display = 'block';
createCalendar();
}

function createCalendar() {
const calendarContainer = document.getElementById('calendar-container');
const currentDate = new Date();
const currentMonth = currentDate.getMonth();
const currentYear = currentDate.getFullYear();

// Get the number of days in the current month
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();

// Clear the calendar container
calendarContainer.innerHTML = '';

// Create boxes for each day of the month
for (let day = 1; day <= daysInMonth; day++) {
const dayBox = document.createElement('div');
dayBox.classList.add('day-box');

// Create an input field for notes
const notesInput = document.createElement('textarea');
notesInput.classList.add('notes-input');
notesInput.setAttribute('placeholder', 'Type your notes here...');
dayBox.appendChild(notesInput);

calendarContainer.appendChild(dayBox);
}

// Set the current month and day labels
document.getElementById('current-month').textContent = `Current Month: ${currentDate.toLocaleString('default', { month: 'long' })}`;
document.getElementById('current-day').textContent = `Current Day: ${currentDate.getDate()}`;
}

function sortConsignments() {
const sortSelect = document.getElementById('sortSelect');
const selectedOption = sortSelect.options[sortSelect.selectedIndex].value;

switch (selectedOption) {
case 'nameAZ':
consignments.sort((a, b) => a.shop_name.localeCompare(b.shop_name));
break;
case 'pickup':
const now = new Date();
consignments.sort((a, b) => {
const aDate = new Date(a.pickup_time);
const bDate = new Date(b.pickup_time);
return Math.abs(now - aDate) - Math.abs(now - bDate);
});
break;
case 'input':
// Do nothing, maintain the order it was inputted
break;
}
updateTable();
}

function sortPreviousConsignments() {
const previousSortSelect = document.getElementById('previousSortSelect');
const selectedOption = previousSortSelect.options[previousSortSelect.selectedIndex].value;

switch (selectedOption) {
case 'nameAZ':
previousConsignments.sort((a, b) => a.shop_name.localeCompare(b.shop_name));
break;
case 'earnings':
previousConsignments.sort((a, b) => a.earnings - b.earnings);
break;
case 'input':
// Do nothing, maintain the order it was inputted
break;
}
showPreviousConsignments();
}

function removePreviousConsignment(id) {
const index = previousConsignments.findIndex(consignment => consignment.id === id);
if (index !== -1) {
previousConsignments.splice(index, 1);
showPreviousConsignments();
}
}

function sumEarnings() {
let earningsSum = 0;
previousConsignments.forEach(consignment => {
earningsSum += parseFloat(consignment.earnings) || 0;
});
alert(`Total Earnings from Previous Consignments: $${earningsSum.toFixed(2)}`);
}

showTab('add');
updateTable();
</script>
</body>
</html>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.