manual item code

This commit is contained in:
2026-10-13 16:00:15 +05:30
commit 2aa19f6671
37 changed files with 31751 additions and 0 deletions
+367
View File
@@ -0,0 +1,367 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Account</title>
<style>
:root {
--primary: #0284c7;
--primary-hover: #0369a1;
--primary-focus-ring: rgba(2, 132, 199, 0.2);
--surface: #ffffff;
--background: #f8fafc;
--border: #e2e8f0;
--border-focus: #0284c7;
--text-primary: #0f172a;
--text-secondary: #475569;
--text-muted: #64748b;
--danger: #dc2626;
--danger-bg: #fef2f2;
--danger-border: #fecaca;
--success: #059669;
--success-bg: #ecfdf5;
--success-border: #a7f3d0;
--radius: 8px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: var(--background);
color: var(--text-primary);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 32px 16px;
line-height: 1.5;
}
.auth-card {
background-color: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
width: 100%;
max-width: 480px;
padding: 40px 32px;
}
/* Dedicated Logo Placeholder Area */
.logo-placeholder-container {
display: flex;
justify-content: center;
margin-bottom: 24px;
}
.logo-placeholder {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 8px;
}
.logo-placeholder img {
max-height: 72px;
height: 68px;
width: auto;
object-fit: contain;
display: block;
}
.auth-header {
text-align: center;
margin-bottom: 28px;
}
.auth-header h1 {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.01em;
margin-bottom: 6px;
}
.auth-header p {
font-size: 14px;
color: var(--text-secondary);
}
.form-group {
margin-bottom: 18px;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
label {
display: block;
margin-bottom: 6px;
color: var(--text-primary);
font-weight: 500;
font-size: 13px;
}
input[type="text"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 10px 14px;
border: 1px solid #cbd5e1;
border-radius: 6px;
font-size: 14px;
color: var(--text-primary);
background-color: #ffffff;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
font-family: inherit;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
outline: none;
border-color: var(--border-focus);
box-shadow: 0 0 0 3px var(--primary-focus-ring);
}
.helper-text {
font-size: 12px;
color: var(--text-muted);
margin-top: 5px;
}
.submit-btn {
width: 100%;
padding: 11px 16px;
background-color: var(--primary);
color: #ffffff;
border: none;
border-radius: 6px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background-color 0.15s ease;
margin-top: 10px;
}
.submit-btn:hover {
background-color: var(--primary-hover);
}
.submit-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.auth-footer {
text-align: center;
margin-top: 28px;
padding-top: 20px;
border-top: 1px solid var(--border);
font-size: 13px;
color: var(--text-secondary);
}
.auth-footer a {
color: var(--primary);
text-decoration: none;
font-weight: 500;
}
.auth-footer a:hover {
text-decoration: underline;
}
.message {
padding: 10px 14px;
border-radius: 6px;
margin-bottom: 20px;
font-size: 13px;
display: none;
line-height: 1.4;
}
.message.error {
background-color: var(--danger-bg);
color: var(--danger);
border: 1px solid var(--danger-border);
display: block;
}
.message.success {
background-color: var(--success-bg);
color: var(--success);
border: 1px solid var(--success-border);
display: block;
}
.loading {
display: none;
text-align: center;
color: var(--text-secondary);
font-size: 13px;
margin-bottom: 12px;
}
.spinner {
display: inline-block;
width: 14px;
height: 14px;
border: 2px solid var(--border);
border-top: 2px solid var(--primary);
border-radius: 50%;
animation: spin 0.6s linear infinite;
margin-right: 8px;
vertical-align: middle;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (max-width: 480px) {
.auth-card {
padding: 28px 20px;
}
.form-row {
grid-template-columns: 1fr;
gap: 0;
}
}
</style>
</head>
<body>
<div class="auth-card">
<div class="logo-placeholder-container">
<div class="logo-placeholder" id="logoPlaceholder">
<img src="{{ url_for('static', filename='logo.png') }}" alt="Logo">
</div>
</div>
<div class="auth-header">
<h1>Create Account</h1>
<p>Register a new user account</p>
</div>
<div id="message" class="message"></div>
<form id="registerForm">
<div class="form-row">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="Choose username" autocomplete="username" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" name="email" placeholder="user@domain.com" autocomplete="email" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" placeholder="Minimum 6 characters" autocomplete="new-password" required>
<div class="helper-text">Minimum 6 characters</div>
</div>
<div class="form-group">
<label for="confirm">Confirm Password</label>
<input type="password" id="confirm" name="confirm_password" placeholder="Confirm password" autocomplete="new-password" required>
</div>
</div>
<div class="loading" id="loading">
<span class="spinner"></span>
Creating account...
</div>
<button type="submit" class="submit-btn" id="submitBtn">Register</button>
</form>
<div class="auth-footer">
Already have an account? <a href="/login">Sign In</a>
</div>
</div>
<script>
document.getElementById('registerForm').addEventListener('submit', async (e) => {
e.preventDefault();
const username = document.getElementById('username').value.trim();
const email = document.getElementById('email').value.trim();
const password = document.getElementById('password').value;
const confirmPassword = document.getElementById('confirm').value;
const messageDiv = document.getElementById('message');
const loading = document.getElementById('loading');
const submitBtn = document.getElementById('submitBtn');
// Validation
if (!username || !email || !password || !confirmPassword) {
showMessage('Please fill in all fields', 'error');
return;
}
if (password.length < 6) {
showMessage('Password must be at least 6 characters', 'error');
return;
}
if (password !== confirmPassword) {
showMessage('Passwords do not match', 'error');
return;
}
if (!email.includes('@')) {
showMessage('Please enter a valid email address', 'error');
return;
}
loading.style.display = 'block';
submitBtn.disabled = true;
try {
const response = await fetch('/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username,
email,
password,
confirm_password: confirmPassword
})
});
const data = await response.json();
if (response.ok) {
showMessage('Account created successfully. Redirecting to sign in...', 'success');
setTimeout(() => {
window.location.href = '/login';
}, 1200);
} else {
showMessage(data.message || 'Registration failed', 'error');
}
} catch (error) {
showMessage('Connection error. Please try again.', 'error');
} finally {
loading.style.display = 'none';
submitBtn.disabled = false;
}
});
function showMessage(msg, type) {
const messageDiv = document.getElementById('message');
messageDiv.textContent = msg;
messageDiv.className = `message ${type}`;
}
</script>
</body>
</html>