Tailwind css -> table height responsiv - html-table
I finally decided to seek help from people who will be more knowledgeable than me with this problem..
I have a table, very simple, and I would like this one to take up all the remaining space on the page, knowing that before it there is a list of inputs..
I tried several tricks, but after several hours I think you'll find the solution pretty quickly...^^
Main function :
export default function Interventions(){
return (
<div className="dark:bg-slate-800 px-4 sm:px-6 lg:px-8">
<InterventionSearchInput/>
<InterventionsTable/>
</div>
)
}
InterventionSearchInput :
export function InterventionSearchInput(props){
return(
<div className="text-center space-y-3 mt-4 mb-4">
<div className="space-x-2 flex justify-center" style={{flexFlow:'row wrap'}}>
<input
type="text"
name="id_intervention"
id="id_intervention"
placeholder="N° d'intervention"
className="max-w-[140px] mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<input
type="text"
name="idInterne"
id="idInterne"
placeholder="Id Interne"
className="max-w-[140px] mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<input
type="text"
name="IdTicket"
id="IdTicket"
placeholder="Id Ticket"
className="max-w-[140px] mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<input
type="text"
name="site"
id="site"
placeholder="Site"
className="max-w-[140px] mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<input
type="date"
name="dateStart"
id="dateStart"
className="mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<input
type="date"
name="dateEnd"
id="dateEnd"
className="mt-1 border border-gray-300 dark:border-gray-500 dark:bg-slate-700 dark:text-gray-300 dark:placeholder-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:border-indigo-500 sm:text-sm hover:bg-indigo-50 dark:hover:bg-slate-600"
/>
<StatutListSearch setStatutSearch={props.setStatutSearch} statutSearch={props.statutSearch} setStatutSearchId={props.setStatutSearchId}/>
<button
onClick={() => csvInter()}
disabled={props.loaderCSV}
className="inline-block px-4 py-2 text-xs font-medium text-center text-yellow-500 uppercase transition bg-transparent border-2 border-yellow-500 rounded shadow ripple hover:shadow-lg hover:bg-yellow-100 focus:outline-none"
>
{props.loaderCSV && (
<svg role="status"
className="inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-yellow-400"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"/>
</svg>
)}
{props.loaderCSV && <span>CSV en cours de création</span>}
{!props.loaderCSV && <span>CSV</span>}
</button>
</div>
</div>
)
}
InterventionsTable :
export function InterventionsTable(props){
return(
loading ?
<LoaderTable type="spin" color="#00b0f0"/>
:
<div className="dark:bg-slate-800 flex flex-col">
<div className="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="inline-block min-w-full py-2 align-middle md:px-6 lg:px-8">
<div onScroll={handleScroll}
className="shadow ring-1 ring-black ring-opacity-5 md:rounded-lg overflow-y-scroll Xsm:max-h-[50vh] sm:max-h-[60vh] md:max-h-[65vh] lg:max-h-[70vh] xl:max-h-[75vh] 2xl:max-h-[85vh] xxl:max-h-[89vh]">
<table className="min-w-full divide-y divide-gray-300 dark:divide-gray-500">
<thead className="bg-gray-50 sticky top-0">
<tr className="divide-x divide-gray-200 dark:divide-gray-500">
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderID === 'asc' ?
changeOrder('desc', 'tri_id_inter_listing')
:
changeOrder('asc', 'tri_id_inter_listing')
}}
className="group inline-flex">
Id Interne
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderID === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderIDInterne === 'asc' ?
changeOrder('desc', 'tri_id_client')
:
changeOrder('asc', 'tri_id_client')
}}
className="group inline-flex">
Id Client
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderIDInterne === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderDate === 'asc' ?
changeOrder('desc', 'tri_date_h_rdv')
:
changeOrder('asc', 'tri_date_h_rdv')
}}
className="group inline-flex">
Date RDV
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderDate === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderTech === 'asc' ?
changeOrder('desc', 'tri_technician')
:
changeOrder('asc', 'tri_technician')
}}
className="group inline-flex">
Partenaire
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderTech === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderSite === 'asc' ?
changeOrder('desc', 'tri_site')
:
changeOrder('asc', 'tri_site')
}}
className="group inline-flex">
Site
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderSite === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderAdresse === 'asc' ?
changeOrder('desc', 'tri_adresse')
:
changeOrder('asc', 'tri_adresse')
}}
className="group inline-flex">
Adresse
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderAdresse === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderVille === 'asc' ?
changeOrder('desc', 'tri_ville')
:
changeOrder('asc', 'tri_ville')
}}
className="group inline-flex">
Ville
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderVille === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderCP === 'asc' ?
changeOrder('desc', 'tri_cp')
:
changeOrder('asc', 'tri_cp')
}}
className="group inline-flex">
CP
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderCP === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
className="group inline-flex">
Dossier de clôture
</a>
</th>
<th scope="col"
className="dark:bg-slate-700 dark:text-gray-300 py-3.5 pl-4 pr-4 text-left text-xs font-semibold text-gray-900">
<a href="#"
onClick={() => {
orderStatut === 'asc' ?
changeOrder('desc', 'tri_statut')
:
changeOrder('asc', 'tri_statut')
}}
className="group inline-flex">
Statut
<span
className="ml-2 flex-none rounded bg-gray-200 text-gray-900 group-hover:bg-gray-300">
{
orderStatut === 'asc' ?
<ChevronDownIcon className="h-5 w-5" aria-hidden="true"/>
:
<ChevronUpIcon className="h-5 w-5" aria-hidden="true"/>
}
</span>
</a>
</th>
</tr>
</thead>
<tbody
className="divide-y divide-gray-200 bg-white h-48 max-h-screen overflow-y-scroll dark:bg-slate-700 dark:divide-gray-500">
{
items.map((c, index) => (
<tr onClick={(e) => {
e.preventDefault()
e.stopPropagation()
props.setShowMTicket(!props.showMTicket)
props.setIdInter(c.id)
}}
key={index}
className="divide-x divide-gray-200 dark:divide-gray-500 hover:bg-sky-100 dark:hover:bg-slate-600">
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs font-medium text-gray-900 cursor-pointer dark:text-gray-300">{c.id}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 max-w-xs cursor-pointer dark:text-gray-300">{c.num_inter_apporteur}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300">{c.planning_date_begin}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs font-medium text-gray-500 cursor-pointer dark:text-gray-300">{c.prenomTECH} {c.nomTECH}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300">{c.site}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300">{c.adresse}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300">{c.ville}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300">{c.cp_site}</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer">
{
props.isLoadingDL ?
<Loader type="spin" color="orange"/>
:
<>
<svg xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 m-auto" fill="none"
viewBox="0 0 24 24" stroke="orange"
stroke-width="2" data-tip data-for='duplicata'
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
props.setIsLoadingDL(true)
props.dlFolderCloture(c.id, c.login_intervention);
}}>
<path stroke-linecap="round" stroke-linejoin="round"
d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
</svg>
<ReactTooltip id='duplicata' type='light'
effect='solid'>
<span>Télécharger le dossier de clôture</span>
</ReactTooltip>
</>
}
</td>
<td className="whitespace-wrap py-4 pl-4 pr-4 text-xs text-gray-500 cursor-pointer dark:text-gray-300 text-center">
<span className={
c.statut === "11" || c.statut === "4" ?
"inline-block py-1 px-2 dark:text-gray-300 border-2 border-green-500 rounded-full"
:
c.statut === "5" ?
"inline-block py-1 px-2 dark:text-gray-300 border-2 border-violet-500 rounded-full"
:
c.statut === "1" ?
"inline-block py-1 px-2 dark:text-gray-300 border-2 border-orange-500 rounded-full"
:
"inline-block py-1 px-2 dark:text-gray-300 border-2 border-red-500 rounded-full"
}>{c.libelle_statut}</span>
</td>
</tr>
))
}
</tbody>
</table>
</div>
<div
className="hidden md:flex md:w-48 md:flex-col md:fixed fixed bottom-0 left-0 min-w-12rem">
<div className="max-w-7xl">
<div className="p-2 bg-blue-600 shadow-lg sm:p-3">
<div className="flex items-center justify-center flex-wrap">
<div
className="order-3 mt-2 flex-shrink-0 w-full sm:order-2 sm:mt-0 sm:w-auto font-medium text-white">
<p>Interventions : {props.nbInter}</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
I removed all props and functions, only the css is important for the problem..
So to summarize, how to make the table take all the remaining height and keep the ratio when the page resizes, because currently when I resize, the "end" of the table is no longer visible..
I don't know if I was clear enough.
Image :
[Table without resize][1]
[Table after resize][2]
[1]: https://i.stack.imgur.com/Yjh3E.png
[2]: https://i.stack.imgur.com/A5DTl.png
Related
If click ellipsis-horizontal button, dropdown is hidden into the table
I wrote the code in Tailwindcss and Alpine js. If I click ellipsis-horizontal button, dropdown is hidden into the table. I adjust the Z index also but it also hidden into the table. I want to show that dropdown above the table. https://codepen.io/rskelaa/pen/xxJEdrm/ <div class="flex flex-col border-b"> <div class="z-10 -my-2 overflow-x-auto md:overflow-x-auto sm:-mx-6 lg:-mx-8"> <div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"> <div class="overflow-hidden border-b border-gray-200 shadow sm:rounded-lg"> <table class="relative min-w-full divide-y divide-gray-200 table-fixed"> <thead class="bg-blue-600"> <tr> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> <span class="text-base text-gray-900"> <input class="w-4 h-4 border border-white" type="checkbox" name="" id=""> </span> </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Name </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Paid Days </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Net Pay </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Taxes </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Gross Pay </th> <th scope="col" class="px-4 py-3 font-bold tracking-wider text-left text-gray-100 uppercase"> Action </th> </tr> </thead> <tbody class="bg-white divide-y divide-gray-200"> <tr class=""> <td class="px-4 py-4 whitespace-nowrap"> <span class="text-base text-gray-900"> <input class="w-4 h-4 border border-white" type="checkbox" name="" id=""> </span> </td> <td class="px-4 py-4 whitespace-nowrap"> <div> <a href="employee-detail.html" class="font-semibold text-blue-600">Elavarasan</a> <p class="text-sm text-gray-600">67525165</p> </div> </td> <td class="px-4 py-4 whitespace-nowrap"> <span class="text-base text-gray-900"> 30 </span> </td> <td class="px-4 py-4 whitespace-nowrap"> <span class="text-base text-gray-900"> <span>₹</span> 15000 </span> </td> <td class="px-4 py-4 whitespace-nowrap"> <span class="text-base text-gray-900"> <span>₹</span> 3000 </span> </td> <td class="px-4 py-4 whitespace-nowrap"> <span class="text-base text-gray-900"> <span>₹</span> 18000 </span> </td> <td class="px-4 py-4 whitespace-nowrap"> <div class="px-2 text-gray-600 " x-data="{ isOpen: false }"> <button #click="isOpen = !isOpen" #keydown.escape="isOpen = false" class="flex items-center focus:outline-none"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" /> </svg> </button> <ul x-show="isOpen" #click.away="isOpen = false" class="absolute right-0 z-50 py-1 mt-2 overflow-hidden font-normal bg-white border rounded shadow w-72"> <li class="group hover:bg-indigo-100"> <a href="my-account.html" class="flex items-center px-3 py-3 group-hover:text-indigo-800"> <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" class="mr-3 text-gray-600 text-blue-600 group-hover:text-indigo-800"> <path d="M12 12a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-2a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm9 11a1 1 0 0 1-2 0v-2a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v2a1 1 0 0 1-2 0v-2a5 5 0 0 1 5-5h8a5 5 0 0 1 5 5v2z" class="heroicon-ui"></path> </svg> My Account </a> </li> <li class="group hover:bg-indigo-100"> <a href="settings.html" class="flex items-center px-3 py-3 group-hover:text-indigo-800"> <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 mr-3 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"> <path stroke-linecap="round" stroke-linejoin="round" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"> </path> <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"> </path> </svg> Settings </a> </li> <li class="border-t group hover:bg-indigo-100"> <a href="logout.html" class="flex items-center px-3 py-3 group-hover:text-indigo-800"> <svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="mr-3 text-gray-600 text-blue-600 group-hover:text-indigo-800"> <path d="M0 0h24v24H0z" fill="none"></path> <path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"> </path> </svg>Sign out </a> </li> </ul> </div> </td> </tr> </tbody> </table> </div> </div> </div> <div class="flex justify-center mt-4"> <nav class="relative z-0 inline-flex -space-x-px shadow-sm" aria-label="Pagination"> <a href="#" class="relative inline-flex items-center px-2 py-2 text-base font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md hover:bg-indigo-100"> <span class="sr-only">Previous</span> <!-- Heroicon name: chevron-left --> <svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd"></path> </svg> </a> <a href="#" class="relative inline-flex items-center px-4 py-2 text-base font-medium text-gray-700 bg-white border border-gray-300 hover:bg-indigo-100"> 1 </a> <a href="#" class="relative inline-flex items-center px-4 py-2 text-base font-medium text-gray-700 bg-white border border-gray-300 hover:bg-indigo-100"> 2 </a> <a href="#" class="relative items-center hidden px-4 py-2 text-base font-medium text-gray-700 bg-white border border-gray-300 md:inline-flex hover:bg-indigo-100"> 3 </a> <a href="#" class="relative inline-flex items-center px-4 py-2 text-base font-medium text-gray-700 bg-white border border-gray-300 hover:bg-indigo-100"> 4 </a> <a href="#" class="relative inline-flex items-center px-4 py-2 text-base font-medium text-gray-700 bg-white border border-gray-300 hover:bg-indigo-100"> 5 </a> <a href="#" class="relative inline-flex items-center px-2 py-2 text-base font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md hover:bg-indigo-100"> <span class="sr-only">Next</span> <!-- Heroicon name: chevron-right --> <svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path> </svg> </a> </nav> </div> </div> Rectify this code, I m looking dropdown to above the table.
I'm trying to use a button to switch between a scrollable table and the entire table in vue 3 js
I'm new to Vue and have been using Vue 3 along with Tailwind css on a intro project. I am trying to use two v-if's along with a click button to switch between the tables, but it is only showing the scrollable table, and when I click the button it doesn't show anything. This is my data: <template> <div class="px-4 sm:px-6 lg:px-8"> <div class="sm:items-center"> <div class="sm:flex-none"> <h1 class="text-xl font-semibold text-gray-900 text-center">Test</h1> <p class="mt-2 text-sm text-gray-700 text-center">Dummy Data</p> <div class="flex justify-center mt-6"> <button #click="toggleList" type="button" class="inline-flex items-center justify-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:w-auto">Toggle List</button> </div> </div> </div> <br> <div v-if="listIsVisible"> <div class='flex items-center justify-center'> <div class='h-96 w-96 overflow-y-scroll flex justify-center'> <table class='w-50 shadow-lg bg-white border-separate'> <thead> <tr class='bg-gray-100'> <th class='w-20 px-4 py-2 bg-blue-600 text-white'>Column 1</th> <th class='px-4 py-2 bg-blue-600 text-white'>Column 2</th> </tr> </thead> <tbody class="divide-y divide-gray-200 bg-white"> <tr v-for="dummy in workflow" :key="dummy.contract"> <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-black sm:pl-6 text-center">{{ dummy.contract }}</td> <td class="whitespace-nowrap px-3 py-4 text-sm text-black text-center">{{ dummy.spend }}</td> </tr> </tbody> </table> </div> </div> <div v-if="!listIsVisible"> <div class='flex items-center justify-center'> <div class='overflow-y-scroll flex justify-center'> <table class='w-50 shadow-lg bg-white border-separate'> <thead> <tr class='bg-gray-100'> <th class='w-20 px-4 py-2 bg-blue-600 text-white'>Contract</th> <th class='px-4 py-2 bg-blue-600 text-white'>Spend</th> </tr> </thead> <tbody class="divide-y divide-gray-200 bg-white"> <tr v-for="dummy in raft" :key="dummy.contract"> <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-black sm:pl-6 text-center">{{ dummy.contract }}</td> <td class="whitespace-nowrap px-3 py-4 text-sm text-black text-center">{{ dummy.spend }}</td> </tr> </tbody> </table> </div> </div> </div> </div> </div> </template> <script setup> import { ref } from 'vue'; const listIsVisible = ref(false); function toggleList() { listIsVisible.value = !listIsVisible.value; }
Modal is getting the last value from my table
I created a modal with bootstrap, in react, but when it opens, it takes the last value from my table(sql). Does anyone know why he does this, and how I fix it this is my code with the table and modal When I open my MODAL the information there is wrong, it is taking the last item in my table. this classific is each field of my table return ( <React.Fragment key={classific.ID}> <tbody className="bg-white divide-y divide-gray-200"> <tr> <td className="px-2 py-4 whitespace-nowrap"> <div className="flex items-center"> <div className="ml-4"> <div className="text-sm font-medium text-gray-900"> {classific.ID} </div> </div> </div> </td> <td className="px-6 py-4 whitespace-nowrap"> <div className="font-bold text-sm text-gray-900"> {classific.DS_Classificacao} </div> </td> <td className="px-9 py-4 whitespace-nowrap"> <div className={ classific.Status === true ? 'inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-green-100 text-green-800' : 'inline-flex items-center px-2.5 py-0.5 rounded-md text-sm font-medium bg-red-100 text-red-800' } > {classific.Status === true ? 'Ativo' : 'Inativo'} </div> </td> <td className="content_td"> <button onClick={e => EditForm(classific.ID, e)} className="text-gray-400 hover:text-gray-100 mx-2" > <span className="sr-only">Close panel</span> <PencilIcon className="h-6 w-6" aria-hidden="true" onClick={handleShowE} /> </button> <button className="text-gray-400 hover:text-gray-100 ml-2"> <span className="sr-only">Close panel</span> <TrashIcon className="h-6 w-6" aria-hidden="true" **Here is where I press for my modal to open** onClick={handleShowD} /> </button> </td> </tr> </tbody> **The information inside the modal is wrong** <Modal show={showD} onHide={handleCloseD} backdrop="static" keyboard={false} > <Modal.Header> <Modal.Title> Deletar <b>{classific.DS_Classificacao}</b> </Modal.Title> </Modal.Header> <Modal.Body> Tem certeza que deseja deletar <b> {classific.DS_Classificacao}</b> ? Essa ação é irreversivel. </Modal.Body> <Modal.Footer> <button type="button" className="inline-flex items-center px-2.5 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" onClick={handleCloseD} > Cancelar </button> <button type="button" className="inline-flex items-center px-2.5 py-1.5 border border-gray-300 shadow-sm text-xs font-medium rounded text-red-700 bg-red hover:bg-red-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" onClick={e => deleteForm(classific.ID, e)} > Deletar </button> </Modal.Footer> </Modal> <Modal show={showE} onHide={handleCloseE} backdrop="static" keyboard={false} > <Modal.Header> <Modal.Title>Editar Classificação</Modal.Title> </Modal.Header> <Modal.Body> {/* <ModalEdit id={classific.ID}></ModalEdit> */} </Modal.Body> <Modal.Footer> <button type="button" className="inline-flex items-center px-2.5 py-1.5 border border-transparent text-xs font-medium rounded shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" onClick={handleCloseE} > Cancelar </button> </Modal.Footer> </Modal> </React.Fragment> ) })}```
Search and Pagination in Laravel Breeze
I'm currently developing an appointment application in which I'm working on a page where there would be a list of appointments. I've decided to paginate the data given that appointments would be coming from multiple patients and give the user the option to search. But my search is inactive and my pagination buttons aren't responding. I've push the data from the controller with the paginate function but still no luck. This is the Vue where the list of components are rendered <template> <dashboard-layout :header-caption="Appointments" header="Appointments"> <div class="flex justify-between mb-6"> <div class="max-w-xs"> <input type="search" v-model="params.search" aria-label="Search" placeholder="Search..." class="block w-full rounded-md border-gray-700 shadow-sm focus:ring-blue-700 focus:border-blue-700 sm:text-sm" /> </div> </div> <div class="overflow-hidden bg-white shadow-md sm:rounded-lg"> <div class="flex flex-col"> <div class="overflow-x-auto -my-2 sm:-mx-6 lg:-mx-8"> <div class="inline-block py-2 min-w-full align-middle sm:px-6 lg:px-8" > <div class="overflow-hidden border-b border-gray-700 shadow sm:rounded-lg" > <table class="min-w-full divide-y divide-gray-700 table-fixed" > <thead class="bg-blue-800"> <tr> <th scope="col" class="w-3/12 text-xs font-semibold tracking-wider text-left text-white uppercase" > <span class="inline-flex py-3 px-6 w-full justify-between" >Reason </span> </th> <th scope="col" class="w-3/12 text-xs font-semibold tracking-wider text-left text-white uppercase" > <span class="inline-flex py-3 px-6 w-full justify-between" >Date </span> </th> <th scope="col" class="w-3/12 text-xs font-semibold tracking-wider text-left text-white uppercase" > <span class="inline-flex py-3 px-6 w-full justify-between" >Time </span> </th> <th scope="col" class="w-3/12 text-xs font-semibold tracking-wider text-left text-white uppercase" > <span class="inline-flex py-3 px-6 w-full justify-between" >Actions </span> </th> </tr> </thead> <tbody class="bg-white divide-y divide-gray-700" > <tr v-for="appointment in appointments.data" :key="appointment.id" > <td class="py-4 px-6 text-sm text-gray-800 whitespace-nowrap" v-text="appointment.reason" /> <td class="py-4 px-6 text-sm text-gray-800 whitespace-nowrap" v-text=" formatDate( appointment.appointment_date ) " /> <td class="py-4 px-6 text-sm text-gray-800 whitespace-nowrap" v-text=" tConvert( appointment.appointment_time ) " /> <td> <div v-if=" appointment.status == 'Confirmed' " class="flex" > <status-tag :status="appointment.status" /> <Link method="delete" :href=" route( 'appointments.destroy', appointment ) " > <small-button class="ml-3" color="red" icon="fas fa-trash-alt fa-lg" label="Remove" type="button" /> </Link> </div> <div v-else-if=" appointment.status == 'Declined' " class="flex" > <status-tag :status="appointment.status" /> <Link method="delete" :href=" route( 'appointments.destroy', appointment ) " > <small-button class="ml-3" color="red" icon="fas fa-trash-alt fa-lg" label="Remove" type="button" /> </Link> </div> <div v-else class="flex justify-end mr-9" > <small-button color="blue" icon="fas fa-check-circle fa-lg" label="Confirm" type="button" #click=" confirmAppointment({ appointment, }) " /> <!-- <small-button class="ml-5" color="purple" icon="fas fa-clock fa-lg" type="button" label="Reschedule" /> --> <small-button class="ml-5" color="red" icon="fas fa-times-circle fa-lg" type="button" label="Decline" #click=" declineAppointment({ appointment, }) " /> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> <pagination class="mt-10" :links="appointments.links" /> <appointment-modal v-if="showAppointmentModal" #toggle="toggleAppointmentModal" /> </dashboard-layout> </template> <script> import DashboardLayout from "#/Layouts/DashboardLayout"; import Pagination from "#/Components/Common/Pagination"; import useFormatter from "#/Components/composables/useFormatter"; import BaseButton from "#/Components/Common/BaseButton"; import SmallButton from "#/Components/Common/SmallButton"; import StatusTag from "#/Components/Common/StatusTag"; import { Link } from "#inertiajs/inertia-vue3"; import { Inertia } from "#inertiajs/inertia"; export default { components: { Link, DashboardLayout, Pagination, StatusTag, BaseButton, SmallButton, }, props: { appointments: Object, }, data() { const { formatDate } = useFormatter(); function tConvert(time) { // Check correct time format and split into components time = time .toString() .match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [time]; if (time.length > 1) { // If time format correct time = time.slice(1); // Remove full string match value time[5] = +time[0] < 12 ? "AM" : "PM"; // Set AM/PM time[0] = +time[0] % 12 || 12; // Adjust hours } return time.join(""); // return adjusted time or original string } function confirmAppointment(appointment) { Inertia.visit("appointment/confirm", { method: "put", data: { appointment: appointment }, }); } function reschedule(appointment) {} function declineAppointment(appointment) { Inertia.visit("appointment/declined", { method: "put", data: { appointment: appointment }, }); } return { declineAppointment, confirmAppointment, formatDate, tConvert, params: { search: null }, }; }, watch: { params: { handler() { this.inertia.get(this.route("appointments"), this.params, { replace: true, preserveState: true, }); }, deep: true, }, }, }; </script> <style></style> and this is what is being pushed from the Appointment Controller public function index() { return Inertia::render("Doctor/Appointments", [ 'appointments' => Appointment::where('status','!=','')->paginate(10) ]); }
CSS suggestions don't show up
I am currently working in PhpStorm and closed the project yesterday evening as usual, as well as started it as usual today. But now when I type CSS code I don't get any recommendations / auto completion suggestions. The only difference is that I have a new keyboard today, everything else is the same as yesterday. Edit: Here is a screenshot as requested: It doesn't work in one specific file, in the other files it is working fine, here is the file where it doesn't work: #extends('layouts.app') #section('content') <div class="flex justify-center "> <div class="w-11/12 bg-gray-400 p-6 rounded-lg font-serif text-4xl font-bold bg-opacity-70 subpixel-antialiased tracking-wide not-italic"> <div class="p-10 shadow-2xl mb-10 bg-gradient-to-r from-green-400 to-blue-500 border-solid border-2 border-black rounded-lg"> <div class="bg-gray-100 shadow-2xl border-solid border-2 border-gray-500 rounded-lg"> <h1 class="pt-2 pl-4 text-4xl font-bold text-gray-900 title-font mb-8 underline"> {{ $post->Titel }} </h1> <div class="flex-grow"> <div> <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Standort: {{ $post->Standort }}</div> <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Kontakt: {{ $post->Kontakt }}</div> <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif"> Startdatum: {{ $post->startdate }}</div> <div class="pt-2 pl-4 pb-3 ml-8 font-medium text-base font-bold font-serif mb-8"> Enddatum: {{ $post->enddate }}</div> <div class="flex-grow ml-5 ml-8 mb-5 content md:w-3/4 pr-4 text-lg text-justify tracking-widest leading-loose mr-7 subpixel-antialiased"> {!! $post->Beschreibung !!} </div> </div> </div> <div class="pt-2 pl-4 mb-2 ml-8 font-medium text-base font-bold font-serif"> Referenzcode: {{ $post->id }}</div> <div class="flex justify-end font-medium text-base font-bold font-serif mb-5 ml-8 mr-8"> <a href="{{ route('bewerben', $post->id) }}"> <button type="submit" class="text-white px-4 py-3 rounded text-base font-medium bg-gradient-to-r from-green-400 to-blue-500 float-right shadow transition duration-500 ease-in-out transform hover:-translate-y-1 hover:scale-100">Direkt bewerben! </button> </a> </div> </div> </div> </div> </div> #endsection