Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e01423622f |
@ -1,403 +1,109 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
font-family: 'Cairo', sans-serif;
|
||||||
background-size: 400% 400%;
|
background-color: #f8f9fa;
|
||||||
animation: gradient 15s ease infinite;
|
color: #333;
|
||||||
color: #212529;
|
direction: rtl;
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
text-align: right;
|
||||||
font-size: 14px;
|
overflow-x: hidden;
|
||||||
margin: 0;
|
|
||||||
min-height: 100vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
.navbar {
|
||||||
display: flex;
|
background-color: #fff;
|
||||||
align-items: center;
|
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
||||||
justify-content: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
width: 100%;
|
|
||||||
padding: 20px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes gradient {
|
.nav-link {
|
||||||
0% {
|
color: #444;
|
||||||
background-position: 0% 50%;
|
font-weight: 600;
|
||||||
}
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-container {
|
.nav-link.active {
|
||||||
width: 100%;
|
color: #007bff !important;
|
||||||
max-width: 600px;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 85vh;
|
|
||||||
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
-webkit-backdrop-filter: blur(15px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-header {
|
.card {
|
||||||
padding: 1.5rem;
|
border: none;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
border-radius: 12px;
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-messages {
|
|
||||||
flex: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
padding: 1.5rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Custom Scrollbar */
|
|
||||||
::-webkit-scrollbar {
|
|
||||||
width: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
max-width: 85%;
|
|
||||||
padding: 0.85rem 1.1rem;
|
|
||||||
border-radius: 16px;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
||||||
animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(45deg, #007bff, #0056b3);
|
||||||
|
border: none;
|
||||||
|
padding: 10px 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-success {
|
||||||
|
background: linear-gradient(45deg, #28a745, #218838);
|
||||||
|
border: none;
|
||||||
|
padding: 10px 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover {
|
||||||
|
opacity: 0.9;
|
||||||
|
transform: scale(1.02);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container {
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 100px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-in {
|
||||||
|
animation: fadeIn 0.8s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
from { opacity: 0; transform: translateY(10px); }
|
||||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
to { opacity: 1; transform: translateY(0); }
|
||||||
}
|
|
||||||
|
|
||||||
.message.visitor {
|
|
||||||
align-self: flex-end;
|
|
||||||
background: linear-gradient(135deg, #212529 0%, #343a40 100%);
|
|
||||||
color: #fff;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.bot {
|
|
||||||
align-self: flex-start;
|
|
||||||
background: #ffffff;
|
|
||||||
color: #212529;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area {
|
|
||||||
padding: 1.25rem;
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area form {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input {
|
|
||||||
flex: 1;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
outline: none;
|
|
||||||
background: rgba(255, 255, 255, 0.9);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input:focus {
|
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button {
|
|
||||||
background: #212529;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 600;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button:hover {
|
|
||||||
background: #000;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Background Animations */
|
|
||||||
.bg-animations {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob {
|
|
||||||
position: absolute;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
left: -10%;
|
|
||||||
background: rgba(238, 119, 82, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: -10%;
|
|
||||||
right: -10%;
|
|
||||||
background: rgba(35, 166, 213, 0.4);
|
|
||||||
animation-delay: -7s;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-3 {
|
|
||||||
top: 40%;
|
|
||||||
left: 30%;
|
|
||||||
background: rgba(231, 60, 126, 0.3);
|
|
||||||
animation-delay: -14s;
|
|
||||||
width: 450px;
|
|
||||||
height: 450px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move {
|
|
||||||
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
|
||||||
33% { transform: translate(150px, 100px) rotate(120deg) scale(1.1); }
|
|
||||||
66% { transform: translate(-50px, 200px) rotate(240deg) scale(0.9); }
|
|
||||||
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-link {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-link:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.4);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admin Styles */
|
|
||||||
.admin-container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 3rem auto;
|
|
||||||
padding: 2.5rem;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
border-radius: 24px;
|
|
||||||
box-shadow: 0 20px 50px rgba(0,0,0,0.15);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-container h1 {
|
|
||||||
margin-top: 0;
|
|
||||||
color: #212529;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
width: 100%;
|
background-color: #fff;
|
||||||
border-collapse: separate;
|
border-radius: 12px;
|
||||||
border-spacing: 0 8px;
|
overflow: hidden;
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.table th {
|
.table th {
|
||||||
background: transparent;
|
background-color: #f8f9fa;
|
||||||
border: none;
|
border-bottom: 2px solid #eee;
|
||||||
padding: 1rem;
|
|
||||||
color: #6c757d;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table td {
|
|
||||||
background: #fff;
|
|
||||||
padding: 1rem;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table tr td:first-child { border-radius: 12px 0 0 12px; }
|
|
||||||
.table tr td:last-child { border-radius: 0 12px 12px 0; }
|
|
||||||
|
|
||||||
.form-group {
|
|
||||||
margin-bottom: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
background: #fff;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header-links {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-card {
|
|
||||||
background: rgba(255, 255, 255, 0.6);
|
|
||||||
padding: 2rem;
|
|
||||||
border-radius: 20px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
||||||
margin-bottom: 2.5rem;
|
|
||||||
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-card h3 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-delete {
|
.stat-icon {
|
||||||
background: #dc3545;
|
font-size: 2.5rem;
|
||||||
color: white;
|
color: #007bff;
|
||||||
border: none;
|
opacity: 0.2;
|
||||||
padding: 0.25rem 0.5rem;
|
position: absolute;
|
||||||
border-radius: 4px;
|
left: 20px;
|
||||||
cursor: pointer;
|
top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-add {
|
.sidebar {
|
||||||
background: #212529;
|
min-height: 100vh;
|
||||||
color: white;
|
background-color: #fff;
|
||||||
border: none;
|
border-left: 1px solid #eee;
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-save {
|
@media (max-width: 768px) {
|
||||||
background: #0088cc;
|
.sidebar {
|
||||||
color: white;
|
min-height: auto;
|
||||||
border: none;
|
border-left: none;
|
||||||
padding: 0.8rem 1.5rem;
|
border-bottom: 1px solid #eee;
|
||||||
border-radius: 12px;
|
}
|
||||||
cursor: pointer;
|
|
||||||
font-weight: 600;
|
|
||||||
width: 100%;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.webhook-url {
|
|
||||||
font-size: 0.85em;
|
|
||||||
color: #555;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-table-container {
|
|
||||||
overflow-x: auto;
|
|
||||||
background: rgba(255, 255, 255, 0.4);
|
|
||||||
padding: 1rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-table-time {
|
|
||||||
width: 15%;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: 0.85em;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-table-user {
|
|
||||||
width: 35%;
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.history-table-ai {
|
|
||||||
width: 50%;
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-messages {
|
|
||||||
text-align: center;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
@ -1,39 +1,44 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const chatForm = document.getElementById('chat-form');
|
// Add fade-in classes to sections
|
||||||
const chatInput = document.getElementById('chat-input');
|
const sections = document.querySelectorAll('section, .card, .table');
|
||||||
const chatMessages = document.getElementById('chat-messages');
|
sections.forEach(el => el.classList.add('fade-in'));
|
||||||
|
|
||||||
const appendMessage = (text, sender) => {
|
// Form validation and feedback
|
||||||
const msgDiv = document.createElement('div');
|
const forms = document.querySelectorAll('.needs-validation');
|
||||||
msgDiv.classList.add('message', sender);
|
Array.from(forms).forEach(form => {
|
||||||
msgDiv.textContent = text;
|
form.addEventListener('submit', event => {
|
||||||
chatMessages.appendChild(msgDiv);
|
if (!form.checkValidity()) {
|
||||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
event.preventDefault();
|
||||||
};
|
event.stopPropagation();
|
||||||
|
}
|
||||||
chatForm.addEventListener('submit', async (e) => {
|
form.classList.add('was-validated');
|
||||||
e.preventDefault();
|
}, false);
|
||||||
const message = chatInput.value.trim();
|
|
||||||
if (!message) return;
|
|
||||||
|
|
||||||
appendMessage(message, 'visitor');
|
|
||||||
chatInput.value = '';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('api/chat.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ message })
|
|
||||||
});
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
// Artificial delay for realism
|
|
||||||
setTimeout(() => {
|
|
||||||
appendMessage(data.reply, 'bot');
|
|
||||||
}, 500);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error:', error);
|
|
||||||
appendMessage("Sorry, something went wrong. Please try again.", 'bot');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
// Simple toast notification
|
||||||
|
window.showAlert = function(message, type = 'success') {
|
||||||
|
const toastContainer = document.getElementById('toast-container');
|
||||||
|
if (!toastContainer) {
|
||||||
|
const container = document.createElement('div');
|
||||||
|
container.id = 'toast-container';
|
||||||
|
container.style.position = 'fixed';
|
||||||
|
container.style.bottom = '20px';
|
||||||
|
container.style.left = '20px';
|
||||||
|
container.style.zIndex = '1050';
|
||||||
|
document.body.appendChild(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.className = `alert alert-${type} fade show`;
|
||||||
|
toast.role = 'alert';
|
||||||
|
toast.style.marginBottom = '10px';
|
||||||
|
toast.innerHTML = message;
|
||||||
|
|
||||||
|
document.getElementById('toast-container').appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.classList.remove('show');
|
||||||
|
setTimeout(() => toast.remove(), 500);
|
||||||
|
}, 3000);
|
||||||
|
};
|
||||||
|
});
|
||||||
148
attendance.php
Normal file
148
attendance.php
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Simple login check
|
||||||
|
if (!isset($_SESSION['user'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
$msg = '';
|
||||||
|
$today = date('Y-m-d');
|
||||||
|
|
||||||
|
// Attendance toggle logic
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$emp_id = $_POST['employee_id'] ?? 0;
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
if ($action === 'check_in') {
|
||||||
|
$stmt = $db->prepare("INSERT INTO attendance (employee_id, date, check_in) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE check_in = ?");
|
||||||
|
if ($stmt->execute([$emp_id, $today, date('H:i:s'), date('H:i:s')])) {
|
||||||
|
$msg = 'تم تسجيل الحضور بنجاح!';
|
||||||
|
}
|
||||||
|
} elseif ($action === 'check_out') {
|
||||||
|
$stmt = $db->prepare("UPDATE attendance SET check_out = ? WHERE employee_id = ? AND date = ?");
|
||||||
|
if ($stmt->execute([date('H:i:s'), $emp_id, $today])) {
|
||||||
|
$msg = 'تم تسجيل الانصراف بنجاح!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch all employees and their today's attendance
|
||||||
|
$employees = $db->query("SELECT e.*, a.check_in, a.check_out FROM employees e LEFT JOIN attendance a ON e.id = a.employee_id AND a.date = '$today' ORDER BY e.id DESC")->fetchAll();
|
||||||
|
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>تسجيل الحضور - <?php echo htmlspecialchars($project_name); ?></title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand fw-bold" href="index.php"><?php echo htmlspecialchars($project_name); ?></a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php">لوحة التحكم</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="employees.php">الموظفين</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link active" href="attendance.php">الحضور</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="payroll.php">الرواتب</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container py-5 fade-in">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<div>
|
||||||
|
<h1 class="h2 fw-bold mb-0">سجل الحضور والغياب</h1>
|
||||||
|
<p class="text-muted mb-0">تاريخ اليوم: <?php echo date('Y-m-d'); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($msg): ?>
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<?php echo $msg; ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0 align-middle">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="ps-4">الموظف</th>
|
||||||
|
<th>وقت الحضور</th>
|
||||||
|
<th>وقت الانصراف</th>
|
||||||
|
<th class="pe-4 text-center">إجراءات</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($employees)): ?>
|
||||||
|
<tr><td colspan="4" class="text-center py-5 text-muted">لا يوجد موظفين مسجلين حالياً</td></tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($employees as $emp): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="ps-4 fw-bold">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="rounded-circle bg-success text-white p-2 me-3 text-center" style="width: 40px; height: 40px; line-height: 24px;">
|
||||||
|
<?php echo mb_substr($emp['name'], 0, 1, 'UTF-8'); ?>
|
||||||
|
</div>
|
||||||
|
<?php echo htmlspecialchars($emp['name']); ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($emp['check_in']): ?>
|
||||||
|
<span class="badge bg-success py-2 px-3"><?php echo date('H:i', strtotime($emp['check_in'])); ?></span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted small">--:--</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($emp['check_out']): ?>
|
||||||
|
<span class="badge bg-primary py-2 px-3"><?php echo date('H:i', strtotime($emp['check_out'])); ?></span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted small">--:--</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="pe-4 text-center">
|
||||||
|
<form action="attendance.php" method="POST" style="display:inline-block;">
|
||||||
|
<input type="hidden" name="employee_id" value="<?php echo $emp['id']; ?>">
|
||||||
|
<?php if (!$emp['check_in']): ?>
|
||||||
|
<button type="submit" name="action" value="check_in" class="btn btn-sm btn-success">
|
||||||
|
<i class="fas fa-sign-in-alt"></i> تسجيل حضور
|
||||||
|
</button>
|
||||||
|
<?php elseif (!$emp['check_out']): ?>
|
||||||
|
<button type="submit" name="action" value="check_out" class="btn btn-sm btn-primary">
|
||||||
|
<i class="fas fa-sign-out-alt"></i> تسجيل انصراف
|
||||||
|
</button>
|
||||||
|
<?php else: ?>
|
||||||
|
<button type="button" class="btn btn-sm btn-secondary" disabled>
|
||||||
|
<i class="fas fa-check-double"></i> تم الانتهاء
|
||||||
|
</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
160
employees.php
Normal file
160
employees.php
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Simple login check
|
||||||
|
if (!isset($_SESSION['user'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
$msg = '';
|
||||||
|
|
||||||
|
// Add employee logic
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_employee'])) {
|
||||||
|
$name = $_POST['name'] ?? '';
|
||||||
|
$phone = $_POST['phone'] ?? '';
|
||||||
|
$salary = $_POST['salary'] ?? 0.00;
|
||||||
|
|
||||||
|
if (!empty($name)) {
|
||||||
|
$stmt = $db->prepare("INSERT INTO employees (name, phone, salary) VALUES (?, ?, ?)");
|
||||||
|
if ($stmt->execute([$name, $phone, $salary])) {
|
||||||
|
$msg = 'تم إضافة الموظف بنجاح!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete employee logic
|
||||||
|
if (isset($_GET['delete'])) {
|
||||||
|
$stmt = $db->prepare("DELETE FROM employees WHERE id = ?");
|
||||||
|
if ($stmt->execute([$_GET['delete']])) {
|
||||||
|
$msg = 'تم حذف الموظف بنجاح!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$employees = $db->query("SELECT * FROM employees ORDER BY id DESC")->fetchAll();
|
||||||
|
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>إدارة الموظفين - <?php echo htmlspecialchars($project_name); ?></title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand fw-bold" href="index.php"><?php echo htmlspecialchars($project_name); ?></a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php">لوحة التحكم</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link active" href="employees.php">الموظفين</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="attendance.php">الحضور</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="payroll.php">الرواتب</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container py-5 fade-in">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1 class="h2 fw-bold mb-0">قائمة الموظفين</h1>
|
||||||
|
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addEmployeeModal">إضافة موظف جديد</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($msg): ?>
|
||||||
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||||
|
<?php echo $msg; ?>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0 align-middle">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="ps-4">الموظف</th>
|
||||||
|
<th>رقم الهاتف</th>
|
||||||
|
<th>الراتب الأساسي</th>
|
||||||
|
<th>تاريخ الانضمام</th>
|
||||||
|
<th class="pe-4 text-center">إجراءات</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($employees)): ?>
|
||||||
|
<tr><td colspan="5" class="text-center py-5 text-muted">لا يوجد موظفين حالياً</td></tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($employees as $emp): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="ps-4 fw-bold">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="rounded-circle bg-primary text-white p-2 me-3 text-center" style="width: 40px; height: 40px; line-height: 24px;">
|
||||||
|
<?php echo mb_substr($emp['name'], 0, 1, 'UTF-8'); ?>
|
||||||
|
</div>
|
||||||
|
<?php echo htmlspecialchars($emp['name']); ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo htmlspecialchars($emp['phone']); ?></td>
|
||||||
|
<td><?php echo number_format($emp['salary'], 2); ?> ج.م</td>
|
||||||
|
<td class="text-muted"><?php echo date('Y-m-d', strtotime($emp['created_at'])); ?></td>
|
||||||
|
<td class="pe-4 text-center">
|
||||||
|
<a href="employees.php?delete=<?php echo $emp['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('هل أنت متأكد من حذف هذا الموظف؟')">
|
||||||
|
<i class="fas fa-trash"></i> حذف
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Add Employee Modal -->
|
||||||
|
<div class="modal fade" id="addEmployeeModal" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form action="employees.php" method="POST" class="needs-validation" novalidate>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold">إضافة موظف جديد</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label small fw-bold">اسم الموظف</label>
|
||||||
|
<input type="text" name="name" class="form-control" required placeholder="أدخل اسم الموظف">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label small fw-bold">رقم الهاتف</label>
|
||||||
|
<input type="text" name="phone" class="form-control" placeholder="010XXXXXXXX">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label small fw-bold">الراتب الأساسي</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="number" step="0.01" name="salary" class="form-control" placeholder="0.00" value="0.00">
|
||||||
|
<span class="input-group-text">ج.م</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-light" data-bs-dismiss="modal">إلغاء</button>
|
||||||
|
<button type="submit" name="add_employee" class="btn btn-primary fw-bold">إضافة الموظف</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
315
index.php
315
index.php
@ -1,150 +1,179 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
session_start();
|
||||||
@ini_set('display_errors', '1');
|
require_once 'db/config.php';
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
// Simple login check
|
||||||
|
if (!isset($_SESSION['user'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
|
||||||
|
// Fetch stats
|
||||||
|
$totalEmployees = $db->query("SELECT COUNT(*) FROM employees")->fetchColumn();
|
||||||
|
$todayDate = date('Y-m-d');
|
||||||
|
$todayAttendance = $db->query("SELECT COUNT(*) FROM attendance WHERE date = '$todayDate' AND check_in IS NOT NULL")->fetchColumn();
|
||||||
|
|
||||||
|
// Project meta tags from environment
|
||||||
|
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام إدارة الموارد البشرية';
|
||||||
|
$project_description = $_SERVER['PROJECT_DESCRIPTION'] ?? 'نظام متكامل لإدارة الموظفين والحضور والرواتب باللغة العربية.';
|
||||||
|
$project_image = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="ar" dir="rtl">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title><?php echo htmlspecialchars($project_name); ?> - لوحة التحكم</title>
|
||||||
<?php
|
<meta name="description" content="<?php echo htmlspecialchars($project_description); ?>">
|
||||||
// Read project preview data from environment
|
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<!-- Bootstrap 5 RTL -->
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
||||||
?>
|
<!-- Font Awesome -->
|
||||||
<?php if ($projectDescription): ?>
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
<!-- Meta description -->
|
<!-- Custom CSS -->
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a class="navbar-brand fw-bold" href="index.php">
|
||||||
<span class="sr-only">Loading…</span>
|
<i class="fas fa-users-cog text-primary me-2"></i>
|
||||||
</div>
|
<?php echo htmlspecialchars($project_name); ?>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</a>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</div>
|
</button>
|
||||||
</main>
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
<footer>
|
<ul class="navbar-nav ms-auto">
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<li class="nav-item">
|
||||||
</footer>
|
<a class="nav-link active" href="index.php">لوحة التحكم</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="employees.php">الموظفين</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="attendance.php">الحضور</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="payroll.php">الرواتب</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link text-danger" href="login.php?logout=1">تسجيل الخروج</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container py-5 fade-in">
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-12">
|
||||||
|
<h1 class="h2 fw-bold mb-1">أهلاً بك في لوحة التحكم، <?php echo htmlspecialchars($_SESSION['user']['name']); ?>!</h1>
|
||||||
|
<p class="text-muted">نظرة عامة سريعة على أداء الشركة اليوم.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<!-- Total Employees Card -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 position-relative overflow-hidden border-0">
|
||||||
|
<i class="fas fa-users stat-icon"></i>
|
||||||
|
<h3 class="h6 text-muted mb-2">إجمالي الموظفين</h3>
|
||||||
|
<div class="h2 fw-bold mb-0"><?php echo $totalEmployees; ?></div>
|
||||||
|
<div class="mt-2 text-primary small">
|
||||||
|
<i class="fas fa-arrow-up me-1"></i>
|
||||||
|
موظف مسجل حالياً
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Today's Attendance Card -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 position-relative overflow-hidden border-0">
|
||||||
|
<i class="fas fa-calendar-check stat-icon text-success"></i>
|
||||||
|
<h3 class="h6 text-muted mb-2">الحضور اليوم</h3>
|
||||||
|
<div class="h2 fw-bold mb-0 text-success"><?php echo $todayAttendance; ?></div>
|
||||||
|
<div class="mt-2 text-success small">
|
||||||
|
<i class="fas fa-check-circle me-1"></i>
|
||||||
|
موظف حاضر اليوم
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Quick Actions Card -->
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 border-0 h-100">
|
||||||
|
<h3 class="h6 text-muted mb-3">روابط سريعة</h3>
|
||||||
|
<div class="d-grid gap-2">
|
||||||
|
<a href="employees.php" class="btn btn-primary btn-sm">إضافة موظف جديد</a>
|
||||||
|
<a href="attendance.php" class="btn btn-outline-success btn-sm">تسجيل الحضور</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mt-5">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card p-0 border-0 shadow-sm overflow-hidden">
|
||||||
|
<div class="card-header bg-white p-3 border-0 d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="fw-bold mb-0">آخر الموظفين المضافين</h5>
|
||||||
|
<a href="employees.php" class="btn btn-link btn-sm text-decoration-none">عرض الكل</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0 align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="ps-4">الاسم</th>
|
||||||
|
<th>رقم الهاتف</th>
|
||||||
|
<th>الراتب</th>
|
||||||
|
<th class="pe-4 text-center">التاريخ</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
$latestEmployees = $db->query("SELECT * FROM employees ORDER BY created_at DESC LIMIT 5")->fetchAll();
|
||||||
|
if (empty($latestEmployees)) {
|
||||||
|
echo '<tr><td colspan="4" class="text-center py-4 text-muted">لا يوجد موظفين حالياً</td></tr>';
|
||||||
|
} else {
|
||||||
|
foreach ($latestEmployees as $emp) {
|
||||||
|
echo '<tr>
|
||||||
|
<td class="ps-4 fw-bold">'.htmlspecialchars($emp['name']).'</td>
|
||||||
|
<td>'.htmlspecialchars($emp['phone']).'</td>
|
||||||
|
<td>'.number_format($emp['salary'], 2).' ج.م</td>
|
||||||
|
<td class="pe-4 text-center text-muted">'.date('Y-m-d', strtotime($emp['created_at'])).'</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card border-0 p-4 shadow-sm h-100 bg-primary text-white" style="background: linear-gradient(135deg, #007bff, #00c6ff);">
|
||||||
|
<h5 class="fw-bold mb-4">نصيحة اليوم للإدارة</h5>
|
||||||
|
<p class="mb-4" style="opacity: 0.9;">التواصل الفعال مع الموظفين يزيد من الإنتاجية بنسبة 25%. احرص على الاجتماع بفريقك بانتظام.</p>
|
||||||
|
<div class="mt-auto">
|
||||||
|
<small style="opacity: 0.7;">فريق الموارد البشرية</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="text-center py-4 mt-5 text-muted border-top">
|
||||||
|
<div class="container">
|
||||||
|
© <?php echo date('Y'); ?> <?php echo htmlspecialchars($project_name); ?>. جميع الحقوق محفوظة.
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
92
login.php
Normal file
92
login.php
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Logout logic
|
||||||
|
if (isset($_GET['logout'])) {
|
||||||
|
session_destroy();
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple logic for any login
|
||||||
|
$error = '';
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
|
if (empty($email) || empty($password)) {
|
||||||
|
$error = 'يرجى إدخال البريد الإلكتروني وكلمة المرور.';
|
||||||
|
} else {
|
||||||
|
// Any login is accepted as requested
|
||||||
|
$_SESSION['user'] = [
|
||||||
|
'name' => 'مسؤول الموارد البشرية',
|
||||||
|
'email' => $email
|
||||||
|
];
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية';
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>تسجيل الدخول - <?php echo htmlspecialchars($project_name); ?></title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body { background-color: #f0f2f5; }
|
||||||
|
.login-card { border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: none; }
|
||||||
|
.login-header { text-align: center; margin-bottom: 30px; }
|
||||||
|
.form-control { border-radius: 10px; padding: 12px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="fade-in">
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center align-items-center vh-100">
|
||||||
|
<div class="col-md-5 col-lg-4">
|
||||||
|
<div class="card login-card p-4 p-md-5">
|
||||||
|
<div class="login-header">
|
||||||
|
<div class="mb-3">
|
||||||
|
<i class="fas fa-users-cog fa-4x text-primary"></i>
|
||||||
|
</div>
|
||||||
|
<h2 class="fw-bold h4">تسجيل الدخول</h2>
|
||||||
|
<p class="text-muted small">مرحباً بك مجدداً في لوحة التحكم.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger py-2 small"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="login.php" method="POST" class="needs-validation" novalidate>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label small fw-bold">البريد الإلكتروني</label>
|
||||||
|
<input type="email" name="email" class="form-control" placeholder="admin@example.com" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label small fw-bold">كلمة المرور</label>
|
||||||
|
<input type="password" name="password" class="form-control" placeholder="••••••••" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary fw-bold py-2">دخول النظام</button>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 text-center">
|
||||||
|
<small class="text-muted">ملاحظة: يمكنك إدخال أي بريد وكلمة مرور للتجربة.</small>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 text-center">
|
||||||
|
<small class="text-muted">© <?php echo date('Y'); ?> <?php echo htmlspecialchars($project_name); ?></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
110
payroll.php
Normal file
110
payroll.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
// Simple login check
|
||||||
|
if (!isset($_SESSION['user'])) {
|
||||||
|
header('Location: login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = db();
|
||||||
|
$employees = $db->query("SELECT * FROM employees ORDER BY id DESC")->fetchAll();
|
||||||
|
$project_name = $_SERVER['PROJECT_NAME'] ?? 'نظام الموارد البشرية';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ar" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>إدارة الرواتب - <?php echo htmlspecialchars($project_name); ?></title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand fw-bold" href="index.php"><?php echo htmlspecialchars($project_name); ?></a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php">لوحة التحكم</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="employees.php">الموظفين</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="attendance.php">الحضور</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link active" href="payroll.php">الرواتب</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container py-5 fade-in">
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h1 class="h2 fw-bold mb-1">مسير الرواتب</h1>
|
||||||
|
<p class="text-muted">متابعة الرواتب الأساسية والمستحقات.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4 mb-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card p-4 border-0 shadow-sm" style="background: linear-gradient(135deg, #28a745, #1e7e34); color: #fff;">
|
||||||
|
<h3 class="h6 mb-2">إجمالي الرواتب الشهرية</h3>
|
||||||
|
<div class="h2 fw-bold mb-0">
|
||||||
|
<?php
|
||||||
|
$totalSalary = array_sum(array_column($employees, 'salary'));
|
||||||
|
echo number_format($totalSalary, 2);
|
||||||
|
?> ج.م
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0 align-middle">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="ps-4">الموظف</th>
|
||||||
|
<th>الراتب الأساسي</th>
|
||||||
|
<th>الحالة</th>
|
||||||
|
<th class="pe-4 text-center">إجراءات</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($employees)): ?>
|
||||||
|
<tr><td colspan="4" class="text-center py-5 text-muted">لا يوجد بيانات موظفين حالياً</td></tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($employees as $emp): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="ps-4 fw-bold">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="rounded-circle bg-light text-primary p-2 me-3 text-center" style="width: 40px; height: 40px; line-height: 24px; border: 1px solid #eee;">
|
||||||
|
<i class="fas fa-money-bill-wave"></i>
|
||||||
|
</div>
|
||||||
|
<?php echo htmlspecialchars($emp['name']); ?>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><?php echo number_format($emp['salary'], 2); ?> ج.م</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-light text-success border border-success px-3 py-2">نشط</span>
|
||||||
|
</td>
|
||||||
|
<td class="pe-4 text-center">
|
||||||
|
<button class="btn btn-sm btn-outline-primary px-3">
|
||||||
|
<i class="fas fa-file-invoice-dollar"></i> عرض التفاصيل
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user