-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-task.php
More file actions
225 lines (206 loc) · 9.43 KB
/
Copy pathedit-task.php
File metadata and controls
225 lines (206 loc) · 9.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
session_start();
require_once 'config/config.php';
require_once 'models/Database.php';
require_once 'models/Task.php';
require_once 'models/Category.php';
// التحقق من تسجيل الدخول
if (!isset($_SESSION['user_id'])) {
header('Location: index.php');
exit;
}
// التحقق من وجود معرف المهمة
if (!isset($_GET['id']) || empty($_GET['id'])) {
header('Location: tasks.php');
exit;
}
$taskId = (int)$_GET['id'];
$db = new Database();
$taskModel = new Task($db->getConnection());
$categoryModel = new Category($db->getConnection());
// جلب بيانات المهمة
$task = $taskModel->getTaskById($taskId, $_SESSION['user_id']);
if (!$task) {
header('Location: tasks.php');
exit;
}
// جلب جميع الفئات
$categories = $categoryModel->getCategoriesByUser($_SESSION['user_id']);
$pageTitle = 'עריכת משימה';
?>
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $pageTitle; ?> - מערכת ניהול משימות</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link href="assets/css/official-navbar.css" rel="stylesheet">
<link href="assets/css/add-task.css" rel="stylesheet">
<link href="assets/css/mobile.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.edit-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.form-control, .form-select {
border-radius: 15px;
border: 2px solid #e9ecef;
padding: 12px 20px;
transition: all 0.3s ease;
}
.form-control:focus, .form-select:focus {
border-color: #667eea;
box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
border-radius: 15px;
padding: 12px 30px;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.btn-secondary {
border-radius: 15px;
padding: 12px 30px;
font-weight: 600;
}
</style>
</head>
<body>
<!-- Official Navbar سيتم إدراجه تلقائياً بواسطة JavaScript -->
<!-- المحتوى الرئيسي -->
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="edit-card p-5">
<div class="text-center mb-4">
<h2 class="text-primary">
<i class="fas fa-edit me-2"></i>
עריכת משימה
</h2>
<p class="text-muted">ערוך את פרטי המשימה שלך</p>
</div>
<form id="editTaskForm">
<input type="hidden" id="taskId" value="<?php echo $task['id']; ?>">
<div class="mb-4">
<label for="title" class="form-label">
<i class="fas fa-heading me-1"></i>
כותרת המשימה *
</label>
<input type="text" class="form-control" id="title" name="title"
value="<?php echo htmlspecialchars($task['title']); ?>" required>
</div>
<div class="mb-4">
<label for="description" class="form-label">
<i class="fas fa-align-right me-1"></i>
תיאור המשימה
</label>
<textarea class="form-control" id="description" name="description" rows="4"><?php echo htmlspecialchars($task['description']); ?></textarea>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<label for="category" class="form-label">
<i class="fas fa-folder me-1"></i>
קטגוריה
</label>
<select class="form-select" id="category" name="category">
<option value="">בחר קטגוריה</option>
<?php foreach ($categories as $category): ?>
<option value="<?php echo $category['id']; ?>"
<?php echo ($task['category_id'] == $category['id']) ? 'selected' : ''; ?>>
<?php echo htmlspecialchars($category['name']); ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-6 mb-4">
<label for="priority" class="form-label">
<i class="fas fa-exclamation-circle me-1"></i>
עדיפות
</label>
<select class="form-select" id="priority" name="priority">
<option value="Low" <?php echo ($task['priority'] == 'Low') ? 'selected' : ''; ?>>נמוכה</option>
<option value="Medium" <?php echo ($task['priority'] == 'Medium') ? 'selected' : ''; ?>>בינונית</option>
<option value="High" <?php echo ($task['priority'] == 'High') ? 'selected' : ''; ?>>גבוהה</option>
</select>
</div>
</div>
<div class="mb-4">
<label for="dueDate" class="form-label">
<i class="fas fa-calendar-alt me-1"></i>
תאריך יעד
</label>
<input type="datetime-local" class="form-control" id="dueDate" name="dueDate"
value="<?php echo $task['due_date'] ? date('Y-m-d\TH:i', strtotime($task['due_date'])) : ''; ?>">
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary me-3">
<i class="fas fa-save me-1"></i>
שמור שינויים
</button>
<a href="tasks.php" class="btn btn-secondary">
<i class="fas fa-times me-1"></i>
ביטול
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Toast للرسائل -->
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="messageToast" class="toast" role="alert">
<div class="toast-header">
<i class="fas fa-info-circle text-primary me-2"></i>
<strong class="me-auto">הודעה</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
</div>
<div class="toast-body" id="toastMessage"></div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/official-navbar.js"></script>
<script src="assets/js/edit-task.js"></script>
<script src="assets/js/mobile.js"></script>
<script>
function logout() {
if (confirm('האם אתה בטוח שברצונך להתנתק?')) {
const formData = new FormData();
formData.append('action', 'logout');
fetch('api/auth.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
window.location.href = data.redirect || 'index.php';
} else {
alert('שגיאה בהתנתקות: ' + data.message);
}
})
.catch(error => {
console.error('Error:', error);
window.location.href = 'index.php';
});
}
}
</script>
</body>
</html>