Spaces:
Sleeping
Sleeping
Update templates/company_profile.html
Browse files- templates/company_profile.html +542 -520
templates/company_profile.html
CHANGED
|
@@ -1,521 +1,543 @@
|
|
| 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 |
-
.card {
|
| 24 |
-
padding: 0;
|
| 25 |
-
margin-top: 10px;
|
| 26 |
-
margin-left: -40px;
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
.content-wrapper {
|
| 30 |
-
background-color: transparent !important;
|
| 31 |
-
text-align: center;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
.wrapper {
|
| 35 |
-
background-color: transparent !important;
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
.modal-content {
|
| 39 |
-
background-color: #fff;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
h1 {
|
| 43 |
-
text-align: center;
|
| 44 |
-
margin-bottom: 30px;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
.table-responsive {
|
| 49 |
-
width: 100%;
|
| 50 |
-
overflow-x: auto;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
.table {
|
| 54 |
-
width: 100%;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.text-wrap {
|
| 58 |
-
white-space: normal !important;
|
| 59 |
-
word-break: break-word;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 63 |
-
width: 60px;
|
| 64 |
-
display: inline-block;
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
.center-align {
|
| 68 |
-
padding-top: 20px;
|
| 69 |
-
display: flex;
|
| 70 |
-
justify-content: center;
|
| 71 |
-
align-items: center;
|
| 72 |
-
width: 100%;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
.reduced-width {
|
| 76 |
-
width: 50%;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
th,
|
| 80 |
-
td {
|
| 81 |
-
white-space: nowrap;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
.select2-container--bootstrap4 {
|
| 85 |
-
z-index: 1050;
|
| 86 |
-
/* Higher than the modal's z-index */
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
.select2-container--open {
|
| 90 |
-
z-index: 1060;
|
| 91 |
-
/* Ensure the dropdown is above the modal */
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
th:nth-child(1),
|
| 95 |
-
td:nth-child(1) {
|
| 96 |
-
width: 5%;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
th:nth-child(2),
|
| 100 |
-
td:nth-child(2) {
|
| 101 |
-
width: 20%;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
th:nth-child(3),
|
| 105 |
-
td:nth-child(3) {
|
| 106 |
-
width: 20%;
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
th:nth-child(4),
|
| 110 |
-
td:nth-child(4) {
|
| 111 |
-
width: 20%;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
th:nth-child(5),
|
| 115 |
-
td:nth-child(5) {
|
| 116 |
-
width: 20%;
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
th:nth-child(6),
|
| 120 |
-
td:nth-child(6) {
|
| 121 |
-
width: 15%;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
th:nth-child(7),
|
| 125 |
-
td:nth-child(7) {
|
| 126 |
-
width: 20%;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
.alert {
|
| 130 |
-
position: relative;
|
| 131 |
-
padding: 15px;
|
| 132 |
-
margin-bottom: 20px;
|
| 133 |
-
border: 1px solid transparent;
|
| 134 |
-
border-radius: 4px;
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
.alert-success {
|
| 138 |
-
color: #3c763d;
|
| 139 |
-
background-color: #dff0d8;
|
| 140 |
-
border-color: #d6e9c6;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
.alert-danger {
|
| 144 |
-
color: #a94442;
|
| 145 |
-
background-color: #f2dede;
|
| 146 |
-
border-color: #ebccd1;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
.close2 {
|
| 150 |
-
position: absolute;
|
| 151 |
-
bottom: 10px;
|
| 152 |
-
right: 10px;
|
| 153 |
-
border: none;
|
| 154 |
-
background: none;
|
| 155 |
-
font-size: 16px;
|
| 156 |
-
cursor: pointer;
|
| 157 |
-
}
|
| 158 |
-
</style>
|
| 159 |
-
</head>
|
| 160 |
-
|
| 161 |
-
<body>
|
| 162 |
-
{% include 'sidepane.html' %}
|
| 163 |
-
|
| 164 |
-
<div class="wrapper">
|
| 165 |
-
<div class="content-wrapper">
|
| 166 |
-
<!-- Content Header (Page header) -->
|
| 167 |
-
<div class="content-header">
|
| 168 |
-
<div class="container-fluid">
|
| 169 |
-
<div class="row mb-2">
|
| 170 |
-
<div class="col-12">
|
| 171 |
-
<div class="col-12 d-flex justify-content-end mb-3">
|
| 172 |
-
<button class="btn btn-primary" style="margin-bottom:-30px;position:fixed"
|
| 173 |
-
id="add">Add</button>
|
| 174 |
-
</div>
|
| 175 |
-
</div>
|
| 176 |
-
<div class="row">
|
| 177 |
-
<div id="message-container" style="margin-left: 200px;width:600px;"></div>
|
| 178 |
-
</div>
|
| 179 |
-
</div>
|
| 180 |
-
</div>
|
| 181 |
-
</div>
|
| 182 |
-
<!-- Main content -->
|
| 183 |
-
<section class="content">
|
| 184 |
-
<div class="container-fluid">
|
| 185 |
-
<div class="row">
|
| 186 |
-
<div class="col-12">
|
| 187 |
-
<div class="card">
|
| 188 |
-
<div class="card-body table-container">
|
| 189 |
-
<table id="companyTable"
|
| 190 |
-
class="custom-select-lm table table-bordered table-striped">
|
| 191 |
-
<thead>
|
| 192 |
-
<tr>
|
| 193 |
-
<th>Sno</th>
|
| 194 |
-
<th>Company Name</th>
|
| 195 |
-
<th>Company code</th>
|
| 196 |
-
<th>Domain</th>
|
| 197 |
-
<th>LLM Tools</th>
|
| 198 |
-
<th>View</th>
|
| 199 |
-
<th>Edit</th>
|
| 200 |
-
<th>Delete</th>
|
| 201 |
-
</tr>
|
| 202 |
-
</thead>
|
| 203 |
-
<tbody>
|
| 204 |
-
</tbody>
|
| 205 |
-
</table>
|
| 206 |
-
</div>
|
| 207 |
-
</div>
|
| 208 |
-
</div>
|
| 209 |
-
</div>
|
| 210 |
-
</div>
|
| 211 |
-
</section>
|
| 212 |
-
</div>
|
| 213 |
-
</div>
|
| 214 |
-
<!-- Modal -->
|
| 215 |
-
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 216 |
-
aria-hidden="true">
|
| 217 |
-
<div class="modal-dialog" role="document">
|
| 218 |
-
<div class="modal-content">
|
| 219 |
-
<div class="modal-header">
|
| 220 |
-
<h5 class="modal-title" id="addModalLabel">Add Company Profile</h5>
|
| 221 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 222 |
-
<span aria-hidden="true" data-backdrop="static" data-keyboard="false">×</span>
|
| 223 |
-
</button>
|
| 224 |
-
</div>
|
| 225 |
-
<div class="modal-body">
|
| 226 |
-
<form id="companyForm">
|
| 227 |
-
<div class="form-group">
|
| 228 |
-
<label for="companyName">Company Name<span class="text-danger">*</span></label>
|
| 229 |
-
<input type="text" class="form-control" id="company_name" name="company_name" required>
|
| 230 |
-
</div>
|
| 231 |
-
<div class="form-group">
|
| 232 |
-
<label for="companyCode">Company Code<span class="text-danger">*</span></label>
|
| 233 |
-
<input type="text" class="form-control" id="company_code" name="company_code" required>
|
| 234 |
-
</div>
|
| 235 |
-
<div class="form-group">
|
| 236 |
-
<label for="domain">Domain<span class="text-danger">*</span></label>
|
| 237 |
-
<input type="text" class="form-control" id="domain" name="domain" required>
|
| 238 |
-
</div>
|
| 239 |
-
<div class="form-group">
|
| 240 |
-
<label for="llm_tools">LLM Tools<span class="text-danger">*</span></label>
|
| 241 |
-
<select class="form-control" id="llm_tools" name="llm_tools" multiple required>
|
| 242 |
-
<option value="Database">Database</option>
|
| 243 |
-
<option value="Static Documents">Static Documents</option>
|
| 244 |
-
<option value="API">API</option>
|
| 245 |
-
</select>
|
| 246 |
-
<div class="invalid-feedback">
|
| 247 |
-
Please select at least one LLM tool.
|
| 248 |
-
</div>
|
| 249 |
-
</div>
|
| 250 |
-
</form>
|
| 251 |
-
</div>
|
| 252 |
-
<div class="modal-footer">
|
| 253 |
-
<button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button>
|
| 254 |
-
<button type="button" id="save" onclick="saveProfile()" class="btn btn-primary">Save</button>
|
| 255 |
-
</div>
|
| 256 |
-
</div>
|
| 257 |
-
</div>
|
| 258 |
-
</div>
|
| 259 |
-
{%include 'footer.html'%}
|
| 260 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 261 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 262 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
|
| 263 |
-
<script>
|
| 264 |
-
document.addEventListener('DOMContentLoaded', function () {
|
| 265 |
-
|
| 266 |
-
const role = sessionStorage.getItem('userRole');
|
| 267 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 268 |
-
|
| 269 |
-
if (role === 'admin') {
|
| 270 |
-
document.getElementById('add').style.display = 'block';
|
| 271 |
-
} else {
|
| 272 |
-
document.getElementById('add').style.display = 'none';
|
| 273 |
-
}
|
| 274 |
-
fetchCompanies();
|
| 275 |
-
});
|
| 276 |
-
window.addEventListener('pageshow', function (event) {
|
| 277 |
-
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 278 |
-
window.location.reload();
|
| 279 |
-
}
|
| 280 |
-
});
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
$(document).ready(function () {
|
| 284 |
-
// Initialize DataTable
|
| 285 |
-
$('#companyTable').DataTable();
|
| 286 |
-
// Initialize Select2
|
| 287 |
-
$('#llm_tools').select2({
|
| 288 |
-
theme: 'bootstrap4',
|
| 289 |
-
placeholder: 'Select',
|
| 290 |
-
allowClear: true
|
| 291 |
-
});
|
| 292 |
-
// Show modal function
|
| 293 |
-
$('#add').on('click', function () {
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
$('#
|
| 297 |
-
|
| 298 |
-
$('#
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
$
|
| 337 |
-
$('#
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
$('#
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
$('#
|
| 360 |
-
$('#
|
| 361 |
-
$('#
|
| 362 |
-
$('#
|
| 363 |
-
|
| 364 |
-
//
|
| 365 |
-
$('#
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
$('#
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
</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">
|
| 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 |
+
.card {
|
| 24 |
+
padding: 0;
|
| 25 |
+
margin-top: 10px;
|
| 26 |
+
margin-left: -40px;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.content-wrapper {
|
| 30 |
+
background-color: transparent !important;
|
| 31 |
+
text-align: center;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.wrapper {
|
| 35 |
+
background-color: transparent !important;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.modal-content {
|
| 39 |
+
background-color: #fff;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
h1 {
|
| 43 |
+
text-align: center;
|
| 44 |
+
margin-bottom: 30px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
.table-responsive {
|
| 49 |
+
width: 100%;
|
| 50 |
+
overflow-x: auto;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.table {
|
| 54 |
+
width: 100%;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.text-wrap {
|
| 58 |
+
white-space: normal !important;
|
| 59 |
+
word-break: break-word;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
div.dataTables_wrapper div.dataTables_length select {
|
| 63 |
+
width: 60px;
|
| 64 |
+
display: inline-block;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.center-align {
|
| 68 |
+
padding-top: 20px;
|
| 69 |
+
display: flex;
|
| 70 |
+
justify-content: center;
|
| 71 |
+
align-items: center;
|
| 72 |
+
width: 100%;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.reduced-width {
|
| 76 |
+
width: 50%;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
th,
|
| 80 |
+
td {
|
| 81 |
+
white-space: nowrap;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
.select2-container--bootstrap4 {
|
| 85 |
+
z-index: 1050;
|
| 86 |
+
/* Higher than the modal's z-index */
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.select2-container--open {
|
| 90 |
+
z-index: 1060;
|
| 91 |
+
/* Ensure the dropdown is above the modal */
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
th:nth-child(1),
|
| 95 |
+
td:nth-child(1) {
|
| 96 |
+
width: 5%;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
th:nth-child(2),
|
| 100 |
+
td:nth-child(2) {
|
| 101 |
+
width: 20%;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
th:nth-child(3),
|
| 105 |
+
td:nth-child(3) {
|
| 106 |
+
width: 20%;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
th:nth-child(4),
|
| 110 |
+
td:nth-child(4) {
|
| 111 |
+
width: 20%;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
th:nth-child(5),
|
| 115 |
+
td:nth-child(5) {
|
| 116 |
+
width: 20%;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
th:nth-child(6),
|
| 120 |
+
td:nth-child(6) {
|
| 121 |
+
width: 15%;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
th:nth-child(7),
|
| 125 |
+
td:nth-child(7) {
|
| 126 |
+
width: 20%;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.alert {
|
| 130 |
+
position: relative;
|
| 131 |
+
padding: 15px;
|
| 132 |
+
margin-bottom: 20px;
|
| 133 |
+
border: 1px solid transparent;
|
| 134 |
+
border-radius: 4px;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
.alert-success {
|
| 138 |
+
color: #3c763d;
|
| 139 |
+
background-color: #dff0d8;
|
| 140 |
+
border-color: #d6e9c6;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.alert-danger {
|
| 144 |
+
color: #a94442;
|
| 145 |
+
background-color: #f2dede;
|
| 146 |
+
border-color: #ebccd1;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
.close2 {
|
| 150 |
+
position: absolute;
|
| 151 |
+
bottom: 10px;
|
| 152 |
+
right: 10px;
|
| 153 |
+
border: none;
|
| 154 |
+
background: none;
|
| 155 |
+
font-size: 16px;
|
| 156 |
+
cursor: pointer;
|
| 157 |
+
}
|
| 158 |
+
</style>
|
| 159 |
+
</head>
|
| 160 |
+
|
| 161 |
+
<body>
|
| 162 |
+
{% include 'sidepane.html' %}
|
| 163 |
+
|
| 164 |
+
<div class="wrapper">
|
| 165 |
+
<div class="content-wrapper">
|
| 166 |
+
<!-- Content Header (Page header) -->
|
| 167 |
+
<div class="content-header">
|
| 168 |
+
<div class="container-fluid">
|
| 169 |
+
<div class="row mb-2">
|
| 170 |
+
<div class="col-12">
|
| 171 |
+
<div class="col-12 d-flex justify-content-end mb-3">
|
| 172 |
+
<button class="btn btn-primary" style="margin-bottom:-30px;position:fixed"
|
| 173 |
+
id="add">Add</button>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
<div class="row">
|
| 177 |
+
<div id="message-container" style="margin-left: 200px;width:600px;"></div>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
</div>
|
| 182 |
+
<!-- Main content -->
|
| 183 |
+
<section class="content">
|
| 184 |
+
<div class="container-fluid">
|
| 185 |
+
<div class="row">
|
| 186 |
+
<div class="col-12">
|
| 187 |
+
<div class="card">
|
| 188 |
+
<div class="card-body table-container">
|
| 189 |
+
<table id="companyTable"
|
| 190 |
+
class="custom-select-lm table table-bordered table-striped">
|
| 191 |
+
<thead>
|
| 192 |
+
<tr>
|
| 193 |
+
<th>Sno</th>
|
| 194 |
+
<th>Company Name</th>
|
| 195 |
+
<th>Company code</th>
|
| 196 |
+
<th>Domain</th>
|
| 197 |
+
<th>LLM Tools</th>
|
| 198 |
+
<th>View</th>
|
| 199 |
+
<th>Edit</th>
|
| 200 |
+
<th>Delete</th>
|
| 201 |
+
</tr>
|
| 202 |
+
</thead>
|
| 203 |
+
<tbody>
|
| 204 |
+
</tbody>
|
| 205 |
+
</table>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
</section>
|
| 212 |
+
</div>
|
| 213 |
+
</div>
|
| 214 |
+
<!-- Modal -->
|
| 215 |
+
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 216 |
+
aria-hidden="true">
|
| 217 |
+
<div class="modal-dialog" role="document">
|
| 218 |
+
<div class="modal-content">
|
| 219 |
+
<div class="modal-header">
|
| 220 |
+
<h5 class="modal-title" id="addModalLabel">Add Company Profile</h5>
|
| 221 |
+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 222 |
+
<span aria-hidden="true" data-backdrop="static" data-keyboard="false">×</span>
|
| 223 |
+
</button>
|
| 224 |
+
</div>
|
| 225 |
+
<div class="modal-body">
|
| 226 |
+
<form id="companyForm">
|
| 227 |
+
<div class="form-group">
|
| 228 |
+
<label for="companyName">Company Name<span class="text-danger">*</span></label>
|
| 229 |
+
<input type="text" class="form-control" id="company_name" name="company_name" required>
|
| 230 |
+
</div>
|
| 231 |
+
<div class="form-group">
|
| 232 |
+
<label for="companyCode">Company Code<span class="text-danger">*</span></label>
|
| 233 |
+
<input type="text" class="form-control" id="company_code" name="company_code" required>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="form-group">
|
| 236 |
+
<label for="domain">Domain<span class="text-danger">*</span></label>
|
| 237 |
+
<input type="text" class="form-control" id="domain" name="domain" required>
|
| 238 |
+
</div>
|
| 239 |
+
<div class="form-group">
|
| 240 |
+
<label for="llm_tools">LLM Tools<span class="text-danger">*</span></label>
|
| 241 |
+
<select class="form-control" id="llm_tools" name="llm_tools" multiple required>
|
| 242 |
+
<option value="Database">Database</option>
|
| 243 |
+
<option value="Static Documents">Static Documents</option>
|
| 244 |
+
<option value="API">API</option>
|
| 245 |
+
</select>
|
| 246 |
+
<div class="invalid-feedback">
|
| 247 |
+
Please select at least one LLM tool.
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
</form>
|
| 251 |
+
</div>
|
| 252 |
+
<div class="modal-footer">
|
| 253 |
+
<button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button>
|
| 254 |
+
<button type="button" id="save" onclick="saveProfile()" class="btn btn-primary">Save</button>
|
| 255 |
+
</div>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
{%include 'footer.html'%}
|
| 260 |
+
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 261 |
+
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 262 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
|
| 263 |
+
<script>
|
| 264 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 265 |
+
|
| 266 |
+
const role = sessionStorage.getItem('userRole');
|
| 267 |
+
console.log('Current role:', role); // Debug statement to check the role
|
| 268 |
+
|
| 269 |
+
if (role === 'admin') {
|
| 270 |
+
document.getElementById('add').style.display = 'block';
|
| 271 |
+
} else {
|
| 272 |
+
document.getElementById('add').style.display = 'none';
|
| 273 |
+
}
|
| 274 |
+
fetchCompanies();
|
| 275 |
+
});
|
| 276 |
+
window.addEventListener('pageshow', function (event) {
|
| 277 |
+
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 278 |
+
window.location.reload();
|
| 279 |
+
}
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
$(document).ready(function () {
|
| 284 |
+
// Initialize DataTable
|
| 285 |
+
$('#companyTable').DataTable();
|
| 286 |
+
// Initialize Select2
|
| 287 |
+
$('#llm_tools').select2({
|
| 288 |
+
theme: 'bootstrap4',
|
| 289 |
+
placeholder: 'Select',
|
| 290 |
+
allowClear: true
|
| 291 |
+
});
|
| 292 |
+
// Show modal function
|
| 293 |
+
$('#add').on('click', function () {
|
| 294 |
+
const modalTitle = document.getElementById('addModalLabel');
|
| 295 |
+
modalTitle.textContent = 'Add Company Details';
|
| 296 |
+
$('#addModal').modal('show');
|
| 297 |
+
$('#save').show();
|
| 298 |
+
$('#saveupdate').hide();
|
| 299 |
+
clearmodal();
|
| 300 |
+
$('#save').prop('disabled', false); // Disable the "Save" button when the modal opens
|
| 301 |
+
});
|
| 302 |
+
$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {
|
| 303 |
+
$('#addModal').modal('hide');
|
| 304 |
+
});
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
$(document).on('click', '.btn-view', function () {
|
| 308 |
+
const companyId = $(this).data('id');
|
| 309 |
+
console.log("company_id in view", companyId);
|
| 310 |
+
viewCompany(companyId);
|
| 311 |
+
});
|
| 312 |
+
|
| 313 |
+
// Edit company details
|
| 314 |
+
$(document).on('click', '.btn-edit', function () {
|
| 315 |
+
const companyId = $(this).data('id');
|
| 316 |
+
console.log("company_id in edit", companyId);
|
| 317 |
+
editCompany(companyId);
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
// Delete company
|
| 321 |
+
$(document).on('click', '.btn-delete', function () {
|
| 322 |
+
const companyId = $(this).data('id'); // Get the company ID from the da
|
| 323 |
+
console.log("company_id in delete", companyId);
|
| 324 |
+
if (confirm("Are you sure you want to delete this company?")) {
|
| 325 |
+
deleteCompany(companyId); // Call the delete function with the company ID
|
| 326 |
+
}
|
| 327 |
+
});
|
| 328 |
+
|
| 329 |
+
});
|
| 330 |
+
// View company details
|
| 331 |
+
function viewCompany(companyId) {
|
| 332 |
+
// Fetch company details by ID
|
| 333 |
+
const modalTitle = document.getElementById('addModalLabel');
|
| 334 |
+
modalTitle.textContent = 'View Company Details';
|
| 335 |
+
$.getJSON(`/api/getcompanydetails/${companyId}`, function (company) {
|
| 336 |
+
// alert(`Company Name: ${company.company_name}\nCompany Code: ${company.company_code}\nDomain: ${company.domain}\nLLM Tools: ${company.llm_tools}`);
|
| 337 |
+
$('#company_name').val(company.company_name).attr('readonly', 'readonly');
|
| 338 |
+
$('#company_code').val(company.company_code).attr('readonly', 'readonly');
|
| 339 |
+
$('#domain').val(company.domain).attr('readonly', 'readonly');
|
| 340 |
+
$('#llm_tools').val(company.llm_tools.split(',')).trigger('change');
|
| 341 |
+
$('#llm_tools').prop('disabled', true); // Disable the select input
|
| 342 |
+
|
| 343 |
+
// Open the modal for editing
|
| 344 |
+
$('#saveupdate').hide();
|
| 345 |
+
$('#save').hide();// Disable the "Save" button when the modal opens
|
| 346 |
+
$('#addModal').modal('show');
|
| 347 |
+
}).fail(function () {
|
| 348 |
+
alert("Error retrieving company details.");
|
| 349 |
+
});
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
// Edit company details
|
| 353 |
+
function editCompany(companyId) {
|
| 354 |
+
const modalTitle = document.getElementById('addModalLabel');
|
| 355 |
+
modalTitle.textContent = 'Edit Company Details';
|
| 356 |
+
// Fetch company details by ID
|
| 357 |
+
$.getJSON(`/api/getcompanydetails/${companyId}`, function (company) {
|
| 358 |
+
$('#company_name').removeAttr('readonly');
|
| 359 |
+
$('#company_code').removeAttr('readonly');
|
| 360 |
+
$('#domain').removeAttr('readonly');
|
| 361 |
+
$('#llm_tools').prop('disabled', false);
|
| 362 |
+
$('#save').hide();
|
| 363 |
+
$('#saveupdate').show();
|
| 364 |
+
// Populate the form with the company's details
|
| 365 |
+
$('#company_name').val(company.company_name);
|
| 366 |
+
$('#company_code').val(company.company_code);
|
| 367 |
+
$('#domain').val(company.domain);
|
| 368 |
+
$('#llm_tools').val(company.llm_tools.split(',')).trigger('change');
|
| 369 |
+
|
| 370 |
+
// Open the modal for editing
|
| 371 |
+
$('#addModal').modal('show');
|
| 372 |
+
|
| 373 |
+
// Update the save button to save the edited company
|
| 374 |
+
$('#saveupdate').off('click').on('click', function () {
|
| 375 |
+
|
| 376 |
+
saveupdate(companyId); // Pass the company ID for updating
|
| 377 |
+
});
|
| 378 |
+
}).fail(function () {
|
| 379 |
+
alert("Error retrieving company details.");
|
| 380 |
+
});
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
// Delete company
|
| 384 |
+
function deleteCompany(companyId) {
|
| 385 |
+
console.log("company_id deleted", companyId);
|
| 386 |
+
$.ajax({
|
| 387 |
+
type: "DELETE",
|
| 388 |
+
url: `/api/delcompanydetails/${companyId}`,
|
| 389 |
+
success: function () {
|
| 390 |
+
// alert("Company deleted successfully.");
|
| 391 |
+
const messageContainer = document.getElementById('message-container');
|
| 392 |
+
if (messageContainer)
|
| 393 |
+
messageContainer.innerHTML = `
|
| 394 |
+
<div class='alert alert-danger'>
|
| 395 |
+
Company details deleted successfully.
|
| 396 |
+
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 397 |
+
</div>`;
|
| 398 |
+
fetchCompanies(); // Refresh the table
|
| 399 |
+
},
|
| 400 |
+
error: function (xhr) {
|
| 401 |
+
alert("Error deleting company: " + xhr.responseJSON.detail);
|
| 402 |
+
}
|
| 403 |
+
});
|
| 404 |
+
}
|
| 405 |
+
function saveupdate(companyId) {
|
| 406 |
+
console.log("company_id", companyId);
|
| 407 |
+
var companyData = {
|
| 408 |
+
company_name: $('#company_name').val(),
|
| 409 |
+
company_code: $('#company_code').val(),
|
| 410 |
+
domain: $('#domain').val(),
|
| 411 |
+
llm_tools: $('#llm_tools').val().join(',') // Assuming llm_tools is a multi-select
|
| 412 |
+
};
|
| 413 |
+
console.log("company_data", companyData);
|
| 414 |
+
|
| 415 |
+
$.ajax({
|
| 416 |
+
url: `/api/putcompanydetails/${companyId}`,
|
| 417 |
+
type: 'PUT',
|
| 418 |
+
data: companyData,
|
| 419 |
+
success: function (response) {
|
| 420 |
+
// alert('Company details updated successfully.');
|
| 421 |
+
const messageContainer = document.getElementById('message-container');
|
| 422 |
+
if(messageContainer)
|
| 423 |
+
messageContainer.innerHTML = `
|
| 424 |
+
<div class='alert alert-success'>
|
| 425 |
+
Company Data Updated successfully
|
| 426 |
+
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 427 |
+
</div>`;
|
| 428 |
+
$('#addModal').modal('hide'); // Close the modal after saving
|
| 429 |
+
fetchCompanies();
|
| 430 |
+
},
|
| 431 |
+
error: function () {
|
| 432 |
+
|
| 433 |
+
const messageContainer = document.getElementById('message-container');
|
| 434 |
+
if(messageContainer)
|
| 435 |
+
messageContainer.innerHTML = `
|
| 436 |
+
<div class='alert alert-danger'>
|
| 437 |
+
No changes have been made to update company details.
|
| 438 |
+
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 439 |
+
</div>`;
|
| 440 |
+
$('#addModal').modal('hide');
|
| 441 |
+
//alert('No changes have been made to update company details.');
|
| 442 |
+
}
|
| 443 |
+
});
|
| 444 |
+
}
|
| 445 |
+
function saveProfile() {
|
| 446 |
+
const form = document.getElementById('companyForm');
|
| 447 |
+
|
| 448 |
+
// Check if the form is valid
|
| 449 |
+
if (!form.checkValidity()) {
|
| 450 |
+
// If the form is invalid, show validation messages and stop the submission
|
| 451 |
+
form.reportValidity();
|
| 452 |
+
return;
|
| 453 |
+
}
|
| 454 |
+
// Gather form data
|
| 455 |
+
const company_name = document.getElementById('company_name').value;
|
| 456 |
+
const company_code = document.getElementById('company_code').value;
|
| 457 |
+
const domain = document.getElementById('domain').value;
|
| 458 |
+
const llm_tools = $('#llm_tools').val(); // Get selected values from Select2
|
| 459 |
+
|
| 460 |
+
// Prepare FormData
|
| 461 |
+
let formData = new FormData();
|
| 462 |
+
formData.append("company_name", company_name);
|
| 463 |
+
formData.append("company_code", company_code);
|
| 464 |
+
formData.append("domain", domain);
|
| 465 |
+
formData.append("llm_tools", llm_tools.join(','));
|
| 466 |
+
|
| 467 |
+
$.ajax({
|
| 468 |
+
type: "POST",
|
| 469 |
+
url: "/submit_company_profile",
|
| 470 |
+
data: formData,
|
| 471 |
+
processData: false,
|
| 472 |
+
contentType: false,
|
| 473 |
+
success: function (response) {
|
| 474 |
+
// alert("Data saved successfully"); // Show success message
|
| 475 |
+
const messageContainer = document.getElementById('message-container');
|
| 476 |
+
if (messageContainer)
|
| 477 |
+
messageContainer.innerHTML = `
|
| 478 |
+
<div class='alert alert-success'>
|
| 479 |
+
Data saved successfully
|
| 480 |
+
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 481 |
+
</div>`;
|
| 482 |
+
fetchCompanies(); // Refresh table data
|
| 483 |
+
|
| 484 |
+
// Clear the form and close the modal
|
| 485 |
+
// $('#companyForm')[0].reset();
|
| 486 |
+
$('#addModal').modal('hide');
|
| 487 |
+
},
|
| 488 |
+
error: function (xhr) {
|
| 489 |
+
alert("An error occurred: " + xhr.responseJSON.detail); // Show error message
|
| 490 |
+
}
|
| 491 |
+
});
|
| 492 |
+
}
|
| 493 |
+
function dismissMessage() {
|
| 494 |
+
const messageContainer = document.getElementById('message-container');
|
| 495 |
+
if (messageContainer) {
|
| 496 |
+
messageContainer.innerHTML = '';
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
async function fetchCompanies() {
|
| 500 |
+
try {
|
| 501 |
+
console.log("Fetching companies...");
|
| 502 |
+
const response = await fetch(`/api/companydetails`);
|
| 503 |
+
const companies = await response.json();
|
| 504 |
+
console.log(companies); // Inspect the data here
|
| 505 |
+
|
| 506 |
+
if (!Array.isArray(companies)) {
|
| 507 |
+
throw new TypeError('Expected an array of companies');
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
const table = $('#companyTable').DataTable();
|
| 511 |
+
table.clear(); // Clear existing table data
|
| 512 |
+
|
| 513 |
+
companies.forEach((company, index) => {
|
| 514 |
+
table.row.add([
|
| 515 |
+
index + 1,
|
| 516 |
+
company.company_name,
|
| 517 |
+
company.company_code,
|
| 518 |
+
company.domain,
|
| 519 |
+
company.llm_tools, // Join array of tools into a string
|
| 520 |
+
`<a href='#' class='btn btn-info btn-sm'onclick='viewCompany(${company.company_id})'><i class='fas fa-eye'></i></a>`,
|
| 521 |
+
`<a href='#' class='btn btn-warning btn-sm'onclick='editCompany(${company.company_id})'><i class='fas fa-edit'></i></a>`,
|
| 522 |
+
`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`
|
| 523 |
+
|
| 524 |
+
]).draw(false);
|
| 525 |
+
});
|
| 526 |
+
} catch (error) {
|
| 527 |
+
console.error('Error fetching companies:', error);
|
| 528 |
+
}
|
| 529 |
+
}
|
| 530 |
+
function clearmodal() {
|
| 531 |
+
$('#companyForm')[0].reset(); // Reset all form fields
|
| 532 |
+
$('#llm_tools').val(null).trigger('change'); // Clear and reset the Select2 field
|
| 533 |
+
$('#llm_tools').select2({
|
| 534 |
+
theme: 'bootstrap4',
|
| 535 |
+
placeholder: 'Select',
|
| 536 |
+
allowClear: true
|
| 537 |
+
}); // Reinitialize Select2
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
</script>
|
| 541 |
+
</body>
|
| 542 |
+
|
| 543 |
</html>
|