Move mock status to replace live status
This commit is contained in:
parent
8d96055ba1
commit
eb3d09c989
5 changed files with 127 additions and 176 deletions
|
|
@ -30,6 +30,18 @@ type Contact struct {
|
||||||
Name string
|
Name string
|
||||||
Phone string
|
Phone string
|
||||||
}
|
}
|
||||||
|
type ContentStatus struct {
|
||||||
|
Error string
|
||||||
|
MapboxToken string
|
||||||
|
ReportID string
|
||||||
|
URL ContentURL
|
||||||
|
}
|
||||||
|
type ContentStatusByID struct {
|
||||||
|
MapboxToken string
|
||||||
|
Report Report
|
||||||
|
URL ContentURL
|
||||||
|
}
|
||||||
|
|
||||||
type Image struct {
|
type Image struct {
|
||||||
Location string
|
Location string
|
||||||
URL string
|
URL string
|
||||||
|
|
@ -47,15 +59,6 @@ type Report struct {
|
||||||
Type string
|
Type string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContentStatus struct {
|
|
||||||
Error string
|
|
||||||
ReportID string
|
|
||||||
}
|
|
||||||
type ContentStatusByID struct {
|
|
||||||
MapboxToken string
|
|
||||||
Report Report
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Status = buildTemplate("status", "base")
|
Status = buildTemplate("status", "base")
|
||||||
StatusByID = buildTemplate("status-by-id", "base")
|
StatusByID = buildTemplate("status-by-id", "base")
|
||||||
|
|
@ -83,28 +86,21 @@ func formatReportID(s string) string {
|
||||||
|
|
||||||
func getStatus(w http.ResponseWriter, r *http.Request) {
|
func getStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
report_id_str := r.URL.Query().Get("report")
|
report_id_str := r.URL.Query().Get("report")
|
||||||
|
content := ContentStatus{
|
||||||
|
Error: "",
|
||||||
|
MapboxToken: config.MapboxToken,
|
||||||
|
ReportID: "",
|
||||||
|
URL: makeContentURL(nil),
|
||||||
|
}
|
||||||
if report_id_str == "" {
|
if report_id_str == "" {
|
||||||
html.RenderOrError(
|
html.RenderOrError(w, Status, content)
|
||||||
w,
|
|
||||||
Status,
|
|
||||||
ContentStatus{
|
|
||||||
Error: "",
|
|
||||||
ReportID: "",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
report_id := sanitizeReportID(report_id_str)
|
report_id := sanitizeReportID(report_id_str)
|
||||||
report_id_str = formatReportID(report_id)
|
report_id_str = formatReportID(report_id)
|
||||||
//some_report, e := report.FindSomeReport(r.Context(), report_id)
|
//some_report, e := report.FindSomeReport(r.Context(), report_id)
|
||||||
html.RenderOrError(
|
content.Error = "Sorry, we can't find that report"
|
||||||
w,
|
html.RenderOrError(w, Status, content)
|
||||||
Status,
|
|
||||||
ContentStatus{
|
|
||||||
Error: "Sorry, we can't find that report",
|
|
||||||
ReportID: report_id_str,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
func contentFromNuisance(ctx context.Context, report_id string) (result ContentStatusByID, err error) {
|
func contentFromNuisance(ctx context.Context, report_id string) (result ContentStatusByID, err error) {
|
||||||
nuisance, err := models.PublicreportNuisances.Query(
|
nuisance, err := models.PublicreportNuisances.Query(
|
||||||
|
|
@ -206,6 +202,7 @@ func getStatusByID(w http.ResponseWriter, r *http.Request) {
|
||||||
content, err = contentFromQuick(ctx, report_id)
|
content, err = contentFromQuick(ctx, report_id)
|
||||||
}
|
}
|
||||||
content.MapboxToken = config.MapboxToken
|
content.MapboxToken = config.MapboxToken
|
||||||
|
content.URL = makeContentURL(nil)
|
||||||
html.RenderOrError(
|
html.RenderOrError(
|
||||||
w,
|
w,
|
||||||
StatusByID,
|
StatusByID,
|
||||||
|
|
|
||||||
|
|
@ -8,35 +8,6 @@
|
||||||
<script src="/static/js/map-multipoint.js"></script>
|
<script src="/static/js/map-multipoint.js"></script>
|
||||||
<script src="/static/js/report-table.js"></script>
|
<script src="/static/js/report-table.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.map-container {
|
|
||||||
background-color: #e9ecef;
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
|
||||||
height: 500px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
#map {
|
|
||||||
height: 500px;
|
|
||||||
width:100%;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
#map img {
|
|
||||||
max-width: none;
|
|
||||||
min-width: 0px;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
.search-box {
|
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.map-container {
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
const MAPBOX_ACCESS_TOKEN = '{{.MapboxToken}}';
|
const MAPBOX_ACCESS_TOKEN = '{{.MapboxToken}}';
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,12 @@
|
||||||
|
|
||||||
{{define "title"}}Status{{end}}
|
{{define "title"}}Status{{end}}
|
||||||
{{define "extraheader"}}
|
{{define "extraheader"}}
|
||||||
|
<script src='https://api.mapbox.com/mapbox-gl-js/v3.17.0-beta.1/mapbox-gl.js'></script>
|
||||||
|
<script src="/static/js/geocode.js"></script>
|
||||||
|
<script src="/static/js/location.js"></script>
|
||||||
|
<script src="/static/js/map-multipoint.js"></script>
|
||||||
|
<script src="/static/js/report-table.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.option-card {
|
|
||||||
transition: transform 0.3s;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.option-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
|
||||||
}
|
|
||||||
.district-logo {
|
|
||||||
max-height: 80px;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
.divider {
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.divider-line {
|
|
||||||
border-left: 1px solid #dee2e6;
|
|
||||||
height: 80%;
|
|
||||||
}
|
|
||||||
@media (max-width: 767.98px) {
|
|
||||||
.divider-line {
|
|
||||||
border-left: none;
|
|
||||||
border-top: 1px solid #dee2e6;
|
|
||||||
width: 80%;
|
|
||||||
height: auto;
|
|
||||||
margin: 2rem 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
function formatReportID(inputElement) {
|
function formatReportID(inputElement) {
|
||||||
|
|
@ -74,102 +48,80 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{define "content"}}
|
{{define "content"}}
|
||||||
<main>
|
<div class="container my-4">
|
||||||
<!-- Page Title -->
|
<!-- Search Box -->
|
||||||
<section class="py-4 bg-primary text-white">
|
<div class="card search-box mb-4">
|
||||||
<div class="container">
|
<div class="card-body">
|
||||||
<h2 class="text-center mb-0">Check Status or Follow-up</h2>
|
<form class="row g-3 align-items-center">
|
||||||
</div>
|
<div class="col-md-9">
|
||||||
</section>
|
<label for="addressSearch" class="visually-hidden">Search by address</label>
|
||||||
|
<div class="input-group">
|
||||||
<!-- Lookup Options -->
|
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
||||||
<section class="py-5">
|
<input type="text" class="form-control form-control-lg" id="addressSearch"
|
||||||
<div class="container">
|
placeholder="Enter a report ID, address, neighborhood, or zip code">
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 mb-4">
|
|
||||||
<p class="lead text-center">
|
|
||||||
Choose one of the following options to check on mosquito activity or follow up on a previous report.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row g-4">
|
|
||||||
<!-- Report ID Lookup -->
|
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="card option-card h-100">
|
|
||||||
<div class="card-body p-4">
|
|
||||||
<div class="text-center mb-4">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-file-earmark-text" viewBox="0 0 16 16">
|
|
||||||
<path d="M5.5 7a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1h-5zM5 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z"/>
|
|
||||||
<path d="M9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0zm0 1v2A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<h4 class="card-title text-center mb-4">Look up by Report ID</h4>
|
|
||||||
<p class="card-text">
|
|
||||||
If you have a report ID from a previous request, enter it below to view the details and current status.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form action="/status" method="GET">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="report" class="form-label">Report ID</label>
|
|
||||||
<input type="text" class="form-control" id="report" name="report" placeholder="Enter your report ID" value="{{.ReportID}}" required>
|
|
||||||
<div class="form-text">Example: ABCD-1234-5678</div>
|
|
||||||
{{ if ne .Error "" }}
|
|
||||||
<div class="alert alert-warning" role="alert">
|
|
||||||
{{ .Error }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
<div class="d-grid gap-2">
|
|
||||||
<button type="submit" class="btn btn-success w-100 submit-btn">View Report Details</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
<!-- Divider for visual separation -->
|
<button type="submit" class="btn btn-primary btn-lg w-100">Search</button>
|
||||||
<div class="col-md-2 divider">
|
|
||||||
<div class="divider-line"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
<!-- Location Lookup -->
|
<div class="form-check form-check-inline">
|
||||||
<div class="col-md-5">
|
<input class="form-check-input" type="checkbox" id="mosquitoNuisance" checked>
|
||||||
<div class="card option-card h-100">
|
<label class="form-check-label" for="mosquitoNuisance">Mosquito Nuisance</label>
|
||||||
<div class="card-body p-4">
|
</div>
|
||||||
<div class="text-center mb-4">
|
<div class="form-check form-check-inline">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-geo-alt" viewBox="0 0 16 16">
|
<input class="form-check-input" type="checkbox" id="stagnantWater" checked>
|
||||||
<path d="M12.166 8.94c-.524 1.062-1.234 2.12-1.96 3.07A31.493 31.493 0 0 1 8 14.58a31.481 31.481 0 0 1-2.206-2.57c-.726-.95-1.436-2.008-1.96-3.07C3.304 7.867 3 6.862 3 6a5 5 0 0 1 10 0c0 .862-.305 1.867-.834 2.94zM8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10z"/>
|
<label class="form-check-label" for="gWaterreenPool">Stagnant Water</label>
|
||||||
<path d="M8 8a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 1a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<h4 class="card-title text-center mb-4">Look up by Location</h4>
|
|
||||||
<p class="card-text">
|
|
||||||
Don't have a report ID? You can check mosquito activity and reports in your area by providing your location information.
|
|
||||||
</p>
|
|
||||||
<p class="card-text mb-4">
|
|
||||||
This option will guide you through selecting your location to find relevant information about mosquito activity near you.
|
|
||||||
</p>
|
|
||||||
<div class="d-grid gap-2 mt-auto">
|
|
||||||
<a href="/search" class="btn btn-primary">Search by Location</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
|
</div>
|
||||||
<!-- Back button -->
|
</div>
|
||||||
<div class="row mt-5">
|
|
||||||
<div class="col-12 text-center">
|
<!-- Map Section -->
|
||||||
<a href="/" class="btn btn-outline-secondary">
|
<div class="card mb-4">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left me-2" viewBox="0 0 16 16">
|
<div class="card-header bg-info text-white">
|
||||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"/>
|
<h5 class="mb-0"><i class="fas fa-map-marked-alt me-2"></i>Reports Map</h5>
|
||||||
</svg>
|
</div>
|
||||||
Back to Home
|
<div class="card-body p-0">
|
||||||
</a>
|
<map-multipoint
|
||||||
</div>
|
api-key="{{ .MapboxToken }}"
|
||||||
|
latitude="36.3"
|
||||||
|
longitude="-119.2"
|
||||||
|
tegola="{{.URL.Tegola}}"
|
||||||
|
zoom="9"
|
||||||
|
/></map-multipoint>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Results Section -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
|
||||||
|
<h5 class="mb-0"><i class="fas fa-list me-2"></i>Reports Near You</h5>
|
||||||
|
<span class="badge bg-light text-dark">15 Reports Found</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<report-table />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
<!--
|
||||||
</main>
|
<div class="card-footer">
|
||||||
|
<nav aria-label="Page navigation">
|
||||||
|
<ul class="pagination justify-content-center mb-0">
|
||||||
|
<li class="page-item disabled">
|
||||||
|
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a>
|
||||||
|
</li>
|
||||||
|
<li class="page-item active"><a class="page-link" href="#">1</a></li>
|
||||||
|
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
||||||
|
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="#">Next</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,4 @@ $theme-colors: map-merge(
|
||||||
@import "./sidebar.scss";
|
@import "./sidebar.scss";
|
||||||
@import "./rmo/nuisance.scss";
|
@import "./rmo/nuisance.scss";
|
||||||
@import "./rmo/root.scss";
|
@import "./rmo/root.scss";
|
||||||
|
@import "./rmo/status.scss";
|
||||||
|
|
|
||||||
30
scss/status.scss
Normal file
30
scss/status.scss
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
.map-container {
|
||||||
|
background-color: #e9ecef;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
||||||
|
height: 500px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
#map {
|
||||||
|
height: 500px;
|
||||||
|
width:100%;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
#map img {
|
||||||
|
max-width: none;
|
||||||
|
min-width: 0px;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.search-box {
|
||||||
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.map-container {
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue