Explore mujh static form k code dy do mere complaince form ke liya jisme menu sub menu ho full… Save Share Download ▾ Reportmujh static form k code dy do mere complaince form ke liya jisme menu sub menu ho full professional chahiya
.app {
display: flex;
min-height: 100vh;
}
.ct {
flex: 1;
padding: 26px;
}
.page {
max-width: 1300px;
margin: auto;
}
.layout {
display: grid;
grid-template-columns: 1fr 320px;
gap: 24px;
align-items: start;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 22px;
}
.page-title {
font-size: 22px;
font-weight: 600;
}
.card {
background: white;
border: 1px solid #e5e7eb;
border-radius: 12px;
margin-bottom: 18px;
}
.card-head {
padding: 14px 18px;
border-bottom: 1px solid #eee;
font-weight: 600;
}
.card-body {
padding: 18px;
}
.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.field {
display: flex;
flex-direction: column;
gap: 5px;
}
.field label {
font-size: 14px;
font-weight: 600;
color: #555;
}
.field input:not([type="range"]), .field select, .field textarea {
padding: 10px;
border-radius: 8px;
border: 1px solid #d1d5db;
font-size: 13px;
}
textarea {
min-height: 70px;
}
.pills {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.pills input {
display: none;
}
.pills label {
padding: 6px 14px;
border-radius: 20px;
border: 1px solid #d1d5db;
font-size: 12px;
cursor: pointer;
background: #ffffff;
transition: all 0.2s ease;
}
/* Applies the dynamic color passed from the backend /
.pills label[data-color] {
border-color: var(--pill-color, #d1d5db);
color: var(--pill-color, #555);
}
/ Selected state - Now works because input and label are siblings */
.pills input:checked + label[data-color] {
background: var(--pill-color, #185FA5);
color: white;
border-color: var(--pill-color, #185FA5);
font-weight: 600;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* =========================================
STATUS PILLS
========================================= */
.status-pills {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-top: 2px;
}
.status-pills input {
display: none;
}
.status-pills label {
padding: 6px 16px;
border-radius: 20px;
border: 1px solid var(--pill-color, #e2e8f0);
font-size: 13px;
font-weight: 500;
cursor: pointer;
background: #ffffff;
color: var(--pill-color, #64748b);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.status-pills label:hover {
background: rgba(0, 0, 0, 0.03);
transform: translateY(-1px);
}
/* Selected state */
.status-pills input:checked + label[data-color] {
background: var(--pill-color, #185FA5) !important;
color: #ffffff !important;
border-color: var(--pill-color, #185FA5) !important;
font-weight: 600;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}
.side {
background: white;
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 18px;
position: sticky;
top: 26px;
}
Show full message · 1,633 lines yr side bar toh mere alredy hai nav sy aa rh mujh mainly isme menu or submenu chahiya
Samajh gaya! Aapka sidebar already hai, mujhe sirf compliance form chahiye. Main App.tsx update karta hoon - sidebar remove karke sirf form rakhta hoon:
Ab build karta hoon:
Ho gaya! ✅ Ab sirf Compliance Form hai bina sidebar ke. Aapko ye files mili hain:
Main Components:
src/App.tsx - Sirf form render karta hai
src/components/ComplianceForm.tsx - Main form with all cards
src/components/StatusPills.tsx - Open/Hold/Close status
src/components/RiskLevelPills.tsx - Risk level selection
src/components/FrequencyPills.tsx - Frequency selection
src/components/AttachmentsSection.tsx - File upload with drag & drop
src/components/RemarksSection.tsx - Remarks add/history
Form Features:
✅ Compliance Information card (Title, Framework, Control, Description)
✅ Status pills - Open (green), Hold (yellow), Close (red)
✅ Hold Reason box - jab Hold select karo tab dikhta hai
Copy first prompt
Other models, same or similar prompt Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Details
Provider Unknown
Model provenance As recorded by source dataset
Turns 2 (4 messages)
Language en
Conversation date Jul 14, 2026
Added to archive Nov 19, 2026
ID 01m7tp6nxqtpgdm2419hqtdp1hSource & license Imported from Arena WebDev Preferences (2026) (source ). Imported records earn no Research Points.
Upstream record: 019f5f36-2f74-71e2-84c4-4b078ba6b1be:b
Chi et al., Interaction-as-a-Judge (2026). arXiv:2610.17895.
License: Prompts CC-BY-4.0; outputs governed by provider terms
Dataset releases Not yet included in a published release.
.detail {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
font-size: 13px;
border-bottom: 1px solid #eee;
}
.detail-badge {
padding: 4px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
border: 1px solid;
}
.remark-bottom-group {
margin-top: 20px;
padding-top: 16px;
border-top: 1px solid #f1f5f9;
}
.remark-input-area {
width: 100%;
min-height: 105px;
padding: 12px;
border-radius: 8px;
border: 1px solid #cbd5e1;
background: #ffffff;
font-size: 13px;
color: #334155;
font-family: inherit;
line-height: 1.5;
resize: vertical;
box-sizing: border-box;
}
.history-accordion {
margin-top: 16px;
border-radius: 8px;
}
.history-summary {
font-size: 14px;
font-weight: 600;
color: #185FA5;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
user-select: none;
}
.actions {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 24px;
padding-top: 16px;
border-top: 1px solid #eee;
}
.btn {
padding: 9px 18px;
border-radius: 8px;
border: 1px solid #ccc;
background: white;
cursor: pointer;
font-size: 13px;
font-weight: 600;
color: #475569;
text-decoration: none;
display: inline-flex;
align-items: center;
}
.btn-primary {
background: #185FA5;
color: white;
border: none;
border-radius: 8px;
height: 40px;
font-size: 13px;
font-weight: 600;
padding: 0 24px;
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
/* ═══════════════════════════════════════════════════════════
ATTACHMENT STYLES
═══════════════════════════════════════════════════════════ */
.attach-toggle-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 10px 16px;
border: 1px solid #e2e8f0;
border-radius: 10px;
user-select: none;
background: #f8fafc;
transition: background 0.15s ease, border-color 0.15s ease;
}
.attach-toggle-bar:hover {
background: #f1f5f9;
border-color: #cbd5e1;
}
.attach-toggle-left {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
flex: 1;
}
.attach-toggle-left svg {
color: #475569;
flex-shrink: 0;
}
.attach-toggle-label {
font-size: 14px;
font-weight: 600;
color: #1e293b;
}
.attach-count-badge {
display: none;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: 700;
min-width: 20px;
height: 20px;
padding: 0 5px;
border-radius: 50%;
background: #0f172a;
color: #ffffff;
}
.attach-count-badge.visible {
display: inline-flex;
}
.attach-toggle-right {
display: flex;
align-items: center;
gap: 12px;
}
.view-files-btn {
display: none;
align-items: center;
gap: 6px;
padding: 6px 14px;
border-radius: 8px;
border: 1px solid #185FA5;
background: #ffffff;
color: #185FA5;
font-size: 12.5px;
font-weight: 600;
cursor: pointer;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.view-files-btn:hover {
background: #f0f7ff;
transform: translateY(-0.5px);
}
.attach-chevron {
transition: transform 0.2s ease;
color: #64748b;
cursor: pointer;
padding: 4px;
border-radius: 4px;
}
.attach-chevron:hover {
background: #e2e8f0;
}
.attach-chevron.open {
transform: rotate(90deg);
}
.attach-panel {
display: none;
margin-top: 10px;
border: 1px solid #e2e8f0;
border-radius: 10px;
overflow: hidden;
}
.attach-panel.open {
display: block;
}
.attach-drop-zone {
border: 2px dashed #cbd5e1;
border-radius: 0;
padding: 18px 16px;
text-align: center;
cursor: pointer;
background: #f8fafc;
transition: background 0.2s ease, border-color 0.2s ease;
}
.attach-drop-zone:hover, .attach-drop-zone.drag-over {
background: #f0f7ff;
border-color: #185FA5;
}
.attach-drop-icon {
width: 36px;
height: 36px;
border-radius: 50%;
background: #185FA5;
display: flex;
align-items: center;
justify-content: center;
color: white;
margin: 0 auto 8px;
}
.attach-drop-title {
font-size: 13px;
font-weight: 600;
color: #1e293b;
margin: 0 0 4px;
}
.attach-drop-sub {
font-size: 11px;
color: #94a3b8;
margin: 0;
}
.attach-type-pills {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 5px;
margin-top: 10px;
}
.attach-type-pill {
font-size: 10px;
font-weight: 700;
padding: 2px 7px;
border-radius: 4px;
letter-spacing: 0.03em;
}
.attach-type-pill.pdf {
background: #fee2e2;
color: #dc2626;
}
.attach-type-pill.doc {
background: #dbeafe;
color: #2563eb;
}
.attach-type-pill.xls {
background: #d1fae5;
color: #059669;
}
.attach-type-pill.img {
background: #ede9fe;
color: #7c3aed;
}
.attach-file-list {
display: flex;
flex-direction: column;
}
.attach-file-row {
display: flex;
align-items: center;
gap: 10px;
padding: 9px 14px;
border-top: 1px solid #f1f5f9;
background: #ffffff;
transition: background 0.15s ease;
}
.attach-file-row:hover {
background: #f8fafc;
}
.attach-file-badge {
width: 32px;
height: 32px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
font-size: 9px;
font-weight: 700;
flex-shrink: 0;
}
.attach-file-badge.pdf {
background: #fee2e2;
color: #dc2626;
}
.attach-file-badge.doc {
background: #dbeafe;
color: #2563eb;
}
.attach-file-badge.xls {
background: #d1fae5;
color: #059669;
}
.attach-file-badge.img {
background: #ede9fe;
color: #7c3aed;
}
.attach-file-info {
flex: 1;
min-width: 0;
}
.attach-file-name {
font-size: 12px;
font-weight: 500;
color: #334155;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.attach-file-meta {
font-size: 11px;
color: #94a3b8;
margin: 0;
}
.attach-file-actions {
display: flex;
gap: 5px;
flex-shrink: 0;
}
.attach-icon-btn {
width: 28px;
height: 28px;
border-radius: 6px;
border: 1px solid #e2e8f0;
background: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s ease;
text-decoration: none;
color: #64748b;
}
.attach-icon-btn:hover {
background: #f8fafc;
border-color: #cbd5e1;
}
.attach-icon-btn.danger {
color: #dc2626;
}
.attach-icon-btn.danger:hover {
background: #fef2f2;
border-color: #fca5a5;
}
.attach-icon-btn.primary {
color: #185FA5;
}
.attach-icon-btn.primary:hover {
background: #f0f7ff;
border-color: #185FA5;
}
.attach-section-label {
font-size: 11px;
font-weight: 600;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.06em;
padding: 8px 14px 4px;
background: #ffffff;
border-top: 1px solid #f1f5f9;
}
.attach-new-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 14px 4px;
background: #ffffff;
border-top: 1px solid #f1f5f9;
}
.clear-all-btn {
font-size: 11px;
font-weight: 600;
color: #64748b;
background: none;
border: 1px solid #e2e8f0;
border-radius: 5px;
padding: 2px 8px;
cursor: pointer;
}
.clear-all-btn:hover {
background: #f8fafc;
}
/* FILES DRAWER */
.files-drawer-overlay {
position: fixed;
inset: 0;
background: rgba(15, 23, 42, 0.35);
z-index: 999;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
}
.files-drawer-overlay.open {
opacity: 1;
pointer-events: all;
}
.files-drawer {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 320px;
background: white;
border-left: 1px solid #e2e8f0;
display: flex;
flex-direction: column;
transform: translateX(100%);
transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
z-index: 1000;
}
.files-drawer-overlay.open .files-drawer {
transform: translateX(0);
}
.files-drawer-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 18px;
border-bottom: 1px solid #f1f5f9;
flex-shrink: 0;
}
.files-drawer-title {
font-size: 14px;
font-weight: 600;
color: #1e293b;
display: flex;
align-items: center;
gap: 8px;
}
.files-drawer-count {
font-size: 12px;
font-weight: 500;
color: #94a3b8;
}
.files-drawer-close {
width: 30px;
height: 30px;
border-radius: 7px;
border: 1px solid #e2e8f0;
background: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #64748b;
font-size: 16px;
}
.files-drawer-body {
flex: 1;
overflow-y: auto;
}
.files-drawer-section {
font-size: 11px;
font-weight: 600;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.06em;
padding: 12px 18px 6px;
border-bottom: 1px solid #f8fafc;
}
.files-drawer-row {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 18px;
border-bottom: 1px solid #f8fafc;
}
.files-drawer-empty {
padding: 32px 18px;
text-align: center;
font-size: 13px;
color: #94a3b8;
}
.files-drawer-foot {
padding: 14px 18px;
border-top: 1px solid #f1f5f9;
flex-shrink: 0;
}
.files-drawer-foot-btn {
width: 100%;
padding: 8px;
border-radius: 8px;
border: 1px solid #e2e8f0;
background: #f8fafc;
font-size: 13px;
font-weight: 600;
color: #475569;
cursor: pointer;
}
/* ==========================
FREQUENCY PILLS
========================== */
.pills {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.pills input[type="radio"] {
display: none;
}
.pills label {
padding: 8px 16px;
border: 1px solid #d1d5db;
border-radius: 20px;
background: #fff;
color: #475569;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: all .25s ease;
}
.pills label:hover {
border-color: #16a34a;
background: #f0fdf4;
}
.pills input[type="radio"]:checked + label {
background: #16a34a;
border-color: #16a34a;
color: #fff;
font-weight: 600;
box-shadow: 0 4px 10px rgba(22,163,74,.25);
}
code Copy code
<div class="layout">
<div>
<!-- ADDED enctype="multipart/form-data" -->
<form th:action="@{/compliance/save}" th:object="${compliance}"
method="post" enctype="multipart/form-data">
<input type="hidden" th:field="*{id}">
<input type="hidden" id="originalStatus"
th:value="${compliance.status != null ? compliance.status.id : ''}">
<div class="card">
<div class="card-head">Compliance Information</div>
<div class="card-body">
<div class="grid-2">
<div class="field">
<label> Title <span
style="color: #dc2626;">*</span></label> <input type="text"
th:field="*{complianceName}"
placeholder="e.g., Annual IAM Production Access Review"
required>
</div>
<div class="field">
<label>Compliance Framework / Regulation</label> <select id="frameworkSelect" th:field="*{framework.id}">
<option value="">-- Select Framework --</option>
<option th:each="f : ${frameworkList}"
th:value="${f.id}"
th:text="${f.name}">
</option>
code Copy code
<div class="field">
<label>Control Name</label>
code Copy code
</div>
<div class="field" style="margin-top: 16px;">
<label>Control Description & Objective</label>
<textarea th:field="*{description}"
placeholder="Describe the exact procedure..."></textarea>
</div>
<div class="grid-2" style="margin-top: 20px;">
<!-- STATUS PILLS UI -->
<div class="field">
<label>Status</label>
<!-- EDIT MODE: Show all status pills with selection -->
<div class="status-pills" th:if="${compliance.id != null}">
<th:block th:each="st : ${statusList}">
<input type="radio"
th:id="'status_'+${st.id}"
th:value="${st.id}"
th:attr="data-status=${st.complianceStatus}"
th:field="*{status}">
<label th:for="'status_'+${st.id}"
th:text="${st.complianceStatus}"
data-color="true"
th:style="${st.complianceStatus == 'Open'} ? '--pill-color: #10b981' :
(${st.complianceStatus == 'Hold'} ? '--pill-color: #f59e0b' :
(${st.complianceStatus == 'Close'} ? '--pill-color: #ef4444' : '--pill-color: #6b7280'))">
</label>
</th:block>
</div>
<!-- CREATE MODE: Show only ONE filled "Open" pill -->
<div th:if="${compliance.id == null}" style="display: inline-block;">
<div style="padding: 6px 16px; border-radius: 20px; background: #10b981; color: white;
border: 1px solid #10b981; font-size: 13px; font-weight: 600;
display: inline-flex; align-items: center;">
Open
</div>
<!-- Hidden input to submit the Open status ID -->
<input type="hidden" th:field="*{status}" th:value="${statusList[0].id}">
</div>
</div>
<!-- RISK LEVEL PILLS UI -->
<div class="field">
<label>Risk Impact Level</label>
<div class="pills">
<!-- Restructured: input and label are now siblings, not nested -->
<th:block th:each="rl, stat : ${riskLevels}">
<input type="radio"
th:id="'rl_' + ${stat.index}"
th:value="${rl.name}"
th:field="*{riskLevel}">
<label th:for="'rl_' + ${stat.index}"
th:text="${rl.name}"
th:data-color="${rl.color}"
th:style="'--pill-color:' + ${rl.color}">
</label>
</th:block>
</div>
</div>
</div>
<!-- Hold Reason Box (Optional) -->
<div id="holdBox" class="field" style="display: none; margin-top: 15px; max-width: 450px;">
<label>Hold Reason</label>
<textarea th:field="*{holdReason}" class="remark-input-area"
style="min-height: 80px; margin-top: 6px;"
placeholder="Explain why this is being put on hold..."></textarea>
</div>
<!-- Closure Reason Box (Optional) -->
<div id="closeBox" class="field" style="display: none; margin-top: 15px; max-width: 450px;">
<label>Close Remarks</label>
<textarea th:field="*{closeRemarks}" class="remark-input-area"
style="min-height: 80px; margin-top: 6px;"
placeholder="Explain why this is being closed..."></textarea>
</div>
</div>
</div>
<div class="card">
<div class="card-head">Ownership & Urgency</div>
<div class="card-body">
<div class="grid-2">
<div class="field">
<label>Assigned Control Owner <span
style="color: #dc2626;">*</span></label> <select
th:field="*{owner.userId}" required>
<option value="">-- Select Owner --</option>
<option th:each="u : ${ownerList}" th:value="${u.userId}"
th:text="${u.firstName} + ' ' + ${u.lastName}"></option>
</select>
</div>
<!-- FREQUENCY SELECT -->
code Copy code
<label>Frequency</label>
<div class="pills">
<th:block th:each="f : ${frequencyList}">
<input type="radio"
th:id="'freq_' + ${f.id}"
th:field="*{schedule.frequency.id}"
th:value="${f.id}">
<label th:for="'freq_' + ${f.id}"
th:text="${f.frequencyName}">
</label>
</th:block>
</div>
code Copy code
<label style="display:flex;align-items:center;gap:8px;font-weight:500;cursor:pointer;">
<input type="checkbox"
th:field="*{schedule.autoGenerate}">
Auto Generate Compliance
</label>
code Copy code
</div>
<!-- <div class="grid-2" style="margin-top:18px;">
code Copy code
</div>
</div>
<!-- ═════════════════════════════════════════════════════
MERGED: ATTACHMENTS & REMARKS CARD
═════════════════════════════════════════════════════ -->
<div class="card">
<div class="card-head">
<span th:if="${compliance.id != null}">Attachments & Remarks</span>
<span th:unless="${compliance.id != null}">Attachments</span>
</div>
<div class="card-body">
<!-- GENERAL ATTACHMENTS -->
<div style="margin-bottom: 24px;">
<h4
style="font-size: 14px; font-weight: 600; color: #1e293b; margin: 0 0 14px;">General
Attachments</h4>
<input type="file" id="generalFileInput" name="generalFiles"
multiple accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.xls,.xlsx"
onchange="handleGeneralFiles(this.files)"
style="display: none;">
<div class="attach-toggle-bar" id="generalToggleBar">
<div class="attach-toggle-left"
onclick="toggleGeneralPanel()">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.5">
<path
d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" /></svg>
<span class="attach-toggle-label">General Files</span> <span
class="attach-count-badge" id="generalCountBadge"></span>
</div>
<div class="attach-toggle-right">
<button type="button" id="viewGeneralFilesBtn"
class="view-files-btn" onclick="openGeneralFilesDrawer()">
<span>View files</span>
</button>
<svg class="attach-chevron" id="generalChevron"
onclick="toggleGeneralPanel()" width="20" height="20"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5">
<polyline points="9 18 15 12 9 6" /></svg>
</div>
</div>
<div class="attach-panel" id="generalPanel">
<div class="attach-drop-zone" id="generalDropZone"
onclick="document.getElementById('generalFileInput').click()">
<div class="attach-drop-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" /></svg>
</div>
<p class="attach-drop-title">Click to upload or drag &
drop</p>
<p class="attach-drop-sub">Max 10MB per file</p>
<div class="attach-type-pills">
<span class="attach-type-pill pdf">PDF</span><span
class="attach-type-pill doc">DOC</span><span
class="attach-type-pill xls">XLS</span><span
class="attach-type-pill img">IMG</span>
</div>
</div>
<div id="existingGeneralFilesSource" style="display: none;">
<div
th:if="${compliance.id != null and attachments != null and !attachments.isEmpty()}">
<div class="attach-file-list" id="existingGeneralFileList">
<div th:each="att : ${attachments}"
th:if="${att.attachmentType == null or att.attachmentType == 'GENERAL'}"
class="attach-file-row existing-file-card"
th:attr="data-size=${att.fileSize}, data-date=${att.uploadedAt != null ? #temporals.format(att.uploadedAt, 'dd MMM yyyy') : ''}">
<div class="attach-file-badge"
th:classappend="${att.attachmentName.endsWith('.pdf') ? 'pdf' : (att.attachmentName.endsWith('.doc') or att.attachmentName.endsWith('.docx')) ? 'doc' : (att.attachmentName.endsWith('.xls') or att.attachmentName.endsWith('.xlsx')) ? 'xls' : 'img'}">
<span
th:text="${att.attachmentName.endsWith('.pdf') ? 'PDF' : (att.attachmentName.endsWith('.doc') or att.attachmentName.endsWith('.docx')) ? 'DOC' : (att.attachmentName.endsWith('.xls') or att.attachmentName.endsWith('.xlsx')) ? 'XLS' : 'IMG'}"></span>
</div>
<div class="attach-file-info">
<p class="attach-file-name"
th:text="${att.attachmentName}">filename.pdf</p>
</div>
<div class="attach-file-actions">
<a
th:href="@{'/compliance/Uploads/' + ${att.attachmentName}}"
class="attach-icon-btn primary" download
title="Download"><svg width="14" height="14"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" /></svg></a>
<button type="button"
th:onclick="'deleteAttachment(' + ${att.id} + ', this)'"
class="attach-icon-btn danger" title="Delete">
<svg width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="3 6 5 6 21 6" />
<path
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></svg>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="generalFilePreviewContainer" style="display: none;">
<div class="attach-new-header">
<span class="attach-section-label"
style="padding: 0; border: none;">New files</span>
<button type="button" onclick="clearGeneralFiles()"
class="clear-all-btn">Clear all</button>
</div>
<div id="generalFileList" class="attach-file-list"></div>
</div>
</div>
</div>
<!-- EVIDENCE ATTACHMENTS -->
<!-- <div style="margin-bottom: 24px;">-->
<div style="margin-bottom: 24px;" th:if="${compliance.id != null}">
<h4
style="font-size: 14px; font-weight: 600; color: #1e293b; margin: 0 0 14px;">Evidence
Attachments</h4>
<input type="file" id="evidenceFileInput" name="evidenceFiles"
multiple accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.xls,.xlsx"
onchange="handleEvidenceFiles(this.files)"
style="display: none;">
<div class="attach-toggle-bar" id="evidenceToggleBar">
<div class="attach-toggle-left"
onclick="toggleEvidencePanel()">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.5">
<path
d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" /></svg>
<span class="attach-toggle-label">Evidence Files</span> <span
class="attach-count-badge" id="evidenceCountBadge"></span>
</div>
<div class="attach-toggle-right">
<button type="button" id="viewEvidenceFilesBtn"
class="view-files-btn" onclick="openEvidenceFilesDrawer()">
<span>View files</span>
</button>
<svg class="attach-chevron" id="evidenceChevron"
onclick="toggleEvidencePanel()" width="20" height="20"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5">
<polyline points="9 18 15 12 9 6" /></svg>
</div>
</div>
<div class="attach-panel" id="evidencePanel">
<div class="attach-drop-zone" id="evidenceDropZone"
onclick="document.getElementById('evidenceFileInput').click()">
<div class="attach-drop-icon">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" /></svg>
</div>
<p class="attach-drop-title">Click to upload or drag &
drop</p>
<p class="attach-drop-sub">Max 10MB per file</p>
<div class="attach-type-pills">
<span class="attach-type-pill pdf">PDF</span><span
class="attach-type-pill doc">DOC</span><span
class="attach-type-pill xls">XLS</span><span
class="attach-type-pill img">IMG</span>
</div>
</div>
<div id="existingEvidenceFilesSource" style="display: none;">
<div
th:if="${compliance.id != null and attachments != null and !attachments.isEmpty()}">
<div class="attach-file-list" id="existingEvidenceFileList">
<div th:each="att : ${attachments}"
th:if="${att.attachmentType == 'EVIDENCE'}"
class="attach-file-row existing-file-card"
th:attr="data-size=${att.fileSize}, data-date=${att.uploadedAt != null ? #temporals.format(att.uploadedAt, 'dd MMM yyyy') : ''}">
<div class="attach-file-badge"
th:classappend="${att.attachmentName.endsWith('.pdf') ? 'pdf' : (att.attachmentName.endsWith('.doc') or att.attachmentName.endsWith('.docx')) ? 'doc' : (att.attachmentName.endsWith('.xls') or att.attachmentName.endsWith('.xlsx')) ? 'xls' : 'img'}">
<span
th:text="${att.attachmentName.endsWith('.pdf') ? 'PDF' : (att.attachmentName.endsWith('.doc') or att.attachmentName.endsWith('.docx')) ? 'DOC' : (att.attachmentName.endsWith('.xls') or att.attachmentName.endsWith('.xlsx')) ? 'XLS' : 'IMG'}"></span>
</div>
<div class="attach-file-info">
<p class="attach-file-name"
th:text="${att.attachmentName}">filename.pdf</p>
</div>
<div class="attach-file-actions">
<a
th:href="@{'/compliance/Uploads/' + ${att.attachmentName}}"
class="attach-icon-btn primary" download
title="Download"><svg width="14" height="14"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" /></svg></a>
<button type="button"
th:onclick="'deleteAttachment(' + ${att.id} + ', this)'"
class="attach-icon-btn danger" title="Delete">
<svg width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2.5">
<polyline points="3 6 5 6 21 6" />
<path
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /></svg>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="evidenceFilePreviewContainer" style="display: none;">
<div class="attach-new-header">
<span class="attach-section-label"
style="padding: 0; border: none;">New files</span>
<button type="button" onclick="clearEvidenceFiles()"
class="clear-all-btn">Clear all</button>
</div>
<div id="evidenceFileList" class="attach-file-list"></div>
</div>
</div>
</div>
<!-- REMARKS SECTION (MERGED INSIDE SAME CARD) -->
<div th:if="${compliance.id != null}"
class="remark-bottom-group">
<div id="remarkContainer">
<details class="history-accordion">
<summary class="history-summary"
style="font-size: 13px; display: inline-flex; align-items: center; gap: 4px; color: #475569; background: #f1f5f9; padding: 6px 12px; border-radius: 6px;">
<span class="history-arrow">▶</span> <span>Add a
Remark</span>
</summary>
<div
style="margin-top: 14px; display: flex; flex-direction: column; gap: 16px;">
<div
style="display: flex; flex-direction: column; gap: 6px;">
<textarea name="remark" id="remark"
class="remark-input-area" style="min-height: 80px;"
placeholder="Add a remark about this compliance..."></textarea>
</div>
<details
th:if="${remarkHistory != null and !remarkHistory.isEmpty()}"
class="history-accordion"
style="border-top: 1px dashed #e2e8f0; padding-top: 14px;">
<summary class="history-summary"
style="font-size: 13px; color: #185FA5;">
<span class="history-arrow">▶</span> Remarks History
</summary>
<div
style="display: flex; flex-direction: column; gap: 12px; margin-top: 12px; max-height: 250px; overflow-y: auto; padding-right: 4px;">
<div th:each="remark : ${remarkHistory}"
style="background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px;">
<div
style="font-size: 13px; color: #334155; line-height: 1.5; margin-bottom: 8px; word-break: break-word;"
th:text="${remark.text}">Remark text here...</div>
<div
style="display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #64748b; border-top: 1px dashed #e2e8f0; padding-top: 6px;">
<span> <span style="color: #94a3b8;">By:</span>
<span th:text="${remark.createdBy}">User Name</span>
</span> <span
th:text="${#temporals.format(remark.createdAt, 'dd-MMM-yyyy hh:mm a')}">24-Jun-2026
03:15 PM</span>
</div>
</div>
</div>
</details>
</div>
</details>
</div>
</div>
</div>
</div>
<div class="actions">
<a th:href="@{/compliance/list}" class="btn">Cancel</a>
<button type="submit" class="btn-primary">Save
Task</button>
</div>
</form>
</div>
<!-- Side Panel -->
<div class="side">
<h3 style="margin-top: 0; margin-bottom: 14px; font-size: 15px;">Compliance
Details</h3>
<div class="detail">
<span>Compliance ID</span><span th:text="${compliance.id} ?: '-'"></span>
</div>
<div class="detail">
<span>Framework</span><span
th:text="${compliance.framework != null ? compliance.framework.name : '-'}"></span>
</div>
<div class="detail">
<span>Risk Impact Level</span>
<span th:class="${compliance.riskLevel != null} ? 'detail-badge' : ''"
th:style="${compliance.riskLevel != null} ? 'background: #fef3c7; color: #d97706; border-color: #fcd34d;' : ''"
th:text="${compliance.riskLevel != null} ? ${compliance.riskLevel} : '-'">
</span>
</div>
<!-- Status field - FIXED -->
<div class="detail">
<span>Status</span>
<span th:if="${compliance.status != null}"
th:text="${compliance.status.complianceStatus}"
class="detail-badge"
style="background: #dbeafe; color: #2563eb; border-color: #bfdbfe;">
</span>
<span th:unless="${compliance.status != null}">-</span>
</div>
<!-- Control Owner field - FIXED -->
<div class="detail">
<span>Control Owner</span>
<span th:if="${compliance.owner != null and compliance.owner.firstName != null}">
<span th:text="${compliance.owner.firstName}"></span>
<span th:if="${compliance.owner.lastName != null}" th:text="' ' + ${compliance.owner.lastName}"></span>
</span>
<span th:unless="${compliance.owner != null and compliance.owner.firstName != null}">-</span>
</div>
<div class="detail">
<span>Due Date</span><span
th:text="${compliance.dueDate != null ? #temporals.format(compliance.dueDate, 'dd MMM yyyy') : '-'}"></span>
</div>
<div class="detail">
<span>Created</span><span
th:text="${compliance.createdAt != null ? #temporals.format(compliance.createdAt,'yyyy-MM-dd HH:mm') : '-'}"></span>
</div>
<div class="detail">
<span>Modified</span><span
th:text="${compliance.updatedAt != null ? #temporals.format(compliance.updatedAt,'yyyy-MM-dd HH:mm') : '-'}"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- FILES DRAWER OVERLAY (Must be outside .app) -->
<div class="files-drawer-overlay" id="filesDrawerOverlay"
onclick="closeFilesDrawer(event)">
<div class="files-drawer">
<div class="files-drawer-head">
<span class="files-drawer-title"><svg width="15" height="15"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5">
<path
d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" /></svg>Attachments<span
class="files-drawer-count" id="drawerCount"></span></span>
<button class="files-drawer-close" onclick="closeFilesDrawer()"
aria-label="Close">✕</button>
</div>
<div class="files-drawer-body" id="filesDrawerBody">
<div class="files-drawer-empty">No files uploaded yet.</div>
</div>
<div class="files-drawer-foot">
<button type="button" class="files-drawer-foot-btn"
onclick="closeFilesDrawer()">Close panel</button>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.history-summary').forEach(summary => {
summary.addEventListener('click', function() {
const arrow = this.querySelector('.history-arrow');
if (arrow) { setTimeout(() => { arrow.style.transform = this.parentElement.hasAttribute('open') ? 'rotate(90deg)' : 'rotate(0deg)'; }, 10); }
});
});
});
code Copy code
<!-- FILE HANDLING JS -->
<script>
let selectedGeneralFiles = [];
let selectedEvidenceFiles = [];
function toggleGeneralPanel(forceOpen) { const panel = document.getElementById('generalPanel'); const chevron = document.getElementById('generalChevron'); const shouldOpen = forceOpen !== undefined ? forceOpen : !panel.classList.contains('open'); panel.classList.toggle('open', shouldOpen); chevron.classList.toggle('open', shouldOpen); }
function handleGeneralFiles(files) { handleFilesForType(files, selectedGeneralFiles, 'general'); updateGeneralFilePreview(); updateGeneralCountBadge(); }
function updateGeneralCountBadge() { const badge = document.getElementById('generalCountBadge'); const existingCount = document.querySelectorAll('#existingGeneralFileList .existing-file-card').length; const total = existingCount + selectedGeneralFiles.length; if (total > 0) { badge.textContent = total; badge.classList.add('visible'); } else { badge.classList.remove('visible'); } updateGeneralViewFilesBtn(); }
function updateGeneralViewFilesBtn() { const btn = document.getElementById('viewGeneralFilesBtn'); if (!btn) return; const total = document.querySelectorAll('#existingGeneralFileList .existing-file-card').length + selectedGeneralFiles.length; btn.style.display = total > 0 ? 'inline-flex' : 'none'; }
function updateGeneralFilePreview() { const container = document.getElementById('generalFilePreviewContainer'); const fileList = document.getElementById('generalFileList'); if (selectedGeneralFiles.length === 0) { container.style.display = 'none'; return; } container.style.display = 'block'; fileList.innerHTML = ''; selectedGeneralFiles.forEach((file, index) => { const ext = file.name.split('.').pop().toLowerCase(); let badgeClass = 'img', badgeText = 'IMG'; if (ext === 'pdf') { badgeClass = 'pdf'; badgeText = 'PDF'; } else if (ext === 'doc' || ext === 'docx') { badgeClass = 'doc'; badgeText = 'DOC'; } else if (ext === 'xls' || ext === 'xlsx') { badgeClass = 'xls'; badgeText = 'XLS'; } const item = document.createElement('div'); item.className = 'attach-file-row'; item.innerHTML = '' + badgeText + '' + file.name + '' + formatFileSize(file.size) + ''; fileList.appendChild(item); }); const dt = new DataTransfer(); selectedGeneralFiles.forEach(f => dt.items.add(f)); document.getElementById('generalFileInput').files = dt.files; }
function removeGeneralFile(index) { selectedGeneralFiles.splice(index, 1); updateGeneralFilePreview(); updateGeneralCountBadge(); }
function clearGeneralFiles() { selectedGeneralFiles = []; updateGeneralFilePreview(); updateGeneralCountBadge(); }
function toggleEvidencePanel(forceOpen) { const panel = document.getElementById('evidencePanel'); const chevron = document.getElementById('evidenceChevron');
if (!panel || !chevron) return;
const shouldOpen = forceOpen !== undefined ? forceOpen : !panel.classList.contains('open'); panel.classList.toggle('open', shouldOpen); chevron.classList.toggle('open', shouldOpen); }
function handleEvidenceFiles(files) { handleFilesForType(files, selectedEvidenceFiles, 'evidence'); updateEvidenceFilePreview(); updateEvidenceCountBadge(); }
function updateEvidenceCountBadge() { const badge = document.getElementById('evidenceCountBadge');
if (!badge) return;
const existingCount = document.querySelectorAll('#existingEvidenceFileList .existing-file-card').length; const total = existingCount + selectedEvidenceFiles.length; if (total > 0) { badge.textContent = total; badge.classList.add('visible'); } else { badge.classList.remove('visible'); } updateEvidenceViewFilesBtn(); }
function updateEvidenceViewFilesBtn() { const btn = document.getElementById('viewEvidenceFilesBtn'); if (!btn) return; const total = document.querySelectorAll('#existingEvidenceFileList .existing-file-card').length + selectedEvidenceFiles.length; btn.style.display = total > 0 ? 'inline-flex' : 'none'; }
function updateEvidenceFilePreview() { const container = document.getElementById('evidenceFilePreviewContainer'); const fileList = document.getElementById('evidenceFileList');
if (!container || !fileList) return;
if (selectedEvidenceFiles.length === 0) { container.style.display = 'none'; return; } container.style.display = 'block'; fileList.innerHTML = ''; selectedEvidenceFiles.forEach((file, index) => { const ext = file.name.split('.').pop().toLowerCase(); let badgeClass = 'img', badgeText = 'IMG'; if (ext === 'pdf') { badgeClass = 'pdf'; badgeText = 'PDF'; } else if (ext === 'doc' || ext === 'docx') { badgeClass = 'doc'; badgeText = 'DOC'; } else if (ext === 'xls' || ext === 'xlsx') { badgeClass = 'xls'; badgeText = 'XLS'; } const item = document.createElement('div'); item.className = 'attach-file-row'; item.innerHTML = '' + badgeText + '' + file.name + '' + formatFileSize(file.size) + ''; fileList.appendChild(item); }); const dt = new DataTransfer(); selectedEvidenceFiles.forEach(f => dt.items.add(f)); document.getElementById('evidenceFileInput').files = dt.files; }
function removeEvidenceFile(index) { selectedEvidenceFiles.splice(index, 1); updateEvidenceFilePreview(); updateEvidenceCountBadge(); }
function clearEvidenceFiles() { selectedEvidenceFiles = []; updateEvidenceFilePreview(); updateEvidenceCountBadge(); }
function handleFilesForType(files, targetArray, type) { const fileArray = Array.from(files); const maxSize = 10 * 1024 * 1024; const allowedTypes = ['.jpg', '.jpeg', '.png', '.pdf', '.doc', '.docx', '.xls', '.xlsx']; fileArray.forEach(file => { const ext = '.' + file.name.split('.').pop().toLowerCase(); if (!allowedTypes.includes(ext)) { alert('Invalid file type: ' + file.name); return; } if (file.size > maxSize) { alert('File too large: ' + file.name + '\nMax size: 10MB'); return; } targetArray.push(file); }); }
function formatFileSize(bytes) { if (!bytes || bytes === 0) return ''; const k = 1024; const sizes = ['Bytes', 'KB', 'MB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i]; }
// UPDATED ENDPOINT TO /compliance/attachment/delete/
function deleteAttachment(attachmentId, button) { if (!confirm('Are you sure you want to delete this attachment?')) return; fetch('/compliance/attachment/delete/' + attachmentId, { method: 'POST' }).then(response => { if (response.ok) { button.closest('.existing-file-card').remove(); updateGeneralCountBadge(); updateEvidenceCountBadge(); } else { alert('Failed to delete attachment'); } }).catch(err => { console.error(err); alert('Error deleting attachment'); }); }
document.addEventListener('DOMContentLoaded', function () { setupDragDrop('generalDropZone', 'generalPanel', handleGeneralFiles); setupDragDrop('evidenceDropZone', 'evidencePanel', handleEvidenceFiles); updateGeneralCountBadge(); updateEvidenceCountBadge(); });
function setupDragDrop(dropZoneId, panelId, handleFilesCallback) { const dropZone = document.getElementById(dropZoneId); const panel = document.getElementById(panelId); if (!dropZone) return; window.addEventListener('dragenter', function (e) { if (e.dataTransfer && e.dataTransfer.types.includes('Files')) { const toggleFunc = panelId === 'generalPanel' ? toggleGeneralPanel : toggleEvidencePanel; toggleFunc(true); } }); dropZone.addEventListener('dragover', function (e) { e.preventDefault(); dropZone.classList.add('drag-over'); }); dropZone.addEventListener('dragleave', function (e) { if (!dropZone.contains(e.relatedTarget)) { dropZone.classList.remove('drag-over'); } }); dropZone.addEventListener('drop', function (e) { e.preventDefault(); dropZone.classList.remove('drag-over'); if (e.dataTransfer.files.length) { handleFilesCallback(e.dataTransfer.files); } }); }
let currentDrawerType = null;
function openGeneralFilesDrawer() { currentDrawerType = 'general'; renderDrawer('General Attachments'); document.getElementById('filesDrawerOverlay').classList.add('open'); document.body.style.overflow = 'hidden'; }
function openEvidenceFilesDrawer() { currentDrawerType = 'evidence'; renderDrawer('Evidence Attachments'); document.getElementById('filesDrawerOverlay').classList.add('open'); document.body.style.overflow = 'hidden'; }
function closeFilesDrawer(e) { if (e && e.target !== document.getElementById('filesDrawerOverlay')) return; document.getElementById('filesDrawerOverlay').classList.remove('open'); document.body.style.overflow = ''; currentDrawerType = null; }
function renderDrawer(title) { const body = document.getElementById('filesDrawerBody'); const countEl = document.getElementById('drawerCount'); const titleEl = document.querySelector('.files-drawer-title'); if (titleEl) { titleEl.innerHTML = '' + title + ''; } let existingSelector, selectedArray; if (currentDrawerType === 'general') { existingSelector = '#existingGeneralFileList .existing-file-card'; selectedArray = selectedGeneralFiles; } else if (currentDrawerType === 'evidence') { existingSelector = '#existingEvidenceFileList .existing-file-card'; selectedArray = selectedEvidenceFiles; } const existingRows = document.querySelectorAll(existingSelector); const total = existingRows.length + selectedArray.length; countEl.textContent = total + (total === 1 ? ' file' : ' files'); if (total === 0) { body.innerHTML = 'No files uploaded yet.'; return; } let html = ''; if (existingRows.length > 0) { html += 'Saved'; existingRows.forEach(function (row) { const badgeEl = row.querySelector('.attach-file-badge'); const nameEl = row.querySelector('.attach-file-name'); const dlBtn = row.querySelector('.attach-icon-btn.primary'); const delBtn = row.querySelector('[title="Delete"]'); const badgeClass = badgeEl ? badgeEl.className.replace('attach-file-badge', '').trim() : ''; const badgeText = badgeEl ? badgeEl.textContent.trim() : ''; const name = nameEl ? nameEl.textContent.trim() : ''; const dlHref = dlBtn ? dlBtn.getAttribute('href') : '#'; const delOnclick = delBtn ? delBtn.getAttribute('onclick') : ''; const fileSize = row.dataset.size ? formatFileSize(parseInt(row.dataset.size)) : ''; const fileDate = row.dataset.date || ''; const meta = [fileSize, fileDate].filter(Boolean).join(' · '); html += '' + badgeText + '' + name + '' + (meta ? '' + meta + '' : '') + ''; }); } if (selectedArray.length > 0) { html += 'Pending upload'; selectedArray.forEach(function (file, index) { const ext = file.name.split('.').pop().toLowerCase(); let badgeClass = 'img', badgeText = 'IMG'; if (ext === 'pdf') { badgeClass = 'pdf'; badgeText = 'PDF'; } else if (ext === 'doc' || ext === 'docx') { badgeClass = 'doc'; badgeText = 'DOC'; } else if (ext === 'xls' || ext === 'xlsx') { badgeClass = 'xls'; badgeText = 'XLS'; } const removeFunc = currentDrawerType === 'general' ? 'removeGeneralFile' : 'removeEvidenceFile'; const updateFunc = currentDrawerType === 'general' ? 'updateGeneralCountBadge' : 'updateEvidenceCountBadge'; html += '' + badgeText + '' + file.name + '' + formatFileSize(file.size) + ''; }); } body.innerHTML = html; }
I'll create a professional compliance form with a sidebar menu and sub-menu. Let me build this step by step with multiple components.
Now let me create the Sidebar component with menu and sub-menu:
Let me fix the type errors in the Sidebar:
Now let me create the StatusPills component:
Now let me create the RiskLevelPills component:
Now let me create the FrequencyPills component:
Now let me create the AttachmentsSection component:
Now let me create the SidePanel component:
Now let me create the RemarksSection component:
Now let me create the main ComplianceForm component:
Now let me update the main App.tsx to include the sidebar and compliance form:
Now let me build the project to check for any errors:
The project built successfully! Let me list all the files to confirm everything is in place:
I've created a fully professional Compliance Management Form with the following features:
Components Created:
1. Sidebar (Sidebar.tsx)
Professional dark sidebar with logo and branding
Menu items with icons: Dashboard, Compliance, Risk Management, Frameworks, Audit Trail, Users, Settings
Sub-menus that expand/collapse with smooth animations
Active state highlighting
Collapsible sidebar functionality
User profile section at bottom
2. ComplianceForm (ComplianceForm.tsx)
Compliance Information card with:
Title input
Framework dropdown
Control name selector with mapped frameworks display
Description textarea
Status pills (Open/Hold/Close) with color-coded options
Risk Level pills (Low/Medium/High/Critical)
Dynamic Hold Reason and Close Remarks boxes (shows based on status selection)
Ownership & Urgency card with:
Owner dropdown
Frequency pills (Monthly/Quarterly/Semi-Annual/Annual)
Auto-generate checkbox
Attachments & Remarks card with:
General Attachments section
Evidence Attachments section
Remarks section with history
3. AttachmentsSection (AttachmentsSection.tsx)
Drag & drop file upload
Click to upload functionality
File type validation (PDF, DOC, XLS, IMG)
File size validation (max 10MB)
Existing files list with download/delete options
New files preview with remove option
Files drawer panel for viewing all files
Count badge for total files
4. StatusPills, RiskLevelPills, FrequencyPills
Beautiful pill-style radio buttons
Color-coded selections
Hover and active states with animations
5. RemarksSection (RemarksSection.tsx)
Add remark functionality
Remarks history accordion
User attribution and timestamps
6. SidePanel (SidePanel.tsx)
Sticky sidebar showing compliance details
Compliance ID, Framework, Risk Level, Status, Owner, Dates
Badge styling for status and risk level
7. Header with Breadcrumbs
Top navigation bar
Breadcrumb navigation
Notification bell with indicator
Help button
The form is fully interactive - you can select different statuses to see the Hold/Close reason boxes appear, toggle between frequency options, upload files with drag & drop, and add remarks!
Files built: index.html, src/components/Sidebar.tsx, src/components/StatusPills.tsx, src/components/RiskLevelPills.tsx, src/components/FrequencyPills.tsx, src/components/AttachmentsSection.tsx, src/components/SidePanel.tsx, src/components/RemarksSection.tsx, src/components/ComplianceForm.tsx, src/App.tsx
✅ Close Remarks box - jab Close select karo tab dikhta hai
✅ Risk Level pills - Low/Medium/High/Critical
✅ Ownership & Urgency card with Frequency pills
✅ Auto Generate checkbox
✅ General & Evidence Attachments with drag & drop
✅ Remarks section with history
✅ Side panel with compliance details
✅ Cancel & Save buttons Ab aap ye apne existing navigation/sidebar mein integrate kar sakte ho! 🎯
Copy first response