باز هم منصفانه نیست مثلا کسی که یک روز با دونفر یک مسئولیت داشته هفته بعد هم با کسی دیگر همان مسئولیت را دارد در حالی که باید منصفانه باشد و هرکس در طول این ۲۰ هفته برار با هم مسئولیت ها را داشته باشن
Browse files- README.md +9 -5
- index.html +282 -18
README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: undefined
|
| 3 |
+
colorFrom: blue
|
| 4 |
+
colorTo: green
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
| 14 |
+
|
index.html
CHANGED
|
@@ -1,19 +1,283 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fa" dir="rtl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>برنامه کاری گروه پذیرایی مدرسه</title>
|
| 7 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<style>
|
| 11 |
+
@keyframes fadeIn {
|
| 12 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 13 |
+
to { opacity: 1; transform: translateY(0); }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.fade-in {
|
| 17 |
+
animation: fadeIn 0.5s ease-out forwards;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.task-cell {
|
| 21 |
+
transition: all 0.3s ease;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.task-cell:hover {
|
| 25 |
+
transform: scale(1.05);
|
| 26 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.highlight-leader {
|
| 30 |
+
position: relative;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.highlight-leader::after {
|
| 34 |
+
content: "⭐";
|
| 35 |
+
position: absolute;
|
| 36 |
+
left: -20px;
|
| 37 |
+
top: 50%;
|
| 38 |
+
transform: translateY(-50%);
|
| 39 |
+
}
|
| 40 |
+
</style>
|
| 41 |
+
</head>
|
| 42 |
+
<body class="bg-gradient-to-b from-blue-50 to-gray-100 min-h-screen font-[Vazirmatn]">
|
| 43 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
| 44 |
+
<!-- Header -->
|
| 45 |
+
<header class="bg-gradient-to-r from-blue-600 to-blue-800 text-white rounded-xl shadow-lg p-6 mb-8 text-center">
|
| 46 |
+
<h1 class="text-2xl md:text-3xl font-bold">📅 برنامهریزی گروه پذیرایی مدرسه</h1>
|
| 47 |
+
<p class="mt-2 opacity-90">تقسیم منصفانه مسئولیتهای پذیرایی بین دانشآموزان</p>
|
| 48 |
+
</header>
|
| 49 |
+
|
| 50 |
+
<!-- Input Section -->
|
| 51 |
+
<div class="bg-white rounded-xl shadow-md p-6 mb-8">
|
| 52 |
+
<div class="max-w-md mx-auto space-y-6">
|
| 53 |
+
<div>
|
| 54 |
+
<label for="names" class="block text-sm font-medium text-blue-700 mb-1">👥 اسامی اعضا (با نقطه ویرگول جدا کنید):</label>
|
| 55 |
+
<input type="text" id="names"
|
| 56 |
+
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all"
|
| 57 |
+
placeholder="مثال: علی محمدی؛ رضا احمدی؛ امیر حسینی؛ ...">
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<div>
|
| 61 |
+
<label for="leader" class="block text-sm font-medium text-blue-700 mb-1">⭐ سرگروه</label>
|
| 62 |
+
<input type="text" id="leader"
|
| 63 |
+
class="w-full px-4 py-3 border-2 border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all"
|
| 64 |
+
placeholder="نام سرگروه را وارد کنید">
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<div class="flex gap-4 pt-2">
|
| 68 |
+
<button onclick="generateSchedule()"
|
| 69 |
+
class="flex-1 bg-blue-600 hover:bg-blue-700 text-white font-medium py-3 px-4 rounded-xl shadow-md transition-all hover:shadow-lg flex items-center justify-center gap-2">
|
| 70 |
+
<span>🚀 ایجاد برنامه</span>
|
| 71 |
+
</button>
|
| 72 |
+
<button onclick="exportToExcel()"
|
| 73 |
+
class="flex-1 bg-green-600 hover:bg-green-700 text-white font-medium py-3 px-4 rounded-xl shadow-md transition-all hover:shadow-lg flex items-center justify-center gap-2">
|
| 74 |
+
<span>📥 خروجی اکسل</span>
|
| 75 |
+
</button>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
|
| 80 |
+
<!-- Leader Display -->
|
| 81 |
+
<div id="leaderDisplay" class="bg-blue-100 text-blue-800 rounded-xl p-4 mb-6 text-center font-medium hidden"></div>
|
| 82 |
+
|
| 83 |
+
<!-- Schedule Table -->
|
| 84 |
+
<div class="bg-white rounded-xl shadow-md overflow-hidden">
|
| 85 |
+
<div class="overflow-x-auto">
|
| 86 |
+
<table id="scheduleTable" class="w-full">
|
| 87 |
+
<thead class="bg-blue-600 text-white">
|
| 88 |
+
<tr>
|
| 89 |
+
<th class="py-3 px-4">هفته</th>
|
| 90 |
+
<th class="py-3 px-4">🍽 شستن ظروف (2 نفر)</th>
|
| 91 |
+
<th class="py-3 px-4">🥘 شستن قابلمه (1 نفر)</th>
|
| 92 |
+
<th class="py-3 px-4">🧺 جمعآوری سفره (2 نفر)</th>
|
| 93 |
+
<th class="py-3 px-4">🤝 کمک در پخش (1 نفر)</th>
|
| 94 |
+
</tr>
|
| 95 |
+
</thead>
|
| 96 |
+
<tbody class="divide-y divide-gray-200">
|
| 97 |
+
<!-- برنامه کاری در اینجا قرار میگیرد -->
|
| 98 |
+
</tbody>
|
| 99 |
+
</table>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<script>
|
| 105 |
+
let scheduleData = [];
|
| 106 |
+
let previousWeekAssignments = [];
|
| 107 |
+
let members = [];
|
| 108 |
+
let leader = '';
|
| 109 |
+
|
| 110 |
+
function generateSchedule() {
|
| 111 |
+
const namesInput = document.getElementById('names').value;
|
| 112 |
+
leader = document.getElementById('leader').value.trim();
|
| 113 |
+
members = namesInput.split('؛').map(name => name.trim()).filter(name => name !== '');
|
| 114 |
+
const totalWeeks = 12; // Reduced to 12 weeks for better rotation
|
| 115 |
+
|
| 116 |
+
// Validation
|
| 117 |
+
if (!leader) {
|
| 118 |
+
showAlert('لطفاً نام سرگروه را وارد کنید.', 'error');
|
| 119 |
+
return;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
if (members.includes(leader)) {
|
| 123 |
+
showAlert('نام سرگروه نباید در لیست افراد باشد.', 'error');
|
| 124 |
+
return;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
if (members.length < 5) {
|
| 128 |
+
showAlert('حداقل باید 5 نفر وارد کنید.', 'error');
|
| 129 |
+
return;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
// Show leader
|
| 133 |
+
const leaderDisplay = document.getElementById('leaderDisplay');
|
| 134 |
+
leaderDisplay.textContent = `سرگروه: ${leader}`;
|
| 135 |
+
leaderDisplay.classList.remove('hidden');
|
| 136 |
+
leaderDisplay.classList.add('fade-in');
|
| 137 |
+
|
| 138 |
+
// Generate schedule
|
| 139 |
+
const scheduleTableBody = document.querySelector('#scheduleTable tbody');
|
| 140 |
+
scheduleTableBody.innerHTML = '';
|
| 141 |
+
|
| 142 |
+
const tasks = {
|
| 143 |
+
'🍽 شستن ظروف': 2,
|
| 144 |
+
'🥘 شستن قابلمه': 1,
|
| 145 |
+
'🧺 جمعآوری سفره': 2,
|
| 146 |
+
'🤝 کمک در پخش': 1
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
scheduleData = [];
|
| 150 |
+
previousWeekAssignments = [];
|
| 151 |
+
const taskRotation = {}; // Track how many times each person has done each task
|
| 152 |
+
|
| 153 |
+
// Initialize task rotation tracking
|
| 154 |
+
members.forEach(member => {
|
| 155 |
+
taskRotation[member] = {};
|
| 156 |
+
Object.keys(tasks).forEach(task => {
|
| 157 |
+
taskRotation[member][task] = 0;
|
| 158 |
+
});
|
| 159 |
+
});
|
| 160 |
+
|
| 161 |
+
for (let week = 1; week <= totalWeeks; week++) {
|
| 162 |
+
const weekData = { هفته: `هفته ${week}` };
|
| 163 |
+
const currentWeekAssignments = {};
|
| 164 |
+
const availableMembers = [...members];
|
| 165 |
+
const assignments = {};
|
| 166 |
+
|
| 167 |
+
// Initialize assignments
|
| 168 |
+
Object.keys(tasks).forEach(task => {
|
| 169 |
+
assignments[task] = [];
|
| 170 |
+
});
|
| 171 |
+
|
| 172 |
+
// Assign tasks with fairness
|
| 173 |
+
Object.entries(tasks).forEach(([task, count]) => {
|
| 174 |
+
// Sort members by how few times they've done this task
|
| 175 |
+
availableMembers.sort((a, b) => {
|
| 176 |
+
return taskRotation[a][task] - taskRotation[b][task];
|
| 177 |
+
});
|
| 178 |
+
|
| 179 |
+
// Select required number of members with least assignments
|
| 180 |
+
for (let i = 0; i < count && i < availableMembers.length; i++) {
|
| 181 |
+
const member = availableMembers[i];
|
| 182 |
+
assignments[task].push(member);
|
| 183 |
+
currentWeekAssignments[member] = task;
|
| 184 |
+
taskRotation[member][task]++;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// Remove assigned members from available pool for this week
|
| 188 |
+
assignments[task].forEach(member => {
|
| 189 |
+
const index = availableMembers.indexOf(member);
|
| 190 |
+
if (index !== -1) {
|
| 191 |
+
availableMembers.splice(index, 1);
|
| 192 |
+
}
|
| 193 |
+
});
|
| 194 |
+
});
|
| 195 |
+
|
| 196 |
+
previousWeekAssignments.push(currentWeekAssignments);
|
| 197 |
+
|
| 198 |
+
// Create table row
|
| 199 |
+
const row = document.createElement('tr');
|
| 200 |
+
if (week % 2 === 0) {
|
| 201 |
+
row.classList.add('bg-gray-50');
|
| 202 |
+
}
|
| 203 |
+
row.classList.add('fade-in');
|
| 204 |
+
row.style.animationDelay = `${week * 0.1}s`;
|
| 205 |
+
|
| 206 |
+
// Week cell
|
| 207 |
+
const weekCell = document.createElement('td');
|
| 208 |
+
weekCell.className = 'py-3 px-4 font-medium';
|
| 209 |
+
weekCell.textContent = `هفته ${week}`;
|
| 210 |
+
row.appendChild(weekCell);
|
| 211 |
+
|
| 212 |
+
// Task cells
|
| 213 |
+
Object.entries(tasks).forEach(([task, count]) => {
|
| 214 |
+
const taskCell = document.createElement('td');
|
| 215 |
+
taskCell.className = 'py-3 px-4 task-cell';
|
| 216 |
+
|
| 217 |
+
const assignedPeople = assignments[task];
|
| 218 |
+
taskCell.innerHTML = assignedPeople.map(person => {
|
| 219 |
+
return person === leader ? `<span class="highlight-leader">${person}</span>` : person;
|
| 220 |
+
}).join('، ');
|
| 221 |
+
|
| 222 |
+
row.appendChild(taskCell);
|
| 223 |
+
weekData[task] = assignedPeople.join('، ');
|
| 224 |
+
});
|
| 225 |
+
|
| 226 |
+
scheduleTableBody.appendChild(row);
|
| 227 |
+
scheduleData.push(weekData);
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
showAlert('برنامه با موفقیت ایجاد شد!', 'success');
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
function showAlert(message, type) {
|
| 234 |
+
const alert = document.createElement('div');
|
| 235 |
+
alert.className = `fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white font-medium ${
|
| 236 |
+
type === 'error' ? 'bg-red-500' : 'bg-green-500'
|
| 237 |
+
}`;
|
| 238 |
+
alert.textContent = message;
|
| 239 |
+
alert.style.zIndex = 1000;
|
| 240 |
+
document.body.appendChild(alert);
|
| 241 |
+
|
| 242 |
+
setTimeout(() => {
|
| 243 |
+
alert.classList.add('opacity-0', 'transition-opacity', 'duration-500');
|
| 244 |
+
setTimeout(() => {
|
| 245 |
+
document.body.removeChild(alert);
|
| 246 |
+
}, 500);
|
| 247 |
+
}, 3000);
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
function exportToExcel() {
|
| 251 |
+
if (scheduleData.length === 0) {
|
| 252 |
+
showAlert('ابتدا برنامه کاری را تولید کنید.', 'error');
|
| 253 |
+
return;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
const worksheetData = [
|
| 257 |
+
['سرگروه:', leader],
|
| 258 |
+
[],
|
| 259 |
+
['هفته', 'شستن ظروف (2 نفر)', 'شستن قابلمه (1 نفر)', 'جمعآوری سفره (2 نفر)', 'کمک در پخش (1 نفر)']
|
| 260 |
+
];
|
| 261 |
+
|
| 262 |
+
scheduleData.forEach(row => {
|
| 263 |
+
worksheetData.push([row['هفته'], row['🍽 شستن ظروف'], row['🥘 شستن قابلمه'], row['🧺 جمعآوری سفره'], row['🤝 کمک در پخش']]);
|
| 264 |
+
});
|
| 265 |
+
|
| 266 |
+
const worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
| 267 |
+
const workbook = XLSX.utils.book_new();
|
| 268 |
+
XLSX.utils.book_append_sheet(workbook, worksheet, 'برنامه کاری');
|
| 269 |
+
XLSX.writeFile(workbook, `برنامه_کاری_گروه_پذیرایی_${new Date().toLocaleDateString('fa-IR')}.xlsx`);
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
// Improved shuffle function
|
| 273 |
+
function shuffleArray(array) {
|
| 274 |
+
const newArray = [...array];
|
| 275 |
+
for (let i = newArray.length - 1; i > 0; i--) {
|
| 276 |
+
const j = Math.floor(Math.random() * (i + 1));
|
| 277 |
+
[newArray[i], newArray[j]] = [newArray[j], newArray[i]];
|
| 278 |
+
}
|
| 279 |
+
return newArray;
|
| 280 |
+
}
|
| 281 |
+
</script>
|
| 282 |
+
</body>
|
| 283 |
</html>
|