Files
Comparison_Project/app/templates/report.html

64 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
<h2 class="mb-4 text-center">Generate Subcontractor Report</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="card p-4 shadow-sm mx-auto" style="max-width: 600px;">
<form method="POST">
<div class="mb-3">
<label class="form-label fw-semibold">Select Subcontractor</label>
<select name="subcontractor_id" class="form-select" required>
<option value="">-- Select Subcontractor --</option>
{% for sc in subcontractors %}
<option value="{{ sc.id }}">{{ sc.subcontractor_name }}</option>
{% endfor %}
</select>
</div>
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" name="download_all" value="true" id="downloadAllSwitch" onchange="toggleRAInput(this)">
<label class="form-check-label fw-bold text-primary" for="downloadAllSwitch">
Download All RA Bills for this Contractor
</label>
</div>
<div class="mb-4" id="ra_bill_container">
<label class="form-label fw-semibold">RA Bill Number</label>
<input type="text" name="ra_bill_no" id="ra_bill_input" class="form-control" placeholder="e.g. 01">
<small class="text-muted">Required if "Download All" is off.</small>
</div>
<button type="submit" class="btn btn-primary w-100 py-2">
<i class="fas fa-download me-2"></i>Generate Excel Report
</button>
</form>
</div>
</div>
<script>
function toggleRAInput(checkbox) {
const input = document.getElementById('ra_bill_input');
const container = document.getElementById('ra_bill_container');
if (checkbox.checked) {
input.value = "";
input.disabled = true;
container.style.opacity = "0.5";
} else {
input.disabled = false;
container.style.opacity = "1";
}
}
</script>
{% endblock %}