dealroom/templates/dealrooms.templ

82 lines
3.9 KiB
Plaintext

package templates
import "dealroom/internal/model"
import "fmt"
templ DealRooms(profile *model.Profile, deals []*model.Deal) {
@Layout(profile, "deals") {
<div class="space-y-5">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold">Deal Rooms</h1>
<p class="text-sm text-gray-500 mt-1">{ fmt.Sprintf("%d deal rooms", len(deals)) } across your organization.</p>
</div>
<button onclick="document.getElementById('newRoomModal').classList.remove('hidden')" class="h-9 px-4 rounded-lg bg-teal-500 text-white text-sm font-medium flex items-center gap-1.5 hover:bg-teal-600 transition">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
New Room
</button>
</div>
<div class="bg-gray-900 rounded-lg border border-gray-800">
<table class="w-full">
<thead>
<tr class="border-b border-gray-800">
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">Deal Room</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">Target</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">Stage</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">Deal Size</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">Documents</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">IOI Date</th>
<th class="text-left px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider">LOI Date</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-800/50">
for _, deal := range deals {
<tr class="hover:bg-gray-800/30 transition group">
<td class="px-4 py-3">
<a href={ templ.SafeURL(fmt.Sprintf("/deals/%s", deal.ID)) } class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded bg-teal-500/10 flex items-center justify-center text-xs font-bold text-teal-400">
{ string(deal.Name[len(deal.Name)-1:]) }
</div>
<span class="text-sm font-medium group-hover:text-teal-400 transition">{ deal.Name }</span>
</a>
</td>
<td class="px-4 py-3 text-sm text-gray-400">{ deal.TargetCompany }</td>
<td class="px-4 py-3">@StageBadge(deal.Stage)</td>
<td class="px-4 py-3 text-sm text-gray-300">{ formatDealSize(deal.DealSize) }</td>
<td class="px-4 py-3 text-sm text-gray-400">{ fmt.Sprintf("%d files", deal.FileCount) }</td>
<td class="px-4 py-3 text-xs text-gray-500">{ deal.IOIDate }</td>
<td class="px-4 py-3 text-xs text-gray-500">{ deal.LOIDate }</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<!-- New Room Modal -->
<div id="newRoomModal" class="hidden fixed inset-0 z-50 flex items-center justify-center">
<div class="absolute inset-0 bg-black/60" onclick="document.getElementById('newRoomModal').classList.add('hidden')"></div>
<div class="relative bg-gray-900 border border-gray-700 rounded-xl shadow-2xl w-full max-w-xl mx-4 p-6">
<div class="flex items-center justify-between mb-5">
<h2 class="text-lg font-bold">Create New Room</h2>
<button onclick="document.getElementById('newRoomModal').classList.add('hidden')" class="text-gray-500 hover:text-gray-300">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
</button>
</div>
@newRoomForm()
</div>
</div>
}
}
func formatDealSize(size float64) string {
if size >= 1000000 {
return fmt.Sprintf("$%.0fM", size/1000000)
}
if size >= 1000 {
return fmt.Sprintf("$%.0fK", size/1000)
}
return fmt.Sprintf("$%.0f", size)
}