<div class="modal fade" id="hbAiIntakeModal" tabindex="-1" role="dialog" aria-labelledby="hbAiIntakeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="display:flex;align-items:center;justify-content:space-between;gap:12px;">
<div>
<h4 class="modal-title" id="hbAiIntakeModalLabel" style="margin:0;font-weight:700;">AI Intake</h4>
<small id="hbAiIntakeModalSubtitle" style="color:#777;">Upload a document, preview the extracted data, then apply or continue importing.</small>
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="background:#f9fafb;">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="control-label" style="font-weight:600;">Import Type</label>
{# ONE source with the /ai-import page (ImportTypeCore). These two
lists used to be hardcoded here and drifted: Tender was added to
the page and never to this modal, which is why it kept reading as
"missing from the AI import pages" from the + menu. #}
<select id="hbAiIntakeType" class="form-control">
{% for key, label in hb_import_types() %}
<option value="{{ key }}"{% if key == 'expense' %} selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="control-label" style="font-weight:600;">Document Type</label>
<select id="hbAiIntakeDocumentType" class="form-control">
{% for key, label in hb_document_types() %}
<option value="{{ key }}"{% if key == 'auto' %} selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="form-group" style="margin-bottom:18px;">
<label class="btn btn-default btn-block" style="padding:12px;border-radius:8px;background:#fff;">
<i class="fa fa-upload" style="margin-right:6px;"></i>
Choose document
<input type="file" id="hbAiIntakeFile" accept="{{ hb_import_accept() }}" style="display:none;">
</label>
</div>
<div id="hbAiIntakeStatus" class="alert alert-info" style="margin-bottom:18px;">
Pick a file to parse.
</div>
<div id="hbAiIntakePreview" style="display:none;">
<div class="panel panel-default" style="margin-bottom:18px;">
<div class="panel-heading" style="font-weight:600;">Extracted Summary</div>
<div class="panel-body">
<div id="hbAiIntakePreviewMeta" style="margin-bottom:10px;"></div>
<div id="hbAiIntakePreviewFields" style="display:flex;flex-wrap:wrap;gap:8px;"></div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" style="font-weight:600;">Preview Data</div>
<div class="panel-body" style="max-height:300px;overflow:auto;">
<div id="hbAiIntakePreviewTable"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer" style="display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;">
<div>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
<div style="display:flex;gap:8px;flex-wrap:wrap;">
<button type="button" class="btn btn-info" id="hbAiIntakeOpenImportPage" style="display:none;">Continue in AI Import</button>
<button type="button" class="btn btn-primary" id="hbAiIntakeApply" style="display:none;">Apply to Form</button>
</div>
</div>
</div>
</div>
</div>