Redmind commited on
Commit
d95b9c1
·
verified ·
1 Parent(s): 3589f06

Delete templates/company_profile.html

Browse files
Files changed (1) hide show
  1. templates/company_profile.html +0 -312
templates/company_profile.html DELETED
@@ -1,312 +0,0 @@
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">
7
- <title>Company Profile</title>
8
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
9
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
10
- <!-- Include AdminLTE CSS -->
11
- <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/adminlte.min.css">
12
- <!-- Include DataTables CSS -->
13
- <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
14
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
15
- <link href="https://cdn.jsdelivr.net/npm/@ttskch/[email protected]/dist/select2-bootstrap4.min.css"
16
- rel="stylesheet" />
17
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
18
- <style>
19
- body {
20
- background-color: transparent !important;
21
- }
22
-
23
- .content-wrapper {
24
- background-color: transparent !important;
25
- text-align: center;
26
- }
27
- .table-container{
28
- margin-top: 0px !important;
29
-
30
- }
31
- .wrapper {
32
- background-color: transparent !important;
33
- }
34
-
35
- .modal-content {
36
- background-color: #fff;
37
- }
38
-
39
- h1 {
40
- text-align: center;
41
- margin-bottom: 30px;
42
- }
43
-
44
- .card-body {
45
- padding: 0;
46
- margin: 0;
47
- }
48
-
49
- .table-responsive {
50
- width: 100%;
51
- overflow-x: auto;
52
- }
53
-
54
- .table {
55
- width: 100%;
56
- }
57
-
58
- .text-wrap {
59
- white-space: normal !important;
60
- word-break: break-word;
61
- }
62
-
63
- .center-align {
64
- padding-top: 20px;
65
- display: flex;
66
- justify-content: center;
67
- align-items: center;
68
- width: 100%;
69
- }
70
-
71
- .reduced-width {
72
- width: 50%;
73
- }
74
-
75
- th,
76
- td {
77
- white-space: nowrap;
78
- }
79
-
80
- th:nth-child(1),
81
- td:nth-child(1) {
82
- width: 5%;
83
- }
84
-
85
- th:nth-child(2),
86
- td:nth-child(2) {
87
- width: 20%;
88
- }
89
-
90
- th:nth-child(3),
91
- td:nth-child(3) {
92
- width: 20%;
93
- }
94
-
95
- th:nth-child(4),
96
- td:nth-child(4) {
97
- width: 20%;
98
- }
99
-
100
- th:nth-child(5),
101
- td:nth-child(5) {
102
- width: 20%;
103
- }
104
-
105
- th:nth-child(6),
106
- td:nth-child(6) {
107
- width: 15%;
108
- }
109
-
110
- th:nth-child(7),
111
- td:nth-child(7) {
112
- width: 20%;
113
- }
114
- </style>
115
- </head>
116
-
117
- <body>
118
- {% include 'sidepane.html' %}
119
-
120
- <div class="wrapper">
121
- <div class="content-wrapper">
122
- <!-- Content Header (Page header) -->
123
- <div class="content-header">
124
- <div class="container-fluid">
125
- <div class="row mb-2">
126
- <div class="col-12">
127
- <div class="col-12 d-flex justify-content-end mb-3">
128
- <button class="btn btn-primary" id="add">Add</button>
129
- </div>
130
- </div>
131
- </div>
132
- </div>
133
- </div>
134
- <!-- Main content -->
135
- <section class="content">
136
- <div class="container-fluid">
137
- <div class="row">
138
- <div class="col-12">
139
- <div class="card">
140
- <div class="card-body table-container">
141
- <table id="companyTable" class="table table-bordered table-striped">
142
- <thead>
143
- <tr>
144
- <th>Sno</th>
145
- <th>Company Name</th>
146
- <th>Company code</th>
147
- <th>Domain</th>
148
- <th>LLM Tools</th>
149
- <th>View</th>
150
- <th>Edit</th>
151
- <th>Delete</th>
152
- </tr>
153
- </thead>
154
- <tbody>
155
- </tbody>
156
- </table>
157
- </div>
158
- </div>
159
- </div>
160
- </div>
161
- </div>
162
- </section>
163
- </div>
164
- </div>
165
- <!-- Modal -->
166
- <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
167
- aria-hidden="true">
168
- <div class="modal-dialog" role="document">
169
- <div class="modal-content">
170
- <div class="modal-header">
171
- <h5 class="modal-title" id="addModalLabel">Add Company Profile</h5>
172
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
173
- <span aria-hidden="true" data-backdrop="static" data-keyboard="false">&times;</span>
174
- </button>
175
- </div>
176
- <div class="modal-body">
177
- <form id="companyForm">
178
- <div class="form-group">
179
- <label for="companyName">Company Name<span class="text-danger">*</span></label>
180
- <input type="text" class="form-control" id="company_name" name="company_name" required>
181
- </div>
182
- <div class="form-group">
183
- <label for="companyCode">Company Code<span class="text-danger">*</span></label>
184
- <input type="text" class="form-control" id="company_code" name="company_code" required>
185
- </div>
186
- <div class="form-group">
187
- <label for="domain">Domain<span class="text-danger">*</span></label>
188
- <input type="text" class="form-control" id="domain" name="domain" required>
189
- </div>
190
- <div class="form-group">
191
- <label for="llm_tools">LLM Tools<span class="text-danger">*</span></label>
192
- <select class="form-control" id="llm_tools" name="llm_tools" multiple required>
193
- <option value="Database">Database</option>
194
- <option value="Static Documents">Static Documents</option>
195
- <option value="API">API</option>
196
- </select>
197
- <div class="invalid-feedback">
198
- Please select at least one LLM tool.
199
- </div>
200
- </div>
201
- </form>
202
- </div>
203
- <div class="modal-footer">
204
- <button type="button" id="save" onclick="saveProfile()" class="btn btn-primary">Save</button>
205
- </div>
206
- </div>
207
- </div>
208
- </div>
209
-
210
- <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
211
- <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
212
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
213
- <script>
214
- document.addEventListener('DOMContentLoaded', function () {
215
- fetchCompanies();
216
- });
217
-
218
- $(document).ready(function () {
219
- // Initialize DataTable
220
- $('#companyTable').DataTable();
221
-
222
- // Show modal function
223
- $('#add').on('click', function () {
224
- $('#addModal').modal('show');
225
- });
226
- $('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {
227
- $('#addModal').modal('hide');
228
- });
229
- // Initialize Select2
230
- $('#llm_tools').select2({
231
- theme: 'bootstrap4',
232
- placeholder: 'Select',
233
- allowClear: true
234
- });
235
- });
236
-
237
- function saveProfile() {
238
- const form = document.getElementById('companyForm');
239
-
240
- // Check if the form is valid
241
- if (!form.checkValidity()) {
242
- // If the form is invalid, show validation messages and stop the submission
243
- form.reportValidity();
244
- return;
245
- }
246
- // Gather form data
247
- const company_name = document.getElementById('company_name').value;
248
- const company_code = document.getElementById('company_code').value;
249
- const domain = document.getElementById('domain').value;
250
- const llm_tools = $('#llm_tools').val(); // Get selected values from Select2
251
-
252
- // Prepare FormData
253
- let formData = new FormData();
254
- formData.append("company_name", company_name);
255
- formData.append("company_code", company_code);
256
- formData.append("domain", domain);
257
- formData.append("llm_tools", llm_tools.join(','));
258
-
259
- $.ajax({
260
- type: "POST",
261
- url: "/submit_company_profile",
262
- data: formData,
263
- processData: false,
264
- contentType: false,
265
- success: function (response) {
266
- alert("Data saved successfully"); // Show success message
267
- fetchCompanies(); // Refresh table data
268
-
269
- // Clear the form and close the modal
270
- $('#companyForm')[0].reset();
271
- $('#addModal').modal('hide');
272
- },
273
- error: function (xhr) {
274
- alert("An error occurred: " + xhr.responseJSON.detail); // Show error message
275
- }
276
- });
277
- }
278
-
279
- async function fetchCompanies() {
280
- try {
281
- console.log("Fetching companies...");
282
- const response = await fetch(`/api/companydetails`);
283
- const companies = await response.json();
284
- console.log(companies); // Inspect the data here
285
-
286
- if (!Array.isArray(companies)) {
287
- throw new TypeError('Expected an array of companies');
288
- }
289
-
290
- const table = $('#companyTable').DataTable();
291
- table.clear(); // Clear existing table data
292
-
293
- companies.forEach((company, index) => {
294
- table.row.add([
295
- index + 1,
296
- company.company_name,
297
- company.company_code,
298
- company.domain,
299
- company.llm_tools, // Join array of tools into a string
300
- "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",
301
- "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",
302
- "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"
303
- ]).draw(false);
304
- });
305
- } catch (error) {
306
- console.error('Error fetching companies:', error);
307
- }
308
- }
309
- </script>
310
- </body>
311
-
312
- </html>