├── logout.php ├── README.md ├── update_session.php ├── db.php ├── main.html ├── circle.css ├── login_backend.php ├── fetch_data.php ├── flogin.php ├── diamondbackend.php ├── backend1.php ├── backend.php ├── hodbackend.php ├── login.php ├── fbackend.php ├── complaints (14).sql ├── manager_dash.php ├── testbackend.php ├── index.php ├── p_index.php ├── ajax.js ├── worker_helpline.html └── requirements1.php /logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /db.php: -------------------------------------------------------------------------------- 1 | connect_error) { 12 | die("Connection failed: " . $conn->connect_error); 13 | } 14 | ?> -------------------------------------------------------------------------------- /main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | Faculty Page

10 | Infra Page

11 | Hod Page

12 | Manager Page

13 | Principal Page

14 | Worker Page

15 | 16 | -------------------------------------------------------------------------------- /circle.css: -------------------------------------------------------------------------------- 1 | 2 | .diamond-container { 3 | position: relative; 4 | width: 100px; 5 | height: 100px; 6 | margin-top: 30px; 7 | margin-bottom: 150px; 8 | margin-left: 50px; 9 | } 10 | 11 | .diamond { 12 | width: 150px; 13 | height: 150px; 14 | border-radius: 80%; 15 | background-color: #3498db; 16 | display: flex; 17 | justify-content: center; 18 | align-items: center; 19 | text-align: center; 20 | } 21 | 22 | .diamond > div { 23 | display: flex; 24 | flex-direction: column; 25 | align-items: center; 26 | } 27 | 28 | .diamond > div > h5 { 29 | margin: 0; 30 | } 31 | 32 | .border-animation { 33 | position: absolute; 34 | top: -25px; 35 | left: -25px; 36 | width: 193px; 37 | height: 193px; 38 | border: 4px solid transparent; 39 | border-top-color: #ff5733; 40 | border-bottom-color: #3357ff; 41 | border-radius: 100%; 42 | animation: rotateBorder 4s linear infinite; 43 | } 44 | 45 | @keyframes rotateBorder { 46 | 100% { 47 | transform: rotate(360deg); 48 | } 49 | } -------------------------------------------------------------------------------- /login_backend.php: -------------------------------------------------------------------------------- 1 | alert('Invalid Faculty ID or Password. Please try again.'); window.location.href='flogin.php';"; 22 | } 23 | } else { 24 | header("Location: flogin.php"); // Redirect back to login page if accessed without form submission 25 | exit(); 26 | } 27 | -------------------------------------------------------------------------------- /fetch_data.php: -------------------------------------------------------------------------------- 1 | 2 | connect_error) { 19 | die("Connection failed: " . $conn->connect_error); 20 | } 21 | 22 | if (isset($_POST['department'])){ 23 | // Fetch data from the worker_details table 24 | $sql = "SELECT worker_first_name, worker_last_name, worker_emp_type, worker_dept FROM worker_details WHERE worker_id = '$worker_id'"; 25 | $result = $conn->query($sql); 26 | 27 | if ($result->num_rows > 0) { 28 | // Output data of each row 29 | $row = $result->fetch_assoc(); 30 | echo json_encode([ 31 | 'name' => $row['worker_first_name'], 32 | 'employment_type' => $row['worker_emp_type'], 33 | 'department' => $row['worker_dept'], 34 | ]); 35 | } else { 36 | echo json_encode([ 37 | 'name' => '', 38 | 'employment_type' => '', 39 | 'department' => '', 40 | ]); 41 | } 42 | 43 | 44 | } 45 | ?> 46 | -------------------------------------------------------------------------------- /flogin.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Login 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |

Faculty Login

17 |
18 |
19 | 20 | 21 |
22 |
23 | 24 | 25 |
26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /diamondbackend.php: -------------------------------------------------------------------------------- 1 | 0"; 11 | $output1 = mysqli_query($conn, $query1); 12 | $row1 = mysqli_fetch_assoc($output1); 13 | $response['complainCount'] = $row1['complain']; 14 | 15 | // Fetch completed complaints 16 | $query2 = "SELECT COUNT(*) as completed FROM complaints_detail WHERE status = '13'"; 17 | $output2 = mysqli_query($conn, $query2); 18 | $row2 = mysqli_fetch_assoc($output2); 19 | $response['completedCount'] = $row2['completed']; 20 | 21 | // Fetch in-progress complaints 22 | $query3 = "SELECT COUNT(*) as inprogress FROM complaints_detail WHERE status = '10'"; 23 | $output3 = mysqli_query($conn, $query3); 24 | $row3 = mysqli_fetch_assoc($output3); 25 | $response['inprogressCount'] = $row3['inprogress']; 26 | 27 | // Fetch pending status 28 | $query4 = "SELECT COUNT(*) as pending FROM complaints_detail WHERE status ='7'"; 29 | $output4 = mysqli_query($conn, $query4); 30 | $row4 = mysqli_fetch_assoc($output4); 31 | $response['pendingCount'] = $row4['pending']; 32 | 33 | // Fetch request count 34 | $query5 = "SELECT COUNT(*) as request FROM complaints_detail WHERE status ='6'"; 35 | $output5 = mysqli_query($conn, $query5); 36 | $row5 = mysqli_fetch_assoc($output5); 37 | $response['requestCount'] = $row5['request']; 38 | 39 | // Fetch reassigned work 40 | $query6 = "SELECT COUNT(*) as reassign FROM complaints_detail WHERE status ='14'"; 41 | $output6 = mysqli_query($conn, $query6); 42 | $row6 = mysqli_fetch_assoc($output6); 43 | $response['reassignCount'] = $row6['reassign']; 44 | 45 | // Query to get counts of each type_of_problem 46 | $query7 = "SELECT type_of_problem, COUNT(*) as count FROM complaints_detail WHERE status IN ('7', '10','17') GROUP BY type_of_problem"; 47 | $output7 = $conn->query($query7); 48 | 49 | // pie chart count to display Initialize an array to store type_of_problem counts 50 | $typeOfProblemCounts = array(); 51 | while ($row7 = $output7->fetch_assoc()) { 52 | $typeOfProblemCounts[] = $row7; 53 | } 54 | $response['typeOfProblemCounts'] = $typeOfProblemCounts; 55 | 56 | // Return the full response as a JSON object 57 | echo json_encode($response); 58 | } else { 59 | echo json_encode(array("error" => "Invalid request method.")); 60 | } 61 | ?> 62 | -------------------------------------------------------------------------------- /backend1.php: -------------------------------------------------------------------------------- 1 | 200]); 23 | } else { 24 | $res = [ 25 | 'status' => 500, 26 | 'message' => 'Details Not Deleted' 27 | ]; 28 | echo json_encode($res); 29 | return; 30 | } 31 | } 32 | 33 | //requirements rejected 34 | 35 | if (isset($_POST['save_reason'])) { 36 | try { 37 | // Sanitize input values 38 | $reason = mysqli_real_escape_string($conn, $_POST['reason']); 39 | $customer_id = mysqli_real_escape_string($conn, $_POST['problem_id']); 40 | 41 | // Start the transaction 42 | mysqli_begin_transaction($conn); 43 | 44 | // First query: Update the status in complaints_detail table 45 | $query = "UPDATE complaints_detail SET status='19' WHERE id='$customer_id'"; 46 | $query_run = mysqli_query($conn, $query); 47 | 48 | // Second query: Update the feedback column 49 | $comment = "UPDATE complaints_detail SET feedback='$reason' WHERE id='$customer_id'"; 50 | $comment_run = mysqli_query($conn, $comment); 51 | 52 | // Third query: Delete from comments table 53 | $delete_query = "DELETE FROM comments WHERE problem_id='$customer_id'"; 54 | $delete_run = mysqli_query($conn, $delete_query); 55 | 56 | // Check if all queries ran successfully 57 | if ($query_run && $comment_run && $delete_run) { 58 | // Commit transaction if all succeeded 59 | mysqli_commit($conn); 60 | echo json_encode(['status' => 200,]); 61 | } else { 62 | // Rollback if any query fails 63 | mysqli_rollback($conn); 64 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 65 | } 66 | } catch (Exception $e) { 67 | // Return error response in case of exception 68 | $res = [ 69 | 'status' => 500, 70 | 'message' => 'Error: ' . $e->getMessage() 71 | ]; 72 | echo json_encode($res); 73 | } 74 | } 75 | 76 | //comments query to give by user 77 | 78 | if (isset($_POST['edit_user'])) { 79 | $customer_id = mysqli_real_escape_string($conn, $_POST['user_id']); 80 | 81 | $query = "SELECT * FROM manager WHERE task_id='$customer_id'"; 82 | $query_run = mysqli_query($conn, $query); 83 | 84 | $User_data = mysqli_fetch_array($query_run); 85 | $query_date = $User_data['query_date']; 86 | $current_date = date('Y-m-d'); 87 | 88 | // Calculate the difference in days between current date and query date 89 | $date_diff = (strtotime($current_date) - strtotime($query_date)) / (60 * 60 * 24); 90 | 91 | if($date_diff < 5 && !empty($User_data['comment_query'])){ 92 | $readonly = true; 93 | }// Check if the reply is still empty and 5 days have passed 94 | else{ 95 | $readonly = false; // Make it editable if conditions are met 96 | } 97 | 98 | if ($query_run) { 99 | $res = [ 100 | 'status' => 200, 101 | 'message' => 'details Fetch Successfully by id', 102 | 'data' => $User_data, 103 | 'readonly' => $readonly, 104 | 'date_diff' => $date_diff 105 | ]; 106 | echo json_encode($res); 107 | return; 108 | } else { 109 | $res = [ 110 | 'status' => 500, 111 | 'message' => 'Details Not Deleted' 112 | ]; 113 | echo json_encode($res); 114 | return; 115 | } 116 | } 117 | 118 | //query save user 119 | if (isset($_POST['save_edituser'])) { 120 | $customer_id = mysqli_real_escape_string($conn, $_POST['task_id']); 121 | $query = mysqli_real_escape_string($conn, $_POST['comment_query']); 122 | $reply = mysqli_real_escape_string($conn, $_POST['comment_reply']); 123 | 124 | $query = "UPDATE manager SET comment_query='$query',query_date=NOW() WHERE task_id='$customer_id'"; 125 | $query_run = mysqli_query($conn, $query); 126 | 127 | if ($query_run) { 128 | $res = [ 129 | 'status' => 200, 130 | 'message' => 'details Updated Successfully' 131 | ]; 132 | echo json_encode($res); 133 | return; 134 | } else { 135 | $res = [ 136 | 'status' => 500, 137 | 'message' => 'Details Not Deleted' 138 | ]; 139 | echo json_encode($res); 140 | return; 141 | } 142 | } 143 | 144 | //get image 145 | if (isset($_POST['get_image'])) { 146 | $user_id = $_POST['user_id']; 147 | 148 | // Query to fetch the image based on user ID 149 | $query = "SELECT id, images FROM complaints_detail WHERE id = ?"; 150 | $stmt = $conn->prepare($query); 151 | $stmt->bind_param('i', $user_id); 152 | $stmt->execute(); 153 | $result = $stmt->get_result(); 154 | 155 | if ($result->num_rows > 0) { 156 | $row = $result->fetch_assoc(); 157 | echo json_encode(['status' => 200, 'data' => $row]); 158 | } else { 159 | echo json_encode(['status' => 500, 'message' => 'Image not found']); 160 | } 161 | 162 | $stmt->close(); 163 | $conn->close(); 164 | } 165 | 166 | //after images 167 | if (isset($_POST['after_image'])) { 168 | $user_id = $_POST['user_id']; 169 | 170 | // Query to fetch the image based on user ID 171 | $query = "SELECT id, after_photo FROM worker_taskdet WHERE task_id= ?"; 172 | $stmt = $conn->prepare($query); 173 | $stmt->bind_param('i', $user_id); 174 | $stmt->execute(); 175 | $result = $stmt->get_result(); 176 | 177 | if ($result->num_rows > 0) { 178 | $row = $result->fetch_assoc(); 179 | echo json_encode(['status' => 200, 'data' => $row]); 180 | } else { 181 | echo json_encode(['status' => 500, 'message' => 'Image not found']); 182 | } 183 | 184 | $stmt->close(); 185 | $conn->close(); 186 | } 187 | 188 | 189 | 190 | 191 | 192 | ?> -------------------------------------------------------------------------------- /backend.php: -------------------------------------------------------------------------------- 1 | 'Task ID not provided'])); 14 | } 15 | 16 | $sql = "SELECT 17 | f.faculty_name, 18 | f.faculty_contact, 19 | cd.block_venue, 20 | cd.venue_name, 21 | cd.problem_description, 22 | cd.days_to_complete 23 | FROM 24 | complaints_detail AS cd 25 | JOIN 26 | faculty AS f ON cd.faculty_id = f.faculty_id 27 | WHERE 28 | cd.id = (SELECT problem_id FROM manager WHERE task_id = ?) 29 | "; 30 | 31 | 32 | $stmt = $conn->prepare($sql); 33 | $stmt->bind_param("i", $task_id); 34 | $stmt->execute(); 35 | $result = $stmt->get_result(); 36 | 37 | $response = array(); 38 | 39 | if ($result->num_rows > 0) { 40 | $row = $result->fetch_assoc(); 41 | $response = array( 42 | 'faculty_name' => $row['faculty_name'], 43 | 'faculty_contact' => $row['faculty_contact'], 44 | 'block_venue' => $row['block_venue'], 45 | 'venue_name' => $row['venue_name'], 46 | 'problem_description' => $row['problem_description'], 47 | 'days_to_complete' => $row['days_to_complete'] 48 | ); 49 | echo json_encode($response); 50 | } else { 51 | $response['error'] = 'No details found for this complaint.'; 52 | } 53 | 54 | 55 | 56 | $stmt->close(); 57 | 58 | 59 | } 60 | 61 | if (isset($_POST['start_work'])) { 62 | $id = $_POST['task_id']; 63 | 64 | 65 | 66 | $sql = "UPDATE complaints_detail 67 | SET status = 10 68 | WHERE id = (SELECT problem_id FROM manager WHERE task_id = '$id')"; 69 | 70 | $query_run = mysqli_query($conn, $sql); 71 | if($query_run){ 72 | $res =[ 73 | "status" => 200, 74 | "message" => "Work started successfully" 75 | ]; 76 | echo json_encode($res); 77 | } 78 | else{ 79 | $res =[ 80 | "status" => 500, 81 | "message" => "Work could not be started" 82 | ]; 83 | echo json_encode($res); 84 | } 85 | } 86 | 87 | 88 | 89 | 90 | 91 | 92 | //work completion backend 93 | if (isset($_POST['update'])) { 94 | $taskId = $_POST['task_id']; 95 | $completionStatus = $_POST['completion_status']; 96 | $reason = $_POST['reason']; 97 | 98 | // Database connection 99 | $servername = "localhost"; 100 | $username = "root"; 101 | $password = ""; 102 | $dbname = "complaints"; 103 | $conn = new mysqli($servername, $username, $password, $dbname); 104 | if ($conn->connect_error) { 105 | die("Connection failed: " . $conn->connect_error); 106 | } 107 | 108 | // Update status and task_completion in the complaints_detail table 109 | $updateComplaintSql = "UPDATE complaints_detail 110 | SET status = 11, task_completion = ?,reason = ?,date_of_completion = NOW() 111 | WHERE id = (SELECT problem_id FROM manager WHERE task_id = ?)"; 112 | if ($stmt = $conn->prepare($updateComplaintSql)) { 113 | $stmt->bind_param("ssi", $completionStatus,$reason,$taskId); 114 | if (!$stmt->execute()) { 115 | echo "Update failed: (" . $stmt->errno . ") " . $stmt->error; 116 | } else { 117 | echo "Complaint status and task completion updated successfully."; 118 | } 119 | $stmt->close(); 120 | } else { 121 | echo "Prepare failed: (" . $conn->errno . ") " . $conn->error; 122 | } 123 | 124 | // Handle file upload 125 | $imgAfterName = null; 126 | if (isset($_FILES['img_after']) && $_FILES['img_after']['error'] === UPLOAD_ERR_OK) { 127 | $uploadDir = 'imgafter/'; 128 | $imgAfterName = basename($_FILES['img_after']['name']); // This stores only the file name 129 | $uploadFile = $uploadDir . $imgAfterName; // Full path to move the file 130 | 131 | if (move_uploaded_file($_FILES['img_after']['tmp_name'], $uploadFile)) { 132 | echo "File successfully uploaded: " . $imgAfterName; 133 | 134 | // Insert only the image name into worker_taskdet table 135 | $insertTaskDetSql = "INSERT INTO worker_taskdet (task_id, task_completion, after_photo, work_completion_date) 136 | VALUES (?, ?, ?, NOW())"; 137 | if ($stmt = $conn->prepare($insertTaskDetSql)) { 138 | // Pass the image name (not the path) to the database 139 | $stmt->bind_param("sss", $taskId, $completionStatus, $imgAfterName); 140 | if (!$stmt->execute()) { 141 | echo "Insertion into worker_taskdet failed: (" . $stmt->errno . ") " . $stmt->error; 142 | } else { 143 | echo "Record inserted successfully into worker_taskdet."; 144 | } 145 | $stmt->close(); 146 | } else { 147 | echo "Prepare failed: (" . $conn->errno . ") " . $conn->error; 148 | } 149 | } else { 150 | echo "File upload failed."; 151 | } 152 | } else { 153 | echo "No file uploaded or file upload error."; 154 | } 155 | 156 | } 157 | 158 | 159 | 160 | 161 | 162 | if (isset($_POST['get_bef'])) { 163 | $task_id = isset($_POST['task_id']) ? $_POST['task_id'] : ''; 164 | 165 | // Validate task_id 166 | if (empty($task_id)) { 167 | echo json_encode(['status' => 400, 'message' => 'Task ID not provided']); 168 | exit; 169 | } 170 | 171 | // Query to fetch the image based on task_id 172 | $query = "SELECT images FROM complaints_detail WHERE id = (SELECT problem_id FROM manager WHERE task_id = ?)"; 173 | $stmt = $conn->prepare($query); 174 | 175 | if (!$stmt) { 176 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 177 | exit; 178 | } 179 | 180 | $stmt->bind_param('i', $task_id); 181 | $stmt->execute(); 182 | $result = $stmt->get_result(); 183 | 184 | if ($result->num_rows > 0) { 185 | $row = $result->fetch_assoc(); 186 | 187 | // Extract only the filename 188 | $image_filename = basename($row['images']); 189 | // Ensure correct path construction 190 | $image_path = 'uploads/' . $image_filename; 191 | 192 | echo json_encode(['status' => 200, 'data' => ['after_photo' => $image_path]]); 193 | } else { 194 | echo json_encode(['status' => 500, 'message' => 'No image found']); 195 | } 196 | 197 | $stmt->close(); 198 | exit; 199 | } 200 | 201 | 202 | 203 | if (isset($_POST['get_image'])) { 204 | $task_id = isset($_POST['task_id']) ? $_POST['task_id'] : ''; 205 | 206 | // Validate task_id 207 | if (empty($task_id)) { 208 | echo json_encode(['status' => 400, 'message' => 'Task ID not provided']); 209 | exit; 210 | } 211 | 212 | // Query to fetch the image based on task_id 213 | $query = "SELECT after_photo FROM worker_taskdet WHERE task_id = ?"; 214 | $stmt = $conn->prepare($query); 215 | 216 | if (!$stmt) { 217 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 218 | exit; 219 | } 220 | 221 | $stmt->bind_param('i', $task_id); 222 | $stmt->execute(); 223 | $result = $stmt->get_result(); 224 | 225 | if ($result->num_rows > 0) { 226 | $row = $result->fetch_assoc(); 227 | 228 | // Extract only the filename 229 | $image_filename = basename($row['after_photo']); 230 | // Ensure correct path construction 231 | $image_path = 'imgafter/' . $image_filename; 232 | 233 | echo json_encode(['status' => 200, 'data' => ['after_photo' => $image_path]]); 234 | } else { 235 | echo json_encode(['status' => 500, 'message' => 'No image found']); 236 | } 237 | 238 | $stmt->close(); 239 | exit; 240 | } 241 | 242 | 243 | 244 | 245 | 246 | if (isset($_GET['department'])) { 247 | // Fetch data from the worker_details table 248 | $sql = "SELECT worker_first_name, worker_last_name, worker_emp_type, worker_dept FROM worker_details WHERE id = id"; // Adjust WHERE clause as necessary 249 | $result = $conn->query($sql); 250 | 251 | if ($result->num_rows > 0) { 252 | // Output data of each row 253 | $row = $result->fetch_assoc(); 254 | echo json_encode([ 255 | 'name' => $row['worker_first_name'] . ' ' . $row['worker_last_name'], 256 | 'employment_type' => $row['worker_emp_type'], 257 | 'department' => $row['worker_dept'], 258 | ]); 259 | } else { 260 | echo json_encode([ 261 | 'name' => '', 262 | 'employment_type' => '', 263 | 'department' => '', 264 | ]); 265 | } 266 | } 267 | ?> 268 | -------------------------------------------------------------------------------- /hodbackend.php: -------------------------------------------------------------------------------- 1 | 200, 14 | 'message' => 'Details Updated Successfully' 15 | ]; 16 | echo json_encode($res); 17 | } else { 18 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 19 | } 20 | } catch (Exception $e) { 21 | $res = [ 22 | 'status' => 500, 23 | 'message' => 'Error: ' . $e->getMessage() 24 | ]; 25 | echo json_encode($res); 26 | } 27 | } 28 | 29 | //Approve All Button 30 | if (isset($_POST['approveallbtn'])) { 31 | try { 32 | $query = "UPDATE complaints_detail SET status = '4' WHERE status='2' "; 33 | 34 | if (mysqli_query($conn, $query)) { 35 | $res = [ 36 | 'status' => 200, 37 | 'message' => 'Details Updated Successfully' 38 | ]; 39 | echo json_encode($res); 40 | } else { 41 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 42 | } 43 | } catch (Exception $e) { 44 | $res = [ 45 | 'status' => 500, 46 | 'message' => 'Error: ' . $e->getMessage() 47 | ]; 48 | echo json_encode($res); 49 | } 50 | } 51 | 52 | //Rejected Feedback 53 | if (isset($_POST['rejfeed'])) { 54 | try { 55 | $id = mysqli_real_escape_string($conn, $_POST['reject_id']); 56 | $feedback = mysqli_real_escape_string($conn, $_POST['rejfeed']); 57 | 58 | $query = "UPDATE complaints_detail SET feedback = '$feedback', status = '5' WHERE id = '$id'"; 59 | 60 | if (mysqli_query($conn, $query)) { 61 | $res = [ 62 | 'status' => 200, 63 | 'message' => 'Details Updated Successfully' 64 | ]; 65 | echo json_encode($res); 66 | } else { 67 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 68 | echo "print"; 69 | } 70 | } catch (Exception $e) { 71 | $res = [ 72 | 'status' => 500, 73 | 'message' => 'Error: ' . $e->getMessage() 74 | ]; 75 | echo json_encode($res); 76 | } 77 | } 78 | 79 | //Problem Description 80 | if (isset($_POST['seedetails'])) { 81 | $student_id1 = mysqli_real_escape_string($conn, $_POST['user_id']); 82 | $query = "SELECT * FROM complaints_detail WHERE id='$student_id1'"; 83 | $query_run = mysqli_query($conn, $query); 84 | $User_data = mysqli_fetch_array($query_run); 85 | if ($query_run) { 86 | $res = [ 87 | 'status' => 200, 88 | 'message' => 'details Fetch Successfully by id', 89 | 'data' => $User_data 90 | ]; 91 | echo json_encode($res); 92 | return; 93 | } else { 94 | $res = [ 95 | 'status' => 500, 96 | 'message' => 'Details Not Deleted' 97 | ]; 98 | echo json_encode($res); 99 | return; 100 | } 101 | } 102 | 103 | //Faculty Details 104 | if (isset($_POST['facultydetails'])) { 105 | $student_id1 = mysqli_real_escape_string($conn, $_POST['user_id']); 106 | $query = "SELECT cd.*, faculty.faculty_name, faculty.department, faculty.faculty_contact, faculty.faculty_mail 107 | FROM complaints_detail cd 108 | JOIN faculty ON cd.faculty_id = faculty.faculty_id WHERE cd.id='$student_id1'"; 109 | $query_run = mysqli_query($conn, $query); 110 | $User_data = mysqli_fetch_array($query_run); 111 | if ($query_run) { 112 | $res = [ 113 | 'status' => 200, 114 | 'message' => 'details Fetch Successfully by id', 115 | 'data' => $User_data 116 | ]; 117 | echo json_encode($res); 118 | return; 119 | } else { 120 | $res = [ 121 | 'status' => 500, 122 | 'message' => 'Details Not Deleted' 123 | ]; 124 | echo json_encode($res); 125 | return; 126 | } 127 | } 128 | 129 | //Rejected Reason 130 | if (isset($_POST['seefeedback'])) { 131 | $student_id5 = mysqli_real_escape_string($conn, $_POST['user_idrej']); 132 | 133 | $query = "SELECT * FROM complaints_detail WHERE id='$student_id5'"; 134 | $query_run = mysqli_query($conn, $query); 135 | $User_data = mysqli_fetch_array($query_run); 136 | 137 | if ($query_run) { 138 | $res = [ 139 | 'status' => 200, 140 | 'message' => 'details Fetch Successfully by id', 141 | 'data' => $User_data 142 | ]; 143 | echo json_encode($res); 144 | return; 145 | } else { 146 | $res = [ 147 | 'status' => 500, 148 | 'message' => 'Details Not Deleted' 149 | ]; 150 | echo json_encode($res); 151 | return; 152 | } 153 | } 154 | 155 | //Rejected Feedback for Faculty Infra 156 | if (isset($_POST['rejfeedfac'])) { 157 | try { 158 | $id = mysqli_real_escape_string($conn, $_POST['reject_idfac']); 159 | $feedback = mysqli_real_escape_string($conn, $_POST['rejfeedfac']); 160 | 161 | $query = "UPDATE complaints_detail SET feedback = '$feedback', status = '3' WHERE id = '$id'"; 162 | 163 | if (mysqli_query($conn, $query)) { 164 | $res = [ 165 | 'status' => 200, 166 | 'message' => 'Details Updated Successfully' 167 | ]; 168 | echo json_encode($res); 169 | } else { 170 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 171 | echo "print"; 172 | } 173 | } catch (Exception $e) { 174 | $res = [ 175 | 'status' => 500, 176 | 'message' => 'Error: ' . $e->getMessage() 177 | ]; 178 | echo json_encode($res); 179 | } 180 | } 181 | 182 | //Approve Button for Faculty Infra 183 | if (isset($_POST['approvefacbtn'])) { 184 | try { 185 | $id = mysqli_real_escape_string($conn, $_POST['approvefac']); 186 | 187 | $query = "UPDATE complaints_detail SET status = '2' WHERE id='$id'"; 188 | 189 | if (mysqli_query($conn, $query)) { 190 | $res = [ 191 | 'status' => 200, 192 | 'message' => 'Details Updated Successfully' 193 | ]; 194 | echo json_encode($res); 195 | } else { 196 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 197 | } 198 | } catch (Exception $e) { 199 | $res = [ 200 | 'status' => 500, 201 | 'message' => 'Error: ' . $e->getMessage() 202 | ]; 203 | echo json_encode($res); 204 | } 205 | } 206 | 207 | // Get Image 208 | if (isset($_POST['get_image'])) { 209 | $task_id = isset($_POST['task_id']) ? intval($_POST['task_id']) : ''; 210 | 211 | if ($task_id == 0 212 | ) { 213 | echo json_encode(['status' => 400, 'message' => 'Task ID not provided or invalid']); 214 | exit; 215 | } 216 | 217 | $query = "SELECT images FROM complaints_detail WHERE id = ?"; 218 | $stmt = $conn->prepare($query); 219 | 220 | if (!$stmt) { 221 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 222 | exit; 223 | } 224 | 225 | $stmt->bind_param('i', $task_id); 226 | $stmt->execute(); 227 | $result = $stmt->get_result(); 228 | 229 | if ($result->num_rows > 0) { 230 | $row = $result->fetch_assoc(); 231 | $image_path = 'uploads/' . $row['images']; 232 | 233 | if (file_exists($image_path)) { 234 | echo json_encode(['status' => 200, 'data' => ['images' => $image_path]]); 235 | } else { 236 | echo json_encode(['status' => 404, 'message' => 'Image file not found on the server']); 237 | } 238 | } else { 239 | echo json_encode(['status' => 404, 'message' => 'No image found']); 240 | } 241 | 242 | $stmt->close(); 243 | $conn->close(); 244 | exit; 245 | } 246 | 247 | // Get After Image 248 | if (isset($_POST['after_image'])) { 249 | $task_id = isset($_POST['task_id']) ? intval($_POST['task_id']) : ''; 250 | 251 | if ($task_id == 0) { 252 | echo json_encode(['status' => 400, 'message' => 'Task ID not provided or invalid']); 253 | exit; 254 | } 255 | 256 | $query = "SELECT after_photo FROM worker_taskdet WHERE id = ?"; 257 | $stmt = $conn->prepare($query); 258 | 259 | if (!$stmt) { 260 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 261 | exit; 262 | } 263 | 264 | $stmt->bind_param('i', $task_id); 265 | $stmt->execute(); 266 | $result = $stmt->get_result(); 267 | 268 | if ($result->num_rows > 0) { 269 | $row = $result->fetch_assoc(); 270 | $image_path = 'imgafter/' . $row['after_photo']; 271 | 272 | if (file_exists($image_path)) { 273 | echo json_encode(['status' => 200, 'data' => ['after_photo' => $image_path]]); 274 | } else { 275 | echo json_encode(['status' => 404, 'message' => 'Image file not found on the server']); 276 | } 277 | } else { 278 | echo json_encode(['status' => 404, 'message' => 'No image found']); 279 | } 280 | 281 | $stmt->close(); 282 | $conn->close(); 283 | exit; 284 | } 285 | 286 | ?> 287 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT * FROM worker_details WHERE worker_id = ? AND password = ?"); 23 | $stmt->bind_param("ss", $worker_id, $password); 24 | $stmt->execute(); 25 | $result = $stmt->get_result(); 26 | $row = $result->fetch_assoc(); 27 | 28 | if ($row) { 29 | $_SESSION["worker_id"] = $worker_id; 30 | $success_flag = true; // Set the success flag for SweetAlert 31 | 32 | if ($row["usertype"] == "user") { 33 | // Delay redirect to show SweetAlert 34 | echo ""; 39 | } elseif ($row["usertype"] == "admin") { 40 | // Delay redirect to show SweetAlert 41 | echo ""; 46 | } 47 | } else { 48 | $error_flag = true; // Trigger error flag if credentials are wrong 49 | } 50 | $stmt->close(); 51 | } 52 | ?> 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Login - CMS 62 | 63 | 64 | 65 | 66 | 67 | 68 | 140 | 141 | 142 | 143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | 151 |
152 |
153 |
154 |
155 |

Worker login

156 |
157 | 158 |
159 |
160 |
161 |
162 |
163 | 165 |
166 | 169 |
170 |
171 |
172 | 174 |
175 | 178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 | 187 | 188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 | Enter your e-mail address below and we will send you instructions how 197 | to recover a password. 198 |
199 |
200 |
201 |
202 |
203 | 205 |
206 | 208 |
209 |
210 |
211 | Back To Login 212 | 214 |
215 |
216 |
217 |
218 |

219 | 222 |
223 |
224 |
225 | 226 | 227 | 228 | 229 | 230 | 231 | 256 | 257 | 258 | -------------------------------------------------------------------------------- /fbackend.php: -------------------------------------------------------------------------------- 1 | 500, 'message' => 'Database connection failed']); 10 | exit; 11 | } 12 | 13 | // Define the counter file path 14 | $counterFilePath = './uploads/counter.txt'; 15 | 16 | // Function to get the next file number 17 | function getNextFileNumber($counterFilePath) 18 | { 19 | if (file_exists($counterFilePath)) { 20 | $file = fopen($counterFilePath, 'r'); 21 | $lastNumber = (int)fgets($file); 22 | fclose($file); 23 | $nextNumber = $lastNumber + 1; 24 | } else { 25 | $nextNumber = 1; 26 | } 27 | $file = fopen($counterFilePath, 'w'); 28 | fwrite($file, $nextNumber); 29 | fclose($file); 30 | return $nextNumber; 31 | } 32 | 33 | // Handle form submission 34 | if (isset($_POST['faculty_id'])) { 35 | $faculty_id = mysqli_real_escape_string($conn, $_POST['faculty_id']); 36 | $block_venue = mysqli_real_escape_string($conn, $_POST['block_venue']); 37 | $venue_name = mysqli_real_escape_string($conn, $_POST['venue_name']); 38 | $type_of_problem = mysqli_real_escape_string($conn, $_POST['type_of_problem']); 39 | $problem_description = mysqli_real_escape_string($conn, $_POST['problem_description']); 40 | $date_of_reg = mysqli_real_escape_string($conn, $_POST['date_of_reg']); 41 | $status = $_POST['status']; 42 | 43 | // Handle file upload 44 | $images = ""; 45 | $uploadFileDir = './uploads/'; 46 | 47 | if (!is_dir($uploadFileDir) && !mkdir($uploadFileDir, 0755, true)) { 48 | echo json_encode(['status' => 500, 'message' => 'Failed to create upload directory.']); 49 | exit; 50 | } 51 | 52 | if (isset($_FILES['images']) && $_FILES['images']['error'] === UPLOAD_ERR_OK) { 53 | $fileTmpPath = $_FILES['images']['tmp_name']; 54 | $fileNameCmps = explode(".", $_FILES['images']['name']); 55 | $fileExtension = strtolower(end($fileNameCmps)); 56 | 57 | $allowedExtensions = ['jpg', 'jpeg', 'png']; 58 | if (in_array($fileExtension, $allowedExtensions)) { 59 | $nextFileNumber = getNextFileNumber($counterFilePath); 60 | $newFileName = str_pad($nextFileNumber, 10, '0', STR_PAD_LEFT) . '.' . $fileExtension; 61 | $dest_path = $uploadFileDir . $newFileName; 62 | 63 | if (move_uploaded_file($fileTmpPath, $dest_path)) { 64 | $images = $newFileName; 65 | } else { 66 | echo json_encode(['status' => 500, 'message' => 'Error moving the uploaded file.']); 67 | exit; 68 | } 69 | } else { 70 | echo json_encode(['status' => 500, 'message' => 'Upload failed. Allowed types: jpg, jpeg, png.']); 71 | exit; 72 | } 73 | } 74 | 75 | 76 | // Insert data into the database 77 | $query = "INSERT INTO complaints_detail (faculty_id, block_venue, venue_name, type_of_problem, problem_description, images, date_of_reg, status) 78 | VALUES ('$faculty_id', '$block_venue', '$venue_name', '$type_of_problem', '$problem_description', '$images', '$date_of_reg', '$status')"; 79 | 80 | if (mysqli_query($conn, $query)) { 81 | echo json_encode(['status' => 200, 'message' => 'Success']); 82 | } else { 83 | echo json_encode(['status' => 500, 'message' => 'Error inserting data: ' . mysqli_error($conn)]); 84 | } 85 | exit; 86 | } 87 | 88 | // Handle complaint deletion 89 | if (isset($_POST['delete_user'])) { 90 | $user_id = mysqli_real_escape_string($conn, $_POST['user_id']); 91 | $query = "DELETE FROM complaints_detail WHERE id='$user_id'"; 92 | 93 | if (mysqli_query($conn, $query)) { 94 | echo json_encode(['status' => 200, 'message' => 'Deleted successfully']); 95 | } else { 96 | echo json_encode(['status' => 500, 'message' => 'Error deleting data: ' . mysqli_error($conn)]); 97 | } 98 | exit; 99 | } 100 | 101 | // Handle image retrieval 102 | if (isset($_POST['get_image'])) { 103 | $id = isset($_POST['id']) ? $_POST['id'] : ''; // Ensure id is set 104 | 105 | // Validate id 106 | if (empty($id)) { 107 | echo json_encode(['status' => 400, 'message' => 'ID not provided']); 108 | exit; 109 | } 110 | 111 | // Query to fetch the image based on id 112 | $query = "SELECT id, images FROM complaints_detail WHERE id = ?"; 113 | $stmt = $conn->prepare($query); 114 | 115 | if (!$stmt) { 116 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 117 | exit; 118 | } 119 | 120 | $stmt->bind_param('i', $id); 121 | $stmt->execute(); 122 | $result = $stmt->get_result(); 123 | 124 | if ($result->num_rows > 0) { 125 | $row = $result->fetch_assoc(); 126 | echo json_encode(['status' => 200, 'data' => $row]); 127 | } else { 128 | echo json_encode(['status' => 500, 'message' => 'No image found']); 129 | } 130 | 131 | $stmt->close(); 132 | $conn->close(); 133 | exit; // Ensure we exit after handling the request 134 | } 135 | 136 | // View workers details 137 | if (isset($_POST['get_worker_details'])) { 138 | $id = $_POST['id']; 139 | 140 | // SQL query to get worker details 141 | $query = " 142 | SELECT w.worker_first_name, 143 | w.worker_mobile 144 | FROM complaints_detail cd 145 | INNER JOIN manager m ON cd.id = m.problem_id 146 | INNER JOIN worker_details w ON m.worker_id = w.worker_id 147 | WHERE cd.id = ? 148 | "; 149 | 150 | $stmt = $conn->prepare($query); 151 | $stmt->bind_param("i", $id); 152 | $stmt->execute(); 153 | $result = $stmt->get_result(); 154 | 155 | if ($result->num_rows > 0) { 156 | $worker = $result->fetch_assoc(); 157 | echo json_encode(['status' => 200, 'worker_first_name' => $worker['worker_first_name'], 'worker_mobile' => $worker['worker_mobile']]); 158 | } else { 159 | echo json_encode(['status' => 500, 'message' => 'No worker details found for this id']); 160 | } 161 | 162 | $stmt->close(); 163 | $conn->close(); 164 | exit; 165 | } 166 | 167 | // Handle status details retrieval 168 | if (isset($_POST['get_status_details'])) { 169 | $id = $_POST['id']; 170 | 171 | // Query to fetch status based on id 172 | $query = "SELECT status FROM complaints_detail WHERE id = ?"; 173 | $stmt = $conn->prepare($query); 174 | $stmt->bind_param('i', $id); 175 | $stmt->execute(); 176 | $result = $stmt->get_result(); 177 | 178 | if ($result->num_rows > 0) { 179 | $row = $result->fetch_assoc(); 180 | $status = $row['status']; 181 | 182 | // Mapping status codes to messages 183 | $statusMessage = ''; 184 | if ($status == 1) { 185 | $statusMessage = 'pending'; 186 | } elseif ($status == 2) { 187 | $statusMessage = 'Approved by infra'; 188 | } elseif ($status == 3) { 189 | $statusMessage = 'Rejected by infra'; 190 | } elseif ($status == 4) { 191 | $statusMessage = 'Approved by HOD'; 192 | } elseif ($status == 5) { 193 | $statusMessage = 'Rejected by HOD'; 194 | } elseif ($status == 6) { 195 | $statusMessage = 'sent to principal for approval'; 196 | } elseif ($status == 7) { 197 | $statusMessage = 'Assigned to worker'; 198 | } elseif ($status == 8) { 199 | $statusMessage = 'Approved by Principal '; 200 | } elseif ($status == 9) { 201 | $statusMessage = 'Approved by Manager '; 202 | } elseif ($status == 10) { 203 | $statusMessage = 'worker inprogress'; 204 | } elseif ($status == 11) { 205 | $statusMessage = 'waiting for approval'; 206 | } elseif ($status == 12) { 207 | $statusMessage = 'Satisfied by Faculty'; 208 | } elseif ($status == 13) { 209 | $statusMessage = ''; 210 | } elseif ($status == 14) { 211 | $statusMessage = 'Sent to manager for rework(Reassign)'; 212 | } elseif ($status == 15) { 213 | $statusMessage = 'Rework details'; 214 | } elseif ($status == 16) { 215 | $statusMessage = 'Rejected by manager(Reassign)'; 216 | } elseif ($status == 17) { 217 | $statusMessage = 'In progress'; 218 | } elseif ($status == 18) { 219 | $statusMessage = 'Waiting for Approval'; 220 | } elseif ($status == 19) { 221 | $statusMessage = 'Rejected by Principal'; 222 | } elseif ($status == 20) { 223 | $statusMessage = 'Rejected principal'; 224 | } else { 225 | $statusMessage = 'Unknown status'; 226 | } 227 | 228 | echo json_encode(['status' => 200, 'message' => $statusMessage]); 229 | } else { 230 | echo json_encode(['status' => 500, 'message' => 'No status found']); 231 | } 232 | 233 | $stmt->close(); 234 | $conn->close(); 235 | exit; 236 | } 237 | 238 | // Handle feedback form submission 239 | if (isset($_POST['id'])) { 240 | $id = $_POST['id']; 241 | $satisfaction = $_POST['satisfaction']; // Get satisfaction (13 for Satisfied, 14 for Not Satisfied) 242 | $feedback = $_POST['feedback']; 243 | 244 | // Validate inputs 245 | if (empty($id) || empty($feedback) || empty($satisfaction)) { 246 | echo json_encode(['status' => 400, 'message' => 'Problem ID, Feedback, or Satisfaction is missing']); 247 | exit; 248 | } 249 | 250 | // Check if feedback already exists for the given id 251 | $checkQuery = "SELECT feedback FROM complaints_detail WHERE id = ?"; 252 | $stmt = $conn->prepare($checkQuery); 253 | 254 | if (!$stmt) { 255 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 256 | exit; 257 | } 258 | 259 | $stmt->bind_param('i', $id); 260 | $stmt->execute(); 261 | $stmt->store_result(); 262 | $feedbackExists = $stmt->num_rows > 0; // Check if a row exists for the given id 263 | 264 | $stmt->close(); 265 | 266 | // Update feedback if it exists, otherwise insert a new one 267 | if ($feedbackExists) { 268 | // Update existing feedback and status 269 | $query = "UPDATE complaints_detail SET feedback = ?, status = ? WHERE id = ?"; 270 | } else { 271 | // Insert new feedback (though, this case might not happen since the record should exist) 272 | // You can adjust logic here if necessary, but we'll proceed with update as the case. 273 | $query = "UPDATE complaints_detail SET feedback = ?, status = ? WHERE id = ?"; 274 | } 275 | 276 | $stmt = $conn->prepare($query); 277 | 278 | if (!$stmt) { 279 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 280 | exit; 281 | } 282 | 283 | $stmt->bind_param('sii', $feedback, $satisfaction, $id); 284 | 285 | if ($stmt->execute()) { 286 | echo json_encode(['status' => 200, 'message' => 'Feedback updated successfully']); 287 | } else { 288 | echo json_encode(['status' => 500, 'message' => 'Query failed: ' . $stmt->error]); 289 | } 290 | 291 | $stmt->close(); 292 | $conn->close(); 293 | exit; 294 | } 295 | 296 | ?> 297 | -------------------------------------------------------------------------------- /complaints (14).sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.2.1 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Oct 13, 2024 at 10:53 AM 7 | -- Server version: 10.4.32-MariaDB 8 | -- PHP Version: 8.0.30 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | START TRANSACTION; 12 | SET time_zone = "+00:00"; 13 | 14 | 15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 18 | /*!40101 SET NAMES utf8mb4 */; 19 | 20 | -- 21 | -- Database: `complaints` 22 | -- 23 | 24 | -- -------------------------------------------------------- 25 | 26 | -- 27 | -- Table structure for table `comments` 28 | -- 29 | 30 | CREATE TABLE `comments` ( 31 | `id` int(11) NOT NULL, 32 | `problem_id` int(11) NOT NULL, 33 | `reason` varchar(255) NOT NULL 34 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 35 | 36 | -- 37 | -- Dumping data for table `comments` 38 | -- 39 | 40 | INSERT INTO `comments` (`id`, `problem_id`, `reason`) VALUES 41 | (74, 76, 'mkbkjb'), 42 | (75, 76, 'gw'), 43 | (76, 72, 'hhj'), 44 | (77, 72, 'gfu'), 45 | (78, 76, 'need approval'); 46 | 47 | -- -------------------------------------------------------- 48 | 49 | -- 50 | -- Table structure for table `complaints_detail` 51 | -- 52 | 53 | CREATE TABLE `complaints_detail` ( 54 | `id` int(11) NOT NULL, 55 | `faculty_id` int(10) NOT NULL, 56 | `faculty_name` varchar(100) NOT NULL, 57 | `department` varchar(10) NOT NULL, 58 | `faculty_contact` varchar(20) NOT NULL, 59 | `faculty_mail` varchar(50) NOT NULL, 60 | `block_venue` varchar(15) NOT NULL, 61 | `venue_name` varchar(30) NOT NULL, 62 | `type_of_problem` varchar(50) NOT NULL, 63 | `problem_description` varchar(400) NOT NULL, 64 | `images` varchar(255) NOT NULL, 65 | `date_of_reg` date NOT NULL, 66 | `days_to_complete` varchar(100) NOT NULL, 67 | `status` varchar(200) NOT NULL, 68 | `feedback` varchar(250) NOT NULL, 69 | `reason` varchar(255) NOT NULL, 70 | `task_completion` varchar(250) NOT NULL, 71 | `date_of_completion` date NOT NULL, 72 | `reassign_date` date DEFAULT NULL 73 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 74 | 75 | -- 76 | -- Dumping data for table `complaints_detail` 77 | -- 78 | 79 | INSERT INTO `complaints_detail` (`id`, `faculty_id`, `faculty_name`, `department`, `faculty_contact`, `faculty_mail`, `block_venue`, `venue_name`, `type_of_problem`, `problem_description`, `images`, `date_of_reg`, `days_to_complete`, `status`, `feedback`, `reason`, `task_completion`, `date_of_completion`, `reassign_date`) VALUES 80 | (72, 11111111, 'Ragul', 'IT', '9629613708', 'ragul@mkce.ac.in', 'APJ-106', 'class', 'IT Infra Work', '6 CPU Fault', '0000000020.jpg', '2024-10-01', '2024-10-18', '15', 'jhiu', '', 'Fully Completed', '2024-10-01', '2024-10-13'), 81 | (75, 11111111, 'Ragul', 'IT', '9629613708', 'ragul@mkce.ac.in', 'APJ-106', 'class', 'Plumbing Work', 'broken table', '0000000023.png', '2024-10-01', '2024-10-27', '16', 'no need', '', 'Fully Completed', '2024-10-01', '2024-10-13'), 82 | (76, 11111111, 'Ragul', 'IT', '9629613708', 'ragul@mkce.ac.in', 'RK-124', 'department', 'IT Infra Work', 'fan not working', '0000000024.png', '2024-10-01', '2024-10-18', '14', 'jhvjh', '', '', '0000-00-00', NULL), 83 | (77, 11111111, 'Ragul', 'IT', '9629613708', 'ragul@mkce.ac.in', 'APJ-106', 'class', 'IT Infra Work', '6 CPU Fault', '0000000025.png', '2024-10-01', '2024-10-25', '15', 'ydty', '', '', '0000-00-00', '2024-10-13'); 84 | 85 | -- -------------------------------------------------------- 86 | 87 | -- 88 | -- Table structure for table `faculty` 89 | -- 90 | 91 | CREATE TABLE `faculty` ( 92 | `id` int(20) NOT NULL, 93 | `faculty_id` varchar(15) NOT NULL, 94 | `password` varchar(15) NOT NULL, 95 | `faculty_name` varchar(100) NOT NULL, 96 | `department` varchar(20) NOT NULL, 97 | `faculty_contact` varchar(20) NOT NULL, 98 | `faculty_mail` varchar(50) NOT NULL 99 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 100 | 101 | -- 102 | -- Dumping data for table `faculty` 103 | -- 104 | 105 | INSERT INTO `faculty` (`id`, `faculty_id`, `password`, `faculty_name`, `department`, `faculty_contact`, `faculty_mail`) VALUES 106 | (1, '11111111', '1234', 'Ragul', 'IT', '9629613708', 'ragul@mkce.ac.in'), 107 | (2, '22222222', '1234', 'Nalin', 'EEE', '9663852741', 'nalin@mkce.ac.in'), 108 | (3, '33333333', '1234', 'Srihari', 'CSE', '963741852', 'sri@mkce.ac.in'); 109 | 110 | -- -------------------------------------------------------- 111 | 112 | -- 113 | -- Table structure for table `manager` 114 | -- 115 | 116 | CREATE TABLE `manager` ( 117 | `task_id` int(11) NOT NULL, 118 | `problem_id` int(11) NOT NULL, 119 | `worker_id` varchar(25) NOT NULL, 120 | `priority` varchar(25) NOT NULL, 121 | `comment_query` varchar(250) NOT NULL, 122 | `comment_reply` varchar(250) NOT NULL, 123 | `query_date` date DEFAULT NULL, 124 | `reply_date` date DEFAULT NULL 125 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 126 | 127 | -- 128 | -- Dumping data for table `manager` 129 | -- 130 | 131 | INSERT INTO `manager` (`task_id`, `problem_id`, `worker_id`, `priority`, `comment_query`, `comment_reply`, `query_date`, `reply_date`) VALUES 132 | (95, 75, 'CIV01', 'low', 'HII', '', '0000-00-00', NULL), 133 | (96, 76, 'ELE01', 'medium', 'helo', 'ok sir', '0000-00-00', '2024-10-09'), 134 | (97, 77, 'PUM02', 'high', '', '', '0000-00-00', NULL); 135 | 136 | -- -------------------------------------------------------- 137 | 138 | -- 139 | -- Table structure for table `workers` 140 | -- 141 | 142 | CREATE TABLE `workers` ( 143 | `id` int(11) NOT NULL, 144 | `name` varchar(255) NOT NULL, 145 | `dept` varchar(255) NOT NULL, 146 | `phone` varchar(255) NOT NULL 147 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 148 | 149 | -- 150 | -- Dumping data for table `workers` 151 | -- 152 | 153 | INSERT INTO `workers` (`id`, `name`, `dept`, `phone`) VALUES 154 | (1, 'ELE01', 'ELECTRICAL', ''), 155 | (2, 'ELE02', 'ELECTRICAL', ''), 156 | (3, 'CIV01', 'CIVIL', ''), 157 | (4, 'CIV02', 'CIVIL', ''), 158 | (5, 'PLU01', 'PLUMBING', ''), 159 | (6, 'PLU02', 'PLUMBING', ''), 160 | (7, 'PAR01', 'PARTITION', ''), 161 | (8, 'PAR02', 'PARTITION', ''), 162 | (9, 'INF01', 'IT INFRA', ''), 163 | (10, 'INF02', 'IT INFRA', ''), 164 | (11, 'CAR01', 'CARPENTER', ''), 165 | (12, 'CAR02', 'CARPENTER', ''); 166 | 167 | -- -------------------------------------------------------- 168 | 169 | -- 170 | -- Table structure for table `worker_details` 171 | -- 172 | 173 | CREATE TABLE `worker_details` ( 174 | `id` int(11) NOT NULL, 175 | `worker_id` varchar(100) NOT NULL, 176 | `password` varchar(50) NOT NULL, 177 | `worker_first_name` varchar(100) NOT NULL, 178 | `worker_last_name` varchar(100) NOT NULL, 179 | `worker_gender` varchar(100) NOT NULL, 180 | `worker_dept` varchar(100) NOT NULL, 181 | `worker_mobile` varchar(10) NOT NULL, 182 | `worker_mail` varchar(100) NOT NULL, 183 | `worker_emp_type` varchar(100) NOT NULL, 184 | `worker_photo` varchar(50) NOT NULL, 185 | `usertype` varchar(20) NOT NULL 186 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 187 | 188 | -- 189 | -- Dumping data for table `worker_details` 190 | -- 191 | 192 | INSERT INTO `worker_details` (`id`, `worker_id`, `password`, `worker_first_name`, `worker_last_name`, `worker_gender`, `worker_dept`, `worker_mobile`, `worker_mail`, `worker_emp_type`, `worker_photo`, `usertype`) VALUES 193 | (32, 'head', '123', 'Dhandapani', 'K', 'Female', 'ELECTRICAL', '9952625820', 'nivethak.vlsi@mkce.ac.in', ' Full-time', '', 'user'), 194 | (33, 'CAR01', '123', 'Sundar', '', 'Male', 'CARPENTRY', '9940911511', 'mukeshp.civil@mkce.ac.in', 'Full-time', '', 'user'), 195 | (34, 'CIVIL01', '123', 'Ravi', '', 'Male', 'CIVIL', '9159594640', 'karthickr.mech@mkce.ac.in ', 'Full-time', '', 'user'), 196 | (35, 'PAR01', '123', 'Kumar', '', 'Male', 'PARTITION', '9159594640', 'manirajp.eee@mkce.ac.in', 'Full-time', '', 'user'), 197 | (36, 'PLU01', '123', 'Praveen', '', 'Male', 'PLUMBING', '8220638519', 'ranganathanr.maths@mkce.ac.in', 'Full-time', '', 'user'), 198 | (37, 'INFRA01', '123', 'Gopal', '', 'Female', 'IT INFRA', '6380153269', 'sathiyanathans.it@mkce.ac.in', 'Part-time', '', 'user'), 199 | (38, 'ELE01', '', 'Ramesh', 'K', 'male', 'ELECTRICAL', '951753486', '', '', '', ''); 200 | 201 | -- -------------------------------------------------------- 202 | 203 | -- 204 | -- Table structure for table `worker_taskdet` 205 | -- 206 | 207 | CREATE TABLE `worker_taskdet` ( 208 | `id` int(255) NOT NULL, 209 | `task_id` int(11) NOT NULL, 210 | `after_photo` varchar(255) NOT NULL, 211 | `task_completion` varchar(100) NOT NULL, 212 | `work_completion_date` date NOT NULL 213 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 214 | 215 | -- 216 | -- Dumping data for table `worker_taskdet` 217 | -- 218 | 219 | INSERT INTO `worker_taskdet` (`id`, `task_id`, `after_photo`, `task_completion`, `work_completion_date`) VALUES 220 | (38, 81, '5_6120435620658544983.jpg', 'Fully Completed', '2024-10-01'), 221 | (39, 82, 'Screenshot 2024-05-10 071700.png', 'Fully Completed', '2024-10-01'); 222 | 223 | -- 224 | -- Indexes for dumped tables 225 | -- 226 | 227 | -- 228 | -- Indexes for table `comments` 229 | -- 230 | ALTER TABLE `comments` 231 | ADD PRIMARY KEY (`id`), 232 | ADD KEY `problem_id` (`problem_id`); 233 | 234 | -- 235 | -- Indexes for table `complaints_detail` 236 | -- 237 | ALTER TABLE `complaints_detail` 238 | ADD PRIMARY KEY (`id`); 239 | 240 | -- 241 | -- Indexes for table `faculty` 242 | -- 243 | ALTER TABLE `faculty` 244 | ADD PRIMARY KEY (`id`); 245 | 246 | -- 247 | -- Indexes for table `manager` 248 | -- 249 | ALTER TABLE `manager` 250 | ADD PRIMARY KEY (`task_id`), 251 | ADD KEY `problem_id` (`problem_id`), 252 | ADD KEY `problem_id_2` (`problem_id`); 253 | 254 | -- 255 | -- Indexes for table `workers` 256 | -- 257 | ALTER TABLE `workers` 258 | ADD PRIMARY KEY (`id`); 259 | 260 | -- 261 | -- Indexes for table `worker_details` 262 | -- 263 | ALTER TABLE `worker_details` 264 | ADD PRIMARY KEY (`id`); 265 | 266 | -- 267 | -- Indexes for table `worker_taskdet` 268 | -- 269 | ALTER TABLE `worker_taskdet` 270 | ADD PRIMARY KEY (`id`), 271 | ADD KEY `task_id` (`task_id`); 272 | 273 | -- 274 | -- AUTO_INCREMENT for dumped tables 275 | -- 276 | 277 | -- 278 | -- AUTO_INCREMENT for table `comments` 279 | -- 280 | ALTER TABLE `comments` 281 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79; 282 | 283 | -- 284 | -- AUTO_INCREMENT for table `complaints_detail` 285 | -- 286 | ALTER TABLE `complaints_detail` 287 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=78; 288 | 289 | -- 290 | -- AUTO_INCREMENT for table `faculty` 291 | -- 292 | ALTER TABLE `faculty` 293 | MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; 294 | 295 | -- 296 | -- AUTO_INCREMENT for table `manager` 297 | -- 298 | ALTER TABLE `manager` 299 | MODIFY `task_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=98; 300 | 301 | -- 302 | -- AUTO_INCREMENT for table `workers` 303 | -- 304 | ALTER TABLE `workers` 305 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; 306 | 307 | -- 308 | -- AUTO_INCREMENT for table `worker_details` 309 | -- 310 | ALTER TABLE `worker_details` 311 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=39; 312 | 313 | -- 314 | -- AUTO_INCREMENT for table `worker_taskdet` 315 | -- 316 | ALTER TABLE `worker_taskdet` 317 | MODIFY `id` int(255) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=40; 318 | COMMIT; 319 | 320 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 321 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 322 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 323 | -------------------------------------------------------------------------------- /manager_dash.php: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | MIC - MKCE 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 78 |
79 | 93 |
94 | 110 |
111 |
112 |
113 |
114 |
115 |

116 |
Name
MANAGER NAME
117 |
118 |
119 |
120 |
121 |
122 |
123 |

124 |
Role
MANAGER
125 |
126 |
127 |
128 |
129 |
130 |
131 |

132 |
Branch
M.KUMARASAMY COLLEGE OF ENGINEERING
133 |
134 |
135 |
136 |

137 |
138 |
139 |

Issue Analysis


140 |
141 |
142 |
143 |
144 |
145 |
147 | 148 |

149 | New issues 150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
161 | 162 |

163 | Pending 164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
175 | 176 |

177 | Completed 178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
189 | 190 |

191 | Reassigned 192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 | 207 |
208 |
209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | -------------------------------------------------------------------------------- /testbackend.php: -------------------------------------------------------------------------------- 1 | 200, 18 | 'message' => 'details Fetch Successfully by id', 19 | 'data' => $User_data 20 | ]; 21 | echo json_encode($res); 22 | return; 23 | } else { 24 | $res = [ 25 | 'status' => 500, 26 | 'message' => 'Details Not Deleted' 27 | ]; 28 | echo json_encode($res); 29 | return; 30 | } 31 | } 32 | 33 | 34 | //backend for worker details 35 | if (isset($_POST['see_worker_detail'])) { 36 | $complain_id = mysqli_real_escape_string($conn, $_POST['user_id']); 37 | $id = "SELECT * FROM manager WHERE problem_id='$complain_id'"; 38 | $query_run1 = mysqli_query($conn, $id); 39 | $row = mysqli_fetch_array($query_run1); 40 | $worker_id = $row['worker_id']; 41 | //data only for editing 42 | $query = "SELECT * FROM worker_details WHERE worker_dept='$worker_id'"; 43 | $query_run = mysqli_query($conn, $query); 44 | $User_data = mysqli_fetch_array($query_run); 45 | if ($query_run) { 46 | $res = [ 47 | 'status' => 200, 48 | 'message' => 'details Fetch Successfully by id', 49 | 'data' => $User_data 50 | ]; 51 | echo json_encode($res); 52 | return; 53 | } else { 54 | $res = [ 55 | 'status' => 500, 56 | 'message' => 'Details Not Deleted' 57 | ]; 58 | echo json_encode($res); 59 | return; 60 | } 61 | } 62 | 63 | 64 | //reject reason 65 | if (isset($_POST["reject_complaint"])) { 66 | try { 67 | $id = mysqli_real_escape_string($conn, $_POST['id']); 68 | $reason = mysqli_real_escape_string($conn, $_POST['feedback']); 69 | $query = "UPDATE complaints_detail SET feedback = '$reason', status = '20' WHERE id = $id"; 70 | if (mysqli_query($conn, $query)) { 71 | $res = [ 72 | 'status' => 200, 73 | 74 | ]; 75 | echo json_encode($res); 76 | } else { 77 | throw new Exception('Query Failed: ' . mysqli_error($conn)); 78 | } 79 | } catch (Exception $e) { 80 | $res = [ 81 | 'status' => 500, 82 | 'message' => 'Error: ' . $e->getMessage() 83 | ]; 84 | echo json_encode($res); 85 | } 86 | } 87 | 88 | 89 | //Accept reason 90 | if (isset($_POST['accept_complaint'])) { 91 | $problem_id = $_POST['problem_id']; 92 | $worker_id = $_POST['worker_id']; 93 | $priority = $_POST['priority']; 94 | $worker = $_POST['worker']; 95 | 96 | 97 | /* $principal_approval = isset($_POST['principal_approval']) ? 6 : 7; 98 | $reason = isset($_POST['reason11']) ? $_POST['reason11'] : ''; */ 99 | // Insert into manager table 100 | $insertQuery = "INSERT INTO manager (problem_id, worker_id, priority) VALUES ('$problem_id', '$worker', '$priority')"; 101 | if (mysqli_query($conn, $insertQuery)) { 102 | // Update status in complaints_detail table 103 | $updateQuery = "UPDATE complaints_detail SET status='7' WHERE id='$problem_id'"; 104 | if (mysqli_query($conn, $updateQuery)) { 105 | $response = ['status' => 200, 'message' => 'Complaint accepted and status updated successfully!']; 106 | /* $updateQuery7 = "INSERT INTO comments (problem_id, reason) VALUES ('$problem_id','$reason') "; 107 | if (mysqli_query($conn, $updateQuery7)) { 108 | $response = ['status' => 200, 'message' => 'Complaint accepted and status updated successfully!']; 109 | } else { 110 | $response = ['status' => 500, 'message' => 'Failed to update comments table.']; 111 | } */ 112 | } else { 113 | $response = ['status' => 500, 'message' => 'Failed to update complaint status.']; 114 | } 115 | } else { 116 | $response = ['status' => 500, 'message' => 'Failed to insert data into manager table.']; 117 | } 118 | echo json_encode($response); 119 | } 120 | 121 | 122 | // Check if ID is provided 123 | if (isset($_POST['id'])) { 124 | $complaint_id = intval($_POST['id']); 125 | // Prepare SQL query 126 | $query = "SELECT feedback FROM complaints_detail WHERE id = ? AND status IN ('13', '14')"; 127 | $stmt = $conn->prepare($query); 128 | $stmt->bind_param("i", $complaint_id); 129 | $stmt->execute(); 130 | $stmt->bind_result($feedback); 131 | $stmt->fetch(); 132 | $stmt->close(); 133 | // Return the feedback 134 | echo $feedback; 135 | } 136 | 137 | // Handle reply submission for principal's query 138 | if (isset($_POST['submit_comment_reply'])) { 139 | $task_id = $_POST['task_id']; 140 | $comment_reply = $_POST['comment_reply']; 141 | $reply_date = date('Y-m-d'); // Get current date 142 | 143 | // Update the comment_reply and reply_date fields for the corresponding task_id 144 | $query = "UPDATE manager SET comment_reply=?, reply_date=? WHERE task_id=?"; 145 | $stmt = $conn->prepare($query); 146 | $stmt->bind_param('ssi', $comment_reply, $reply_date, $task_id); 147 | if ($stmt->execute()) { 148 | $response = ['status' => 200, 'message' => 'Reply submitted successfully!']; 149 | } else { 150 | $response = ['status' => 500, 'message' => 'Failed to submit reply.']; 151 | } 152 | echo json_encode($response); 153 | } 154 | 155 | if (isset($_POST['complaintfeed_id']) && isset($_POST['status'])) { 156 | $id = $_POST['complaintfeed_id']; // Get the complaint ID from the POST request 157 | $status = $_POST['status']; 158 | $current_date = date('Y-m-d'); // Get the current date in the format YYYY-MM-DD 159 | 160 | // Check if a reassign deadline is provided (only when status is 'reassign') 161 | $reassign_deadline = isset($_POST['reassign_deadline']) ? $_POST['reassign_deadline'] : null; 162 | 163 | // Prepare the SQL query based on the provided status and deadline 164 | if ($status == 15 && $reassign_deadline) { 165 | // Status '15' for Reassign, update reassign_date and reassign_deadline 166 | $sql = "UPDATE complaints_detail SET status='$status', reassign_date='$current_date', days_to_complete='$reassign_deadline' WHERE id='$id'"; 167 | } else { 168 | // For other statuses, only update status and reassign_date (no reassign_deadline) 169 | $sql = "UPDATE complaints_detail SET status='$status', reassign_date='$current_date' WHERE id='$id'"; 170 | } 171 | 172 | // Execute the query 173 | if (mysqli_query($conn, $sql)) { 174 | echo json_encode([ 175 | 'status' => 200, 176 | 'message' => "Status and updates saved successfully." 177 | ]); 178 | } else { 179 | echo json_encode([ 180 | 'status' => 500, 181 | 'message' => "Error updating status: " . mysqli_error($conn) 182 | ]); 183 | } 184 | } 185 | 186 | 187 | 188 | 189 | if (isset($_POST['get_aimage'])) { 190 | // Get the problem_id from POST request 191 | $problem_id = isset($_POST['problem2_id']) ? $_POST['problem2_id'] : ''; 192 | 193 | // Validate problem_id 194 | if (empty($problem_id)) { 195 | echo json_encode(['status' => 400, 'message' => 'Problem ID not provided']); 196 | exit; 197 | } 198 | 199 | // Log the received problem_id for debugging 200 | error_log("Problem ID received: " . $problem_id); 201 | 202 | // First, fetch the task_id from the manager table using the problem_id 203 | $query = "SELECT task_id FROM manager WHERE problem_id = ?"; 204 | $stmt = $conn->prepare($query); 205 | 206 | if (!$stmt) { 207 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 208 | exit; 209 | } 210 | 211 | $stmt->bind_param('i', $problem_id); 212 | $stmt->execute(); 213 | $result = $stmt->get_result(); 214 | 215 | if ($result->num_rows > 0) { 216 | $row = $result->fetch_assoc(); 217 | $task_id = $row['task_id']; 218 | 219 | // Log the fetched task_id for debugging 220 | error_log("Task ID fetched: " . $task_id); 221 | 222 | $stmt->close(); 223 | 224 | // Now, fetch the after_photo using the retrieved task_id 225 | $query = "SELECT after_photo FROM worker_taskdet WHERE task_id = ?"; 226 | $stmt = $conn->prepare($query); 227 | 228 | if (!$stmt) { 229 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 230 | exit; 231 | } 232 | 233 | $stmt->bind_param('i', $task_id); 234 | $stmt->execute(); 235 | $result = $stmt->get_result(); 236 | 237 | if ($result->num_rows > 0) { 238 | $row = $result->fetch_assoc(); 239 | $image_filename = basename($row['after_photo']); // Get the filename 240 | $image_path = 'imgafter/' . $image_filename; // Path to the image 241 | 242 | echo json_encode(['status' => 200, 'data' => ['after_photo' => $image_path]]); 243 | } else { 244 | echo json_encode(['status' => 404, 'message' => 'No image found for the provided task ID']); 245 | } 246 | 247 | $stmt->close(); 248 | } else { 249 | echo json_encode(['status' => 404, 'message' => 'No task found for the provided problem ID']); 250 | } 251 | } 252 | 253 | if (isset($_POST['get_image'])) { 254 | $problem_id = isset($_POST['problem_id']) ? $_POST['problem_id'] : ''; // Ensure problem_id is set 255 | // Validate problem_id 256 | if (empty($problem_id)) { 257 | echo json_encode(['status' => 400, 'message' => 'Problem ID not provided']); 258 | exit; 259 | } 260 | // Query to fetch the image based on problem_id 261 | $query = "SELECT images FROM complaints_detail WHERE id = ?"; 262 | $stmt = $conn->prepare($query); 263 | if (!$stmt) { 264 | echo json_encode(['status' => 500, 'message' => 'Prepare statement failed: ' . $conn->error]); 265 | exit; 266 | } 267 | $stmt->bind_param('i', $problem_id); 268 | $stmt->execute(); 269 | $result = $stmt->get_result(); 270 | if ($result->num_rows > 0) { 271 | $row = $result->fetch_assoc(); 272 | $response = json_encode(['status' => 200, 'data' => ['images' => $row['images']]]); 273 | // Log response to debug if the JSON is correctly formed 274 | error_log("Response: " . $response); 275 | echo $response; 276 | } else { 277 | // Return 404 if no image is found for the given problem_id 278 | echo json_encode(['status' => 404, 'message' => 'Image not found']); 279 | } 280 | $stmt->close(); 281 | $conn->close(); 282 | exit; 283 | } 284 | 285 | 286 | if (isset($_POST['facfeedview'])) { 287 | $student_id = mysqli_real_escape_string($conn, $_POST['user_id']); 288 | $query = "SELECT * FROM complaints_detail WHERE id=$student_id and status IN ('13', '14')"; 289 | $query_run = mysqli_query($conn, $query); 290 | //data only for editing 291 | $User_data = mysqli_fetch_array($query_run); 292 | if ($query_run) { 293 | $res = [ 294 | 'status' => 200, 295 | 'message' => 'details Fetch Successfully by id', 296 | 'data' => $User_data 297 | ]; 298 | echo json_encode($res); 299 | return; 300 | } else { 301 | $res = [ 302 | 'status' => 500, 303 | 'message' => 'Details Not Deleted' 304 | ]; 305 | echo json_encode($res); 306 | return; 307 | } 308 | } 309 | 310 | 311 | //Accept reason 312 | if (isset($_POST['principal_complaint'])) { 313 | $problem_id = $_POST['id']; 314 | $reason = $_POST['reason']; 315 | /* $principal_approval = isset($_POST['principal_approval']) ? 6 : 7; 316 | $reason = isset($_POST['reason11']) ? $_POST['reason11'] : ''; */ 317 | // Insert into manager table 318 | $insertQuery = "INSERT INTO comments (problem_id, reason) VALUES ('$problem_id','$reason')"; 319 | if (mysqli_query($conn, $insertQuery)) { 320 | // Update status in complaints_detail table 321 | $updateQuery = "UPDATE complaints_detail SET status='6' WHERE id='$problem_id'"; 322 | if (mysqli_query($conn, $updateQuery)) { 323 | $response = ['status' => 200, 'message' => 'Complaint accepted and status updated successfully!']; 324 | /* $updateQuery7 = "INSERT INTO comments (problem_id, reason) VALUES ('$problem_id','$reason') "; 325 | if (mysqli_query($conn, $updateQuery7)) { 326 | $response = ['status' => 200, 'message' => 'Complaint accepted and status updated successfully!']; 327 | } else { 328 | $response = ['status' => 500, 'message' => 'Failed to update comments table.']; 329 | } */ 330 | } else { 331 | $response = ['status' => 500, 'message' => 'Failed to update complaint status.']; 332 | } 333 | } else { 334 | $response = ['status' => 500, 'message' => 'Failed to insert data into manager table.']; 335 | } 336 | echo json_encode($response); 337 | } 338 | 339 | 340 | if(isset($_POST["manager_approve"])){ 341 | $deadline = $_POST["deadline"]; 342 | $id = $_POST["problem_id"]; 343 | $query = "UPDATE complaints_detail SET days_to_complete='$deadline' , status='9' WHERE id= $id"; 344 | 345 | if(mysqli_query($conn, $query)){ 346 | $res = [ 347 | "status" => 200, 348 | "msg" => "complaint accepted sucessfully" 349 | ]; 350 | echo json_encode($res); 351 | }else{ 352 | echo 'Error updating status'; 353 | } 354 | } 355 | 356 | //reject reason from principal 357 | if (isset($_POST['get_reject_reason'])) { 358 | $complain_id = mysqli_real_escape_string($conn, $_POST['problem_id']); 359 | $query = "SELECT feedback FROM complaints_detail WHERE id='$complain_id'"; 360 | $query_run = mysqli_query($conn, $query); 361 | $User_data = mysqli_fetch_array($query_run); 362 | if ($query_run) { 363 | $res = [ 364 | 'status' => 200, 365 | 'message' => 'details Fetch Successfully by id', 366 | 'data' => $User_data 367 | ]; 368 | echo json_encode($res); 369 | return; 370 | } else { 371 | $res = [ 372 | 'status' => 500, 373 | 'message' => 'Details Not Deleted' 374 | ]; 375 | echo json_encode($res); 376 | return; 377 | } 378 | } 379 | 380 | //worker phone number 381 | 382 | if (isset($_POST['get_worker_phone'])) { 383 | $complain_id = mysqli_real_escape_string($conn, $_POST['prblm_id']); 384 | $query = " 385 | SELECT w.* 386 | FROM complaints_detail cd 387 | INNER JOIN manager m ON cd.id = m.problem_id 388 | INNER JOIN worker_details w ON m.worker_id = w.worker_id 389 | WHERE cd.id = '$complain_id' 390 | "; 391 | $query_run = mysqli_query($conn, $query); 392 | $User_data = mysqli_fetch_array($query_run); 393 | if ($query_run) { 394 | $res = [ 395 | 'status' => 200, 396 | 'message' => 'details Fetch Successfully by id', 397 | 'data' => $User_data 398 | ]; 399 | echo json_encode($res); 400 | return; 401 | } else { 402 | $res = [ 403 | 'status' => 500, 404 | 'message' => 'Details Not Deleted' 405 | ]; 406 | echo json_encode($res); 407 | return; 408 | } 409 | } 410 | 411 | ?> -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | MIC - MKCE 88 | 89 | 90 | 91 | 92 | 93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | 138 |
139 | 156 |
157 | 173 |
174 |
175 |
176 |
177 |
178 |

179 |

Name

180 |
DhandaPani
181 | 182 |
183 |
184 |
185 |
186 |
187 |
188 |

189 |

Employment Type

190 |
Full Time
191 | 192 |
193 |
194 |
195 |
196 |
197 |
198 |

199 |

Designation

200 |
Worker-Head
201 | 202 | 203 |
204 |
205 |
206 |

207 |
208 |
209 |


210 |
211 |
212 |
213 |
214 |
215 |
217 | 218 |

219 | Task Completed 220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
231 | 232 |

233 | New Tasks 234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
245 | 246 |

247 | Task in progress 248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
259 | 260 |

261 | Tasks waiting for approval 262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 | 277 |
278 |
279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 346 | 347 | 348 | 349 | -------------------------------------------------------------------------------- /p_index.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Mkce Complain Management Systems 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
61 |
62 |
63 |
64 |
65 |
66 | 67 |
68 |
69 | 116 |
117 | 118 | 119 | 120 | 121 | 122 | 138 | 139 | 140 | 141 |
142 | 143 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 |
168 | 169 | 170 | 171 |
172 | 173 |
174 |
175 |
176 |

177 |
NAME
178 |
MURUGAN B.S
179 | 180 |
181 |
182 |
183 | 184 |
185 |
186 |
187 |

188 |
ROLE
189 |
PRINCIPAL
190 | 191 |
192 |
193 |
194 |
195 |
196 |
197 |

198 |
DOB
199 |
07-10-1983
200 |
201 |
202 |
203 | 204 | 205 | 206 | 207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
217 | 218 |
219 | Total Companies 220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
231 | 232 |
233 | Completed 234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
245 | 246 |
247 | In Progress 248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
261 | 262 | 263 |
264 | Pending 265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
276 | 277 |
278 | Request 279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
290 | 291 |
292 | Reassign 293 |
294 |
295 |
296 |
297 |
298 | 299 | 300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 466 | 467 | 468 | 469 | 470 | 471 | -------------------------------------------------------------------------------- /ajax.js: -------------------------------------------------------------------------------- 1 | /**************************************** 2 | * Basic Table * 3 | ****************************************/ 4 | 5 | $(document).ready(function () { 6 | $("#principal_table").DataTable(); 7 | }); 8 | $(document).ready(function () { 9 | $("#complain_table").DataTable(); 10 | }); 11 | $(document).ready(function () { 12 | $("#worker_table").DataTable(); 13 | }); 14 | $(document).ready(function () { 15 | $("#finished_table").DataTable(); 16 | }); 17 | $(document).ready(function () { 18 | $("#reassigned_table").DataTable(); 19 | }); 20 | $(document).ready(function () { 21 | $("#completed_table").DataTable(); 22 | }); 23 | $(document).ready(function () { 24 | $("#record_table").DataTable(); 25 | }); 26 | 27 | $(document).ready(function () { 28 | $(".nav-link").click(function (e) { 29 | e.preventDefault(); // Prevent default anchor behavior 30 | // Remove 'active show' class from all nav links 31 | $(".nav-link").removeClass("active show"); 32 | // Add 'active show' class to the clicked nav link 33 | $(this).addClass("active show"); 34 | // Hide all tab panes 35 | $(".tab-pane").removeClass("active show"); 36 | // Show the associated tab pane 37 | var target = $(this).attr("href"); 38 | $(target).addClass("active show"); 39 | }); 40 | }); 41 | 42 | //Jquery to approve by manager 43 | $(document).on("click", ".managerapprove", function (e) { 44 | e.preventDefault(); 45 | var user_id = $(this).val(); // Get the ID from the button's value 46 | console.log("User ID:", user_id); 47 | // Set the user_id in the hidden input field within the form 48 | $("#complaint_id56").val(user_id); 49 | }); 50 | 51 | $(document).on("submit","#managerapproveForm",function(e) { 52 | e.preventDefault(); 53 | var data = new FormData(this); 54 | console.log(data); 55 | data.append("manager_approve",true); 56 | 57 | $.ajax({ 58 | url: "testbackend.php", 59 | type: "POST", 60 | data:data, 61 | processData: false, 62 | contentType: false, 63 | success: function (response) { 64 | var res = jQuery.parseJSON(response); 65 | console.log(res); 66 | if (res.status == 200) { 67 | alert("Complaint accepted by manager"); 68 | $("#managerapproveModal").modal("hide"); 69 | 70 | // Reset the form 71 | $("#managerapproveForm")[0].reset(); 72 | $("#complain_table").load(location.href + " #complain_table"); 73 | /* $("#navrefresh").load(location.href + " #navrefresh"); */ 74 | 75 | 76 | } else { 77 | alert("Failed to accept complaint"); 78 | } 79 | }, 80 | }); 81 | }); 82 | 83 | // JS code for displaying assigned worker on priority modal box 84 | document.querySelectorAll(".worker-option").forEach(function (element) { 85 | element.addEventListener("click", function () { 86 | var worker = this.getAttribute("data-value"); 87 | document.getElementById("assignedWorker").textContent = 88 | "Assigned Worker: " + worker; 89 | }); 90 | }); 91 | 92 | // JS code to handle priority selection 93 | document.querySelectorAll(".modal-body button").forEach(function (element) { 94 | element.addEventListener("click", function () { 95 | // Remove the class from all buttons 96 | document.querySelectorAll(".modal-body button").forEach(function (btn) { 97 | btn.classList.remove("selected-priority"); 98 | }); 99 | // Add the class to the clicked button 100 | this.classList.add("selected-priority"); 101 | }); 102 | }); 103 | 104 | // JS code for getting reason from the manager when principal approval toggle is ON 105 | /* document 106 | .getElementById("flexSwitchCheckDefault") 107 | .addEventListener("change", function () { 108 | var reasonInput = document.getElementById("reasonInput"); 109 | if (this.checked) { 110 | reasonInput.style.display = "block"; 111 | } else { 112 | reasonInput.style.display = "none"; 113 | } 114 | }); 115 | */ 116 | 117 | //Jquery to pass id into accept and priority form 118 | // When the "Accept" button is clicked, open the modal and reset the worker details 119 | $(document).on("click", ".acceptcomplaint", function (e) { 120 | e.preventDefault(); 121 | 122 | var user_id = $(this).val(); // Get the ID from the button's value 123 | console.log("User ID:", user_id); 124 | 125 | // Set the complaint ID in the hidden input field within the form 126 | $("#complaint_id77").val(user_id); 127 | 128 | // Reset the worker selection and the text in the modal 129 | $("#worker_id").val(''); // Reset the worker ID 130 | $("#assignedWorker").text('Assigned Worker: '); // Reset the assigned worker text 131 | }); 132 | 133 | // Store selected worker value in hidden input field and update assigned worker text using event delegation 134 | $(document).on("click", ".worker-option", function () { 135 | var worker = $(this).data('value'); 136 | 137 | // Set the selected worker in the hidden input and update the text 138 | $("#worker_id").val(worker); 139 | $("#assignedWorker").text("Assigned Worker: " + worker); 140 | }); 141 | 142 | 143 | // Toggle reason input based on Principal Approval checkbox 144 | /* document 145 | .getElementById("flexSwitchCheckDefault") 146 | .addEventListener("change", function () { 147 | var reasonInput = document.getElementById("reasonInput"); 148 | if (this.checked) { 149 | reasonInput.style.display = "block"; 150 | } else { 151 | reasonInput.style.display = "none"; 152 | } 153 | }); */ 154 | 155 | $(document).on("submit", "#acceptForm", function (e) { 156 | e.preventDefault(); 157 | 158 | // Collect form data 159 | var formData = new FormData(this); 160 | formData.append("accept_complaint", true); 161 | 162 | // AJAX request to send data to the backend 163 | $.ajax({ 164 | type: "POST", 165 | url: "testbackend.php", // Replace with your backend script URL 166 | data: formData, 167 | processData: false, 168 | contentType: false, 169 | success: function (response) { 170 | var res = jQuery.parseJSON(response); 171 | if (res.status == 200) { 172 | swal({ 173 | title: "success!", 174 | text: "Complaint accepted sucessfully!", 175 | icon: "success", 176 | button: "Ok", 177 | timer: null 178 | }); 179 | 180 | // Close modal 181 | $("#prioritymodal1").modal("hide"); 182 | 183 | // Reset the form 184 | $("#acceptForm")[0].reset(); 185 | 186 | // Refresh the table body only 187 | $("#complain_table").load(location.href + " #complain_table"); 188 | $("#navrefresh").load(location.href + " #navrefresh"); 189 | $("#worker_table").load(location.href + " #worker_table > *"); 190 | 191 | } 192 | else if (res.status == 500) { 193 | alert("Something went wrong. Please try again."); 194 | } 195 | }, 196 | error: function (xhr, status, error) { 197 | console.error("Error:", error); 198 | alert("Something went wrong. Please try again."); 199 | } 200 | }); 201 | }); 202 | 203 | 204 | 205 | 206 | 207 | //Jquerry to pass the id into principal form 208 | $(document).on("click", "#principalbutton", function (e) { 209 | e.preventDefault(); 210 | var user_id = $(this).val(); // Get the ID from the button's value 211 | console.log("User ID:", user_id); 212 | // Set the user_id in the hidden input field within the form 213 | $("#complaint_id89").val(user_id); 214 | }); 215 | $(document).on("submit", "#principal_Form", function (e) { 216 | e.preventDefault(); 217 | var formData = new FormData(this); 218 | formData.append("principal_complaint", true); 219 | 220 | $.ajax({ 221 | type: "POST", 222 | url: "testbackend.php", 223 | data: formData, 224 | processData: false, 225 | contentType: false, 226 | success: function (response) { 227 | var res = jQuery.parseJSON(response); 228 | 229 | if (res.status == 200) { 230 | 231 | alertify.set('notifier','position', 'bottom-right'); 232 | alertify.success('Sent to Principal'); 233 | // Close modal 234 | $("#principalModal").modal("hide"); 235 | 236 | // Reset the form 237 | $("#principal_Form")[0].reset(); 238 | // Force refresh the table body with cache bypass 239 | $("#complain_table").load(location.href + " #complain_table > *"); 240 | $("#navrefresh").load(location.href + " #navrefresh"); 241 | updateNavbar(); // Call this function initially if needed 242 | 243 | // Display success message 244 | } else if (res.status == 500) { 245 | $("#principalModal").modal("hide"); 246 | $("#principal_Form")[0].reset(); 247 | alert("Something went wrong. Please try again."); 248 | } 249 | }, 250 | error: function (xhr, status, error) { 251 | alert("An error occurred while processing your request."); 252 | }, 253 | }); 254 | }); 255 | 256 | 257 | //Jquerry to pass the id into reject form 258 | $(document).on("click", "#rejectbutton", function (e) { 259 | e.preventDefault(); 260 | var user_id = $(this).val(); // Get the ID from the button's value 261 | console.log("User ID:", user_id); 262 | // Set the user_id in the hidden input field within the form 263 | $("#complaint_id99").val(user_id); 264 | }); 265 | $(document).on("submit", "#rejectForm", function (e) { 266 | e.preventDefault(); 267 | var formData = new FormData(this); 268 | formData.append("reject_complaint", true); 269 | 270 | $.ajax({ 271 | type: "POST", 272 | url: "testbackend.php", 273 | data: formData, 274 | processData: false, 275 | contentType: false, 276 | success: function (response) { 277 | var res = jQuery.parseJSON(response); 278 | 279 | if (res.status == 200) { 280 | 281 | alertify.set('notifier','position', 'bottom-right'); 282 | alertify.error('Rejected'); 283 | // Close modal 284 | $("#navrefresh").load(location.href + " #navrefresh > *"); 285 | 286 | $("#rejectModal").modal("hide"); 287 | 288 | // Reset the form 289 | $("#rejectForm")[0].reset(); 290 | // Force refresh the table body with cache bypass 291 | $("#complain_table").load(location.href + " #complain_table > *"); 292 | 293 | 294 | // Display success message 295 | } else if (res.status == 500) { 296 | $("#rejectModal").modal("hide"); 297 | $("#rejectForm")[0].reset(); 298 | alert("Something went wrong. Please try again."); 299 | } 300 | }, 301 | error: function (xhr, status, error) { 302 | alert("An error occurred while processing your request."); 303 | }, 304 | }); 305 | }); 306 | 307 | 308 | //jquerry for view complaint 309 | $(document).on("click", ".viewcomplaint", function (e) { 310 | e.preventDefault(); 311 | var user_id = $(this).val(); 312 | console.log(user_id); 313 | $.ajax({ 314 | type: "POST", 315 | url: "testbackend.php", 316 | data: { 317 | view_complaint: true, 318 | user_id: user_id, 319 | }, 320 | success: function (response) { 321 | var res = jQuery.parseJSON(response); 322 | console.log(res); 323 | if (res.status == 500) { 324 | alert(res.message); 325 | } else { 326 | //$('#student_id2').val(res.data.uid); 327 | $("#id").val(res.data.id); 328 | $("#type_of_problem").text(res.data.type_of_problem); 329 | $("#problem_description").text(res.data.problem_description); 330 | $("#faculty_name").text(res.data.faculty_name); 331 | $("#faculty_mail").text(res.data.faculty_mail); 332 | $("#faculty_contact").text(res.data.faculty_contact); 333 | $("#block_venue").text(res.data.block_venue); 334 | $("#venue_name").text(res.data.venue_name); 335 | $("#complaintDetailsModal").modal("show"); 336 | } 337 | }, 338 | }); 339 | }); 340 | 341 | $(document).on("click", "#seeworker", function (e) { 342 | e.preventDefault(); 343 | var user_id = $(this).val(); 344 | console.log(user_id); 345 | $.ajax({ 346 | type: "POST", 347 | url: "testbackend.php", 348 | data: { 349 | see_worker_detail: true, 350 | user_id: user_id, 351 | }, 352 | success: function (response) { 353 | var res = jQuery.parseJSON(response); 354 | console.log(res); 355 | if (res.status == 500) { 356 | alert(res.message); 357 | } else { 358 | $("#worker_first_name").text(res.data.worker_first_name); 359 | $("#worker_mobile").text(res.data.worker_mobile); 360 | $("#worker_mail").text(res.data.worker_mail); 361 | $("#worker_dept").text(res.data.worker_dept); 362 | $("#worker_emp_type").text(res.data.worker_emp_type); 363 | $("#detailsModal").modal("show"); 364 | } 365 | }, 366 | }); 367 | }); 368 | 369 | //image model 370 | // Show image 371 | $(document).on("click", ".showImage", function () { 372 | var problem_id = $(this).val(); // Get the problem_id from button value 373 | console.log(problem_id); // Ensure this logs correctly 374 | $.ajax({ 375 | type: "POST", 376 | url: "testbackend.php", 377 | data: { 378 | get_image: true, 379 | problem_id: problem_id, // Correct POST key 380 | }, 381 | dataType: "json", // Automatically parses JSON responses 382 | success: function (response) { 383 | console.log(response); // Log the parsed JSON response 384 | if (response.status == 200) { 385 | // Dynamically set the image source 386 | $("#modalImage").attr("src", "uploads/" + response.data.images); 387 | // Show the modal 388 | $("#imageModal").modal("show"); 389 | } else { 390 | // Handle case where no image is found 391 | alert( 392 | response.message || "An error occurred while retrieving the image." 393 | ); 394 | } 395 | }, 396 | error: function (xhr, status, error) { 397 | // Log the full error details for debugging 398 | console.error("AJAX Error: ", xhr.responseText); 399 | alert( 400 | "An error occurred: " + 401 | error + 402 | "\nStatus: " + 403 | status + 404 | "\nDetails: " + 405 | xhr.responseText 406 | ); 407 | }, 408 | }); 409 | }); 410 | 411 | //principal question jquerry 412 | $(document).ready(function () { 413 | // When the button is clicked, populate the modal with the query 414 | $(".openQueryModal").on("click", function () { 415 | // Check if the button is disabled 416 | if ($(this).is(':disabled')) { 417 | return; // Do nothing if the button is disabled 418 | } 419 | 420 | var commentQuery = $(this).data("comment-query"); 421 | var taskId = $(this).data("task-id"); 422 | // Set the comment query text in the modal 423 | $("#commentQueryText").text(commentQuery); 424 | // Store the task_id for later use when submitting the answer 425 | $("#submitReply").data("task-id", taskId); 426 | }); 427 | 428 | // Handle form submission when 'Submit Reply' is clicked 429 | $("#submitReply").on("click", function () { 430 | var taskId = $(this).data("task-id"); 431 | var commentReply = $("#commentReply").val(); 432 | 433 | // AJAX request to send the reply to the backend 434 | $.ajax({ 435 | url: "testbackend.php", // Your backend file 436 | type: "POST", 437 | data: { 438 | task_id: taskId, 439 | comment_reply: commentReply, 440 | submit_comment_reply: true, 441 | }, 442 | success: function (response) { 443 | var res = jQuery.parseJSON(response); 444 | if (res.status == 200) { 445 | alert(res.message); 446 | $("#principalQueryModal").modal("hide"); 447 | // Reload the table to reflect changes 448 | $("#worker_table").load(location.href + " #worker_table"); 449 | } else { 450 | alert("Something went wrong. Please try again."); 451 | } 452 | }, 453 | error: function (xhr, status, error) { 454 | console.error("Error:", error); 455 | alert("Something went wrong. Please try again."); 456 | }, 457 | }); 458 | }); 459 | }); 460 | 461 | 462 | 463 | $(document).on("click", ".facfeed", function (e) { 464 | e.preventDefault(); 465 | var user_id = $(this).val(); 466 | console.log(user_id); 467 | $.ajax({ 468 | type: "POST", 469 | url: "testbackend.php", 470 | data: { 471 | facfeedview: true, 472 | user_id: user_id, 473 | }, 474 | success: function (response) { 475 | var res = jQuery.parseJSON(response); 476 | console.log(res); 477 | if (res.status == 500) { 478 | alert(res.message); 479 | } else { 480 | //$('#student_id2').val(res.data.uid); 481 | $("#ffeed").val(res.data.feedback); 482 | $("#exampleModal").modal("show"); 483 | } 484 | }, 485 | }); 486 | }); 487 | 488 | $(document).ready(function () { 489 | var complaintfeedId = null; // Store complaintfeed_id globally 490 | 491 | // Open the feedback modal and set the complaintfeed ID (Event Delegation) 492 | $(document).on("click", ".facfeed", function () { 493 | complaintfeedId = $(this).val(); 494 | $("#complaintfeed_id").val(complaintfeedId); // Store complaintfeed ID in the hidden input 495 | }); 496 | 497 | // When 'Done' is clicked (Event Delegation) 498 | $(document).on("click", ".done", function () { 499 | var complaintfeedId = $("#complaintfeed_id").val(); 500 | updateComplaintStatus(complaintfeedId, 16); // Status '16' for Done 501 | refreshTables(); 502 | updateNavbar(); 503 | }); 504 | 505 | // When 'Reassign' is clicked (Event Delegation) 506 | $(document).on("click", ".reass", function () { 507 | $("#datePickerModal").modal("show"); // Show the modal to select deadline 508 | }); 509 | 510 | // When 'Set Deadline' is clicked in the date picker modal 511 | $(document).on("click", "#saveDeadline", function () { 512 | var reassign_deadline = $("#reassign_deadline").val(); // Get the selected deadline 513 | 514 | if (!reassign_deadline) { 515 | alert("Please select a deadline date."); 516 | return; 517 | } 518 | 519 | var complaintfeedId = $("#complaintfeed_id").val(); 520 | updateComplaintStatus(complaintfeedId, 15, reassign_deadline); // Status '15' for Reassign with deadline 521 | 522 | $("#datePickerModal").modal("hide"); // Close the date picker modal 523 | $("#exampleModal").modal("hide"); // Close the feedback modal 524 | refreshTables(); // Refresh the tables after action 525 | updateNavbar(); 526 | }); 527 | 528 | // Function to update the complaint status 529 | function updateComplaintStatus(complaintfeedId, status, reassign_deadline = null) { 530 | $.ajax({ 531 | type: "POST", 532 | url: "testbackend.php", 533 | data: { 534 | complaintfeed_id: complaintfeedId, 535 | status: status, 536 | reassign_deadline: reassign_deadline, // Only pass this if status is 'reassign' 537 | }, 538 | success: function (response) { 539 | var res = jQuery.parseJSON(response); 540 | if (res.status == 500) { 541 | alert(res.message); 542 | } else { 543 | alert("Status updated successfully!"); 544 | } 545 | }, 546 | error: function () { 547 | alert("An error occurred while updating the status."); 548 | } 549 | }); 550 | } 551 | 552 | // Function to refresh tables after actions 553 | function refreshTables() { 554 | $("#finished_table").load(location.href + " #finished_table"); 555 | $("#reassigned_table").load(location.href + " #reassigned_table"); 556 | $("#completed_table").load(location.href + " #completed_table"); 557 | 558 | } 559 | }); 560 | 561 | 562 | // Function to update the complaint status 563 | function updateComplaintStatus(complaintfeedId, status, reassign_deadline = null) { 564 | $.ajax({ 565 | type: "POST", 566 | url: "testbackend.php", 567 | data: { 568 | complaintfeed_id: complaintfeedId, 569 | status: status, 570 | reassign_deadline: reassign_deadline, // Only pass this if status is 'reassign' 571 | }, 572 | success: function (response) { 573 | var res = jQuery.parseJSON(response); 574 | alert(res.message); 575 | if (res.status == 500) { 576 | alert(res.message); 577 | } 578 | } 579 | }); 580 | } 581 | 582 | $(document).on("click", ".imgafter", function () { 583 | var problem_id = $(this).val(); // Get the problem_id from button value 584 | console.log(problem_id); // Ensure this logs correctly 585 | $.ajax({ 586 | type: "POST", 587 | url: "testbackend.php", 588 | data: { 589 | get_aimage: true, 590 | problem2_id: problem_id, // Correct POST key 591 | }, 592 | dataType: "json", // Automatically parses JSON responses 593 | success: function (response) { 594 | console.log(response); // Log the parsed JSON response 595 | if (response.status == 200) { // Use 'response' instead of 'res' 596 | // Dynamically set the image source 597 | $("#modalImage2").attr("src", response.data.after_photo); 598 | // Show the modal 599 | $("#afterImageModal").modal("show"); 600 | } else { 601 | // Handle case where no image is found 602 | alert(response.message || "An error occurred while retrieving the image."); 603 | } 604 | }, 605 | error: function(xhr, status, error) { 606 | console.error("AJAX Error: ", status, error); 607 | } 608 | }); 609 | }); 610 | $('#afterImageModal').on('hidden.bs.modal', function () { 611 | // Reset the image source to a default or blank placeholder 612 | $("#modalImage2").attr("src", "path/to/placeholder_image.jpg"); 613 | }); 614 | document.getElementById('download').addEventListener('click', function () { 615 | var wb = XLSX.utils.book_new(); 616 | var ws = XLSX.utils.table_to_sheet(document.getElementById('record_table')); 617 | XLSX.utils.book_append_sheet(wb, ws, "Complaints Data"); 618 | 619 | // Create and trigger the download 620 | XLSX.writeFile(wb, 'complaints_data.xlsx');}); 621 | 622 | 623 | 624 | 625 | 626 | -------------------------------------------------------------------------------- /worker_helpline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | MKCE_CMS 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 |
41 |
42 |
43 | 44 | 45 | 46 |
47 | 48 | 49 | 50 |
51 | 140 |
141 | 142 | 143 | 144 | 145 | 146 | 147 | 174 | 175 | 176 | 177 | 178 | 179 | 180 |
181 | 182 | 183 | 184 | 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 | 226 | 227 | 228 | 229 | 230 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 324 | 325 | 326 |
S No
Faculty Name
Department
Mail id
Contact
Have a Query?
1Ms.K.NivethaAInivethak.vlsi@mkce.ac.in9952625820   231 |
2Mr.P.MukeshCIVILmukeshp.civil@mkce.ac.in9940911511   240 |
3Mr.A.DuraimuruganCSBSduraimurugana.csbs@mkce.ac.in6380156932   249 |
4Mr.P.ShanmugasundaramCSEshanmugasundaramp.cse@mkce.ac.in9790330897   258 |
5Dr.C.NandagopalECEnandagopalc.ece@mkce.ac.in9003327363   267 |
6Ms.R.MythiliEEEmythilir.eee@mkce.ac.in8220638519   276 |
7Mr.S.SathiyanathanITsathiyanathans.it@mkce.ac.in6380153269   285 |
8Mr.R.KarthickMECHkarthickr.mech@mkce.ac.in9159594640   296 |
9Mrs.P.DeepalakshmiMCAdeepalakshmip.mca@mkce.ac.in8883352707   305 |
10Mr.K.AravinthMBAaravinthk.mba@mkce.ac.in7010538078   314 |
11Mr.R.RanganathanFreshman Enggranganathanr.maths@mkce.ac.in9865844047   323 |
327 |
328 | 329 |
330 |
331 | 332 |
333 | 334 | 335 | 336 |
337 | 338 | 339 | 340 | 341 | 342 | 343 | 347 | 348 | 349 | 350 |
351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | -------------------------------------------------------------------------------- /requirements1.php: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Mkce Complain Management Systems 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 51 | 64 | 65 | 66 | 67 | 68 | 69 |
70 |
71 |
72 |
73 |
74 |
75 | 76 | 77 | 78 |
79 | 80 | 81 | 82 |
83 | 130 |
131 | 132 | 133 | 134 | 135 | 136 | 137 | 153 | 154 | 155 | 156 | 157 | 158 | 159 |
160 | 161 | 162 | 163 | 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 | 207 | 210 | 213 | 216 | 219 | 222 | 223 | 226 | 229 | 230 | 231 | 232 | 233 | 237 | 238 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 317 | 321 | 322 | 323 | 324 | 325 | 331 | 332 | 336 | 337 | 338 | 339 |
205 |
S.No
206 |
208 |
Dept
209 |
211 |
Block \ Venue
212 |
214 |
Complaint
215 |
217 |
Image
218 |
220 |
Date_raised
221 |
224 |
Requirements
225 |
227 |
Action
228 |
239 | \ 318 | 319 | 320 | 326 | 327 | 328 | 329 | 330 |
340 |
341 | 342 |
343 |
344 | 345 |
346 |
347 | 348 | 349 |
350 |
351 |
352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 450 | 451 | 452 | 631 | 632 | 633 | 634 | 635 | 636 | --------------------------------------------------------------------------------