Init Commit
This commit is contained in:
564
ui/main.html
Normal file
564
ui/main.html
Normal file
@@ -0,0 +1,564 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>دستیار انتخاب واحد — Azad Uni Helper</title>
|
||||
|
||||
<!-- فونت وزیر از CDN ایران پسند -->
|
||||
<link rel="stylesheet" href="https://cdn.fontcdn.ir/Font/Persian/Vazirmatn/Vazirmatn.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--bg: #eef2f6;
|
||||
--card-bg: #ffffff;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--accent: #14b8a6;
|
||||
--danger: #ef4444;
|
||||
--success: #22c55e;
|
||||
--text-dark: #1f2937;
|
||||
--text-muted: #6b7280;
|
||||
--radius: 14px;
|
||||
--shadow: 0 8px 25px -10px rgba(31,41,55,0.15);
|
||||
--tooltip-bg: #111827;
|
||||
}
|
||||
|
||||
/* RESET */
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Vazirmatn, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text-dark);
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
/* HEADER */
|
||||
header {
|
||||
background: linear-gradient(135deg, #4f46e5, #3b82f6);
|
||||
color: #fff;
|
||||
padding: 1.5rem 1rem;
|
||||
text-align: center;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
header h1 { margin: 0; font-size: 1.8rem; font-weight: 900; letter-spacing: -0.5px; }
|
||||
header p { margin: 6px 0 0; font-size: 1rem; opacity: 0.9; }
|
||||
|
||||
/* USER BAR */
|
||||
.user-bar {
|
||||
background: var(--card-bg);
|
||||
padding: 0.8rem 1.5rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
.user-bar .username {
|
||||
font-weight: bold;
|
||||
color: var(--primary);
|
||||
font-size: 1rem;
|
||||
}
|
||||
.user-bar .btn-logout {
|
||||
background: linear-gradient(135deg, #ef4444, #dc2626);
|
||||
color: #fff;
|
||||
padding: 0.6rem 1.2rem;
|
||||
border-radius: 8px;
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
transition: 0.2s;
|
||||
font-family: Vazirmatn, sans-serif;
|
||||
}
|
||||
.user-bar .btn-logout:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
/* CONTAINER */
|
||||
.container { max-width: 920px; margin: 1.8rem auto; padding: 0 1rem; }
|
||||
|
||||
/* ALERTS */
|
||||
.alert {
|
||||
padding: 1rem 1.5rem;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 1.5rem;
|
||||
text-align: center;
|
||||
font-size: 0.95rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.alert-error {
|
||||
background: linear-gradient(135deg, #fee2e2, #fecaca);
|
||||
color: #b91c1c;
|
||||
border: 1px solid #fca5a5;
|
||||
}
|
||||
.alert-success {
|
||||
background: linear-gradient(135deg, #dcfce7, #bbf7d0);
|
||||
color: #15803d;
|
||||
border: 1px solid #86efac;
|
||||
}
|
||||
|
||||
/* AUTH FORMS */
|
||||
.auth-container {
|
||||
max-width: 420px;
|
||||
margin: 3rem auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
.auth-card {
|
||||
background: var(--card-bg);
|
||||
padding: 2.5rem 2rem;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.auth-card h2 {
|
||||
text-align: center;
|
||||
color: var(--primary);
|
||||
margin-bottom: 2rem;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
.auth-link {
|
||||
text-align: center;
|
||||
margin-top: 1.5rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.auth-link a { color: var(--primary); text-decoration: none; font-weight: bold; }
|
||||
.auth-link a:hover { text-decoration: underline; }
|
||||
|
||||
/* FORM */
|
||||
.card-form {
|
||||
background: var(--card-bg);
|
||||
padding: 1.6rem;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.card-form h3 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 800;
|
||||
color: var(--primary-hover);
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem 1.2rem;
|
||||
}
|
||||
@media(max-width:650px){.form-grid{grid-template-columns:1fr}}
|
||||
label:not(.form-group label) {
|
||||
display:block;
|
||||
font-size:.8rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom:.3rem;
|
||||
}
|
||||
input:not(.form-group input), select {
|
||||
width:100%;
|
||||
padding:.7rem .9rem;
|
||||
border:1px solid #cbd5e1;
|
||||
border-radius:10px;
|
||||
font-size:.93rem;
|
||||
transition: 0.2s;
|
||||
font-family: Vazirmatn, sans-serif;
|
||||
background: #fff;
|
||||
}
|
||||
input:not(.form-group input):focus, select:focus { border-color: var(--primary); outline:none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
|
||||
|
||||
/* FORM GROUPS */
|
||||
.form-group { margin-bottom: 1.2rem; }
|
||||
.form-group label {
|
||||
display: block;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 0.8rem 1rem;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 10px;
|
||||
font-size: 1rem;
|
||||
transition: 0.2s;
|
||||
font-family: Vazirmatn, sans-serif;
|
||||
background: #fff;
|
||||
}
|
||||
.form-group input:focus {
|
||||
border-color: var(--primary);
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
/* SUBMIT BUTTON */
|
||||
.btn-submit {
|
||||
width: 100%;
|
||||
padding: 1rem 1.5rem;
|
||||
background: var(--primary);
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
font-size: 1.05rem;
|
||||
font-family: Vazirmatn, sans-serif;
|
||||
margin-top: 1.5rem;
|
||||
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
.btn-submit:hover {
|
||||
background: var(--primary-hover);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
|
||||
}
|
||||
.btn-submit:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* COURSE CARD */
|
||||
.course-card {
|
||||
background: var(--card-bg);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
padding: 1.5rem 1.5rem;
|
||||
margin-bottom: 1.2rem;
|
||||
border-right: 5px solid #cbd5f5;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
.course-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 30px -10px rgba(31,41,55,0.25);
|
||||
}
|
||||
|
||||
.priority-high { border-right-color: #ef4444; }
|
||||
.priority-normal { border-right-color: #3b82f6; }
|
||||
.priority-low { border-right-color: #14b8a6; }
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: .9rem;
|
||||
}
|
||||
.course-name { font-size:1.08rem; font-weight:900; }
|
||||
.btn-delete { color: var(--text-muted); text-decoration:none; font-size:.87rem; }
|
||||
.btn-delete:hover { color: var(--danger); }
|
||||
|
||||
/* DATA GRID */
|
||||
.data-grid {
|
||||
display:grid;
|
||||
grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
|
||||
gap:.9rem;
|
||||
}
|
||||
.data-label { font-size:.7rem; color: var(--text-muted); margin-bottom:.25rem; }
|
||||
.copy-box {
|
||||
position: relative;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
border:1px solid #cbd5e1;
|
||||
border-radius:10px;
|
||||
height:42px;
|
||||
overflow:hidden;
|
||||
background:#f3f4f6;
|
||||
}
|
||||
.copy-text {
|
||||
flex:1;
|
||||
padding:.4rem .6rem;
|
||||
font-family:'Courier New', monospace;
|
||||
font-weight:bold;
|
||||
font-size:1rem;
|
||||
direction:ltr;
|
||||
text-align:left;
|
||||
color: var(--text-dark);
|
||||
}
|
||||
.copy-btn {
|
||||
width:42px;
|
||||
border:none;
|
||||
background:#f3f4f6;
|
||||
cursor:pointer;
|
||||
transition: background-color .2s, color .2s, transform .15s, box-shadow .2s;
|
||||
position: relative;
|
||||
}
|
||||
.copy-btn:hover {
|
||||
background:#e0e7ff;
|
||||
color: var(--primary);
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 0 6px var(--primary);
|
||||
}
|
||||
.copy-btn:active {
|
||||
background: var(--primary);
|
||||
color: #fff;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
/* TOOLTIP */
|
||||
.copy-btn::after {
|
||||
content: "کپی شد!";
|
||||
position: absolute;
|
||||
top: -32px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) scale(0);
|
||||
background: var(--tooltip-bg);
|
||||
color: #fff;
|
||||
font-size: .65rem;
|
||||
padding: 3px 6px;
|
||||
border-radius: 6px;
|
||||
white-space: nowrap;
|
||||
pointer-events:none;
|
||||
opacity:0;
|
||||
transition: transform .2s ease, opacity .2s ease;
|
||||
}
|
||||
.copy-btn.copied::after {
|
||||
transform: translateX(-50%) scale(1);
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
/* PROF INFO */
|
||||
.prof-info {
|
||||
margin-top:.9rem;
|
||||
display:flex;
|
||||
gap:1rem;
|
||||
flex-wrap:wrap;
|
||||
color: var(--text-muted);
|
||||
font-size:.85rem;
|
||||
}
|
||||
|
||||
/* EMPTY */
|
||||
.empty {
|
||||
text-align:center;
|
||||
padding: 3rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.empty i {
|
||||
font-size: 3.5rem;
|
||||
opacity: 0.5;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.empty p {
|
||||
font-size: 1.1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* FOOTER */
|
||||
footer {
|
||||
text-align:center;
|
||||
padding: 1rem 0 1.5rem;
|
||||
margin-top: 2rem;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
border-top: 1px solid #e5e7eb;
|
||||
}
|
||||
footer a {
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
footer a:hover { text-decoration: underline; }
|
||||
|
||||
/* TOAST */
|
||||
#toast {
|
||||
visibility:hidden;
|
||||
position:fixed;
|
||||
bottom:30px;
|
||||
left:50%;
|
||||
transform:translateX(-50%);
|
||||
background:#111827;
|
||||
color:#fff;
|
||||
padding:.7rem 1.2rem;
|
||||
border-radius:10px;
|
||||
font-size:.85rem;
|
||||
z-index:100;
|
||||
}
|
||||
#toast.show {
|
||||
visibility:visible;
|
||||
animation: fadein .4s, fadeout .4s 2.4s;
|
||||
}
|
||||
@keyframes fadein { from {opacity:0;} to {opacity:1;} }
|
||||
@keyframes fadeout { from {opacity:1;} to {opacity:0;} }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<div class="container">
|
||||
<h1><i class="fa-solid fa-graduation-cap"></i> دستیار انتخاب واحد</h1>
|
||||
<p>سرعت، دقت و آسودگی دانشجویان — انتخاب واحد بدون استرس</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if page == 'login' or page == 'register' %}
|
||||
<!-- AUTH PAGES -->
|
||||
<div class="auth-container">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="auth-card">
|
||||
{% if page == 'login' %}
|
||||
<h2><i class="fa-solid fa-sign-in-alt"></i> ورود</h2>
|
||||
<form action="{{ url_for('login') }}" method="POST">
|
||||
<div class="form-group">
|
||||
<label>نام کاربری</label>
|
||||
<input type="text" name="username" placeholder="نام کاربری خود را وارد کنید" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>رمز عبور</label>
|
||||
<input type="password" name="password" placeholder="رمز عبور را وارد کنید" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-submit">ورود</button>
|
||||
</form>
|
||||
<div class="auth-link">
|
||||
حساب کاربری ندارید؟ <a href="{{ url_for('register') }}">ثبت نام کنید</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<h2><i class="fa-solid fa-user-plus"></i> ثبت نام</h2>
|
||||
<form action="{{ url_for('register') }}" method="POST">
|
||||
<div class="form-group">
|
||||
<label>نام کاربری</label>
|
||||
<input type="text" name="username" placeholder="یک نام کاربری انتخاب کنید" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>رمز عبور</label>
|
||||
<input type="password" name="password" placeholder="یک رمز عبور انتخاب کنید" required>
|
||||
</div>
|
||||
<button type="submit" class="btn-submit">ثبت نام</button>
|
||||
</form>
|
||||
<div class="auth-link">
|
||||
قبلاً حساب کاربری دارید؟ <a href="{{ url_for('login') }}">وارد شوید</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<!-- MAIN APP PAGE -->
|
||||
<div class="user-bar">
|
||||
<span>کاربر: <span class="username">{{ username }}</span></span>
|
||||
<a href="{{ url_for('logout') }}" class="btn-logout"><i class="fa-solid fa-sign-out-alt"></i> خروج</a>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="card-form">
|
||||
<h3>ثبت درس جدید</h3>
|
||||
<form action="{{ url_for('add_course') }}" method="POST">
|
||||
<div class="form-grid">
|
||||
<div>
|
||||
<label>نام درس</label>
|
||||
<input type="text" name="name" placeholder="مثال: مهندسی نرمافزار" required>
|
||||
</div>
|
||||
<div>
|
||||
<label>اولویت درس</label>
|
||||
<select name="priority">
|
||||
<option value="high">حیاتی</option>
|
||||
<option value="normal" selected>عادی</option>
|
||||
<option value="low">ذخیره</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-grid">
|
||||
<div>
|
||||
<label>کد درس</label>
|
||||
<input type="text" name="code" placeholder="1234567" style="direction:ltr;text-align:left" required>
|
||||
</div>
|
||||
<div>
|
||||
<label>کد ارائه</label>
|
||||
<input type="text" name="group" placeholder="02" style="direction:ltr;text-align:left" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-grid">
|
||||
<div>
|
||||
<label>نام استاد</label>
|
||||
<input type="text" name="prof" placeholder="دکتر رضایی">
|
||||
</div>
|
||||
<div>
|
||||
<label>روز و ساعت</label>
|
||||
<input type="text" name="day" placeholder="شنبه ۱۰–۱۲">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn-submit">ذخیره درس فعلی</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if courses %}
|
||||
{% for course in courses %}
|
||||
<div class="course-card priority-{{ course.priority }}">
|
||||
<div class="card-header">
|
||||
<span class="course-name">{{ course.name }}</span>
|
||||
<a href="{{ url_for('delete_course', course_id=course.id) }}" class="btn-delete" onclick="return confirm('آیا مطمئن هستید؟');">
|
||||
<i class="fa-solid fa-trash"></i> حذف
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="data-grid">
|
||||
<div>
|
||||
<div class="data-label">کد درس</div>
|
||||
<div class="copy-box">
|
||||
<button class="copy-btn" onclick="copyToClipboard(this,'{{ course.code }}')"><i class="fa-regular fa-copy"></i></button>
|
||||
<span class="copy-text">{{ course.code }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="data-label">کد ارائه</div>
|
||||
<div class="copy-box">
|
||||
<button class="copy-btn" onclick="copyToClipboard(this,'{{ course.group }}')"><i class="fa-regular fa-copy"></i></button>
|
||||
<span class="copy-text">{{ course.group }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="prof-info">
|
||||
<div><i class="fa-solid fa-chalkboard-user"></i> {{ course.prof }}</div>
|
||||
<div><i class="fa-regular fa-clock"></i> {{ course.day }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="empty">
|
||||
<i class="fa-solid fa-folder-open" style="font-size:2.8rem;"></i>
|
||||
<p>هنوز درسی ثبت نشده — شروع کن!</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- TOAST -->
|
||||
<div id="toast"><i class="fa-solid fa-check-circle"></i> کپی شد!</div>
|
||||
|
||||
<footer>
|
||||
<strong>radinpirouz · <a href="https://github.com/radinpirouz" target="_blank">GitHub</a></strong>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
function copyToClipboard(btn,text){
|
||||
navigator.clipboard.writeText(text).then(()=>{
|
||||
// Toast
|
||||
let x=document.getElementById("toast");
|
||||
x.className="show";
|
||||
setTimeout(()=>x.className="",3000);
|
||||
// Tooltip روی دکمه
|
||||
btn.classList.add("copied");
|
||||
setTimeout(()=>btn.classList.remove("copied"),1200);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user