Assign 14
Assign 14
14
Aim: Design a mini project for any real time scenario such as online library, Milk dairy,
Hotel online booking etc.
Theory:
The Automated Printing System is a web-based application developed to simplify and automate
the process of handling print jobs in organizations, institutions, or printing services. This
system provides users with an intuitive interface to upload documents and submit print
requests, while administrators can manage, track, and monitor these jobs effectively. The
project leverages modern web technologies including HTML, CSS, and JavaScript for the
front-end, and Node.js with Express.js for the back-end server logic. Data storage and
management are handled through MongoDB, a NoSQL database.
By integrating these technologies, the system reduces manual intervention, minimizes delays,
and improves the overall printing workflow.
Objectives:
4. User-Friendly Interface:
Design an intuitive and responsive user interface for both users and administrators to
ensure easy navigation and usage.
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<script src="https://cdn.tailwindcss.com"></script>
</head>
PrintEase Pro
</a>
</button>
</div>
</div>
</nav>
</div>
<div>
</div>
<div>
</div>
<button type="submit"
Sign In
</button>
New user?
</p>
</form>
</div>
</div>
</div>
<div>
<label class="block text-gray-700 mb-2 font-medium">Email</label>
</div>
<div>
</div>
<button type="submit"
Create Account
</button>
</p>
</form>
</div>
</div>
<button onclick="showAddCenterModal()"
</button>
</button> -->
<button onclick="showUserSide()"
class="bg-gray-200 text-gray-800 px-6 py-2 rounded-lg hover:bg-gray-300">
</button>
</div>
</div>
</div>
</button>
</div>
</div>
<div id="addCenterModal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center p-4">
<div>
</div>
<div>
</div>
<div class="flex gap-4">
Save Center
</button>
Cancel
</button>
</div>
</form>
</div>
</div>
<div class="mb-8">
</div>
</div> -->
</button>
</div>
<div class="mb-8">
</div>
</button>
<div id="uploadZone"
</div>
</div>
<button onclick="showPage('printSettingsPage')"
</button>
</div>
</div>
</button>
<div class="space-y-4">
<div>
</label>
Color (₹10/page)
</label>
</div>
</div>
<div>
</select>
</div>
</div>
</div>
<div class="space-y-4">
<div>
<button onclick="adjustCopies(-1)"
class="px-4 py-2 rounded-lg bg-gray-100 hover:bg-gray-200">
</button>
<button onclick="adjustCopies(1)"
</button>
</div>
</div>
<div>
<option value="portrait">Portrait</option>
<option value="landscape">Landscape</option>
</select>
</div>
</div>
</div>
</div>
</ul>
</div>
<button onclick="showConfirmation()"
</button>
</div>
</div>
</button>
</div>
</div>
</div>
</div>
<button onclick="submitPrintJob()"
</button>
</div>
</div>
</div>
<script src="script.js"></script>
</body></html>
styles.css
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
:root {
--primary: #6366f1;
--secondary: #4f46e5;
--dark: #1e293b;
--light: #f8fafc;
*{
.page {
display: none;
opacity: 0;
transform: translateY(20px);
.active-page {
display: block;
opacity: 1;
transform: translateY(0);
@keyframes fadeIn {
.glassmorphism {
-webkit-backdrop-filter: blur(10px);
.gradient-bg {
.file-preview {
.hover-scale {
.hover-scale:hover {
transform: translateY(-3px);
.dashboard-card {
backdrop-filter: blur(10px);
border-radius: 1.5rem;
script.js
// Admin Configuration
const ADMIN_CREDENTIALS = {
email: '[email protected]',
password: '1234'
};
// Pricing Configuration
const PRICING = {
bw: 2,
color: 10,
paperSizes: {
A4: 2,
A3: 5,
A2: 10,
A1: 20
},
serviceFee: 10
};
// Data Storage
let currentPrintJob = {
center: null,
files: [],
settings: {
color: 'bw',
size: 'A4',
copies: 1,
orientation: 'portrait'
};
function showUserSide() {
document.getElementById('adminBackButton').classList.remove('hidden');
showPage('homePage');
renderUserCenters();
}
function showAdminDashboard() {
document.getElementById('adminBackButton').classList.add('hidden');
showPage('adminDashboard');
renderCenters();
function calculateTotalCost() {
// Auth Management
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();
if (!email || !password) {
return;
}
// 2. Admin check
showAdminDashboard();
document.getElementById('logoutBtn').classList.remove('hidden');
return;
if (valid) {
currentUser = { email };
document.getElementById('logoutBtn').classList.remove('hidden');
showPage('homePage');
renderUserCenters();
} else {
});
});
});
try {
method: 'POST',
});
return response.ok;
} catch (error) {
return false;
}
// Registration Handling
e.preventDefault();
try {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
'email': email,
'password': password
})
});
if (response.ok) {
alert('Registration successful!');
showPage('loginPage');
} else {
alert(data.message);
} catch (error) {
console.error('Error:', error);
});
// Center Management
function renderCenters() {
const container = document.getElementById('centersContainer');
<button onclick="deleteCenter('${center.id}')"
class="text-red-500 hover:text-red-600">
</button>
</div>
<div class="text-gray-600">
${center.distance} away
</span>
<span class="text-yellow-500">
</span>
</div>
</div>
</div>
</div>
`).join('');
function renderUserCenters() {
<div class="text-gray-600">
${center.distance} away
</span>
<span class="text-yellow-500">
</span>
</div>
</div>
</div>
</div>
`).join('');
function showAddCenterModal() {
document.getElementById('addCenterModal').classList.remove('hidden');
document.getElementById('addCenterModal').classList.add('flex');
function hideAddCenterModal() {
document.getElementById('addCenterModal').classList.add('hidden');
document.getElementById('addCenterForm').addEventListener('submit', function(e) {
e.preventDefault();
const newCenter = {
id: Date.now().toString(),
name: document.getElementById('centerName').value,
location: document.getElementById('centerLocation').value,
};
centers.push(newCenter);
localStorage.setItem('printingCenters', JSON.stringify(centers));
renderCenters();
hideAddCenterModal();
});
function deleteCenter(id) {
localStorage.setItem('printingCenters', JSON.stringify(centers));
renderCenters();
function selectCenter(id) {
currentPrintJob.center = id;
showPage('fileUploadPage');
fileInput.addEventListener('change', function(e) {
currentPrintJob.files = Array.from(e.target.files);
updateFileList();
});
e.preventDefault();
uploadZone.classList.add('border-blue-400', 'bg-blue-50');
});
uploadZone.addEventListener('dragleave', () => {
uploadZone.classList.remove('border-blue-400', 'bg-blue-50');
});
uploadZone.addEventListener('drop', (e) => {
e.preventDefault();
uploadZone.classList.remove('border-blue-400', 'bg-blue-50');
currentPrintJob.files = Array.from(e.dataTransfer.files);
updateFileList();
});
function updateFileList() {
<div>
<p class="font-medium">${file.name}</p>
</div>
</button>
</div>
`).join('');
function removeFile(filename) {
updateFileList();
function adjustCopies(change) {
copiesInput.value = copies;
currentPrintJob.settings.copies = copies;
}
// Update Print Settings Event Listeners
document.querySelectorAll('input[name="color"]').forEach(input => {
input.addEventListener('change', () => {
currentPrintJob.settings.color = input.value;
});
});
currentPrintJob.settings.size = e.target.value;
});
currentPrintJob.settings.orientation = e.target.value;
});
function showConfirmation() {
orderDetails.innerHTML = `
`;
paymentSummary.innerHTML = `
<span>Subtotal:</span>
<span>₹${subtotal.toFixed(2)}</span>
</div>
<div class="flex justify-between">
<span>Service Fee:</span>
<span>₹${PRICING.serviceFee.toFixed(2)}</span>
</div>
<span>Total:</span>
<span>₹${total.toFixed(2)}</span>
</div>
`;
showPage('confirmationPage');
function submitPrintJob() {
showPage('homePage');
function showPage(pageId) {
document.querySelectorAll('.page').forEach(page => {
page.classList.remove('active-page');
});
document.getElementById(pageId).classList.add('active-page');
function logout() {
currentUser = null;
currentPrintJob = {
center: null,
files: [],
};
document.getElementById('logoutBtn').classList.add('hidden');
showPage('loginPage');
}
if (centers.length === 0) {
centers = [
id: '1',
rating: 4.5,
distance: '0.5km'
},
id: '2',
rating: 4.8,
distance: '1.2km'
];
localStorage.setItem('printingCenters', JSON.stringify(centers));
showPage('loginPage');
// function showAdminDashboard() {
// showPage('adminDashboard');
// renderCenters();
// }
function showAdminDashboard() {
showPage('adminDashboard');
renderCenters();
document.getElementById('adminBackButton').classList.add('hidden');
}
server.js
app.use(bodyParser.json());
// MongoDB Connection
mongoose.connect('mongodb://localhost:27017/printease', {
useNewUrlParser: true,
useUnifiedTopology: true
})
// User Schema
});
// Registration Endpoint
try {
const { email, password } = req.body;
if (!email || !password) {
if (existingUser) {
await newUser.save();
} catch (error) {
});
// Login Endpoint
try {
} catch (error) {
});
// Start server
app.listen(PORT, () => {
});