Redmind commited on
Commit
2e0c7df
·
verified ·
1 Parent(s): 497048b

Delete templates/knowledgebase2.html

Browse files
Files changed (1) hide show
  1. templates/knowledgebase2.html +0 -360
templates/knowledgebase2.html DELETED
@@ -1,360 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>Knowledge Base</title>
6
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
7
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
8
- <!-- Include AdminLTE CSS -->
9
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/adminlte.min.css">
10
- <!-- Include DataTables CSS -->
11
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
12
- <!-- Include AdminLTE JS -->
13
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/adminlte.min.js"></script>
14
- <!-- Include DataTables JS -->
15
- <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
16
- <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
17
- <style>
18
- body {
19
- background-color: transparent !important;
20
- }
21
-
22
- .content-wrapper {
23
- background-color: transparent !important;
24
- text-align: center;
25
- }
26
-
27
- .wrapper {
28
- background-color: transparent !important;
29
- }
30
-
31
- .modal-content {
32
- background-color: #fff;
33
- }
34
-
35
- h1 {
36
- text-align: center;
37
- margin-bottom: 30px;
38
- }
39
-
40
- /* Adjust table width to full container width */
41
- .card-body {
42
- padding: 0;
43
- }
44
-
45
- .table {
46
- width: 100%;
47
- }
48
-
49
- .text-wrap {
50
- white-space: normal !important;
51
- word-break: break-word;
52
- }
53
-
54
- .center-align {
55
- padding-top: 20px;
56
- display: flex;
57
- justify-content: center;
58
- align-items: center;
59
- width: 100%;
60
- }
61
-
62
- .reduced-width {
63
- width: 50%;
64
- /* Adjust the percentage as needed */
65
- }
66
- </style>
67
- </head>
68
-
69
- <body>
70
- {% include 'sidepane.html' %}
71
-
72
-
73
- <div class="wrapper" style="position: relative; top: 0;">
74
- <div class="content-wrapper">
75
- <div class="content-header">
76
- <div class="container-fluid">
77
- <div class="container mt-2">
78
- <h1 class="m-0 text-center" style="flex-grow: 1;">Knowledge Base</h1>
79
- <div class="form-group center-align">
80
- <label for="company" class="mr-2">Company Name <span class="text-danger">*</span></label>
81
- <select type="text" id="company" name="company" class="form-control reduced-width" required>
82
- <option value="" selected>Select</option>
83
- </select>
84
- </div>
85
- </div>
86
- </div>
87
- </div>
88
- <section class="content" id="contentSection" style="display: none;">
89
- <div class="container-fluid">
90
- <div class="form-group">
91
- <!-- <label for="company_id">company_id</label>--->
92
- <input type="hidden" id="company_id" name="company_id" class="form-control" required>
93
- </div>
94
- <div class="row">
95
- <div class="col-12 d-flex justify-content-end mb-3">
96
- <button class="btn btn-primary" id="add">Add</button>
97
- </div>
98
- <div class="row mb-2">
99
- <div class="col-12">
100
- <div class="col-12">
101
- <div class="card">
102
- <div class="card-body">
103
- <div class="table-responsive">
104
- <div id="message-container">
105
- <table id="knowledgeTable" class="table table-bordered table-striped">
106
- <thead>
107
- <tr>
108
- <th>Sno</th>
109
- <th>Document Name</th>
110
- <th>Document Description</th>
111
- <th>Document Version</th>
112
- <th>VectorDB Flag</th>
113
- <th>View</th>
114
- </tr>
115
- </thead>
116
- <tbody>
117
- <tr>
118
- <td>1</td>
119
- <td>NewAge eWMS BusinessRequirementsDocument_V1.9 - Inbound
120
- </td>
121
- <td>GRN Inbound</td>
122
- <td>1.9</td>
123
- <td>Yes</td>
124
- <td>
125
- <button class="btn btn-primary viewButton">View</button>
126
- </td>
127
- </tr>
128
- <tr>
129
- <td>2</td>
130
- <td>NewAge eWMS BusinessRequirementsDocument_V2.3 - Inbound
131
- </td>
132
- <td>GRN Inbound</td>
133
- <td>2.3</td>
134
- <td>No</td>
135
- <td>
136
- <button class="btn btn-primary viewButton">View</button>
137
- </td>
138
- </tr>
139
- <tr>
140
- <td>3</td>
141
- <td>NewAge eWMS BusinessRequirementsDocument_V1.9 - Outbound
142
- </td>
143
- <td>GRN Outbound</td>
144
- <td>1.9</td>
145
- <td>Yes</td>
146
- <td>
147
- <button class="btn btn-primary viewButton">View</button>
148
- </td>
149
- </tr>
150
- <tr>
151
- <td>4</td>
152
- <td class="text-wrap">NewAge eWMS
153
- BusinessRequirementsDocument_V2.2 - Outbound</td>
154
- <td>ASN Outbound</td>
155
- <td>2.2</td>
156
- <td>No</td>
157
- <td>
158
- <button class="btn btn-primary viewButton">View</button>
159
- </td>
160
- </tr>
161
- </tbody>
162
- </table>
163
- </div>
164
- </div>
165
- </div>
166
- </div>
167
- </div>
168
- </div>
169
- </div>
170
- </section>
171
- </div>
172
-
173
- <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
174
- aria-hidden="true">
175
- <div class="modal-dialog" role="document">
176
- <div class="modal-content">
177
- <div class="modal-header">
178
- <h5 class="modal-title" id="addModalLabel">Add Document</h5>
179
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
180
- <span aria-hidden="true">&times;</span>
181
- </button>
182
- </div>
183
- <div class="modal-body">
184
- <div class="form-group">
185
- <!-- <label for="company_id">company_id</label>--->
186
- <input type="hidden" id="company_id" name="company_id" class="form-control" required>
187
- </div>
188
- <form id="documentForm">
189
- <div class="form-group">
190
- <label for="uploadFile">Upload File<span class="text-danger">*</span></label>
191
- <input type="file" class="form-control-file" id="uploadFile" name="uploadFile" required accept=".pdf,.doc,.docx">
192
- <small class="form-text text-muted">Accepted formats: .pdf, .doc, .docx</small>
193
- </div>
194
- <div class="form-group">
195
- <label for="documentName">Document Name<span class="text-danger">*</span></label>
196
- <input type="text" class="form-control" id="documentName" name="documentName" required>
197
- </div>
198
- <div class="form-group">
199
- <label for="documentDescription">Document Description<span class="text-danger">*</span></label>
200
- <textarea class="form-control" id="documentDescription" name="documentDescription"
201
- rows="3" required></textarea>
202
- </div>
203
- <div class="form-group">
204
- <label for="department">Department<span class="text-danger">*</span></label>
205
- <input type="text" class="form-control" id="department" name="department" required>
206
- </div>
207
- <div class="form-group">
208
- <label for="version">Version<span class="text-danger">*</span></label>
209
- <input type="text" class="form-control" id="version" name="version" required>
210
- </div>
211
- <div class="form-group">
212
- <label for="lastUpdated">Last Updated<span class="text-danger">*</span></label>
213
- <input type="text" class="form-control" id="lastUpdated" name="lastUpdated" required>
214
- </div>
215
- </form>
216
- </div>
217
- <div class="modal-footer">
218
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
219
- <button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button>
220
- </div>
221
- </div>
222
- </div>
223
- </div>
224
- </div>
225
- <!-- JavaScript to handle modal display -->
226
- <script>
227
- document.addEventListener("DOMContentLoaded", function () {
228
- now = new Date().toISOString().substr(0, 10);
229
- document.getElementById('lastUpdated').value = now
230
- // clearFormFields();
231
- });
232
- document.addEventListener('DOMContentLoaded', function () {
233
-
234
- fetchCompanies();
235
-
236
- const companySelect = document.getElementById('company');
237
- const documentForm = document.getElementById('documentForm');
238
-
239
- companySelect.addEventListener('change', async function () {
240
- const selectedCompanyName = companySelect.options[companySelect.selectedIndex].text;
241
- console.log(`Selected Company Name: ${selectedCompanyName}`);
242
-
243
- if (selectedCompanyName !== "Select") {
244
-
245
- try {
246
- const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompanyName)}`);
247
- if (!response.ok) {
248
- contentSection.style.display='none';
249
- const messageContainer = document.getElementById('message-container');
250
- if (messageContainer) {
251
- messageContainer.innerHTML = "<div class='alert alert-danger'>Document details do not exist for this company. Please fill in the details.</div>";
252
- }
253
- throw new Error('Network response was not ok');
254
- }
255
- const data = await response.json();
256
- console.log(`Company ID: ${data.company_id}`);
257
- const companyId = data.company_id;
258
- document.getElementById('company_id').value = companyId;
259
-
260
- if (companyId) {
261
- contentSection.style.display = 'block';
262
- }
263
-
264
-
265
- } catch (error) {
266
- console.error('Error fetching company ID or data documents:', error);
267
- documentForm.style.display = 'none';
268
- }
269
- } else {
270
- //clearFormFields();
271
- documentForm.style.display = 'block';
272
- }
273
- });
274
- });
275
- function clearFormFields() {
276
- document.getElementById('uploadFile').value = "";
277
- document.getElementById('documentName').value = "";
278
- document.getElementById('documentDescription').value = "";
279
- document.getElementById('department').value = "";
280
- document.getElementById('version').value = "";
281
- //document.getElementById('lastUpdated').value = "";
282
- }
283
-
284
-
285
- $(document).ready(function () {
286
- // Show modal function
287
- $('#add').on('click', function () {
288
- clearFormFields();
289
- $('#addModal').modal('show');
290
- });
291
- $('.modal-footer .btn-secondary').on('click', function () {
292
- $('#addModal').modal('hide');
293
- });
294
- // Your save file function here
295
- // async function save_file() {
296
- // alert('Save button clicked');
297
- // // Your save file logic goes here
298
- // }
299
- });
300
- function save_file() {
301
- const uploadFile = document.getElementById("uploadFile").files[0];
302
- const documentName = document.getElementById("documentName").value;
303
- const documentDescription = document.getElementById("documentDescription").value;
304
- const department = document.getElementById("department").value;
305
- const version = document.getElementById("version").value;
306
- const lastUpdated = document.getElementById("lastUpdated").value;
307
- const company_id = document.getElementById("company_id").value;
308
-
309
- const formData = new FormData();
310
- formData.append("uploadFile", uploadFile);
311
- formData.append("documentName", documentName);
312
- formData.append("documentDescription", documentDescription);
313
- formData.append("department", department);
314
- formData.append("version", version);
315
- formData.append("lastUpdated", lastUpdated);
316
- formData.append("company_id", company_id);
317
-
318
- fetch('/upload_document', {
319
- method: 'POST',
320
- body: formData
321
- })
322
- .then(response => {
323
- if (!response.ok) {
324
- throw new Error('Network response was not ok');
325
- }
326
- return response.text();
327
- })
328
- .then(data => {
329
- alert('Document saved successfully');
330
- // $('#addModal').modal('hide');
331
- })
332
- .catch(error => console.error('Error:', error));
333
- }
334
- async function fetchCompanies() {
335
- try {
336
- const response = await fetch('/api/companies');
337
- if (!response.ok) {
338
- throw new Error('Network response was not ok');
339
- }
340
- const data = await response.json();
341
- displayCompanies(data.companies);
342
- } catch (error) {
343
- console.error('Error fetching companies:', error);
344
- }
345
- }
346
-
347
- function displayCompanies(companies) {
348
- const companySelect = document.getElementById('company');
349
- companySelect.innerHTML = '<option value="" selected>Select</option>'; // Reset the dropdown
350
- companies.forEach(company => {
351
- const option = document.createElement('option');
352
- option.value = company.name;
353
- option.textContent = company.name;
354
- companySelect.appendChild(option);
355
- });
356
- }
357
- </script>
358
- </body>
359
-
360
- </html>