Commit 68074c33 authored by Julien Ait azzouzene's avatar Julien Ait azzouzene
Browse files

feat: prevent diving director to edit certains fields in the security sheet

parent fecc580d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -104,13 +104,23 @@ private function callView(string $ds_code, string $viewName){
            ];
        }

        $userRole = 'DIR';
        $roles = session('user')->roles;
        foreach($roles as $role){
            if($role->ROL_CODE === 'RES'){
                $userRole = 'RES';
                break;
            }
        }

        return view($viewName, [
            'dive' => $dive,
            'director' => $director,
            'surfaceSecurity' => $surfaceSecurity,
            'driver' => $driver,
            'location' => $location,
            'divingGroups' => $divingGroupsForView
            'divingGroups' => $divingGroupsForView,
            'userRole' => $userRole 
        ]);
    }

+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ static public function sessionsWithFilledFile():array

    static public function sessionsWithFilledFileWithId():array
    {
        $res =  DB::table('CAR_DIVING_SESSION')->where('US_ID',session('user')->US_ID)->get();
        $res =  DB::table('CAR_DIVING_SESSION')->where('US_ID_CAR_DIRECT',session('user')->US_ID)->get();
        return $res->toArray();
    }

+16 −2
Original line number Diff line number Diff line
@@ -106,7 +106,14 @@ class="dg-start border-2 border-solid border-gray-500" type="time"
                        <td class="px-12 py-4">
                            <input id="dg{{ $groupNumber }}-act-time" class="dg-act-time" type="number"
                                value = "{{ $divingGroup['group']->DG_EFFECTIVE_DIVING_DURATION }}"
                                style="font-size: 20px;width: 50%;-moz-appearance: textfield;text-align: center;background-color: var(--yellow);padding: 10px;border-radius: 10px;">
                                @unless ($userRole === 'RES') disabled="disabled" @endif
                                style="font-size: 20px;width: 50%;-moz-appearance: textfield;text-align: center;background-color: 
                                @if ($userRole === 'RES')
                                    var(--yellow);
                                @else
                                    var(--grey);
                                @endif
                                padding: 10px;border-radius: 10px;">
                        </td>
                    </tr>

@@ -121,8 +128,15 @@ class="dg-start border-2 border-solid border-gray-500" type="time"
                        </td>
                        <td class="px-12 py-4">
                            <input
                                style="font-size: 20px;width: 50%;-moz-appearance: textfield;text-align: center;background-color: var(--yellow);padding: 10px;border-radius: 10px;"
                                style="font-size: 20px;width: 50%;-moz-appearance: textfield;text-align: center;background-color: 
                                @if ($userRole === 'RES')
                                    var(--yellow);
                                @else
                                    var(--grey);
                                @endif
                                padding: 10px;border-radius: 10px;"
                                id="dg{{ $groupNumber }}-act-dep" class="dg-act-dep" type="number"
                                @unless ($userRole === 'RES') disabled="disabled" @endif
                                value = "{{ $divingGroup['group']->DG_MAX_EFFECTIVE_DEPTH }}">
                        </td>
                    </tr>