Commit a90b1b9f authored by LucBUTGH's avatar LucBUTGH
Browse files

feat: page sessions security done + role header added

parent 87993c70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class DivingSession extends Model

    static public function sessionsWithFilledFile():array
    {
        $res =  DB::table('CAR_DIVING_SESSION')->where('DS_FILE_FILLED', 1)->get();
        $res =  DB::table('CAR_DIVING_SESSION')->get();
        return $res->toArray();
    }

+11 −0
Original line number Diff line number Diff line
@@ -45,6 +45,17 @@ public function roles()
        return $this->belongsToMany(Role::class, RoleAttribution::class, 'US_ID', 'ROL_CODE');
    }

    public function getRole() {
        return User::select('CAR_ROLE.ROL_LABEL')
            ->join('CAR_ROLE_ATTRIBUTION', 'CAR_USER.US_ID', '=', 'CAR_ROLE_ATTRIBUTION.US_ID')
            ->join('CAR_ROLE', 'CAR_ROLE_ATTRIBUTION.ROL_CODE', '=', 'CAR_ROLE.ROL_CODE')
            ->where('CAR_USER.US_ID',session('user')->US_ID)
            ->pluck('CAR_ROLE.ROL_LABEL')
            ->first();    }
    
    
    

    /**
     * Check if the user has a given role.
     *
+3 −0
Original line number Diff line number Diff line
@@ -26,7 +26,10 @@ class="w-8 h-8 rounded-full py-2 font-bold text-white">{{ substr(session('user')
                    <div class="px-4 py-3">
                        <span
                            class="block text-sm text-white">{{ session('user')->US_FIRST_NAME . " " . session('user')->US_NAME }}</span>
                            <span class="mb-2 mt-2 italic block text-sm truncate text-white">{{ session('user')->getRole() }}</span>

                            <span class="block text-sm truncate text-gray-400">{{ session('user')->US_EMAIL }}</span>

                    </div>
                    <ul class="py-2" aria-labelledby="user-menu-button">
                        <li>
+39 −2
Original line number Diff line number Diff line
@@ -17,9 +17,46 @@
                        <td class="px-6 py-4">{{ $session->DS_DATE }}</td>
                        <td class="px-6 py-4">{{ $session->DS_CODE }}</td>
                        @if($session->DS_FILE_FILLED == 1)
                            <td class="px-6 py-4">Pas rempli</td>
                            <td class="px-6 py-4 flex items-center justify-between">Rempli
                                <span class="flex items-center">
                                    <!-- Second Icon -->
                                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 w-6 h-6">
                                        <path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" />
                                    </svg>
                            
                                    <!-- Third Icon -->
                                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
                                        <path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
                                    </svg>
                                </span>
                            </td>
                            
                        @elseif($session->DS_FILE_FILLED == 0)
                            <td class="px-6 py-4">Rempli</td>
                        <td class="px-6 py-4 flex items-center justify-between">
                            <span class="flex items-center">
                                <!-- Text and First Icon -->
                                <span class="mr-2">Pas rempli</span>
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
                                </svg>
                            </span>
                        
                            <span class="flex items-center">
                                <!-- Second Icon -->
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mr-2 w-6 h-6">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3" />
                                </svg>
                        
                                <!-- Third Icon -->
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
                                    <path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
                                </svg>
                            </span>
                        </td>
                        
                        
                        
                            
                        @endif
                    </tr>
                @endforeach