532 lines
19 KiB
PHP
Executable File
532 lines
19 KiB
PHP
Executable File
<!doctype html>
|
|
<html lang="en" dir="rtl">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<script src="{{url('/src/tailwindcss.js')}}"></script>
|
|
<title>سامانه حضور و غیاب</title>
|
|
|
|
|
|
<style>
|
|
/* Ignore CSS variable inspection */
|
|
:root {
|
|
/* @phpstorm-ignore */
|
|
--primary-color: #16c8ce;
|
|
--text-color: #ffffff;
|
|
|
|
}
|
|
|
|
.clockpicker-popover {
|
|
position: fixed !important;
|
|
/* مهم: fixed نسبت به viewport */
|
|
left: 50% !important;
|
|
/* افقی وسط */
|
|
top: 50% !important;
|
|
/* عمودی وسط */
|
|
transform: translate(-50%, -50%) !important;
|
|
/* دقیقاً وسط */
|
|
z-index: 99999 !important;
|
|
direction: ltr !important;
|
|
/* چپ به راست */
|
|
}
|
|
|
|
.hidden-row {
|
|
display: none;
|
|
}
|
|
|
|
.form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
max-width: 350px;
|
|
background-color: #fff;
|
|
padding: 20px;
|
|
border-radius: 20px;
|
|
position: relative;
|
|
}
|
|
|
|
|
|
.title {
|
|
padding-right: 28px;
|
|
font-size: 28px;
|
|
color: #424e54;
|
|
font-weight: 600;
|
|
letter-spacing: -1px;
|
|
display: flex;
|
|
align-items: center;
|
|
padding-left: 30px;
|
|
position: relative;
|
|
}
|
|
|
|
.title::before,
|
|
.title::after {
|
|
content: "";
|
|
position: absolute;
|
|
height: 16px;
|
|
width: 16px;
|
|
border-radius: 50%;
|
|
right: 0;
|
|
background-color: #16c8ce;
|
|
}
|
|
|
|
.title::before {
|
|
width: 18px;
|
|
height: 18px;
|
|
}
|
|
|
|
.title::after {
|
|
width: 18px;
|
|
height: 18px;
|
|
animation: pulse 1s linear infinite;
|
|
}
|
|
|
|
.message,
|
|
.signin {
|
|
color: rgba(88, 87, 87, 0.822);
|
|
font-size: 14px;
|
|
}
|
|
|
|
.signin {
|
|
text-align: center;
|
|
}
|
|
|
|
.signin a {
|
|
color: royalblue;
|
|
}
|
|
|
|
.signin a:hover {
|
|
text-decoration: underline royalblue;
|
|
}
|
|
|
|
.flex {
|
|
display: flex;
|
|
width: 100%;
|
|
gap: 6px;
|
|
}
|
|
|
|
.form label {
|
|
position: relative;
|
|
}
|
|
|
|
.form label .input {
|
|
width: 100%;
|
|
padding: 10px 10px 14px 10px;
|
|
outline: 0;
|
|
border: 1px solid rgba(105, 105, 105, 0.397);
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.form label .input + span {
|
|
position: absolute;
|
|
right: 10px;
|
|
color: grey;
|
|
font-size: 0.9em;
|
|
cursor: text;
|
|
transition: 0.3s ease;
|
|
}
|
|
|
|
.form label .input:placeholder-shown + span {
|
|
top: 15px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.form label .input:focus + span,
|
|
.form label .input:valid + span {
|
|
left: 10px;
|
|
top: 30px;
|
|
font-size: 0.7em;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.form label .input:valid + span {
|
|
color: green;
|
|
}
|
|
|
|
.submit {
|
|
border: none;
|
|
outline: none;
|
|
background-color: #16c8ce;
|
|
padding: 10px;
|
|
border-radius: 10px;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
transform: .3s ease;
|
|
}
|
|
|
|
.submit:hover {
|
|
background-color: rgb(255, 0, 0);
|
|
}
|
|
|
|
@keyframes pulse {
|
|
from {
|
|
transform: scale(0.9);
|
|
opacity: 1;
|
|
}
|
|
|
|
to {
|
|
transform: scale(1.8);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
@font-face {
|
|
font-family: 'MyCustomFont';
|
|
src: url('{{url('/src/fonts/woff/iranyekanwebregularfanum.woff')}}') format('woff2'),
|
|
url('{{url('/src/fonts/woff/iranyekanwebregularfanum.woff')}}') format('woff');
|
|
font-weight: normal;
|
|
font-style: normal;
|
|
}
|
|
|
|
* {
|
|
font-family: "MyCustomFont", cursive;
|
|
letter-spacing: 0 !important;
|
|
}
|
|
|
|
body {
|
|
background-color: #e1e1e1;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin: 0;
|
|
}
|
|
|
|
|
|
.header {
|
|
max-width: 420px;
|
|
width: 100%;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
@if (session('message'))
|
|
<center>
|
|
<div id="error-box"
|
|
class="bg-red-500 text-white p-4 rounded shadow-md fixed top-5 left-1/2 transform -translate-x-1/2 transition-opacity
|
|
duration-1000 ease-in-out opacity-100"
|
|
style="z-index: 100; background:{{ session('message.color') }};width: 90%;">
|
|
{{ session('message.text') }}
|
|
</div>
|
|
</center>
|
|
@endif
|
|
|
|
|
|
<div style="max-width: 420px; width: 100%; ">
|
|
<div class="header bg-cyan-500"
|
|
style="position: fixed;padding: 6px; top: 0;max-width: 420px; width: 100%; z-index: 11;
|
|
/*background-color: #16c8ce;*/
|
|
font-size: 24px;font-weight: 600; color: #FFFFFF">
|
|
<div style="padding: 5px 30px 5px 30px; display: flex;justify-content:center">
|
|
<div class="headerItems flex items-center justify-between text-white">
|
|
<!-- Logout -->
|
|
{{-- @if(url()=='')--}}
|
|
<label class=" items-center space-x-2 cursor-pointer"
|
|
onclick="window.location.href = '{{url('attendance/logMeOut')}}'">
|
|
<i class="fa-solid fa-right-from-bracket"></i>
|
|
</label>
|
|
|
|
<!-- Logo وسط -->
|
|
@if(isset($_COOKIE['token-0']))
|
|
<label class="mx-auto font-bold">{{$user_p->name}}<br>
|
|
</label>
|
|
@else
|
|
<label class="mx-auto font-bold">مُنتسک<br>
|
|
</label>
|
|
@endif
|
|
|
|
|
|
<!-- Refresh -->
|
|
<label class=" items-center cursor-pointer"
|
|
onclick="window.location.href = '{{url('')}}'">
|
|
<i class="fa-solid fa-arrows-rotate"></i>
|
|
</label>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div style="margin-bottom: 48px;"></div>
|
|
|
|
{{-- @if(isset($attendance_recorder) and $attendance_recorder == 1 or true)--}}
|
|
|
|
{{-- @else--}}
|
|
{{-- <div class="fixed bottom-0 max-w-[420px] w-full z-20">--}}
|
|
{{-- <form id="actionForm" method="POST"--}}
|
|
{{-- class="flex justify-around gap-4 items-center px-4 py-1 bg-cyan-500 text-[25px]"--}}
|
|
{{-- style="padding: 15px 0 10px 0">--}}
|
|
{{-- @csrf--}}
|
|
{{-- @if(isset($_COOKIE['token_0']) || isset($_COOKIE['token_1']) || isset($_COOKIE['token_2']))--}}
|
|
{{-- <button type="button" onclick="submitForm('up')"><i--}}
|
|
{{-- class="fa-solid fa-arrow-up text-white"></i></button>--}}
|
|
{{-- @endif--}}
|
|
{{-- --}}{{-- attendances list--}}
|
|
{{-- @if(isset($_COOKIE['token-0']))--}}
|
|
{{-- <button type="button" onclick="submitForm('/back')"><i--}}
|
|
{{-- class="fa-solid fa-backward-step text-white"></i>--}}
|
|
{{-- </button>--}}
|
|
{{-- @endif--}}
|
|
{{-- @if(isset($_COOKIE['user_identity']))--}}
|
|
{{-- <button type="button" onclick="submitForm('{{route('attendance.show')}}','')"><i--}}
|
|
{{-- class="fa-solid fa-clipboard-user text-white"></i></button>--}}
|
|
{{-- @endif--}}
|
|
|
|
{{-- <button type="button" onclick="submitForm('/', 'GET')"><i--}}
|
|
{{-- class="fa-solid fa-house text-white"></i></button>--}}
|
|
{{-- @if(!request()->is("admin") && (isset($_COOKIE['ad']) && $_COOKIE['ad']==1))--}}
|
|
|
|
{{-- <button type="button" onclick="submitForm('{{route('admin.dashboard')}}', 'GET')"><i--}}
|
|
{{-- class="fa-solid fa-users text-white"></i></button>--}}
|
|
{{-- @elseif(request()->is("admin") && (isset($_COOKIE['ad']) && $_COOKIE['ad']==1))--}}
|
|
{{-- <button type="button" onclick="submitForm('/', 'GET')"><i--}}
|
|
{{-- class="fa-solid fa-users text-white"></i></button>--}}
|
|
{{-- @endif--}}
|
|
{{-- @if(isset($_COOKIE['user_identity']))--}}
|
|
|
|
{{-- <button type="button" onclick="submitForm('{{route('user.profile')}}', 'GET')"><i--}}
|
|
{{-- class="fa-solid fa-user text-white"></i></button>--}}
|
|
{{-- @endif--}}
|
|
{{-- </form>--}}
|
|
{{-- </div>--}}
|
|
{{-- --}}{{-- @endif--}}
|
|
|
|
{{-- <script>--}}
|
|
{{-- function submitForm(action, method = 'POST') {--}}
|
|
{{-- const form = document.getElementById('actionForm');--}}
|
|
{{-- form.action = `${action}`;--}}
|
|
{{-- form.method = method; // Sets method dynamically--}}
|
|
{{-- if (method === 'GET') {--}}
|
|
{{-- window.location.href = form.action; // Redirect for GET request--}}
|
|
{{-- } else {--}}
|
|
{{-- form.submit(); // Submit for POST request--}}
|
|
{{-- }--}}
|
|
{{-- }--}}
|
|
{{-- </script>--}}
|
|
|
|
|
|
<?php
|
|
|
|
// use App\Models\Attendance;
|
|
// use App\Models\ai;
|
|
// use Morilog\Jalali\Jalalian;
|
|
// use Carbon\Carbon;
|
|
//
|
|
// if (isset($_COOKIE['user_identity']))
|
|
// $Attendance = Attendance::where('user_identity', $_COOKIE['user_identity'])->get();
|
|
//
|
|
//
|
|
// $ids = json_decode(request()->cookie('seen_angizeh_ids', '[]'), true) ?: [];
|
|
// $s = ai::where('key', 'angizeh')
|
|
// ->when($ids, fn($q) => $q->whereNotIn('id', $ids))
|
|
// ->orderByDesc('id')
|
|
// ->first()
|
|
// ?? ai::where('key', 'angizeh')->orderByDesc('id')->first();
|
|
// $ids = array_merge($ids, [$s->id]);
|
|
// Cookie::queue('seen_angizeh_ids', json_encode($ids), 14400);
|
|
//
|
|
////dd($Attendance)
|
|
// ?><!---->
|
|
|
|
<div class="container w-full"
|
|
style="letter-spacing: 0;display: flex;justify-content: center;align-items: center;margin: 90px 0 10px 0 ">
|
|
<form id="attendanceForm" class="form w-[350px]" action="{{url('attendance/login')}}" method="get"
|
|
style="text-align: left">
|
|
@csrf
|
|
<p class="title text-center font-bold text-lg mb-2">سامانه گذارش کار</p>
|
|
{{-- <p class="message text-right text-sm text-gray-700">--}}
|
|
{{-- {{$s->response}}--}}
|
|
{{-- </p>--}}
|
|
|
|
<label>
|
|
<input required placeholder="" name="phone" type="tel" class="input" value="">
|
|
<span>شماره موبایل</span>
|
|
</label>
|
|
|
|
<label>
|
|
<input required placeholder="" name="password" type="password" class="input" value="">
|
|
<span>رمز عبور</span>
|
|
</label>
|
|
|
|
<input type="hidden" name="latitude" id="latitude">
|
|
<input type="hidden" name="longitude" id="longitude">
|
|
<input type="hidden" name="distance" id="distance">
|
|
<button type="submit" class=" text-white px-4 py-2 rounded bg-cyan-500">
|
|
ورود
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<!-- Modals -->
|
|
<!-- Modals -->
|
|
<div id="modal-container"
|
|
class="fixed inset-0 z-50 hidden bg-black bg-opacity-60 flex items-center justify-center p-4">
|
|
<div id="modal-content" class="bg-white p-4 sm:p-6 rounded-lg shadow-lg max-w-sm w-full relative">
|
|
<h2 id="modal-title" class="text-xl sm:text-2xl font-semibold mb-4 text-center"></h2>
|
|
<p id="modal-body" class="text-gray-700 mb-4 text-center"></p>
|
|
<div class="flex justify-center gap-2">
|
|
<a id="panel-access-link" href="#" class="bg-green-500 text-white rounded p-2" title="Panel Access">
|
|
ورودبه پنل کاربر
|
|
</a>
|
|
<button class="bg-yellow-500 text-white rounded p-2" title="Resend Password">
|
|
ارسال دوباره رمز
|
|
</button>
|
|
</div>
|
|
<div class="flex justify-center gap-2">
|
|
|
|
|
|
<form id="panel-access-link-edite" action="#" class=" text-white rounded p-2" title="Panel Access"
|
|
method="post">@csrf
|
|
<button class="bg-blue-500 text-white rounded p-2" title="Edit" style="width: 44px">
|
|
<i class="fas fa-edit text-white text-lg"></i>
|
|
</button>
|
|
</form>
|
|
<form id="panel-access-link-delete" action="#" class=" text-white rounded p-2" title="Panel Access"
|
|
method="post">@csrf
|
|
<button class="bg-red-500 text-white rounded p-2" title="Delete" style="width: 44px">
|
|
<i class="fas fa-trash text-white text-lg"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
|
function openModal(title, id) {
|
|
document.getElementById("modal-title").innerText = title; // Set modal title
|
|
document.getElementById("panel-access-link-edite").action = `/edit/${id}`;
|
|
document.getElementById("panel-access-link-delete").action = `/delete/${id}`;
|
|
const panelLink = document.getElementById("panel-access-link");
|
|
panelLink.href = `/go_down/${id}`;
|
|
document.getElementById("modal-container").classList.remove("hidden"); // Show modal
|
|
}
|
|
|
|
function closeModal() {
|
|
document.getElementById("modal-container").classList.add("hidden");
|
|
}
|
|
|
|
document.getElementById("modal-container").addEventListener("click", (e) => {
|
|
if (e.target === document.getElementById("modal-container")) {
|
|
closeModal();
|
|
}
|
|
});
|
|
|
|
async function getContacts() {
|
|
if ("contacts" in navigator && "ContactsManager" in window) {
|
|
const properties = ["name", "tel"];
|
|
const options = {multiple: true};
|
|
|
|
try {
|
|
const contacts = await navigator.contacts.select(properties, options);
|
|
displayContacts(contacts);
|
|
} catch (error) {
|
|
alert("دسترسی به مخاطبین رد شد یا امکانپذیر نیست.");
|
|
console.error(error);
|
|
}
|
|
} else {
|
|
alert("مرورگر شما از API مخاطبین پشتیبانی نمیکند.");
|
|
}
|
|
}
|
|
|
|
function displayContacts(contacts) {
|
|
const contactsTextarea = document.getElementById("contacts");
|
|
const formContainer = document.getElementById("formContainer");
|
|
let contactsText = "";
|
|
|
|
contacts.forEach(contact => {
|
|
// Normalize and deduplicate phone numbers
|
|
const uniqueTels = normalizeAndDeduplicate(contact.tel);
|
|
|
|
// Store contact info in an object
|
|
const contactInfo = {
|
|
name: contact.name?.join(", ") || "نامشخص",
|
|
number: uniqueTels.join(", ") || "نامشخص"
|
|
};
|
|
|
|
contactsText += `${contactInfo.name}\n${contactInfo.number}\n\n`;
|
|
});
|
|
|
|
// Set the text content of the textarea and show the form container
|
|
contactsTextarea.value = contactsText;
|
|
contactsTextarea.style.display = "block"; // Ensure the textarea is displayed
|
|
formContainer.style.display = "block"; // Show the form container
|
|
}
|
|
|
|
function normalizeAndDeduplicate(telArray) {
|
|
if (!telArray) return [];
|
|
const normalizedSet = new Set();
|
|
|
|
telArray.forEach(tel => {
|
|
// Normalize the phone number by removing spaces and standardizing formats
|
|
let normalizedTel = tel.replace(/\s+/g, "") // Remove spaces
|
|
.replace(/^(?:\+98|0098|98)?0*/, "0"); // Ensure it starts with '0'
|
|
normalizedSet.add(normalizedTel);
|
|
});
|
|
|
|
return Array.from(normalizedSet);
|
|
}
|
|
|
|
function confirmSubmit() {
|
|
return confirm("آیا مطمئن هستید که میخواهید اطلاعات را ارسال کنید؟");
|
|
}
|
|
</script>
|
|
{{--@endsection--}}
|
|
|
|
|
|
<div style="margin-top: 88px;"></div>
|
|
<script>
|
|
function openModal(title, id) {
|
|
// Set the modal content
|
|
const modalTitle = document.getElementById('modal-title')
|
|
const modalBody = document.getElementById('modal-body')
|
|
modalTitle.innerText = title
|
|
|
|
// Set the correct link for Panel Access based on the item's ID
|
|
const panelLink = document.getElementById('panel-access-link')
|
|
panelLink.href = `/go_down/${id}`
|
|
|
|
// Show the modal
|
|
document.getElementById('modal-container').classList.remove('hidden')
|
|
}
|
|
|
|
// Close modal function
|
|
function closeModal() {
|
|
document.getElementById('modal-container').classList.add('hidden')
|
|
}
|
|
|
|
// Close modal when clicking outside the modal content
|
|
document.getElementById('modal-container').addEventListener('click', (e) => {
|
|
if (e.target === document.getElementById('modal-container')) {
|
|
closeModal()
|
|
}
|
|
})
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const errorBox = document.getElementById('error-box')
|
|
if (errorBox) {
|
|
// Fade out the error box after 3 seconds
|
|
setTimeout(() => {
|
|
errorBox.classList.add('opacity-0') // Add fade-out class
|
|
// Remove the error box after the fade-out transition ends
|
|
errorBox.addEventListener('transitionend', () => {
|
|
errorBox.remove()
|
|
})
|
|
}, 3000) // Duration before starting fade out
|
|
}
|
|
})
|
|
</script>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html> |