<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Query Service</title>
</head>
<body>
<div class="container">
<h1 class="my-3">Query Service</h1>
<form action="/search" method="get">
    <div class="form-group"><label for="q">Search Query</label></div>
    <div class="row my-2">
        <div class="col-sm-8"><input type="text" class="form-control" id="q" name="q" value="{{query}}"></div>
        <div class="col-sm-2"><button type="submit" class="btn btn-primary">Submit</button></div>
    </div>
</form>
{{#if results}}
<h2 class="my-3">Results</h2>
{{#each results}}
<div class="mb-3">
    <a href="{{url}}">{{title}}</a>
    <div><small class="text-muted">{{url}}</small></div>
    <p>{{description}}</p>
</div>
{{/each}}
<nav aria-label="pagination">
    <ul class="pagination">
        {{#each pages}}
            <form action="/search">
                <input type="hidden" name="q" value="{{query}}">
                <input type="hidden" name="page" value="{{number}}">
                <li class="page-item {{#if current}}active{{/if}}"><input type="submit" class="page-link" value="{{number}}"></li>
            </form>
        {{/each}}
    </ul>
</nav>
{{#each pages}}

{{/each}}
{{/if}}
</div>
</body>
</html>