Sakda101's picture
Add Browse matrix delete controls
4fa59bf
Raw History Blame Contribute Delete
3.93 kB
{% extends "base.html" %}
{% block title %}Browse Responses - Explorer{% endblock %}
{% block nav_browse %}active{% endblock %}
{% block head %}
<script>
const SERVICES_MAP = {{ services_json | safe }};
const ALL_ROWS = {{ rows_json | safe }};
const CAN_EDIT = {{ 'true' if can_edit else 'false' }};
const GROUP_INTERNAL = {"VISA - KHMER":"VISA - KH","VISA - FOREIGNER":"VISA-FOR"};
</script>
{% endblock %}
{% block content %}
<div class="page-header browse-header">
<div class="page-header-text">
<div class="page-eyebrow">Browse Matrix</div>
<h1 class="page-title">Build the <em>response</em> library.</h1>
<p class="page-subtitle"><span id="browse-count">{{ response_count }}</span> service-objection rows from the active visa matrix. Responses are intentionally blank until your team fills them in.</p>
</div>
<div class="page-header-actions browse-actions">
<a class="btn btn-outline btn-sm" href="/browse/export.csv">Export CSV</a>
{% if can_edit %}
<button class="btn btn-primary btn-sm browse-new-btn" type="button" onclick="openNewResponseModal()">+ New response</button>
<button class="btn btn-outline btn-sm browse-delete-toggle" type="button" onclick="toggleBrowseDeletePanel()">Delete matrix item</button>
{% endif %}
</div>
</div>
{% if can_edit %}
<section id="browse-delete-panel" class="browse-delete-panel" hidden aria-label="Delete Browse matrix item">
<div>
<div class="card-label">Delete From Browse</div>
<p class="text-muted">Remove every row for one service, objection type, or cluster. Deleted items will not be re-created from the CSV seed.</p>
</div>
<div class="browse-delete-grid">
<div class="field">
<label class="field-label" for="browse-delete-scope">Delete</label>
<select class="select" id="browse-delete-scope" onchange="updateBrowseDeleteOptions()">
<option value="service">Service</option>
<option value="objection_type">Objection Type</option>
<option value="cluster">Cluster</option>
</select>
</div>
<div class="field">
<label class="field-label" for="browse-delete-value">Value</label>
<select class="select" id="browse-delete-value"></select>
</div>
<button class="btn btn-outline browse-delete-btn" type="button" onclick="deleteBrowseMatrixItem()">Delete</button>
</div>
<div id="browse-delete-message" class="browse-delete-message" hidden></div>
</section>
{% endif %}
<section class="browse-filter-panel" aria-label="Browse filters">
<div class="field browse-filter-group">
<label class="field-label" for="browse-group">Group</label>
<select class="select" id="browse-group" onchange="browseFilter()">
<option value="">-- All groups --</option>
{% for g in group_labels %}
<option value="{{ g }}">{{ g }}</option>
{% endfor %}
</select>
</div>
<div class="field browse-filter-service">
<label class="field-label" for="browse-service-search">Service</label>
<div class="service-combobox browse-service-combobox" id="browse-service-combobox">
<input type="hidden" id="browse-service" value="" />
<input class="input" type="text" id="browse-service-search" placeholder="All services" autocomplete="off" oninput="filterBrowseServiceOptions()" onfocus="openBrowseServiceOptions()" />
<div id="browse-service-options" class="service-options" hidden></div>
</div>
</div>
<div class="field browse-filter-search">
<label class="field-label" for="browse-search">Search</label>
<input class="input" type="text" id="browse-search" placeholder="Search by type, cluster, or response text..." oninput="browseFilter()" />
</div>
</section>
<section id="browse-results" class="browse-library" aria-label="Response library"></section>
<div id="browse-empty" class="browse-empty-state" hidden>
No responses match the current filters.
</div>
{% endblock %}