NASER add admin levels & fix break button

This commit is contained in:
mobin
2026-04-08 09:22:17 +00:00
parent a6b5f27343
commit fcc50d8ec8
8 changed files with 8543 additions and 8374 deletions
+38 -31
View File
@@ -42,7 +42,7 @@ foreach ($users as $u) {
else
$us = false;
$u->working = $us ? 1 : 0;
}else
} else
$u->working = 0;
foreach ($u->attendances as $u_att) {
@@ -93,7 +93,9 @@ $usersChunked = $users->chunk(3);
<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>
@if($userType == 'admin')
<th class="px-2 py-2 border w-1/6">تعیین وضعیت</th>
@endif
</tr>
</thead>
@@ -115,7 +117,7 @@ $usersChunked = $users->chunk(3);
$newEnter = $rec->newenter ? Carbon::parse($rec->newenter)->format('H:i') : null;
$oldExit = $rec->oldexit ? Carbon::parse($rec->oldexit)->format('H:i') : null;
$newExit = $rec->newexit ? Carbon::parse($rec->newexit)->format('H:i') : null;
@endphp
@endphp
@if( $oldEnter == $newEnter || $newEnter == null)
<td class="px-4 py-2 border">{{ $oldEnter ?? '-' }}</td>
@@ -129,28 +131,30 @@ $usersChunked = $users->chunk(3);
<td class="px-4 py-2 border">{{ $oldExit || $newExit ? ($rec->id=='new' || $oldExit==($newExit ?? '') ? $oldExit : $oldExit.'👇🏻'.$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>
@if($userType == 'admin')
<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>
@endif
</tr>
@empty
<tr>
@@ -196,13 +200,16 @@ $usersChunked = $users->chunk(3);
</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;
@if($userType == 'admin')
<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>
ویرایش
</button>
@endif
</div>
@endforeach
+36 -36
View File
@@ -8,35 +8,35 @@ use Carbon\Carbon;
use Illuminate\Support\Collection;
if (!empty($user->tasks)) {
$in_progress = '#fca000';
$todo = '#7d7d7d';
$error = '#fc0000';
$backlog = '#bababa';
$done = '#40de02';
$cancelled = 'black';
$state = [
"c73c2044-ea14-42cb-b08d-cecf3d1fdfb5" => "$in_progress",// in progress
"a9ce312f-cfca-491e-8e3d-1975aa6ebc10" => "$todo",//to do
"dea1fb57-a281-4fe7-8f3e-ee5567637e35" => "$error",// error
"770fbe42-99f6-41db-9b9e-773d9cced1a5" => "$backlog",//backlog
"b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0" => "$done",//done
"d61d14a3-72f7-4f44-894b-efe8b2a75be1" => "$cancelled",//canceled
];
$state_order = [
"c73c2044-ea14-42cb-b08d-cecf3d1fdfb5",
"a9ce312f-cfca-491e-8e3d-1975aa6ebc10",
"dea1fb57-a281-4fe7-8f3e-ee5567637e35",
"770fbe42-99f6-41db-9b9e-773d9cced1a5",
"b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0",
"d61d14a3-72f7-4f44-894b-efe8b2a75be1",
];
$user->tasks = $user->tasks->sortBy(function ($task) use ($state_order) {
return array_search($task->state, $state_order);
});
}
//if (!empty($user->tasks)) {
// $in_progress = '#fca000';
// $todo = '#7d7d7d';
// $error = '#fc0000';
// $backlog = '#bababa';
// $done = '#40de02';
// $cancelled = 'black';
//
// $state = [
// "c73c2044-ea14-42cb-b08d-cecf3d1fdfb5" => "$in_progress",// in progress
// "a9ce312f-cfca-491e-8e3d-1975aa6ebc10" => "$todo",//to do
// "dea1fb57-a281-4fe7-8f3e-ee5567637e35" => "$error",// error
// "770fbe42-99f6-41db-9b9e-773d9cced1a5" => "$backlog",//backlog
// "b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0" => "$done",//done
// "d61d14a3-72f7-4f44-894b-efe8b2a75be1" => "$cancelled",//canceled
// ];
// $state_order = [
// "c73c2044-ea14-42cb-b08d-cecf3d1fdfb5",
// "a9ce312f-cfca-491e-8e3d-1975aa6ebc10",
// "dea1fb57-a281-4fe7-8f3e-ee5567637e35",
// "770fbe42-99f6-41db-9b9e-773d9cced1a5",
// "b0e464e1-34eb-41ea-b2f7-3ef7483bc9f0",
// "d61d14a3-72f7-4f44-894b-efe8b2a75be1",
// ];
//
// $user->tasks = $user->tasks->sortBy(function ($task) use ($state_order) {
// return array_search($task->state, $state_order);
// });
//}
//dd(count($break = $user->attendanceBreaks));
if (count($user->attendanceBreaks) > 0){
$break = $user->attendanceBreaks[0];
@@ -111,13 +111,13 @@ if (count($user->attendanceBreaks) > 0){
</button>
{{--<p>{{Carbon::now()}}</p>--}}
</form>
@if(session('open_task_modal'))
<script>
window.onload = () => {
openTaskModal();
};
</script>
@endif
{{-- @if(session('open_task_modal'))--}}
{{-- <script>--}}
{{-- window.onload = () => {--}}
{{-- openTaskModal();--}}
{{-- };--}}
{{-- </script>--}}
{{-- @endif--}}
@else