feat: global search page with results for beneficiaries and drivers
This commit is contained in:
@@ -73,6 +73,10 @@ views:
|
||||
files:
|
||||
- web/layouts/layout.html
|
||||
- web/layouts/_partials/mainmenu.html
|
||||
search:
|
||||
results:
|
||||
files:
|
||||
- web/layouts/search/results.html
|
||||
dashboard:
|
||||
files:
|
||||
- web/layouts/dashboard/_partials/agenda-widget.html
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</button>
|
||||
<div class="flex-1 px-4 flex justify-between">
|
||||
<div class="flex-1 flex">
|
||||
<form class="w-full flex md:ml-0" action="/app/beneficiaries/" method="GET">
|
||||
<form class="w-full flex md:ml-0" action="/app/search" method="GET">
|
||||
<label for="search-field" class="sr-only">Search</label>
|
||||
<div class="relative w-full text-gray-400 focus-within:text-gray-600">
|
||||
<div class="absolute inset-y-0 left-0 flex items-center pointer-events-none">
|
||||
@@ -89,7 +89,7 @@
|
||||
</div>
|
||||
<input id="search-field"
|
||||
class="block w-full h-full pl-8 pr-3 py-2 border-transparent text-gray-900 placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-0 focus:border-transparent sm:text-sm"
|
||||
placeholder="Chercher un bénéficiaire" type="search" name="search">
|
||||
placeholder="Rechercher..." type="search" name="q">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
144
web/layouts/search/results.html
Normal file
144
web/layouts/search/results.html
Normal file
@@ -0,0 +1,144 @@
|
||||
{{define "content"}}
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
|
||||
<h1 class="text-2xl font-semibold text-gray-900">Résultats pour « {{.ViewState.query}} »</h1>
|
||||
|
||||
{{if moduleAvailable "beneficiaries"}}
|
||||
<div class="mt-8">
|
||||
<h2 class="text-lg font-medium text-gray-900">
|
||||
Bénéficiaires
|
||||
<span class="ml-2 inline-flex items-center justify-center w-6 h-6 rounded-full bg-co-blue text-xs font-medium text-white">{{len .ViewState.beneficiaries}}</span>
|
||||
</h2>
|
||||
{{if .ViewState.beneficiaries}}
|
||||
<div class="mt-4 overflow-hidden shadow md:rounded-lg">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Nom</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Téléphone</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Adresse</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6"><span class="sr-only">Voir</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{{range .ViewState.beneficiaries}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6">
|
||||
<div class="flex items-center">
|
||||
<div class="h-10 w-10 flex-shrink-0">
|
||||
<img class="h-10 w-10 rounded-co" src="/app/beneficiaries/{{.ID}}/picture" alt="">
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="font-medium text-gray-900">{{.Data.first_name}} {{.Data.last_name}}</div>
|
||||
<div class="text-gray-500">{{.Data.email}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{.Data.phone_number}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
<a href="/app/beneficiaries/{{.ID}}" class="text-co-blue hover:text-co-blue">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="mt-2 text-sm text-gray-500">Aucun résultat</p>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if moduleAvailable "solidarity_transport"}}
|
||||
<div class="mt-8">
|
||||
<h2 class="text-lg font-medium text-gray-900">
|
||||
Conducteurs solidaires
|
||||
<span class="ml-2 inline-flex items-center justify-center w-6 h-6 rounded-full bg-co-blue text-xs font-medium text-white">{{len .ViewState.solidarity_drivers}}</span>
|
||||
</h2>
|
||||
{{if .ViewState.solidarity_drivers}}
|
||||
<div class="mt-4 overflow-hidden shadow md:rounded-lg">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Nom</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Adresse</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Téléphone</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Profil validé</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6"><span class="sr-only">Voir</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{{range .ViewState.solidarity_drivers}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{{.Data.first_name}} {{.Data.last_name}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{.Data.phone_number}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
{{if solidarityDriverValidatedProfile . (solidarityDocuments .ID)}}
|
||||
<span class="p-1 px-2 text-xs bg-co-green rounded-2xl">Oui</span>
|
||||
{{else}}
|
||||
<span class="p-1 px-2 text-xs bg-co-red text-white rounded-2xl">Non</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
<a href="/app/solidarity-transport/drivers/{{.ID}}" class="text-co-blue hover:text-co-blue">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="mt-2 text-sm text-gray-500">Aucun résultat</p>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if moduleAvailable "organized_carpool"}}
|
||||
<div class="mt-8">
|
||||
<h2 class="text-lg font-medium text-gray-900">
|
||||
Conducteurs covoiturage
|
||||
<span class="ml-2 inline-flex items-center justify-center w-6 h-6 rounded-full bg-co-blue text-xs font-medium text-white">{{len .ViewState.organized_carpool_drivers}}</span>
|
||||
</h2>
|
||||
{{if .ViewState.organized_carpool_drivers}}
|
||||
<div class="mt-4 overflow-hidden shadow md:rounded-lg">
|
||||
<table class="min-w-full divide-y divide-gray-300">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6">Nom</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Adresse départ</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Adresse destination</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Téléphone</th>
|
||||
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Profil validé</th>
|
||||
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-6"><span class="sr-only">Voir</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 bg-white">
|
||||
{{range .ViewState.organized_carpool_drivers}}
|
||||
<tr>
|
||||
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6">{{.Data.first_name}} {{.Data.last_name}}</td>
|
||||
<td class="px-3 py-4 text-sm text-gray-500">{{if .Data.address}}{{.Data.address.properties.label}}{{end}}</td>
|
||||
<td class="px-3 py-4 text-sm text-gray-500">{{if .Data.address_destination}}{{.Data.address_destination.properties.label}}{{end}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{.Data.phone_number}}</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
|
||||
{{if carpoolDriverValidatedProfile . (carpoolDocuments .ID)}}
|
||||
<span class="p-1 px-2 text-xs bg-co-green rounded-2xl">Oui</span>
|
||||
{{else}}
|
||||
<span class="p-1 px-2 text-xs bg-co-red text-white rounded-2xl">Non</span>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6">
|
||||
<a href="/app/organized-carpool/drivers/{{.ID}}" class="text-co-blue hover:text-co-blue">Voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="mt-2 text-sm text-gray-500">Aucun résultat</p>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -3197,6 +3197,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.hover\:text-co-blue\/80 {
|
||||
&:hover {
|
||||
@media (hover: hover) {
|
||||
color: color-mix(in oklab, var(--color-co-blue) 80%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
.hover\:text-co-green {
|
||||
&:hover {
|
||||
@media (hover: hover) {
|
||||
|
||||
Reference in New Issue
Block a user