package templates import "dealroom/internal/model" import "fmt" import "strings" import "time" templ DealRoomDetail(profile *model.Profile, deal *model.Deal, folders []*model.Folder, files []*model.File, requests []*model.DiligenceRequest, activeFolder string) { @Layout(profile, "deals") {
Back to Deal Rooms

{ deal.Name }

@StageBadge(deal.Stage)

{ deal.TargetCompany } ยท { deal.Description }

Deal Size
{ formatDealSize(deal.DealSize) }
IOI Date
if deal.IOIDate != "" { { deal.IOIDate } } else { }
Exclusivity Ends
if deal.ExclusivityEnd != "" { { deal.ExclusivityEnd } } else { }

Folders

for _, folder := range folders { if folder.ParentID == "" {
{ folder.Name } for _, child := range folders { if child.ParentID == folder.ID { } }
} } if profile.Role != "buyer" {
}
for _, file := range files { if activeFolder == "" || activeFolder == "all" || file.FolderID == activeFolder { } }
File Name Size Date Status Actions
@fileIcon(file.Name) { file.Name }
{ formatFileSize(file.FileSize) } { formatFileDate(file.CreatedAt) }
if profile.Role == "owner" || profile.Role == "admin" {
}
} } templ statusOption(dealID string, fileID string, status string, label string) { } func formatFileSize(bytes int64) string { if bytes < 1024 { return fmt.Sprintf("%d B", bytes) } if bytes < 1024*1024 { return fmt.Sprintf("%d KB", bytes/1024) } return fmt.Sprintf("%.1f MB", float64(bytes)/(1024*1024)) } func formatFileDate(t time.Time) string { if t.IsZero() { return "" } now := time.Now() if t.Year() == now.Year() { return t.Format("Jan 2") } return t.Format("Jan 2, 2006") } templ fileIcon(name string) {
if hasSuffix(name, ".pdf") { PDF } else if hasSuffix(name, ".xlsx") || hasSuffix(name, ".csv") { XLS } else if hasSuffix(name, ".doc") || hasSuffix(name, ".docx") { DOC } else { FILE }
} func splitLinkedFiles(ids string) []string { if ids == "" { return nil } parts := strings.Split(ids, ",") var result []string for _, p := range parts { p = strings.TrimSpace(p) if p != "" { result = append(result, p) } } return result } func getLinkedFileName(files []*model.File, fileID string) string { for _, f := range files { if f.ID == fileID { return f.Name } } return fileID } func hasSuffix(s, suffix string) bool { return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix }