redesign: request detail — single column, request→response→discussion, project name in breadcrumb

This commit is contained in:
James 2026-03-12 05:03:15 -04:00
parent d3f3360c48
commit 58023f464c
2 changed files with 65 additions and 82 deletions

Binary file not shown.

View File

@ -1,96 +1,72 @@
{{define "header-left"}}
<div class="flex items-center gap-3">
<a href="/app/projects" class="text-xl font-bold text-white tracking-tight"><span class="text-[#c9a84c]">Deal</span>space</a>
<a href="/app/projects" class="text-2xl font-bold text-white tracking-tight"><span class="text-[#c9a84c]">Deal</span>space</a>
<span class="text-white/20">/</span>
<a href="/app/projects" class="text-sm text-[#94a3b8] hover:text-white transition">Projects</a>
<a id="backToProject" href="/app/projects" class="text-sm text-[#94a3b8] hover:text-white transition" id="projectNameLink">Projects</a>
<span class="text-white/20">/</span>
<a id="backToProject" href="/app/projects" class="text-sm text-[#94a3b8] hover:text-white transition">Project</a>
<span class="text-white/20">/</span>
<span id="reqRef" class="text-sm text-white font-medium">Request</span>
<span id="reqRef" class="text-sm text-white font-medium"></span>
</div>
{{end}}
{{define "content"}}
<div class="p-8 max-w-6xl">
<div class="px-8 pt-4 pb-8 max-w-3xl">
<!-- Two-column layout: Request + Response -->
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 mb-6">
<!-- LEFT: Request -->
<div class="lg:col-span-7 bg-[#0d1f3c] border border-white/[0.08] rounded-xl p-6">
<div class="flex items-start gap-3 mb-4">
<p id="reqTitle" class="text-sm text-white leading-relaxed flex-1">Loading...</p>
<button id="editReqBtn" onclick="startEditRequest()" class="shrink-0 p-1.5 rounded-lg hover:bg-white/[0.08] text-[#94a3b8] hover:text-white transition" title="Edit request">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"/></svg>
</button>
<span id="reqItemBadge" class="hidden shrink-0 px-2.5 py-1 rounded-md bg-[#c9a84c]/15 text-[#c9a84c] text-xs font-semibold"></span>
<!-- REQUEST -->
<div class="mb-6">
<div class="flex items-start justify-between gap-3 mb-2">
<div class="flex items-center gap-2 flex-wrap">
<span id="reqItemBadge" class="hidden px-2 py-0.5 rounded text-xs font-medium" style="background:var(--ds-ac);color:#fff;opacity:.85"></span>
<span id="reqPriority" class="hidden px-2 py-0.5 rounded-full text-xs font-medium"></span>
<span id="reqStatus" class="px-2 py-0.5 rounded-full text-xs font-medium capitalize"></span>
<span id="reqDue" class="hidden text-xs" style="color:var(--ds-tx3)"></span>
</div>
<p id="reqDesc" class="text-[#94a3b8] text-sm leading-relaxed mb-5"></p>
<!-- Edit mode form -->
<div id="reqEditMode" class="hidden mb-5">
<div class="space-y-3">
<div>
<label class="block text-xs font-medium text-[#94a3b8] mb-1">Title</label>
<input type="text" id="editReqTitle" class="w-full px-3 py-2 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white text-sm focus:outline-none focus:border-[#c9a84c]">
</div>
<div>
<label class="block text-xs font-medium text-[#94a3b8] mb-1">Description</label>
<textarea id="editReqDesc" rows="3" class="w-full px-3 py-2 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white text-sm focus:outline-none focus:border-[#c9a84c] resize-none"></textarea>
</div>
<div class="flex gap-3">
<div class="flex-1">
<label class="block text-xs font-medium text-[#94a3b8] mb-1">Priority</label>
<select id="editReqPriority" class="w-full px-3 py-2 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white text-sm focus:outline-none focus:border-[#c9a84c]">
<option value="critical">Critical</option>
<option value="high">High</option>
<option value="medium">Medium</option>
<option value="low">Low</option>
</select>
</div>
<div class="flex-1">
<label class="block text-xs font-medium text-[#94a3b8] mb-1">Status</label>
<select id="editReqStatus" class="w-full px-3 py-2 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white text-sm focus:outline-none focus:border-[#c9a84c]">
<option value="open">Open</option>
<option value="in_process">In Process</option>
<option value="partial">Partial</option>
<option value="complete">Complete</option>
</select>
</div>
</div>
<div class="flex gap-2">
<button onclick="saveEditRequestDetail()" class="px-4 py-2 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg text-sm transition">Save</button>
<button onclick="cancelEditRequestDetail()" class="px-4 py-2 bg-white/[0.05] hover:bg-white/[0.08] text-white rounded-lg text-sm transition">Cancel</button>
</div>
</div>
</div>
<div id="reqMetaBar" class="border-t border-white/[0.06] pt-4 flex flex-wrap items-center gap-3">
<span id="reqPriority" class="hidden px-2.5 py-1 rounded-full text-xs font-medium"></span>
<span id="reqDue" class="hidden text-xs text-[#475569]"></span>
<span id="reqStatus" class="px-2.5 py-1 rounded-full text-xs font-medium capitalize"></span>
</div>
</div>
<!-- RIGHT: Response -->
<div class="lg:col-span-5 bg-[#0d1f3c] border border-white/[0.08] rounded-xl p-6 flex flex-col">
<div id="answeredBanner" class="hidden mb-4 px-4 py-2.5 rounded-lg bg-green-500/10 border border-green-500/20 text-green-300 text-sm font-medium flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
Answered
</div>
<div id="answers" class="space-y-2 mb-4 flex-1"></div>
<div id="uploadArea" class="border-2 border-dashed border-white/[0.08] rounded-xl p-6 text-center hover:border-[#c9a84c]/40 transition cursor-pointer" onclick="document.getElementById('fileInput').click()">
<div class="text-2xl mb-1">&#128206;</div>
<p class="text-[#94a3b8] text-sm">Drop files to submit response</p>
<p class="text-[#475569] text-xs mt-1">PDF, DOCX, XLSX, images</p>
<input id="fileInput" type="file" multiple class="hidden" onchange="uploadFiles(this.files)">
</div>
<div id="uploadStatus" class="mt-2 text-sm text-[#94a3b8]"></div>
<button id="markAnsweredBtn" onclick="markAnswered()" class="hidden mt-4 w-full px-4 py-2.5 bg-green-600 hover:bg-green-700 text-white font-semibold rounded-lg text-sm transition flex items-center justify-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
Mark as Answered
<button id="editReqBtn" onclick="startEditRequest()" class="shrink-0 p-1.5 rounded hover:bg-white/[0.08] transition" style="color:var(--ds-tx3)" title="Edit">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"/></svg>
</button>
</div>
<p id="reqTitle" class="text-sm leading-relaxed" style="color:var(--ds-tx)">Loading...</p>
<p id="reqDesc" class="text-sm leading-relaxed mt-2" style="color:var(--ds-tx2)"></p>
<!-- Edit mode -->
<div id="reqEditMode" class="hidden mt-4 space-y-3 p-4 rounded-lg" style="background:var(--ds-sf);border:1px solid var(--ds-bd)">
<div><label class="block text-xs font-medium mb-1" style="color:var(--ds-tx3)">Request text</label>
<textarea id="editReqTitle" rows="4" class="w-full px-3 py-2 rounded text-sm focus:outline-none" style="background:var(--ds-bg);border:1px solid var(--ds-bd);color:var(--ds-tx)"></textarea></div>
<div class="flex gap-3">
<div class="flex-1"><label class="block text-xs font-medium mb-1" style="color:var(--ds-tx3)">Priority</label>
<select id="editReqPriority" class="w-full px-3 py-2 rounded text-sm focus:outline-none" style="background:var(--ds-bg);border:1px solid var(--ds-bd);color:var(--ds-tx)">
<option value="critical">Critical</option><option value="high">High</option><option value="medium">Medium</option><option value="low">Low</option>
</select></div>
<div class="flex-1"><label class="block text-xs font-medium mb-1" style="color:var(--ds-tx3)">Status</label>
<select id="editReqStatus" class="w-full px-3 py-2 rounded text-sm focus:outline-none" style="background:var(--ds-bg);border:1px solid var(--ds-bd);color:var(--ds-tx)">
<option value="open">Open</option><option value="in_process">In Process</option><option value="partial">Partial</option><option value="complete">Complete</option>
</select></div>
</div>
<div><label class="block text-xs font-medium mb-1" style="color:var(--ds-tx3)">Description (optional)</label>
<textarea id="editReqDesc" rows="2" class="w-full px-3 py-2 rounded text-sm focus:outline-none" style="background:var(--ds-bg);border:1px solid var(--ds-bd);color:var(--ds-tx)"></textarea></div>
<div class="flex gap-2">
<button onclick="saveEditRequestDetail()" class="px-4 py-2 rounded text-sm font-semibold transition" style="background:var(--ds-ac);color:var(--ds-act)">Save</button>
<button onclick="cancelEditRequestDetail()" class="px-4 py-2 rounded text-sm transition" style="background:var(--ds-hv);color:var(--ds-tx)">Cancel</button>
</div>
</div>
</div>
<!-- RESPONSE -->
<div class="mb-6 p-5 rounded-lg" style="background:var(--ds-sf);border:1px solid var(--ds-bd)">
<div class="flex items-center justify-between mb-3">
<span class="text-xs font-semibold uppercase tracking-wider" style="color:var(--ds-tx3)">Response</span>
<div id="answeredBanner" class="hidden px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-500/15 text-green-300">&#10003; Answered</div>
</div>
<div id="answers" class="space-y-2 mb-3"></div>
<div id="uploadArea" class="border border-dashed rounded-lg px-4 py-5 text-center cursor-pointer transition" style="border-color:var(--ds-bd)" onclick="document.getElementById('fileInput').click()"
ondragover="event.preventDefault();this.style.borderColor='var(--ds-ac)'" ondragleave="this.style.borderColor='var(--ds-bd)'"
ondrop="event.preventDefault();this.style.borderColor='var(--ds-bd)';uploadFiles(event.dataTransfer.files)">
<p class="text-sm" style="color:var(--ds-tx2)">Drop files or click to upload response</p>
<p class="text-xs mt-0.5" style="color:var(--ds-tx3)">PDF, DOCX, XLSX, images</p>
<input id="fileInput" type="file" multiple class="hidden" onchange="uploadFiles(this.files)">
</div>
<div id="uploadStatus" class="mt-2 text-xs" style="color:var(--ds-tx2)"></div>
<button id="markAnsweredBtn" onclick="markAnswered()" class="hidden mt-3 w-full py-2 rounded text-sm font-semibold bg-green-600 hover:bg-green-700 text-white transition">
&#10003; Mark as Answered
</button>
</div>
<!-- BOTTOM: Discussion (channel-based) -->
@ -179,7 +155,14 @@
// Apply role-based UI restrictions
applyRoleRestrictions();
if (req.project_id) document.getElementById('backToProject').href = '/app/projects/' + req.project_id;
if (req.project_id) {
document.getElementById('backToProject').href = '/app/projects/' + req.project_id;
// Fetch project name for breadcrumb
fetchAPI('/api/projects/' + req.project_id).then(r=>r.json()).then(p=>{
const pname = (p.data_text ? (()=>{try{return JSON.parse(p.data_text)}catch{return{}}})() : {}).name || 'Project';
document.getElementById('backToProject').textContent = pname;
}).catch(()=>{});
}
const badge = document.getElementById('reqItemBadge');
const badgeParts = [d.section, d.item_number].filter(Boolean);