aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask/templates/gnqa_search_history.html
blob: c12e7c93116071da0bd4e1e59589e4107a653844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<section class="container-fluid  gnqa-copy" id="search-hist">
    <header class="row">
        <div class="panel panel default col-sm-6 col-sm-offset-3">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div>
                        <h4 class="text-secondary"
                            style="font-family: 'Linux Libertine','Georgia','Times','Source Serif Pro',serif;
                                   font-size:2.3rem">Your AI search History</h4>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <div class="container row">
        <div>
            <div class="col-sm-6 col-sm-offset-3" style="margin-bottom:10px">
                <button type="button" class="btn btn-danger" id="delete-btn">Delete Selected</button>
            </div>
            <div>
                <div class="panel panel-default col-sm-6 col-sm-offset-3 ">
                    <div>
                        <ul class="list-group list-group-flush" style="overflow-y:scroll">
                            {% for item in  prev_queries %}
                                <li class="row list-group-item">
                                    <input name=""
                                           type="checkbox"
                                           value="{{ item['task_id'] }}"
                                           class="col-sm-1"
                                           style="height: 20px;
                                                  width: 20px">
                                    <div class="col-sm-10">
                                        <button hx-get="/gnqna/record?query={{ item['query'] }}&search_task_id={{ item['task_id'] }}"
                                                hx-target="#swap"
                                                hx-swap="innerHTML"
                                                hx-trigger="click"
                                                data-bs-toggle="tooltip"
                                                data-bs-placement="left"
                                                title="/gnqna/record?query={{ item['query'] }}&search_task_id={{ item['task_id'] }}"
                                                style="background:transparent;
                                                       border:none;
                                                       cursor:pointer">
                                            <p class="text-info">{{ item["query"] }}</p>
                                        </button>
                                    </div>
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                    <div class="row">
                        <nav aria-label="Page navigation example"
                             class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                            <ul class="pagination">
                                {% for idx in range(1, num_pages) %}
                                    {% if current == idx %}
                                        <li class="page-item active">
                                            <a class="page-link"
                                               hx-swap="innerHTML"
                                               hx-target="#swap"
                                               hx-get="/gnqna/records?page={{ idx }}">{{ idx }}</a>
                                        </li>
                                    {% else %}
                                        <li class="page-item">
                                            <a class="page-link"
                                               hx-swap="innerHTML"
                                               hx-target="#swap"
                                               hx-get="/gnqna/records?page={{ idx }}">{{ idx }}</a>
                                        </li>
                                    {% endif %}
                                {% endfor %}
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<script>
  htmx.on("#delete-btn", "click", function(evt){
      htmx.ajax("DELETE","/gnqna/records", {target: "#search-hist", swap :"none",
					    handler: (target,obj) =>{
						htmx.ajax("GET", "gnqna/records", {
						    target: "#search-hist",
						    swap: "innerHTML"
						})
					    },
				      values: Array.from(htmx.findAll("input[type=checkbox]:checked"), e => e.value)}) 
  })
</script>