om4r932 commited on
Commit
53fa589
·
1 Parent(s): 5fccac9

Add filters

Browse files
Files changed (3) hide show
  1. static/script.js +20 -2
  2. static/style.css +60 -0
  3. templates/index.html +55 -3
static/script.js CHANGED
@@ -14,6 +14,12 @@ const docIdInput = document.getElementById('doc-id');
14
  const batchIdsInput = document.getElementById('batch-ids');
15
  const keywordInput = document.getElementById("keywords");
16
 
 
 
 
 
 
 
17
  const searchBtn = document.getElementById('search-btn');
18
  const batchSearchBtn = document.getElementById('batch-search-btn');
19
  const keywordSearchBtn = document.getElementById("keyword-search-btn");
@@ -64,6 +70,11 @@ keywordModeBtn.addEventListener('click', () => {
64
  keywordSearchInput.style.display = "block";
65
  })
66
 
 
 
 
 
 
67
  keywordSearchBtn.addEventListener("click", async ()=>{
68
  const keywords = keywordInput.value.trim();
69
  if (!keywords) {
@@ -80,7 +91,14 @@ keywordSearchBtn.addEventListener("click", async ()=>{
80
  headers: {
81
  "Content-Type": "application/json"
82
  },
83
- body: JSON.stringify({ keywords })
 
 
 
 
 
 
 
84
  });
85
 
86
  const data = await response.json();
@@ -242,7 +260,7 @@ function displayKeywordResults(data) {
242
  `;
243
  resultsList.appendChild(resultItem);
244
  });
245
- resultsStats.textContent = `Found in ${data.search_time.toFixed(2)} seconds`
246
  resultsContainer.style.display = 'block';
247
  }
248
 
 
14
  const batchIdsInput = document.getElementById('batch-ids');
15
  const keywordInput = document.getElementById("keywords");
16
 
17
+ const releaseFilter = document.querySelector("input[name=release]")
18
+ const modeFilter = document.querySelector("select[name=mode]")
19
+ const specTypeFilter = document.querySelector("select[name=spec_type]")
20
+ const workingGroupFilter = document.querySelector("select[name=working_group]")
21
+ const caseSensitiveFilter = document.querySelector("input[name=case_sensitive]")
22
+
23
  const searchBtn = document.getElementById('search-btn');
24
  const batchSearchBtn = document.getElementById('batch-search-btn');
25
  const keywordSearchBtn = document.getElementById("keyword-search-btn");
 
70
  keywordSearchInput.style.display = "block";
71
  })
72
 
73
+ document.getElementById('toggleFilters').onclick = function() {
74
+ var target = document.getElementById('filtersForm');
75
+ target.style.display = (target.style.display === 'none' || target.style.display === '') ? 'flex' : 'none';
76
+ };
77
+
78
  keywordSearchBtn.addEventListener("click", async ()=>{
79
  const keywords = keywordInput.value.trim();
80
  if (!keywords) {
 
91
  headers: {
92
  "Content-Type": "application/json"
93
  },
94
+ body: JSON.stringify({
95
+ keywords,
96
+ "case_sensitive": caseSensitiveFilter.checked,
97
+ "release": releaseFilter.value != '' ? releaseFilter.value : null,
98
+ "mode": modeFilter.value,
99
+ "working_group": workingGroupFilter != '' ? workingGroupFilter.value : null,
100
+ "spec_type": specTypeFilter != "" ? specTypeFilter.value : null
101
+ })
102
  });
103
 
104
  const data = await response.json();
 
260
  `;
261
  resultsList.appendChild(resultItem);
262
  });
263
+ resultsStats.textContent = `Found ${data.results.length} in ${data.search_time.toFixed(2)} seconds`
264
  resultsContainer.style.display = 'block';
265
  }
266
 
static/style.css CHANGED
@@ -10,6 +10,66 @@
10
  --shadow-color: rgba(0, 0, 0, 0.1);
11
  }
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  * {
14
  margin: 0;
15
  padding: 0;
 
10
  --shadow-color: rgba(0, 0, 0, 0.1);
11
  }
12
 
13
+ .filter-tab-container {
14
+ margin-top: 20px;
15
+ margin-bottom: 15px;
16
+ }
17
+
18
+ .filter-toggle-btn {
19
+ background: #3182ce;
20
+ color: #fff;
21
+ border: none;
22
+ border-radius: 4px 4px 0 0;
23
+ padding: 8px 14px;
24
+ cursor: pointer;
25
+ font-size: 16px;
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 5px;
29
+ transition: background 0.3s;
30
+ box-shadow: 0 2px 4px rgba(44, 82, 130, 0.05);
31
+ }
32
+
33
+ .filter-toggle-btn:hover {
34
+ background: #2c5282;
35
+ }
36
+
37
+ .filters-row {
38
+ display: flex;
39
+ gap: 12px;
40
+ align-items: center;
41
+ background: #f8f8f8;
42
+ padding: 13px 14px;
43
+ border: 1px solid #ddd;
44
+ border-top: none;
45
+ border-radius: 0 0 4px 4px;
46
+ margin: 0;
47
+ margin-top: -1px;
48
+ box-shadow: 0 2px 4px rgba(44, 82, 130, 0.06);
49
+ }
50
+
51
+ .filter-input, .filter-select {
52
+ padding: 7px 10px;
53
+ border: 1px solid #ddd;
54
+ border-radius: 4px;
55
+ background: #fff;
56
+ color: #333;
57
+ font-size: 15px;
58
+ }
59
+
60
+ .filter-checkbox-label {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: 7px;
64
+ font-size: 15px;
65
+ color: #2c5282;
66
+ margin: 0;
67
+ }
68
+
69
+ .filter-checkbox {
70
+ accent-color: #3182ce;
71
+ }
72
+
73
  * {
74
  margin: 0;
75
  padding: 0;
templates/index.html CHANGED
@@ -1,5 +1,6 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -7,6 +8,7 @@
7
  <link rel="stylesheet" href="/static/style.css">
8
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap">
9
  </head>
 
10
  <body>
11
  <header>
12
  <div class="container header-content">
@@ -20,7 +22,8 @@
20
  <div class="search-container">
21
  <div class="search-header">
22
  <h2 id="dynamicTitle">Find 3GPP Documents</h2>
23
- <p id="dynamicDesc">Enter a TSG document ID / specification ID (e.g., S1-123456, C2-987654 or 31.102) to locate the document in the 3GPP FTP server.</p>
 
24
  </div>
25
 
26
  <div class="search-mode">
@@ -33,14 +36,16 @@
33
  <div class="input-group single-input">
34
  <label for="doc-id">Document ID</label>
35
  <div class="input-field">
36
- <input type="text" id="doc-id" placeholder="Enter document ID or specification ID (e.g., S1-123456, 12.345)">
 
37
  <button id="search-btn" class="btn">Search</button>
38
  </div>
39
  </div>
40
 
41
  <div class="input-group batch-input">
42
  <label for="batch-ids">Document IDs or Specification IDs (one per line)</label>
43
- <textarea id="batch-ids" placeholder="Enter document IDs or specification IDs, one per line (e.g., S1-123456, C2-987654, 31.102)"></textarea>
 
44
  <div class="hint">Enter one document ID per line</div>
45
  <button id="batch-search-btn" class="btn" style="margin-top: 10px;">Search All</button>
46
  </div>
@@ -51,6 +56,52 @@
51
  <input type="text" id="keywords" placeholder="Enter your keywords separated by space">
52
  <button id="keyword-search-btn" class="btn">Search</button>
53
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  </div>
55
  </div>
56
 
@@ -77,4 +128,5 @@
77
 
78
  <script src="/static/script.js"></script>
79
  </body>
 
80
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
8
  <link rel="stylesheet" href="/static/style.css">
9
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap">
10
  </head>
11
+
12
  <body>
13
  <header>
14
  <div class="container header-content">
 
22
  <div class="search-container">
23
  <div class="search-header">
24
  <h2 id="dynamicTitle">Find 3GPP Documents</h2>
25
+ <p id="dynamicDesc">Enter a TSG document ID / specification ID (e.g., S1-123456, C2-987654 or 31.102) to
26
+ locate the document in the 3GPP FTP server.</p>
27
  </div>
28
 
29
  <div class="search-mode">
 
36
  <div class="input-group single-input">
37
  <label for="doc-id">Document ID</label>
38
  <div class="input-field">
39
+ <input type="text" id="doc-id"
40
+ placeholder="Enter document ID or specification ID (e.g., S1-123456, 12.345)">
41
  <button id="search-btn" class="btn">Search</button>
42
  </div>
43
  </div>
44
 
45
  <div class="input-group batch-input">
46
  <label for="batch-ids">Document IDs or Specification IDs (one per line)</label>
47
+ <textarea id="batch-ids"
48
+ placeholder="Enter document IDs or specification IDs, one per line (e.g., S1-123456, C2-987654, 31.102)"></textarea>
49
  <div class="hint">Enter one document ID per line</div>
50
  <button id="batch-search-btn" class="btn" style="margin-top: 10px;">Search All</button>
51
  </div>
 
56
  <input type="text" id="keywords" placeholder="Enter your keywords separated by space">
57
  <button id="keyword-search-btn" class="btn">Search</button>
58
  </div>
59
+ <div class="filter-tab-container">
60
+ <button type="button" id="toggleFilters" class="filter-toggle-btn">
61
+ <span>Filtres avancés</span>
62
+ <svg width="16" height="16" style="vertical-align:middle" fill="currentColor">
63
+ <path d="M4 7l4 4 4-4"></path>
64
+ </svg>
65
+ </button>
66
+ <form id="filtersForm" class="filters-row" style="display:none;">
67
+ <input type="number" min="0" max="21" name="release" placeholder="Release"
68
+ class="filter-input">
69
+
70
+ <select name="mode" class="filter-select">
71
+ <option value="and">AND</option>
72
+ <option value="or">OR</option>
73
+ </select>
74
+
75
+ <select name="spec_type" class="filter-select">
76
+ <option value="">All types</option>
77
+ <option value="TR">Report</option>
78
+ <option value="TS">Specification</option>
79
+ </select>
80
+
81
+ <select name="working_group" class="filter-select">
82
+ <option value="">Group</option>
83
+ <option value="CP">CP</option>
84
+ <option value="C1">C1</option>
85
+ <option value="C2">C2</option>
86
+ <option value="C3">C3</option>
87
+ <option value="C4">C4</option>
88
+ <option value="C5">C5</option>
89
+ <option value="C6">C6</option>
90
+ <option value="SP">SP</option>
91
+ <option value="S1">S1</option>
92
+ <option value="S2">S2</option>
93
+ <option value="S3">S3</option>
94
+ <option value="S4">S4</option>
95
+ <option value="S5">S5</option>
96
+ <option value="S6">S6</option>
97
+ </select>
98
+
99
+ <label class="filter-checkbox-label">
100
+ <input type="checkbox" name="case_sensitive" class="filter-checkbox" />
101
+ Sensible à la casse
102
+ </label>
103
+ </form>
104
+ </div>
105
  </div>
106
  </div>
107
 
 
128
 
129
  <script src="/static/script.js"></script>
130
  </body>
131
+
132
  </html>