Updated the sorting of the programs

This commit is contained in:
Donny 2024-09-03 15:45:14 -06:00
parent 1780f9760b
commit e1020fd499

View File

@ -37,6 +37,7 @@
const data = await response.json(); const data = await response.json();
licenses = data; licenses = data;
licenses.sort((a, b) => a.program.localeCompare(b.program));
} catch (err) { } catch (err) {
error = `Failed to fetch licenses: ${err.message}`; error = `Failed to fetch licenses: ${err.message}`;
} }
@ -139,25 +140,25 @@
<h2 class="text-3xl text-gray-600">Current License Usage</h2> <h2 class="text-3xl text-gray-600">Current License Usage</h2>
<br> <br>
<table class="w-1/2 m-auto text-left rounded-lg text-gray-700 shadow-lg"> <table class="w-1/2 m-auto text-left rounded-lg text-gray-700 shadow-lg">
<tr class="text-xl bg-gray-600 text-white font-thin"> <tr class="text-xl bg-gray-600 text-white font-thin">
<th>Icon</th> <th>Icon</th>
<th>Program Name</th> <th>Program Name</th>
<th>Username</th> <th>Username</th>
</tr> </tr>
{#each licenses as license, index} {#each licenses as license, index}
<tr class={`${ <tr class={`${
index % 2 === 0 ? 'bg-gray-100 hover:bg-gray-300' : 'bg-gray-200 hover:bg-gray-400' index % 2 === 0 ? 'bg-gray-100 hover:bg-gray-300' : 'bg-gray-200 hover:bg-gray-400'
}`}> }`}>
<td> <td>
<div class="rounded p-1"> <div class="rounded p-1">
<img class="max-w-10" src={getImageSource(license.program)} alt={license.machine + " Logo"}> <img class="max-w-10" src={getImageSource(license.program)} alt={license.machine + " Logo"}>
</div> </div>
</td> </td>
<td><h2 class="text-lg">{license.program === 'Slide' ? 'Slide2' : (license.program === 'WINPROJ' ? 'Project' : license.program)}</h2></td> <td><h2 class="text-lg">{license.program === 'Slide' ? 'Slide2' : (license.program === 'WINPROJ' ? 'Project' : license.program)}</h2></td>
<td>{license.machine.toUpperCase()}</td> <td>{license.machine.toUpperCase()}</td>
</tr> </tr>
{/each} {/each}
</table> </table>
</div> </div>