Commit 0492b40d authored by Julien Ait azzouzene's avatar Julien Ait azzouzene
Browse files

Merge remote-tracking branch 'origin/master' into merge-palanquee

parents 7744eb7e 0ac612f8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@ public static function add($request)
    {
        $dv = new DivingSession();
        
        $dv->DS_CODE = 'DS'.sizeof(DivingSession::all())+1;
        $divingSessionCount = DivingSession::count();

        $dv->DS_CODE = 'DS' . ($divingSessionCount + 1);
        $dv->US_ID = $request->pilot;
        $dv->DL_ID = $request->location;
        $dv->BO_ID = $request->boat;
+38 −2
Original line number Diff line number Diff line
@@ -56,15 +56,26 @@ public function update(string $ds_code, Request $request){

        $divingSession = DivingSession::find($ds_code);
        $divingSession->DS_OBSERVATION_FIELD = $data['observation'];
        $divingSession->save();

        $filled = true;

        foreach($data as $groupNumber => $groupData){
            if(! is_array($groupData)){
                continue;
            }
            self::updateDivingGroup($ds_code, $groupNumber, $groupData);
            if(! self::isFilledGroup($groupData)){
                $filled = false;
            }
        }

        if(! $divingSession->DS_OBSERVATION_FIELD){
            $filled = false;
        }

        $divingSession['DS_FILE_FILLED'] = $filled ? 1 : 0;
        $divingSession->save();

        self::setStrategy(new StoreSilentStrategy);
        self::generate($ds_code);
    }
@@ -104,13 +115,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 
        ]);
    }

@@ -130,4 +151,19 @@ private function updateDivingGroup(string $ds_code, $dg_number, array $divingGro
                'DG_MAX_EFFECTIVE_DEPTH' => $divingGroup['dg-act-dep']
            ]);
    }

    private function isFilledGroup(array $divingGroup): bool{
        return 
            $divingGroup['dg-start'] 
            &&
            $divingGroup['dg-end'] 
            &&
            $divingGroup['dg-exp-time'] 
            &&
            $divingGroup['dg-exp-dep'] 
            &&
            $divingGroup['dg-act-time'] 
            &&
            $divingGroup['dg-act-dep'];
    }
}
+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();
    }

+25 −0
Original line number Diff line number Diff line
@@ -76,6 +76,31 @@ .clickableRed:hover{
    color: var(--white)
}


.clickableBlue{
    background-color: #909aef;
    color: var(--black);
    transition: all 0.4s ease-out;
}

.clickableBlue:hover{
    color: var(--white);
    cursor: pointer;
    background-color: #515dcc;
}

.clickablePink{
    background-color: #e882e1;
    color: var(--black);
    transition: all 0.4s ease-out;
}

.clickablePink:hover{
    color: var(--white);
    cursor: pointer;
    background-color: rgb(207, 96, 199);
}

.aligne{
    display: flex;
    align-items: center;
+17 −0
Original line number Diff line number Diff line
function openForm() {
    document.getElementById("popupForm").style.display = "block";
    document.getElementById("popupForm").style.zIndex = "100000000";
   

    if(!document.getElementById('fullPageDiv')){
        const fullPageDiv = document.createElement('div');
        fullPageDiv.id = 'fullPageDiv';
        fullPageDiv.style.width = "100vw";
        fullPageDiv.style.zIndex = "1000001";
        fullPageDiv.style.position = "absolute";
        fullPageDiv.style.height = "100vh";
        fullPageDiv.style.backgroundColor = "rgba(0, 0, 0, 0.4)";
        document.body.appendChild(fullPageDiv);
    }
}

function closeForm() {
    if(document.getElementById('fullPageDiv')){
        document.body.removeChild(document.getElementById('fullPageDiv'));
    }

    document.getElementById("popupForm").style.display = "none";
}
 No newline at end of file
Loading