This commit is contained in:
mobin
2025-10-11 13:38:30 +00:00
parent 1c5d2c6f10
commit 2adb741dac
61 changed files with 3370 additions and 413 deletions
Regular → Executable
View File
Regular → Executable
View File
Vendored Regular → Executable
View File
Regular → Executable
View File
+235
View File
@@ -0,0 +1,235 @@
<?php
use App\Models\Attendance;
use App\Models\AttendanceBreak;
use Morilog\Jalali\Jalalian;
use Carbon\Carbon;
//dd($reqs);
$now = Jalalian::fromCarbon(Carbon::now());
foreach ($users as $user) {
$totaltime = 0;
$tsec = 0;
foreach ($user->attendances as $att) {
$date = $att->entered_at != null ? Jalalian::fromCarbon(Carbon::parse($att->entered_at)) : null;
$att->date = $date != null ? $date->format('Y/m/d') : null;
if ($att->duration != null && $date != null && $now->getMonth() == $date->getMonth()) {
[$h, $m, $s] = explode(':', $att->duration);
$tsec += $h * 3600 + $m * 60 + $s;
}
}
$hours = floor($tsec / 3600);
$minutes = floor(($tsec % 3600) / 60);
$seconds = $tsec % 60;
$totalTime = sprintf('%02d:%02d', $hours, $minutes);
$user->totaltime = $totalTime;
}
//dd($users);
foreach ($users as $u) {
$us = $u->attendances()
->whereNull('exited_at')
->latest('entered_at')
->exists();
$u->working = $us ? 1 : 0;
foreach ($u->attendances as $u_att) {
$break = AttendanceBreak::wherenull('break_end')->where('attendance_id', $u_att->id)->exists();
if ($break)
$u->working = 2;
}
}
//dd($users);
$users = $users->sortByDesc('working');
//$users = json_decode(json: $users);
// $users = collect($users);
$usersChunked = $users->chunk(3);
//dd($users);
?>
@extends('app')
@section('content')
<div class="container w-full flex flex-col items-center">
@if(!collect($reqs)->pluck('attendances')->flatten()->isEmpty())
<div class="mt-10 bg-white rounded-lg shadow-md max-w-[350px] flex flex-col items-center">
<p style="min-font-size: 30; text-align: center; margin-bottom: 10px">درخواست ها</p>
{{-- {{dd($reqs)}}--}}
@foreach ($reqs as $u)
@if(!empty($u['attendances']))
<button type="button"
class="w-[150px] p-3 font-bold text-white bg-blue-500 hover:bg-blue-700 rounded transition duration-150 text-center "
onclick="togglerequests('attendance-{{ $loop->index }}')"
style="margin: 10px 0; text-align: center; background-color: #00bcd4">
{{ $u['name'] }}
</button>
{{-- @else--}}
{{-- <p class="text-stone-400" style="text-align: center">درخواستی ثبت نشده</p>--}}
{{-- @break--}}
@endif
<div id="attendance-{{ $loop->index }}" class="hidden-content pt-4">
<table style="max-width: 350px; margin: auto; text-align: center" class="w-[350px] table-auto">
<thead>
<tr class="text-sm" style="background-color: #00a3ba; color: white; text-align: center;">
<th class="px-2 py-2 border w-1/6">درخواست</th>
<th class="px-2 py-2 border w-1/6">تاریخ</th>
<th class="px-2 py-2 border w-1/6">ورود</th>
<th class="px-2 py-2 border w-1/6">خروج</th>
<th class="px-2 py-2 border w-1/6">تعیین وضعیت</th>
</tr>
</thead>
<tbody>
{{-- {{dd($u['attendances'])}}--}}
@forelse($u['attendances'] as $rec)
<tr style="background-color: {{$rec->id=='new' ? 'lightblue' : 'white'}}">
<td class="px-4 py-2 border">{{ match ($rec->function) {
'edit' => "تغییر ساعت",
'delete' => "حذف",
'new' => "جدید",
default => "نامشخص",
} }}</td>
<td class="px-4 py-2 border">{{ Jalalian::fromCarbon(Carbon::parse($rec->oldenter))->format('Y/m/d') }}</td>
@if(Carbon::parse($rec->oldenter)->format('H:i') == Carbon::parse($rec->newenter)->format('H:i') || $rec->newenter=='')
<td class="px-4 py-2 border">{{ $rec->oldenter ? Carbon::parse($rec->oldenter)->format('H:i') : '-' }}</td>
@else
<td class="px-4 py-2 border">{{ $rec->oldenter ? ($rec->id=='new' || $rec->oldenter==($rec->newenter ?? '') ? Carbon::parse($rec->oldenter)->format('H:i') : Carbon::parse($rec->oldenter)->format('H:i').'👇🏻'.Carbon::parse($rec->newenter)->format('H:i')) : '-' }}</td>
@endif
@if(Carbon::parse($rec->oldexit)->format('H:i') == Carbon::parse($rec->newexit)->format('H:i') || $rec->newenter=='')
<td class="px-4 py-2 border">{{$rec->oldexit ? Carbon::parse($rec->oldexit)->format('H:i') : '-'}}</td>
@else
<td class="px-4 py-2 border">{{ $rec->oldexit ? ($rec->id=='new' || $rec->oldexit==($rec->newexit ?? '') ? Carbon::parse($rec->oldexit)->format('H:i') : Carbon::parse($rec->oldexit)->format('H:i').'👇🏻'.Carbon::parse($rec->newexit)->format('H:i')) : '-' }}</td>
@endif
{{-- @if(Carbon::parse($rec->oldenter)->format('H:i') == Carbon::parse($rec->newenter)->format('H:i') || $rec->newenter=='')--}}
{{-- {{}}--}}
{{-- <td class="px-4 py-2 border">{{ Carbon::parse($rec->oldenter)->format('H:i') }}</td>--}}
{{-- @else--}}
{{-- <td class="px-4 py-2 border">{{ $rec->oldenter ? ($rec->id=='new' ? Carbon::parse($rec->oldenter)->format('H:i') :Carbon::parse($rec->oldenter)->format('H:i').'👇🏻'.Carbon::parse($rec->newenter)->format('H:i')) : '-' }} </td>--}}
{{-- @endif--}}
{{-- @if(Carbon::parse($rec->oldexit)->format('H:i') == Carbon::parse($rec->newexit)->format('H:i') || $rec->newenter=='')--}}
{{-- <td class="px-4 py-2 border">{{Carbon::parse($rec->oldexit)->format('H:i')}}</td>--}}
{{-- @else--}}
{{-- <td class="px-4 py-2 border">{{ $rec->oldexit ? ($rec->id=='new' ? Carbon::parse($rec->oldexit)->format('H:i') :Carbon::parse($rec->oldexit)->format('H:i').'👇🏻'.$rec->newexit) : '-'}} </td>--}}
{{-- @endif--}}
<td class="px-4 py-2 border">
<form method="post" action="{{route('admin.update')}}">
@csrf
<input type="hidden" name="update" id="update" value="approve">
<input type="hidden" name="data" id="data"
value="{{json_encode($rec)}}">
<button class="bg-white rounded w-full"
style="background-color: #81ff65; margin-bottom: 5px">
تایید
</button>
</form>
<form method="post" action="{{route('admin.update')}}">
@csrf
<input type="hidden" name="update" id="update" value="reject">
<input type="hidden" name="data" id="data"
value="{{json_encode($rec)}}">
<button class="bg-white rounded w-full"
style="background-color: #ff6565">
رد
</button>
</form>
</td>
</tr>
@empty
<tr>
<td class="px-4 py-2 border text-center" colspan="6">هیچ رکوردی ثبت نشده</td>
</tr>
@endforelse
</tbody>
</table>
</div> {{-- پایان hidden-content --}}
@endforeach
{{-- @if(collect($reqs)->pluck('attendances')->flatten()->isEmpty())--}}
{{-- <p class="text-stone-400" style="text-align: center">درخواستی ثبت نشده</p>--}}
</div>
@endif
<div class="container" style="padding-top: 20px">
<div class="grid grid-cols-2 grid-rows-none ">
@foreach ($usersChunked as $chunk)
@foreach ($chunk as $u)
<div class="form m-6 justify-evenly rounded-lg shadow-md"
style="align-items: center; text-align: center; border: 2px solid
{{ $u->working == 1 ? '#16c8ce' : ($u->working == 2 ? 'orange' : 'white' ) }}; padding: 10px; ">
@php
@endphp
<a href="/admin/{{ $u->user_name }}"
class="bg-cyan-500/15 rounded-xl"
style="text-decoration: none; color: inherit;">
<h3 style="font-family:Tahoma; color:#333;">
{{ $u->name ?? $u->user_name }}
</h3>
<p>
کارکرد ماه جاری:
{{ $u->totaltime }}
</p>
</a>
<button type="button"
class="rounded-lg bg-cyan-500 hover:bg-cyan-600"
onclick="window.location.href='{{ url('attendance/profile').'?username='.$u->user_name }}'"
style=" border: none; color: white; padding: 5px 10px; text-align: center; text-decoration: none;
display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; ">
ویرایش
</button>
</div>
@endforeach
@endforeach
<a class="form m-6 justify-evenly rounded-lg shadow-md " href="{{route('admin.new')}}"
style="align-items: center; text-align: center; ">
<i class="fa-regular fa-plus "
style="font-size: 80px; width: 90%; height: 90%;"></i>
</a>
</div>
</div>
{{-- {{dd($reqs)}}--}}
{{--MODAL--}}
@endsection
@section('script')
<script>
// این تابع اکنون یک DIV را باز و بسته می‌کند
function togglerequests(elementId) {
var contentDiv = document.getElementById(elementId);
// بررسی می‌کند اگر عنصر دارای کلاس 'hidden-content' هست، آن را حذف و نمایش دهد، وگرنه اضافه و پنهان کند.
if (contentDiv.classList.contains('hidden-content')) {
contentDiv.classList.remove('hidden-content');
// اگر از Tailwind استفاده می‌کنید، ممکن است بخواهید: contentDiv.classList.remove('hidden');
} else {
contentDiv.classList.add('hidden-content');
// contentDiv.classList.add('hidden');
}
}
</script>
<style>
/* نیاز به این کلاس برای پنهان کردن اولیه محتوا */
.hidden-content {
display: none;
}
</style>
@endsection
+58
View File
@@ -0,0 +1,58 @@
@extends('app')
@section('content')
<div class=" flex flex-col items-center justify-center p-4 " dir="rtl"
style="padding-top: 50px">
<div class="bg-white p-6 md:p-8 rounded-2xl shadow-2xl w-full max-w-sm border-t-8 border-[#16c8ce]">
<div class="text-center mb-6">
<h1 class="text-2xl font-extrabold text-gray-800 border-b pb-2">کاربر جدید</h1>
</div>
<form id="attendanceForm" action="{{route('admin.new')}}" method="post" class="space-y-4">
@csrf
<div>
<label for="name" class="block text-sm font-medium text-gray-700">اسم:</label>
<input type="text" name="name" id="name" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-cyan-500 focus:border-cyan-500 sm:text-sm transition duration-150">
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">ایمیل:</label>
<input type="email" name="email" id="email" placeholder="example@domain.com"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-cyan-500 focus:border-cyan-500 sm:text-sm transition duration-150">
</div>
<div>
<label for="username" class="block text-sm font-medium text-gray-700">نام کاربری:</label>
<input type="text" name="username" id="username" placeholder="user_name" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-cyan-500 focus:border-cyan-500 sm:text-sm transition duration-150">
</div>
<div class="flex flex-col sm:flex-row sm:space-x-4 sm:space-x-reverse space-y-4 sm:space-y-0">
<div class="w-full sm:w-1/2">
<label for="chatid" class="block text-sm font-medium text-gray-700">چت آیدی تلگرام:</label>
<input type="text" name="chatid" id="chatid" placeholder="Telegram chat ID"
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-cyan-500 focus:border-cyan-500 sm:text-sm transition duration-150">
</div>
<div class="w-full sm:w-1/2">
<label for="number" class="block text-sm font-medium text-gray-700">شماره تماس:</label>
<input type="tel" name="number" id="number" placeholder=" ۰۹۱2xxxxxxx" pattern="[0-9]{11}" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-cyan-500 focus:border-cyan-500 sm:text-sm transition duration-150">
</div>
</div>
<button type="submit"
class="col-span-2 bg-cyan-500 hover:bg-cyan-700 cursor-pointer rounded-xl border border-400 justify-self-center text-white px-2 py-1.5">
ثبت اطلاعات
</button>
</form>
</div>
</div>
@endsection
Regular → Executable
+237 -81
View File
@@ -1,5 +1,13 @@
<?php
use App\Models\User;
if(isset($_COOKIE['token-0']))
$user_p = User::select('name')->where('user_name', $_COOKIE['user_identity'])->first();
//dd($user_p);
?>
<!doctype html>
<html lang="en" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport"
@@ -7,12 +15,25 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="{{url('/src/tailwindcss.js')}}"></script>
<title>سامانه حضور و غیاب</title>
{{--ساعت--}}
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/clockpicker/0.0.7/bootstrap-clockpicker.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clockpicker/0.0.7/bootstrap-clockpicker.min.js"></script>
{{--تاریخ--}}
<link rel="stylesheet" href="https://unpkg.com/persian-datepicker@1.2.0/dist/css/persian-datepicker.css">
<script src="https://unpkg.com/persian-date@1.1.0/dist/persian-date.js"></script>
<script src="https://unpkg.com/persian-datepicker@1.2.0/dist/js/persian-datepicker.js"></script>
<link rel="manifest" href="manifest.json">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@600&display=swap" rel="stylesheet">
<style>
/* Ignore CSS variable inspection */
:root {
@@ -21,6 +42,25 @@
--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;
@@ -32,6 +72,7 @@
position: relative;
}
.title {
padding-right: 28px;
font-size: 28px;
@@ -44,7 +85,8 @@
position: relative;
}
.title::before, .title::after {
.title::before,
.title::after {
content: "";
position: absolute;
height: 16px;
@@ -65,7 +107,8 @@
animation: pulse 1s linear infinite;
}
.message, .signin {
.message,
.signin {
color: rgba(88, 87, 87, 0.822);
font-size: 14px;
}
@@ -114,7 +157,8 @@
font-size: 0.9em;
}
.form label .input:focus + span, .form label .input:valid + span {
.form label .input:focus + span,
.form label .input:valid + span {
left: 10px;
top: 30px;
font-size: 0.7em;
@@ -145,6 +189,7 @@
transform: scale(0.9);
opacity: 1;
}
to {
transform: scale(1.8);
opacity: 0;
@@ -153,7 +198,8 @@
@font-face {
font-family: 'MyCustomFont';
src: url('{{url('/src/fonts/woff/iranyekanwebregularfanum.woff')}}') format('woff2'), url('{{url('/src/fonts/woff/iranyekanwebregularfanum.woff')}}') format('woff');
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;
}
@@ -176,59 +222,157 @@
max-width: 420px;
width: 100%;
}
/* Style the tab */
.tab {
overflow: hidden;
/*border: 1px solid #ccc;*/
/*background-color: #f1f1f1;*/
}
/* Style the buttons inside the tab */
.tab button {
background-color: #cfcfcf;
float: left;
border: 1px solid rgba(0, 0, 0, 0);
outline: none;
cursor: pointer;
padding: 10px 16px 8px 16px;
transition: 0.3s;
font-size: 17px;
}
/* Change background color of buttons on hover */
.tab button:hover {
background-color: #ededed;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: #feffff;
}
/* Style the tab content */
.tabcontent {
display: none;
padding: 0px 0px;
/*border: 1px solid #ccc;*/
border-top: none;
}
</style>
@yield('style')
</head>
<body>
@if (session('message'))
<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: 80%;">
{{ session('message.text') }}
</div>
<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"
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="max-width: 420px; width: 100%; ">
@if(url()->current() != url('/tasks'))
<div class="flex mr-6 object-right-bottom bottom-20 fixed z-10 ">
<a class="bg-cyan-500 rounded-full size-14 flex justify-center items-center "
href="/tasks">
<i class=" fa-solid fa-list-check " style="color: white"></i>
</a>
</div>
@endif
<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">
<label>wolog</label>
{{-- <label>{{$user->name}}</label>--}}
{{-- @if(isset($_COOKIE['token_0']) || isset($_COOKIE['token_1']) || isset($_COOKIE['token_2']))--}}
{{-- <label style="font-size: 12px">({{ $user->type == 0 ? 'ادمین' : ($user->type == 1 ? 'میزبان' :($user->type == 2 ? 'دعوت کننده' : 'مهمان')) }}--}}
{{-- )</label>--}}
{{-- @endif--}}
<div class="headerItems flex items-center justify-between text-white">
<!-- Logout -->
<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-[#16c8ce] 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
<button type="button" onclick="submitForm('logout')"><i class="fa-solid fa-right-from-bracket text-white"></i></button>
<button type="button" onclick="submitForm('', 'GET')"><i class="fa-solid fa-house text-white"></i></button>
{{-- @if(isset($attendance_recorder) and $attendance_recorder == 1 or true)--}}
<button type="button" onclick="submitForm('edit')"><i class="fa-solid fa-user text-white"></i></button>
</form>
</div>
@endif
{{-- @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 = `{{ url('/') }}/${action}`;
form.action = `${action}`;
form.method = method; // Sets method dynamically
if (method === 'GET') {
window.location.href = form.action; // Redirect for GET request
@@ -238,58 +382,70 @@
}
</script>
{{-- {{dd(session('admin'))}}--}}
@yield('content')
<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
{{-- <div class="flex justify-center items-center mt-20">--}}
{{-- @if(!request()->is("admin") && (isset($_COOKIE['ad']) && $_COOKIE['ad']==1))--}}
// 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}`
{{-- onclick="window.location.href='{{ route('admin.dashboard') }}'">--}}
{{-- ورود به پنل ادمین--}}
{{-- </button>--}}
// Show the modal
document.getElementById('modal-container').classList.remove('hidden')
}
{{-- @elseif(request()->is("admin") && (isset($_COOKIE['ad']) && $_COOKIE['ad']==1))--}}
{{-- <button class=" bg-white rounded-[23px] shadow-lg flex justify-center px-4 py-2"--}}
{{-- style="max-width: 150px; margin: 0 0 20px 0"--}}
{{-- onclick="window.location.href='/'">--}}
{{-- ثبت ساعت کاری--}}
{{-- </button>--}}
{{-- @endif--}}
{{-- </div>--}}
// Close modal function
function closeModal() {
document.getElementById('modal-container').classList.add('hidden')
}
@yield('content')
<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
// Close modal when clicking outside the modal content
document.getElementById('modal-container').addEventListener('click', (e) => {
if (e.target === document.getElementById('modal-container')) {
closeModal()
// 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')
}
})
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
// Close modal function
function closeModal() {
document.getElementById('modal-container').classList.add('hidden')
}
})
</script>
@yield('script')
// 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>
@yield('script')
</div>
</body>
</html>
</html>
+696 -265
View File
File diff suppressed because it is too large Load Diff
+532
View File
@@ -0,0 +1,532 @@
<!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>
@@ -0,0 +1,70 @@
@extends('app')
@section('content')
{{-- {{dd($user)}}--}}
<div class="w-full mt-[90px] justify-center container flex">
<div class="bg-white w-[350px] p-6 rounded-xl ">
<img src="/assets/img/bg/bg-shape.jpg" class="rounded-full w-32 h-32 mx-auto pb-6" alt="">
{{-- <p class=""> تاریخ شروع همکاری:--}}
{{-- {{\Morilog\Jalali\Jalalian::fromCarbon(\Carbon\Carbon::parse($user->created_at))->format('Y/m/d')}}</p>--}}
@if ($errors->has('password'))
<div class="mt-3 mb-3 text-red-500 text-sm justify-self-center ">
<label>
{{ $errors->first('password') }}
</label>
</div>
@endif
<form action="{{route('edit.profile')}}" method="post" class="grid grid-cols-2 gap-2 justify-items-stretch content-between text-sm indent-2.5 align-middle divide">
{{-- align-center text-sm text-start">--}}
{{-- <div class="grid grid-cols-2 h-64 gap-2 justify-items-stretch content-between text-sm indent-2.5 align-middle divide">--}}
@csrf
<label class="pb-3">نام و نام خانوادگی:</label>
<input type="text" name="name" value="{{ $user->name ?? '' }}"
placeholder="نام و نام خانوادگی"
class="border border-gray-300 rounded-md text-center">
<label class="pb-3">ایمیل:</label>
<input type="email" name="email" value="{{ $user->email ?? '' }}"
placeholder="ایمیل"
class="border border-gray-300 rounded-md text-center">
<label class="pb-3">شماره تماس:</label>
<input type="tel" name="number" value="{{ $user->number ?? '' }}"
placeholder="شماره تماس"
pattern="^09\d{9}$"
class="border border-gray-300 rounded-md text-center" required>
<label class="pb-3">چت آیدی تلگرام:</label>
<input type="text" pattern="\d+" name="chatid" value="{{ $user->chatid ?? '' }}"
placeholder="چت آیدی تلگرام"
class="border border-gray-300 rounded-md text-center">
<label class="pb-3">رمز عبور:</label>
<input type="password" name="password" value="{{ $user->password ?? '' }}"
placeholder="رمز عبور"
class="input border border-gray-300 rounded-md text-center">
<input type="password" name="password_confirmation"
placeholder="تکرار رمز عبور"
class="input border border-gray-300 rounded-md text-center col-start-2 min-h-8">
@if(!empty($_COOKIE['ad']) && $_COOKIE['ad'] == 1)
<label class="pb-3">نقش کاربری:</label>
<select name="role" class="border border-gray-300 rounded-md text-center">
<option value="0" {{ $user->is_admin == 0 ? 'selected' : '' }}>کارمند</option>
<option value="1" {{ $user->is_admin == 1 ? 'selected' : '' }}>ادمین</option>
</select>
@endif
<button type="submit"
class="col-span-2 bg-cyan-500 hover:bg-cyan-700 cursor-pointer
rounded-xl border border-400 justify-self-center
p-1.5 text-white">
ثبت تغییرات
</button>
{{-- </div>--}}
</form>
</div>
</div>
@endsection
+106
View File
@@ -0,0 +1,106 @@
<?php
use Morilog\Jalali\Jalalian;
use Carbon\Carbon;
//dd($data);
$monthlyTotals = [];
foreach ($data as $month => $attendances) {
$tsec = 0;
foreach ($attendances as $attendance) {
// اگر duration موجود باشه استفاده می‌کنیم
if (!empty($attendance->duration)) {
[$h, $m, $s] = explode(':', $attendance->duration);
$tsec += (int)$h * 3600 + (int)$m * 60 + (int)$s;
}
}
$hours = floor($tsec / 3600);
$minutes = floor(($tsec % 3600) / 60);
$seconds = $tsec % 60;
// ذخیره در آرایه جدید با کل زمان ماه
$monthlyTotals[$month] = sprintf('%02d:%02d', $hours, $minutes);
}
//dd($monthlyTotals);
?>
@extends('app')
@section('content')
<div class="container inline-flex flex-col items-center justify-center ">
@if(empty($data))
<div class="mt-80 text-gray-500 text-xl font-bold italic">
<h1>اطلاعاتی موجود نمیباشد</h1>
</div>
@else
<div class="tab rounded-t-2xl max-w-[350px] mx-auto flex"
style="margin-top: 80px; max-width: 350px">
@foreach(array_keys($data) as $month)
<button class="tablinks active rounded-t-2xl cursor-pointer" onclick="openCity(event, '{{$month}}')">{{$month}}</button>
@endforeach
</div>
@foreach($data as $month => $records)
<div id="{{$month}}" class="tabcontent w-[350px] bg-white rounded-b-xl rounded-tl-2xl cursor-default leading-7" style="">
<table class="" style="width:100%; border-collapse: collapse;text-align: center">
<thead>
<tr class="" style="border-bottom: 1px solid #ddd;">
<th style="border-right: 1px solid #ddd;">تاریخ</th>
<th style="border-right: 1px solid #ddd;">روز</th>
<th style="border-right: 1px solid #ddd;">ورود</th>
<th style="border-right: 1px solid #ddd;">خروج</th>
<th style="border-right: 1px solid #ddd;">مدت</th>
</tr>
</thead>
<tbody >
@foreach($records as $row)
<tr class="hover:bg-cyan-500" style="border-bottom: 1px solid #ddd;">
<td style="border-right: 1px solid #ddd;">{{ Jalalian::fromCarbon(\Carbon\Carbon::parse($row->entered_at))->format('m/d') ?? '-' }}</td>
<td style="border-right: 1px solid #ddd;">{{ Jalalian::fromCarbon(\Carbon\Carbon::parse($row->entered_at))->format('%A') ?? '-' }}</td>
<td style="border-right: 1px solid #ddd;">{{ \Carbon\Carbon::parse($row->entered_at)->format('H:i') ?? '-' }}</td>
<td style="border-right: 1px solid #ddd;">{{ $row->exited_at ? \Carbon\Carbon::parse($row->exited_at)->format('H:i') : '-' }}</td>
<td style="border-right: 1px solid #ddd;">{{ $row->exited_at ? \Carbon\Carbon::parse($row->duration)->format('H:i') : '-' }}</td>
</tr>
@endforeach
<tr>
<td colspan="5" class="hover:bg-cyan-500 rounded-b-xl" style="border-top: 1px solid #ddd; text-align: center; ">
مجموع کارکرد این ماه: {{$monthlyTotals[$month]}}
</td>
</tr>
</tbody>
</table>
</div>
@endforeach
@endif
</div>
<script>
function openCity(evt, Month) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(Month).style.display = "block";
evt.currentTarget.className += " active";
}
// باز کردن اولین تب به صورت پیش‌فرض
document.addEventListener("DOMContentLoaded", function () {
let firstTab = document.querySelector(".tablinks"); // اولین دکمه
if (firstTab) {
firstTab.click(); // همون اول کلیک مجازی بخوره
}
});
</script>
@endsection
+70
View File
@@ -0,0 +1,70 @@
<?php
use Morilog\Jalali\Jalalian;
use Carbon\Carbon;
?>
@extends('app')
@section('content')
<div class="container w-full flex justify-center items-center flex-col ">
{{-- {{dd(count($tasks))}}--}}
@if(count($tasks) > 0)
<div class="bg-white p-4 rounded-lg shadow-md mt-10 w-[350px] text-center">
<h1 class="text-xl font-bold">
وظیفه ها
</h1>
</div>
@foreach($tasks as $t)
{{-- <div class="bg-white p-4 rounded-lg shadow-md mt-[10px] w-[350px] text-center">--}}
{{-- <button type="button"--}}
{{-- onclick="togglerequests('attendance-{{ $loop->index }}')"--}}
{{-- class="mt-[0px]">--}}
{{-- hi--}}
{{-- </button>--}}
{{-- </div>--}}
<div class="bg-white p-4 rounded-lg shadow-md mt-[10px] w-[350px] text-center flex flex-col items-center">
<button type="button"
onclick="togglerequests('name-{{ $loop->index }}')"
class="">
{{$t->name}}
</button>
{{-- @endforeach--}}
{{-- @foreach($tasks as $t)--}}
<div id="name-{{ $loop->index }}" class="hidden border-gray-300 border-t-2 border-dotted">
<div class=" w-[350px] text-center">
<p class="mt-2 text-gray-600">
توضیحات: {!! $t->description_html !!}
</p>
@if(isset($t->start_date))
<p class="mt-2 text-gray-600">
تاریخ شروع: {{$t->start_date}}
</p>
@endif
@if(isset($t->target_date))
<p class="mt-2 text-gray-600">
تاریخ
پایان: {{$t->target_date ? Jalalian::fromCarbon(Carbon::parse($t->target_date))->format('Y/m/d') : ''}}
</p>
@endif
</div>
</div>
</div>
@endforeach
@else
<div class=" mt-[200px]">
<h1 class=" text-xl font-bold" style="color: #959595">وظیفه ای ندارید</h1>
</div>
@endif
</div>
<script>
function togglerequests(elementId) {
var contentDiv = document.getElementById(elementId);
contentDiv.classList.toggle('hidden'); // همین یه خط کافیست
}
</script>
@endsection
View File