feat: doc-request list linking

Show linked file names as downloadable pills in request list view.
Files linked to request items during upload are displayed inline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
James 2026-02-23 02:53:06 -05:00
parent 6484145581
commit 70939a602e
1 changed files with 37 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package templates
import "dealroom/internal/model" import "dealroom/internal/model"
import "fmt" import "fmt"
import "strings"
import "time" import "time"
templ DealRoomDetail(profile *model.Profile, deal *model.Deal, folders []*model.Folder, files []*model.File, requests []*model.DiligenceRequest, activeFolder string) { templ DealRoomDetail(profile *model.Profile, deal *model.Deal, folders []*model.Folder, files []*model.File, requests []*model.DiligenceRequest, activeFolder string) {
@ -189,6 +190,7 @@ templ DealRoomDetail(profile *model.Profile, deal *model.Deal, folders []*model.
<th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider w-16">Conf.</th> <th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider w-16">Conf.</th>
<th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider">Buyer</th> <th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider">Buyer</th>
<th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider">Seller</th> <th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider">Seller</th>
<th class="text-left px-4 py-2.5 text-xs font-medium text-gray-500 uppercase tracking-wider">Files</th>
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-gray-800/50"> <tbody class="divide-y divide-gray-800/50">
@ -213,6 +215,17 @@ templ DealRoomDetail(profile *model.Profile, deal *model.Deal, folders []*model.
</td> </td>
<td class="px-4 py-2.5 text-xs text-gray-400 max-w-[140px] truncate">{ req.BuyerComment }</td> <td class="px-4 py-2.5 text-xs text-gray-400 max-w-[140px] truncate">{ req.BuyerComment }</td>
<td class="px-4 py-2.5 text-xs text-gray-400 max-w-[140px] truncate">{ req.SellerComment }</td> <td class="px-4 py-2.5 text-xs text-gray-400 max-w-[140px] truncate">{ req.SellerComment }</td>
<td class="px-4 py-2.5">
if req.LinkedFileIDs != "" {
<div class="flex gap-1 flex-wrap">
for _, lfid := range splitLinkedFiles(req.LinkedFileIDs) {
<a href={ templ.SafeURL(fmt.Sprintf("/deals/files/download/%s", lfid)) } class="text-xs px-1.5 py-0.5 rounded bg-teal-500/10 text-teal-400 hover:bg-teal-500/20 transition">
{ getLinkedFileName(files, lfid) }
</a>
}
</div>
}
</td>
</tr> </tr>
} }
</tbody> </tbody>
@ -382,6 +395,30 @@ templ fileIcon(name string) {
</div> </div>
} }
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 { func hasSuffix(s, suffix string) bool {
return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
} }