Skip to content

Commit

Permalink
DONE invitation management view
Browse files Browse the repository at this point in the history
  • Loading branch information
ClawdeenFleury committed Dec 16, 2023
1 parent 429aba1 commit 8be45e2
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 4 deletions.
9 changes: 9 additions & 0 deletions calm-webserver/resources/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
}
}

/* INVITATION MANAGEMENT */
.disable-line td {
opacity: 0.5;
}

.disable-line td:has(button) {
opacity: 1;
}


/*
Users management
Expand Down
31 changes: 31 additions & 0 deletions calm-webserver/resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,34 @@ import 'flowbite';
form.action = "/management/reservations/" + button.dataset.reservationId;
}

/**
* Toggle the display of invitation lines based on the checkbox state.
*/
function toggleInvitaionDisplay()
{
const getAllDisabledLines = getElements(".disable-line td");
if(this.checked)
{
// Hide all table cells in disabled rows
getAllDisabledLines.forEach((element) => {
element.style.display = "none";
});
}
else
{
getAllDisabledLines.forEach((element) => {

// Determine the display type based on screen width
let typeDisplay = "block";
if(window.matchMedia('(min-width: 1024px)').matches)
{
typeDisplay = "table-cell";
}
element.style.display = typeDisplay;
});
}
}

/**
* Main program
*/
Expand Down Expand Up @@ -133,5 +161,8 @@ import 'flowbite';
deleteUserReservation(button, getElement("#delete-user-reservation-form"))
});
});

const toggleInvitationShow = getElement("#showOnlyActivateInvitations");
addEvent(toggleInvitationShow, "change", toggleInvitaionDisplay);
}()); //mainProgram
}()); //Main IIFE
7 changes: 4 additions & 3 deletions calm-webserver/resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
@section('content')
<h1 class="font-title text-4xl text-center my-3 text-seaNymph">Qu'est-ce que CALM ?</h1>
<p class="text-justify">
<strong>C</strong>apable and <strong>A</strong>ccessible <strong>L</strong>aundry <strong>M</strong>anager
(CALM) est une application web permettant la gestion de buanderies dans les immeubles locatifs. Elle proposerait
en particulier la planification horaire et la gestion des réservations.
<strong class="text-seaNymph">C</strong>apable and <strong class="text-seaNymph">A</strong>ccessible
<strong class="text-seaNymph">L</strong>aundry <strong class="text-seaNymph">M</strong>anager (CALM) est une
application web permettant la gestion de buanderies dans les immeubles locatifs. Elle propose en
particulier la planification horaire et la gestion des réservations.
</p>

<h1 class="font-title text-4xl text-center my-3 text-seaNymph">Notre équipe</h1>
Expand Down
2 changes: 1 addition & 1 deletion calm-webserver/resources/views/layout/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class="block py-2 pl-3 pr-4 rounded hover:bg-rollingStone md:hover:bg-transparen
@can('admin')
<li>
<a href="{{ route('management.organizations.index') }}"
class="block py-2 pl-3 pr-4 rounded hover:bg-rollingStone md:hover:bg-transparent md:hover:text-rollingStone md:p-0">Gestion
class="block py-2 pl-3 pr-4 rounded hover:bg-rollingStone md:hover:bg-transparent md:hover:text-rollingStone md:p-0 {{ $page === 'organizations' ? 'md:text-rollingStone bg-rollingStone md:bg-transparent' : '' }}">Gestion
des organisations</a>
</li>
@endcan
Expand Down
112 changes: 112 additions & 0 deletions calm-webserver/resources/views/management/invitation/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
@extends('layout.app')
@section('content')

<!-- TODO Update the organizations\index.php to add right link to this view -->

<div class="flex flex-col gap-4 items-center justify-center">
<article class="container flex flex-col items-gap-4 w-full mx-auto rounded-sm">
<div class="flex flex-col gap-4 items-center justify-center">
<h1 class="font-title text-4xl text-center mt-3 text-seaNymph">Gestion des invitations de l'organisation</h1>

<div class="relative overflow-x-auto w-full shadow-md sm:rounded-lg">
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400">
<caption class="p-5 text-justify dark:text-white dark:bg-gray-800">
Voici la liste de tous les <strong class="text-seaNymph">codes d'invitations</strong>
ayant permis aux utilisateurs d'entrer dans votre organisation.

<div class="pt-4 text-center lg:text-right">
<label class="relative inline-flex items-center mr-5 cursor-pointer">
<input type="checkbox" name="showOnlyActivateInvitations" value="showOnlyActivateInvitations"
id="showOnlyActivateInvitations" class="sr-only peer choose-wash-dry" {{ old('showOnlyActivateInvitations') ? 'checked' : '' }}>
<div class="toggle-switch peer peer-focus:ring-4 peer-focus:ring-vividTangerine peer-checked:after:translate-x-full peer-checked:after:border-white peer-checked:bg-vividTangerine"></div>
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-gray-300">Invitations actives</span>
</label>
</div>
</caption>

<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
<tr class="invisible text-center lg:visible">
<th scope="col" class="px-6 py-3">
Date de création
</th>
<th scope="col" class="px-6 py-3">
Code
</th>
<th scope="col" class="px-6 py-3">
Crée par
</th>
<th scope="col" class="px-6 py-3">
Nombre d'inscriptions via ce code
</th>
<th scope="col" class="px-6 py-3 text-center">
Action
</th>
</tr>
</thead>

<tbody>
<!-- foreach($invitations as $invitation) -->
<!-- TODO Change if condition => if disable == true, the class is add -->
<tr class="bg-white border-b hover:bg-gray-50 @if(1 == 2)disable-line @endif">
<td data-title="Date de création" class="px-6 lg:py-4 text-center font-medium text-gray-900">
12.10.2312
</td>
<td data-title="Code" class="px-6 lg:py-4 text-center">
DSAD-DFEC-OFRG-DOER
</td>
<td data-title="Crée par" class="px-6 lg:py-4 text-center">
admin@admin.com
</td>
<td data-title="Nombre d'inscriptions via ce code" class="px-6 lg:py-4 text-center">
5
</td>
<td class="px-6 py-4 text-center">
<!-- TODO Change if condition => if disable == true, the activaer button is show -->
@if(1 == 2)
<button class="btn btn-sobre flex w-full justify-center">
Activater
</button>
@else
<button class="btn btn-sobre flex w-full justify-center">
Désactiver
</button>
@endif
</td>
</tr>

<tr class="bg-white border-b hover:bg-gray-50 @if(1 == 1)disable-line @endif">
<td data-title="Date de création" class="px-6 lg:py-4 text-center font-medium text-gray-900">
12.10.2312
</td>
<td data-title="Code" class="px-6 lg:py-4 text-center">
DSAD-DFEC-OFRG-DOER
</td>
<td data-title="Crée par" class="px-6 lg:py-4 text-center">
admin@admin.com
</td>
<td data-title="Nombre d'inscriptions via ce code" class="px-6 lg:py-4 text-center">
5
</td>
<td class="px-6 py-4 text-center">
<!-- TODO Change if condition => if disable == true, the activaer button is show -->
@if(1 == 1)
<button class="btn btn-sobre flex w-full justify-center">
Activater
</button>
@else
<button class="btn btn-sobre flex w-full justify-center">
Désactiver
</button>
@endif
</td>
</tr>
<!-- endforeach -->
</tbody>
</table>
</div>
</div>
</article>
<!-- TODO Change variable for invitation -->
{{$users->links()}}
</div>
@endsection
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<a href="{{ route('management.laundries.index', $organization['id']) }}" class="btn btn-sobre">
Gestions des buanderies
</a>

<!-- TODO Link to right route (web.php) -->
<!--<a href="{#{ route('management.invitation.index', $organization['id']) }}" class="btn btn-sobre">
Gestions des invitations
</a>-->
</div>
</article>
@endforeach
Expand Down

0 comments on commit 8be45e2

Please sign in to comment.