Commit ea69ab2f authored by Waterfox's avatar Waterfox
Browse files

Merge branch 'UpgradeUserManager'

parents 15b8785d 14ba9d8c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
use App\Models\RoleAttribution;
use App\Models\User;
use Illuminate\Http\Request;
use App\Models\DivingNumberModel;

class ManageAdherentController extends Controller {
    function index() {
@@ -12,6 +13,7 @@ function index() {

        $user_role = array();
        $usersInfos = array();
        $userDives = array();

        foreach ($users as $user) {
            $usersInfos[$user->US_ID] = [$user->US_ID, $user->US_FIRST_NAME, $user->US_NAME];
@@ -19,10 +21,17 @@ function index() {
                $user_role[$user->US_ID] = array();
            }
            $user_role[$user->US_ID][] = $user->ROL_CODE;
            $usersCount = DivingNumberModel::join('CAR_REGISTRATION', 'CAR_USER.us_id', '=', 'CAR_REGISTRATION.us_id')
                ->join('CAR_DIVING_SESSION', 'CAR_REGISTRATION.ds_code', '=', 'CAR_DIVING_SESSION.ds_code')
                ->where('CAR_USER.us_id', $user->US_ID)
                ->whereYear('CAR_DIVING_SESSION.ds_date', '=', now()->year)
                ->count();
            $userDives[$user->US_ID] = $usersCount;
        }

        $users = [$usersInfos, $user_role];

        return view('manageAdherent', ['users' => $users]);
        return view('manageAdherent', ['users' => $users, 'usersDives' => $userDives]);
    }

    function update(Request $request) {
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
                        <th scope="col" class="px-6 py-3">Sécurité surface</th>
                        <th scope="col" class="px-6 py-3">Pilote</th>
                        <th scope="col" class="px-6 py-3">Directeur de plongée</th>
                        <th scope="col" class="px-6 py-3">Nombre de plongées</th>
                    </tr>
                </thead>
                <tbody>
@@ -48,6 +49,9 @@
                                    name="checkbox_{{ $users[0][$i][0] }}_DIR" value="DIR"
                                    @if (array_search('DIR', $users[1][$i]) !== false) checked @endif>
                            </td>
                            <td class="px-6 py-4">
                                {{$usersDives[$i]}}
                            </td>
                        </tr>
                    @endforeach
                </tbody>
+5 −3
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@
    <div style="display : flex; flex-direction: row">
        <div style="width: 50%; margin-right: 50px; height: 100%; display:flex; align-items: center; flex-direction: column">
            <img src="{{ asset('/images/Diver1.png') }}" alt="Diver illustration">
            <div style="width: 100%">
                @if(isset($error))
                    <x-popup bgPopup="var(--bad)">{{$error}}</x-popup>
                @endif
            </div>
        </div>

        <form action="/dive/update/{{$dive->DS_CODE}}" method="POST" style="width: 70%;">
@@ -187,9 +192,6 @@ class="clickableDelete clickable block w-full max-w-xs mx-auto bg-red-400 hover:
                </form>
            </div>
        </form>
        @if(isset($error))
            <x-popup>{{$error}}</x-popup>
        @endif
    </div>

    <script src="{{ asset('/js/create_div.js') }}"></script>