Spaces:
Sleeping
Sleeping
Delete templates
Browse files- templates/API_connectors.html +0 -616
- templates/chatbot.html +0 -81
- templates/company_profile.html +0 -724
- templates/dashboard.html +0 -360
- templates/data_connectors.html +0 -624
- templates/footer.html +0 -26
- templates/index.html +0 -359
- templates/knowledgebase.html +0 -710
- templates/prompt_template.html +0 -643
- templates/redmindlogo2.jpg +0 -0
- templates/redmindlogo3.jpg +0 -0
- templates/sidepane.html +0 -347
templates/API_connectors.html
DELETED
|
@@ -1,616 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<title>API Connectors</title>
|
| 6 |
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 7 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 8 |
-
<!-- Include AdminLTE CSS -->
|
| 9 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/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 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 13 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 14 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 15 |
-
<style>
|
| 16 |
-
.form-group {
|
| 17 |
-
margin-top: -10px;
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
.card {
|
| 21 |
-
padding: 0;
|
| 22 |
-
margin-top: -15px;
|
| 23 |
-
margin-left: -40px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.header-row {
|
| 27 |
-
display: flex;
|
| 28 |
-
justify-content: space-between;
|
| 29 |
-
align-items: center;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
.table-container {
|
| 34 |
-
width: 100%;
|
| 35 |
-
overflow-x: auto;
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
.wrapper {
|
| 39 |
-
display: flex;
|
| 40 |
-
flex-direction: column;
|
| 41 |
-
height: 100vh;
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
.content-wrapper {
|
| 45 |
-
flex: 1;
|
| 46 |
-
overflow-y: auto;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.content-header {
|
| 50 |
-
padding: 5px;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
th,
|
| 54 |
-
td {
|
| 55 |
-
white-space: nowrap;
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
th:nth-child(1),
|
| 59 |
-
td:nth-child(1) {
|
| 60 |
-
/* Sno column */
|
| 61 |
-
width: 5%;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 65 |
-
width: 60px;
|
| 66 |
-
display: inline-block;
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
th:nth-child(2),
|
| 70 |
-
td:nth-child(2) {
|
| 71 |
-
/* API Name column */
|
| 72 |
-
width: 20%;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
th:nth-child(3),
|
| 76 |
-
td:nth-child(3) {
|
| 77 |
-
/* API Endpoint column */
|
| 78 |
-
width: 40%;
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
th:nth-child(4),
|
| 82 |
-
td:nth-child(4) {
|
| 83 |
-
/* Auth/Bearer token column */
|
| 84 |
-
width: 5%;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
th:nth-child(5),
|
| 88 |
-
td:nth-child(5) {
|
| 89 |
-
/* View column */
|
| 90 |
-
width: 5%;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
th:nth-child(6),
|
| 94 |
-
td:nth-child(6) {
|
| 95 |
-
/* View column */
|
| 96 |
-
width: 5%;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
.reduced-width {
|
| 100 |
-
width: 25%;
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 104 |
-
width: 60px;
|
| 105 |
-
display: inline-block;
|
| 106 |
-
}
|
| 107 |
-
</style>
|
| 108 |
-
</head>
|
| 109 |
-
|
| 110 |
-
<body>
|
| 111 |
-
{% include 'sidepane.html' %}
|
| 112 |
-
|
| 113 |
-
<div class="wrapper">
|
| 114 |
-
<div class="main-header" style="border-bottom: none;">
|
| 115 |
-
<!-- Content Header (Page header) -->
|
| 116 |
-
<div class="content-header">
|
| 117 |
-
<div class="container-fluid">
|
| 118 |
-
<div class="container mt-2">
|
| 119 |
-
<div class="form-group left-align"id="company-select">
|
| 120 |
-
<h4 id="selectedCompany" style="margin-left: 300px;"></h4>
|
| 121 |
-
|
| 122 |
-
<!-- <div class="col-12 d-flex justify-content-end mb-3">
|
| 123 |
-
<button class="btn btn-primary"
|
| 124 |
-
style="margin-top: -40px;margin-right: -25px;position: fixed;" id="add">Add</button>
|
| 125 |
-
</div> -->
|
| 126 |
-
</div>
|
| 127 |
-
<div class="row">
|
| 128 |
-
<div id="message-container" style="margin-left: 200px; width:500px;"></div>
|
| 129 |
-
</div>
|
| 130 |
-
</div>
|
| 131 |
-
</div>
|
| 132 |
-
</div>
|
| 133 |
-
<h3 id="company_name" style="margin-left: 400px;">{{company_name}}</h3>
|
| 134 |
-
<section class="content" id="contentSection" style="display: none;">
|
| 135 |
-
<div class="container-fluid">
|
| 136 |
-
<div class="form-group">
|
| 137 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 138 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 139 |
-
</div>
|
| 140 |
-
</div>
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
<!-- Main content -->
|
| 144 |
-
<section class="content">
|
| 145 |
-
<div class="container-fluid">
|
| 146 |
-
<div class="row">
|
| 147 |
-
<div class="col-12">
|
| 148 |
-
<div class="card">
|
| 149 |
-
<div class="card-body table-container">
|
| 150 |
-
<table id="apiTable" class="table table-bordered table-striped">
|
| 151 |
-
<thead>
|
| 152 |
-
<tr>
|
| 153 |
-
<th>Sno</th>
|
| 154 |
-
<th>API Name</th>
|
| 155 |
-
<th>API Endpoint</th>
|
| 156 |
-
<th>View</th>
|
| 157 |
-
<th>Edit</th>
|
| 158 |
-
<th>Delete</th>
|
| 159 |
-
</tr>
|
| 160 |
-
</thead>
|
| 161 |
-
<tbody>
|
| 162 |
-
<!-- <tr>
|
| 163 |
-
<td>1</td>
|
| 164 |
-
<td>Warehouse</td>
|
| 165 |
-
<td>http://193.203.162.39:9090/nxt-wms/userWarehouse/fetchWarehouseForUserId
|
| 166 |
-
</td>
|
| 167 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 168 |
-
</tr>
|
| 169 |
-
<tr>
|
| 170 |
-
<td>2</td>
|
| 171 |
-
<td>customer</td>
|
| 172 |
-
<td>http://193.203.162.39:9090/nxt-wms/userCustomer/fetchCustomerForUserId
|
| 173 |
-
</td>
|
| 174 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 175 |
-
</tr>
|
| 176 |
-
<tr>
|
| 177 |
-
<td>3</td>
|
| 178 |
-
<td>SKU</td>
|
| 179 |
-
<td>http://193.203.162.39:9090/nxt-wms/sku/autoComplete?</td>
|
| 180 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 181 |
-
</tr>
|
| 182 |
-
<tr>
|
| 183 |
-
<td>4</td>
|
| 184 |
-
<td>ASN</td>
|
| 185 |
-
<td>http://193.203.162.39:9090/nxt-wms/trnHeader</td>
|
| 186 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 187 |
-
</tr> -->
|
| 188 |
-
</tbody>
|
| 189 |
-
</table>
|
| 190 |
-
</div>
|
| 191 |
-
</div>
|
| 192 |
-
</div>
|
| 193 |
-
</div>
|
| 194 |
-
</div>
|
| 195 |
-
</section>
|
| 196 |
-
</div>
|
| 197 |
-
|
| 198 |
-
</div>
|
| 199 |
-
|
| 200 |
-
<!-- Modal -->
|
| 201 |
-
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 202 |
-
aria-hidden="true">
|
| 203 |
-
<div class="modal-dialog" style="margin-top: -10px;" role="document">
|
| 204 |
-
<div class="modal-content">
|
| 205 |
-
<div class="modal-header">
|
| 206 |
-
<h5 class="modal-title" id="addModalLabel">Add API Details</h5>
|
| 207 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 208 |
-
<span aria-hidden="true" data-backdrop="static" data-keyboard="false">×</span>
|
| 209 |
-
</button>
|
| 210 |
-
</div>
|
| 211 |
-
<div class="modal-body">
|
| 212 |
-
<div class="form-group">
|
| 213 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 214 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 215 |
-
</div>
|
| 216 |
-
<form id="documentForm">
|
| 217 |
-
<div class="form-group">
|
| 218 |
-
<label for="APIName">API Name <span class="text-danger">*</span></label>
|
| 219 |
-
<input type="text" class="form-control" id="APIName" name="APIName" required>
|
| 220 |
-
</div>
|
| 221 |
-
<div class="form-group">
|
| 222 |
-
<label for="APIEndpoint">API Endpoint <span class="text-danger">*</span></label>
|
| 223 |
-
<input type="text" class="form-control" id="APIEndpoint" name="APIEndpoint" required>
|
| 224 |
-
</div>
|
| 225 |
-
<div class="form-group">
|
| 226 |
-
<label for="Auth_Bearer">Auth/Bearer token <span class="text-danger">*</span></label>
|
| 227 |
-
<input type="text" class="form-control" id="Auth_Bearer" name="Auth_Bearer" required>
|
| 228 |
-
</div>
|
| 229 |
-
<div class="form-group">
|
| 230 |
-
<label for="Inputjson">Input parameter <span class="text-danger">*</span></label>
|
| 231 |
-
<input type="text" class="form-control" id="Inputjson" name="Inputjson" required>
|
| 232 |
-
</div>
|
| 233 |
-
<div class="form-group">
|
| 234 |
-
<label for="OutputJson">Output Json <span class="text-danger">*</span></label>
|
| 235 |
-
<input type="text" class="form-control" id="OutputJson" name="OutputJson" required>
|
| 236 |
-
</div>
|
| 237 |
-
<div class="form-group">
|
| 238 |
-
<label for="Description">Description <span class="text-danger">*</span></label>
|
| 239 |
-
<textarea class="form-control" id="Description" name="Description" rows="3"
|
| 240 |
-
required></textarea>
|
| 241 |
-
</div>
|
| 242 |
-
</form>
|
| 243 |
-
</div>
|
| 244 |
-
<div class="modal-footer">
|
| 245 |
-
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> -->
|
| 246 |
-
<button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button>
|
| 247 |
-
<button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button>
|
| 248 |
-
</div>
|
| 249 |
-
</div>
|
| 250 |
-
</div>
|
| 251 |
-
</div>
|
| 252 |
-
|
| 253 |
-
{%include 'footer.html'%}
|
| 254 |
-
|
| 255 |
-
<!-- Include DataTables JS and your custom script -->
|
| 256 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 257 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
<script>
|
| 261 |
-
$(document).ready(function () {
|
| 262 |
-
// Show modal function
|
| 263 |
-
$('#add').on('click', function () {
|
| 264 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 265 |
-
modalTitle.textContent = 'Add API Details';
|
| 266 |
-
clearFormFields();
|
| 267 |
-
$('#save').show();
|
| 268 |
-
$('#saveupdate').hide();
|
| 269 |
-
$('#message-container').empty(); // Clear the message container
|
| 270 |
-
$('#addModal').modal('show');
|
| 271 |
-
});
|
| 272 |
-
$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {
|
| 273 |
-
$('#addModal').modal('hide');
|
| 274 |
-
});
|
| 275 |
-
// $('#apiTable').DataTable({
|
| 276 |
-
// autoWidth: false
|
| 277 |
-
// });
|
| 278 |
-
|
| 279 |
-
});
|
| 280 |
-
var table = $('#apiTable').DataTable();
|
| 281 |
-
const role = sessionStorage.getItem('userRole');
|
| 282 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 283 |
-
const company_name=sessionStorage.getItem('company_name');
|
| 284 |
-
console.log("company_name",company_name);
|
| 285 |
-
// document.getElementById('company_name').textContent = company_name;
|
| 286 |
-
const passedCompanyName = sessionStorage.getItem('company_name')
|
| 287 |
-
document.getElementById('selectedCompany').innerText = `Company Name: ${passedCompanyName}`;
|
| 288 |
-
const company_id = sessionStorage.getItem('company_id');
|
| 289 |
-
document.getElementById("company_id").value = company_id;
|
| 290 |
-
|
| 291 |
-
data_get_from_db(company_id);
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
const companySelect = document.getElementById('company');
|
| 295 |
-
const documentForm = document.getElementById('documentForm');
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
function moveToNextInput(inputs, currentIndex) {
|
| 299 |
-
const nextInput = inputs[currentIndex + 1];
|
| 300 |
-
if (nextInput) {
|
| 301 |
-
nextInput.focus();
|
| 302 |
-
} else {
|
| 303 |
-
// Optionally, submit the form or trigger the save button
|
| 304 |
-
document.getElementById("save").focus();
|
| 305 |
-
}
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
function displayErrorMessage(message) {
|
| 310 |
-
const messageContainer = document.getElementById('message-container');
|
| 311 |
-
if (messageContainer) {
|
| 312 |
-
messageContainer.innerHTML = `<div class='alert alert-danger'>${message}</div>`;
|
| 313 |
-
}
|
| 314 |
-
}
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
async function data_get_from_db(companyId) {
|
| 320 |
-
if (companyId) {
|
| 321 |
-
try {
|
| 322 |
-
console.log('comp_id',companyId)
|
| 323 |
-
const Response = await fetch(`/api/get_api_connectors?company_id=${companyId}`);
|
| 324 |
-
console.log("responce from api :==> ", Response)
|
| 325 |
-
const connectorsResponse = await Response.json();
|
| 326 |
-
console.log("knowledge data table after connecting to table", connectorsResponse);
|
| 327 |
-
console.log("api connector data table after connecting to table", connectorsResponse);
|
| 328 |
-
const table = $('#apiTable').DataTable(); // Initialize DataTable at the start
|
| 329 |
-
table.clear();
|
| 330 |
-
if (!Array.isArray(connectorsResponse)) {
|
| 331 |
-
throw new TypeError('Expected an array of companies');
|
| 332 |
-
|
| 333 |
-
displayErrorMessage("Data do not exist for this company. Please fill in the details by clicking add button.");
|
| 334 |
-
contentSection.style.display = 'none';
|
| 335 |
-
} else {
|
| 336 |
-
|
| 337 |
-
connectorsResponse.forEach((company, index) => {
|
| 338 |
-
table.row.add([
|
| 339 |
-
index + 1,
|
| 340 |
-
company.APIName,
|
| 341 |
-
company.APIEndpoint,
|
| 342 |
-
`<a href='#' class='btn btn-info btn-sm'data-kid-id='${company.row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`,
|
| 343 |
-
`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${company.row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 344 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 345 |
-
]).draw(false);
|
| 346 |
-
});
|
| 347 |
-
contentSection.style.display = 'block';
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
-
} catch (error) {
|
| 351 |
-
console.error('Error fetching company documents:', error);
|
| 352 |
-
//displayEmptyTable();
|
| 353 |
-
|
| 354 |
-
displayErrorMessage("Data do not exist for this company. Please fill in the details by clicking add button.");
|
| 355 |
-
contentSection.style.display = 'none';
|
| 356 |
-
}
|
| 357 |
-
}
|
| 358 |
-
else {
|
| 359 |
-
// displayEmptyTable();
|
| 360 |
-
|
| 361 |
-
displayErrorMessage("Document details2 for knowledge do not exist for this company. Please fill in the details.");
|
| 362 |
-
}
|
| 363 |
-
}
|
| 364 |
-
|
| 365 |
-
function viewCompany(button) {
|
| 366 |
-
var companyId = $(button).data('kid-id');
|
| 367 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 368 |
-
modalTitle.textContent = 'View API Details';
|
| 369 |
-
if(companyId)
|
| 370 |
-
{
|
| 371 |
-
$.getJSON(`/api/viewapiconnectors/${companyId}`, function (company) {
|
| 372 |
-
|
| 373 |
-
$('#APIName').val(company.api_name).attr('readonly', 'readonly');
|
| 374 |
-
$('#APIEndpoint').val(company.api_endpoint).attr('readonly', 'readonly');
|
| 375 |
-
$('#Auth_Bearer').val(company.auth_token).attr('readonly', 'readonly');
|
| 376 |
-
$('#Inputjson').val(company.input_param).attr('readonly', 'readonly');
|
| 377 |
-
$('#OutputJson').val(company.output_json).attr('readonly', 'readonly');
|
| 378 |
-
$('#Description').val(company.description).attr('readonly', 'readonly');
|
| 379 |
-
$('#save').hide();
|
| 380 |
-
$('#saveupdate').hide();
|
| 381 |
-
$('#addModal').modal('show');
|
| 382 |
-
}).fail(function () {
|
| 383 |
-
alert("Error retrieving API details.");
|
| 384 |
-
});
|
| 385 |
-
}
|
| 386 |
-
}
|
| 387 |
-
// Edit knowledge base details
|
| 388 |
-
function editCompany(button) {
|
| 389 |
-
var companyId = $(button).data('kid-id');
|
| 390 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 391 |
-
modalTitle.textContent = 'Edit API Details';
|
| 392 |
-
if(companyId)
|
| 393 |
-
{
|
| 394 |
-
// Fetch company details by ID
|
| 395 |
-
$.getJSON(`/api/viewapiconnectors/${companyId}`, function (company) {
|
| 396 |
-
|
| 397 |
-
$('#APIName').val(company.api_name);
|
| 398 |
-
$('#APIEndpoint').val(company.api_endpoint);
|
| 399 |
-
$('#Auth_Bearer').val(company.auth_token);
|
| 400 |
-
$('#Inputjson').val(company.input_param);
|
| 401 |
-
$('#OutputJson').val(company.output_json);
|
| 402 |
-
$('#Description').val(company.description);
|
| 403 |
-
|
| 404 |
-
// Show/hide appropriate elements
|
| 405 |
-
$('#uploadFile').show(); // Hide the file upload field
|
| 406 |
-
$('#save').hide(); // Hide the default save button
|
| 407 |
-
$('#saveupdate').show(); // Show the update button
|
| 408 |
-
|
| 409 |
-
// Ensure fields are editable
|
| 410 |
-
$('#APIName').removeAttr('readonly');
|
| 411 |
-
$('#APIEndpoint').removeAttr('readonly');
|
| 412 |
-
$('#Auth_Bearer').removeAttr('readonly');
|
| 413 |
-
$('#Inputjson').removeAttr('readonly');
|
| 414 |
-
$('#OutputJson').removeAttr('readonly');
|
| 415 |
-
$('#Description').removeAttr('readonly');
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
// Show the modal
|
| 419 |
-
$('#addModal').modal('show');
|
| 420 |
-
|
| 421 |
-
// Set up the click event for the update button
|
| 422 |
-
$('#saveupdate').off('click').on('click', function () {
|
| 423 |
-
saveupdate(companyId); // Pass the company ID for updating
|
| 424 |
-
});
|
| 425 |
-
}).fail(function () {
|
| 426 |
-
alert("Error in retrieving API details.");
|
| 427 |
-
});
|
| 428 |
-
}
|
| 429 |
-
}
|
| 430 |
-
|
| 431 |
-
function saveupdate(companyId, filename) {
|
| 432 |
-
const formData = new FormData();
|
| 433 |
-
|
| 434 |
-
const company_id = document.getElementById("company_id").value;
|
| 435 |
-
formData.append("company_id", $('#company_id').val());
|
| 436 |
-
formData.append("APIName", $('#APIName').val());
|
| 437 |
-
formData.append("APIEndpoint", $('#APIEndpoint').val());
|
| 438 |
-
formData.append("Auth_Bearer", $('#Auth_Bearer').val());
|
| 439 |
-
formData.append("Inputjson", $('#Inputjson').val());
|
| 440 |
-
formData.append("OutputJson", $('#OutputJson').val());
|
| 441 |
-
formData.append("Description", $('#Description').val());
|
| 442 |
-
console.log("company_id to table refresh", company_id)
|
| 443 |
-
const messageContainer = document.getElementById('message-container');
|
| 444 |
-
$.ajax({
|
| 445 |
-
url: `/api/editapiconnectors/${companyId}`,
|
| 446 |
-
type: 'PUT',
|
| 447 |
-
data: formData,
|
| 448 |
-
processData: false, // Required for FormData
|
| 449 |
-
contentType: false, // Required for FormData
|
| 450 |
-
success: function (response) {
|
| 451 |
-
// alert('Knowledgebase details updated successfully.');
|
| 452 |
-
|
| 453 |
-
if (messageContainer)
|
| 454 |
-
messageContainer.innerHTML = `
|
| 455 |
-
<div class='alert alert-success'>
|
| 456 |
-
API Data Updated successfully
|
| 457 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 458 |
-
</div>`;
|
| 459 |
-
$('#addModal').modal('hide'); // Close the modal after saving
|
| 460 |
-
fetchUpdatedDocuments(company_id);
|
| 461 |
-
},
|
| 462 |
-
error: function () {
|
| 463 |
-
alert('Form has no changes to update knowledge base details.');
|
| 464 |
-
}
|
| 465 |
-
});
|
| 466 |
-
}
|
| 467 |
-
function dismissMessage() {
|
| 468 |
-
const messageContainer = document.getElementById('message-container');
|
| 469 |
-
if (messageContainer) {
|
| 470 |
-
messageContainer.innerHTML = '';
|
| 471 |
-
}
|
| 472 |
-
}
|
| 473 |
-
async function fetchUpdatedDocuments(company_id) {
|
| 474 |
-
console.log("company_id:", company_id);
|
| 475 |
-
|
| 476 |
-
var table = $('#apiTable').DataTable();
|
| 477 |
-
try {
|
| 478 |
-
const response = await fetch(`/api/api_updatetable?company_id=${company_id}`);
|
| 479 |
-
const connectorsResponse = await response.json();
|
| 480 |
-
|
| 481 |
-
console.log("Fetched connectorsResponse:", connectorsResponse);
|
| 482 |
-
|
| 483 |
-
table.clear(); // Clear existing data in the table
|
| 484 |
-
|
| 485 |
-
if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {
|
| 486 |
-
displayErrorMessage("Knowledgebase details do not exist for this company. Please fill in the details.");
|
| 487 |
-
contentSection.style.display = 'none';
|
| 488 |
-
} else {
|
| 489 |
-
connectorsResponse.forEach((company, index) => {
|
| 490 |
-
table.row.add([
|
| 491 |
-
index + 1,
|
| 492 |
-
company.api_name,
|
| 493 |
-
company.api_endpoint,
|
| 494 |
-
`<a href='#' class='btn btn-info btn-sm' data-kid-id='${company.row_id}' data-action="view" onclick='viewCompany(this)'><i class='fas fa-eye'></i></a>`,
|
| 495 |
-
`<a href='#' class='btn btn-warning btn-sm' data-kid-id='${company.row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 496 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 497 |
-
company.row_id
|
| 498 |
-
]);
|
| 499 |
-
});
|
| 500 |
-
table.draw(false); // Draw the table with the new data
|
| 501 |
-
contentSection.style.display = 'block';
|
| 502 |
-
}
|
| 503 |
-
} catch (error) {
|
| 504 |
-
console.error("Error fetching updated documents:", error);
|
| 505 |
-
displayErrorMessage("There was an error fetching the updated documents.");
|
| 506 |
-
}
|
| 507 |
-
}
|
| 508 |
-
|
| 509 |
-
// Delete company
|
| 510 |
-
function deleteCompany(button) {
|
| 511 |
-
var companyId = $(button).data('kid-id');
|
| 512 |
-
console.log("k_id deleted", companyId);
|
| 513 |
-
$.ajax({
|
| 514 |
-
type: "DELETE",
|
| 515 |
-
url: `/api/deleteapi/${companyId}`,
|
| 516 |
-
success: function () {
|
| 517 |
-
var table = $('#apiTable').DataTable();
|
| 518 |
-
table.row($(button).closest('tr')).remove().draw();
|
| 519 |
-
const messageContainer = document.getElementById('message-container');
|
| 520 |
-
if (messageContainer)
|
| 521 |
-
messageContainer.innerHTML = `
|
| 522 |
-
<div class='alert alert-danger'>
|
| 523 |
-
API Data Deleted successfully
|
| 524 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 525 |
-
</div>`;
|
| 526 |
-
//alert("Company deleted successfully.");
|
| 527 |
-
fetchCompanies(); // Refresh the table
|
| 528 |
-
},
|
| 529 |
-
error: function (xhr) {
|
| 530 |
-
alert("Error deleting company: " + xhr.responseJSON.detail);
|
| 531 |
-
}
|
| 532 |
-
});
|
| 533 |
-
}
|
| 534 |
-
|
| 535 |
-
function save_file() {
|
| 536 |
-
const form = document.getElementById('documentForm');
|
| 537 |
-
const messageContainer = document.getElementById('message-container');
|
| 538 |
-
// Check if the form is valid
|
| 539 |
-
if (!form.checkValidity()) {
|
| 540 |
-
// If the form is invalid, show validation messages and stop the submission
|
| 541 |
-
form.reportValidity();
|
| 542 |
-
return;
|
| 543 |
-
}
|
| 544 |
-
const company_id = $('#company_id').val();
|
| 545 |
-
const APIName = $('#APIName').val();
|
| 546 |
-
const APIEndpoint = $('#APIEndpoint').val();
|
| 547 |
-
const Auth_Bearer = $('#Auth_Bearer').val();
|
| 548 |
-
const Inputjson = $('#Inputjson').val();
|
| 549 |
-
const OutputJson = $('#OutputJson').val();
|
| 550 |
-
const Description = $('#Description').val();
|
| 551 |
-
|
| 552 |
-
var formData = new FormData($('#documentForm')[0]);
|
| 553 |
-
|
| 554 |
-
formData.append("company_id", company_id),
|
| 555 |
-
formData.append("api_name", APIName),
|
| 556 |
-
formData.append("api_endpoint", APIEndpoint),
|
| 557 |
-
formData.append("auth_bearer", Auth_Bearer),
|
| 558 |
-
formData.append("input_json", Inputjson),
|
| 559 |
-
formData.append("output_json", OutputJson),
|
| 560 |
-
formData.append("description", Description)
|
| 561 |
-
|
| 562 |
-
//const formData = new FormData();
|
| 563 |
-
fetch('/api/save_api_details', {
|
| 564 |
-
method: 'POST',
|
| 565 |
-
body: formData
|
| 566 |
-
})
|
| 567 |
-
.then(response => {
|
| 568 |
-
if (!response.ok) {
|
| 569 |
-
throw new Error('Network response was not ok');
|
| 570 |
-
}
|
| 571 |
-
return response.json();
|
| 572 |
-
})
|
| 573 |
-
.then(data => {
|
| 574 |
-
row_id = data.row_id;
|
| 575 |
-
var table = $('#apiTable').DataTable();
|
| 576 |
-
var rowCount = table.rows().count();
|
| 577 |
-
const view = `<a href='#' class='btn btn-info btn-sm'data-kid-id='${row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`;
|
| 578 |
-
const edit = `<a href='#' class='btn btn-warning btn-sm'data-kid-id='${row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`;
|
| 579 |
-
const dele = `<a href='#' class='btn btn-danger btn-sm' data-kid-id='${row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`;
|
| 580 |
-
table.row.add([
|
| 581 |
-
rowCount + 1,
|
| 582 |
-
APIName,
|
| 583 |
-
APIEndpoint,
|
| 584 |
-
view,
|
| 585 |
-
edit,
|
| 586 |
-
dele
|
| 587 |
-
]).draw(false);
|
| 588 |
-
|
| 589 |
-
// alert('Document saved successfully');
|
| 590 |
-
if (messageContainer)
|
| 591 |
-
messageContainer.innerHTML = `
|
| 592 |
-
<div class='alert alert-success'>
|
| 593 |
-
API Data saved successfully
|
| 594 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 595 |
-
</div>`;
|
| 596 |
-
$('#addModal').modal('hide');
|
| 597 |
-
document.getElementById('contentSection').style.display = 'block'; // Show the table section
|
| 598 |
-
})
|
| 599 |
-
.catch(error => console.error('Error:', error));
|
| 600 |
-
}
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
function clearFormFields() {
|
| 604 |
-
document.getElementById('APIName').value = "";
|
| 605 |
-
document.getElementById('APIEndpoint').value = "";
|
| 606 |
-
document.getElementById('Auth_Bearer').value = "";
|
| 607 |
-
document.getElementById('Inputjson').value = "";
|
| 608 |
-
document.getElementById('OutputJson').value = "";
|
| 609 |
-
document.getElementById('Description').value = "";
|
| 610 |
-
}
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
</script>
|
| 614 |
-
</body>
|
| 615 |
-
|
| 616 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/chatbot.html
DELETED
|
@@ -1,81 +0,0 @@
|
|
| 1 |
-
# jinja2 html page with chatbot functionality using adminlte3 theme
|
| 2 |
-
<html>
|
| 3 |
-
<body>
|
| 4 |
-
<form id="myform">
|
| 5 |
-
<div class="content-wrapper">
|
| 6 |
-
<section class="content-header">
|
| 7 |
-
<div class="container-fluid">
|
| 8 |
-
<div class="row mb-2">
|
| 9 |
-
<div class="col-sm-6">
|
| 10 |
-
<h1>Chatbot</h1>
|
| 11 |
-
</div>
|
| 12 |
-
<div class="col-sm-6">
|
| 13 |
-
<ol class="breadcrumb float-sm-right">
|
| 14 |
-
<li class="breadcrumb-item"><a href="#">Home</a></li>
|
| 15 |
-
<li class="breadcrumb-item active">Chatbot</li>
|
| 16 |
-
</ol>
|
| 17 |
-
</div>
|
| 18 |
-
</div>
|
| 19 |
-
</div>
|
| 20 |
-
</section>
|
| 21 |
-
|
| 22 |
-
<section class="content">
|
| 23 |
-
<div class="container-fluid">
|
| 24 |
-
<div class="row">
|
| 25 |
-
<div class="col-md-8 offset-md-2">
|
| 26 |
-
<div class="card card-primary">
|
| 27 |
-
<div class="card-header">
|
| 28 |
-
<h3 class="card-title">Chat with our AI</h3>
|
| 29 |
-
</div>
|
| 30 |
-
<div class="card-body">
|
| 31 |
-
<div id="chat-container">
|
| 32 |
-
<div class="chat-messages">
|
| 33 |
-
<!-- Chat messages will be dynamically added here -->
|
| 34 |
-
</div>
|
| 35 |
-
<div class="chat-input">
|
| 36 |
-
<input type="text" id="user_question" placeholder="Type your message...">
|
| 37 |
-
<button id="send-button" onclick="clickform()">Send</button>
|
| 38 |
-
</div>
|
| 39 |
-
</div>
|
| 40 |
-
</div>
|
| 41 |
-
</div>
|
| 42 |
-
</div>
|
| 43 |
-
</div>
|
| 44 |
-
</div>
|
| 45 |
-
</section>
|
| 46 |
-
</div>
|
| 47 |
-
</form>
|
| 48 |
-
<script>
|
| 49 |
-
const chatContainer = document.getElementById('chat-container');
|
| 50 |
-
const userInput = document.getElementById('user_question');
|
| 51 |
-
const sendButton = document.getElementById('send-button');
|
| 52 |
-
|
| 53 |
-
function clickform() {
|
| 54 |
-
alert('Please enter');
|
| 55 |
-
var formElement = document.getElementById('myForm');
|
| 56 |
-
var user_question = document.getElementById('user_question').value;
|
| 57 |
-
alert(user_question);
|
| 58 |
-
//var data = new FormData(formElement);
|
| 59 |
-
//alert(data);
|
| 60 |
-
fetch('/chat_with_agent', {
|
| 61 |
-
method: 'POST',
|
| 62 |
-
//body: data,
|
| 63 |
-
})
|
| 64 |
-
.then(resp => resp.text()) // or, resp.json(), etc.
|
| 65 |
-
.then(data => {
|
| 66 |
-
//document.getElementById("responseArea").innerHTML = data;
|
| 67 |
-
alert(data);
|
| 68 |
-
const chatMessage = document.createElement('div');
|
| 69 |
-
chatMessage.classList.add('chat-message');
|
| 70 |
-
chatMessage.innerHTML = '<strong>You:</strong> ${user_question}<br><strong>AI:</strong> ${data}';
|
| 71 |
-
chatContainer.appendChild(chatMessage);
|
| 72 |
-
|
| 73 |
-
userInput.value = '';
|
| 74 |
-
userInput.focus();
|
| 75 |
-
})
|
| 76 |
-
.catch(error => {
|
| 77 |
-
console.error(error);
|
| 78 |
-
});
|
| 79 |
-
}
|
| 80 |
-
</script>
|
| 81 |
-
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/company_profile.html
DELETED
|
@@ -1,724 +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/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 10 |
-
<!-- Include AdminLTE CSS -->
|
| 11 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/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/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
| 15 |
-
<link href="https://cdn.jsdelivr.net/npm/@ttskch/select2-bootstrap4-theme@1.4.0/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 |
-
|
| 20 |
-
#add {
|
| 21 |
-
display: inline-block ;
|
| 22 |
-
margin-right: 15px !important; /* Optional: Adjust margin if needed */
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
body {
|
| 26 |
-
background-color: transparent !important;
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
.card {
|
| 30 |
-
padding: 0;
|
| 31 |
-
margin-top: 10px;
|
| 32 |
-
margin-left: -50px;
|
| 33 |
-
}
|
| 34 |
-
/* Ensure the DataTable wrapper takes the full width */
|
| 35 |
-
.dataTables_wrapper {
|
| 36 |
-
width: 100%;
|
| 37 |
-
}
|
| 38 |
-
/* Ensure the DataTable wrapper takes the full width */
|
| 39 |
-
.dataTables_wrapper {
|
| 40 |
-
width: 100%;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
/* Style for the custom dropdown */
|
| 46 |
-
.custom-dropdown {
|
| 47 |
-
position: relative;
|
| 48 |
-
display: inline-block;
|
| 49 |
-
margin-left: 10px; /* Space between label and dropdown */
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
.dropdown-button {
|
| 53 |
-
background-color: white;
|
| 54 |
-
color: black;
|
| 55 |
-
padding: 5px;
|
| 56 |
-
border: 1px solid black;
|
| 57 |
-
border-radius: 4px;
|
| 58 |
-
cursor: pointer;
|
| 59 |
-
text-align: left;
|
| 60 |
-
width: 60px; /* Adjust width as needed */
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.dropdown-content {
|
| 64 |
-
display: none;
|
| 65 |
-
position: absolute;
|
| 66 |
-
background-color: #f9f9f9;
|
| 67 |
-
min-width: 80px; /* Adjust width as needed */
|
| 68 |
-
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
| 69 |
-
z-index: 1;
|
| 70 |
-
border: 1px solid #ddd;
|
| 71 |
-
top: 100%; /* Position below the button */
|
| 72 |
-
left: 0;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
.dropdown-content a {
|
| 76 |
-
padding: 10px;
|
| 77 |
-
text-decoration: none;
|
| 78 |
-
display: block;
|
| 79 |
-
color: #333;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
.dropdown-content a:hover {
|
| 83 |
-
background-color: #ddd;
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
.content-wrapper {
|
| 87 |
-
background-color: transparent !important;
|
| 88 |
-
text-align: center;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
.wrapper {
|
| 92 |
-
background-color: transparent !important;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
.modal-content {
|
| 96 |
-
background-color: #fff;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
h1 {
|
| 100 |
-
text-align: center;
|
| 101 |
-
margin-bottom: 30px;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
.table-responsive {
|
| 106 |
-
width: 95%;
|
| 107 |
-
overflow-x:none;
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
.table {
|
| 111 |
-
width: 100%;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
.text-wrap {
|
| 115 |
-
white-space: normal !important;
|
| 116 |
-
word-break: break-word;
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 120 |
-
width: 60px;
|
| 121 |
-
display: inline-block;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
.center-align {
|
| 125 |
-
padding-top: 20px;
|
| 126 |
-
display: flex;
|
| 127 |
-
justify-content: center;
|
| 128 |
-
align-items: center;
|
| 129 |
-
width: 100%;
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
.reduced-width {
|
| 133 |
-
width: 50%;
|
| 134 |
-
}
|
| 135 |
-
|
| 136 |
-
th,
|
| 137 |
-
td {
|
| 138 |
-
white-space: nowrap;
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
.select2-container--bootstrap4 {
|
| 142 |
-
z-index: 1050;
|
| 143 |
-
/* Higher than the modal's z-index */
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
.select2-container--open {
|
| 147 |
-
z-index: 1060;
|
| 148 |
-
/* Ensure the dropdown is above the modal */
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
th:nth-child(1),
|
| 152 |
-
td:nth-child(1) {
|
| 153 |
-
width: 5%;
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
th:nth-child(2),
|
| 157 |
-
td:nth-child(2) {
|
| 158 |
-
width: 20%;
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
th:nth-child(3),
|
| 162 |
-
td:nth-child(3) {
|
| 163 |
-
width: 20%;
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
th:nth-child(4),
|
| 167 |
-
td:nth-child(4) {
|
| 168 |
-
width: 20%;
|
| 169 |
-
}
|
| 170 |
-
|
| 171 |
-
th:nth-child(5),
|
| 172 |
-
td:nth-child(5) {
|
| 173 |
-
width: 10%;
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
th:nth-child(6),
|
| 177 |
-
td:nth-child(6) {
|
| 178 |
-
width: 10%;
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
th:nth-child(7),
|
| 182 |
-
td:nth-child(7) {
|
| 183 |
-
width: 10%;
|
| 184 |
-
}
|
| 185 |
-
th:nth-child(8),
|
| 186 |
-
td:nth-child(8) {
|
| 187 |
-
width: 10%;
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
-
.alert {
|
| 191 |
-
position: relative;
|
| 192 |
-
padding: 15px;
|
| 193 |
-
margin-bottom: 20px;
|
| 194 |
-
border: 1px solid transparent;
|
| 195 |
-
border-radius: 4px;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
-
.alert-success {
|
| 199 |
-
color: #3c763d;
|
| 200 |
-
background-color: #dff0d8;
|
| 201 |
-
border-color: #d6e9c6;
|
| 202 |
-
}
|
| 203 |
-
|
| 204 |
-
.alert-danger {
|
| 205 |
-
color: #a94442;
|
| 206 |
-
background-color: #f2dede;
|
| 207 |
-
border-color: #ebccd1;
|
| 208 |
-
}
|
| 209 |
-
|
| 210 |
-
.close2 {
|
| 211 |
-
position: absolute;
|
| 212 |
-
bottom: 10px;
|
| 213 |
-
right: 10px;
|
| 214 |
-
border: none;
|
| 215 |
-
background: none;
|
| 216 |
-
font-size: 16px;
|
| 217 |
-
cursor: pointer;
|
| 218 |
-
}
|
| 219 |
-
</style>
|
| 220 |
-
</head>
|
| 221 |
-
|
| 222 |
-
<body>
|
| 223 |
-
{% include 'sidepane.html' %}
|
| 224 |
-
|
| 225 |
-
<div class="wrapper">
|
| 226 |
-
<div class="content-wrapper">
|
| 227 |
-
<!-- Content Header (Page header) -->
|
| 228 |
-
<div class="content-header">
|
| 229 |
-
<div class="container-fluid">
|
| 230 |
-
<div class="row mb-2">
|
| 231 |
-
<!-- <div class="col-12">
|
| 232 |
-
<div class="col-12 d-flex justify-content-end mb-3">
|
| 233 |
-
<button class="btn btn-primary" style="margin-bottom:-30px;position:fixed" id="add">Add</button>
|
| 234 |
-
</div>
|
| 235 |
-
</div> -->
|
| 236 |
-
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 237 |
-
<div class="row">
|
| 238 |
-
<div id="message-container" style="margin-left: 200px;width:600px;"></div>
|
| 239 |
-
</div>
|
| 240 |
-
</div>
|
| 241 |
-
</div>
|
| 242 |
-
</div>
|
| 243 |
-
<!-- Main content -->
|
| 244 |
-
<section class="content" id="startTable" style="display: none;">
|
| 245 |
-
|
| 246 |
-
<div class="row">
|
| 247 |
-
<div class="col-12">
|
| 248 |
-
<div class="card">
|
| 249 |
-
<div class="card-body table-container">
|
| 250 |
-
<div class="dataTables_wrapper">
|
| 251 |
-
<div class="row">
|
| 252 |
-
<div class="dataTables_length" >
|
| 253 |
-
<label style="display: inline-block;margin-right:800px; margin-bottom: -40px;" >Show entries:
|
| 254 |
-
<div class="custom-dropdown">
|
| 255 |
-
<button class="dropdown-button">5</button>
|
| 256 |
-
<div class="dropdown-content">
|
| 257 |
-
<a href="#" data-length="5">5</a>
|
| 258 |
-
<a href="#" data-length="10">10</a>
|
| 259 |
-
<a href="#" data-length="50">50</a>
|
| 260 |
-
<a href="#" data-length="100">100</a>
|
| 261 |
-
</div>
|
| 262 |
-
</div>
|
| 263 |
-
</label>
|
| 264 |
-
</div>
|
| 265 |
-
<table id="companyTable" class="table display mb-4 dataTablesCard dataTable table-responsive-xl card-table" >
|
| 266 |
-
<thead>
|
| 267 |
-
<tr>
|
| 268 |
-
<th>Sno</th>
|
| 269 |
-
<th>Company Name</th>
|
| 270 |
-
<th>Company code</th>
|
| 271 |
-
<th>Domain</th>
|
| 272 |
-
<th>LLM Tools</th>
|
| 273 |
-
<th>View</th>
|
| 274 |
-
<th>Edit</th>
|
| 275 |
-
<th>Delete</th>
|
| 276 |
-
</tr>
|
| 277 |
-
</thead>
|
| 278 |
-
|
| 279 |
-
</table>
|
| 280 |
-
</div>
|
| 281 |
-
</div>
|
| 282 |
-
</div>
|
| 283 |
-
</div>
|
| 284 |
-
</div>
|
| 285 |
-
</section>
|
| 286 |
-
</div>
|
| 287 |
-
</div>
|
| 288 |
-
<!-- Modal -->
|
| 289 |
-
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 290 |
-
aria-hidden="true">
|
| 291 |
-
<div class="modal-dialog" role="document">
|
| 292 |
-
<div class="modal-content">
|
| 293 |
-
<div class="modal-header">
|
| 294 |
-
<h5 class="modal-title" id="addModalLabel">Add Company Profile</h5>
|
| 295 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
| 296 |
-
<span aria-hidden="true" data-backdrop="static" data-keyboard="false">×</span>
|
| 297 |
-
</button>
|
| 298 |
-
</div>
|
| 299 |
-
<div class="modal-body">
|
| 300 |
-
<form id="companyForm">
|
| 301 |
-
<div class="form-group">
|
| 302 |
-
<label for="companyName">Company Name<span class="text-danger">*</span></label>
|
| 303 |
-
<input type="text" class="form-control" id="company_name" name="company_name" required>
|
| 304 |
-
</div>
|
| 305 |
-
<div class="form-group">
|
| 306 |
-
<label for="companyCode">Company Code<span class="text-danger">*</span></label>
|
| 307 |
-
<input type="text" class="form-control" id="company_code" name="company_code" required>
|
| 308 |
-
</div>
|
| 309 |
-
<div class="form-group">
|
| 310 |
-
<label for="domain">Domain<span class="text-danger">*</span></label>
|
| 311 |
-
<input type="text" class="form-control" id="domain" name="domain" required>
|
| 312 |
-
</div>
|
| 313 |
-
<div class="form-group" >
|
| 314 |
-
<label for="llm_tools">LLM Tools<span class="text-danger">*</span></label>
|
| 315 |
-
<select class="form-select" id="llm_tools" name="llm_tools[]" multiple required>
|
| 316 |
-
<option value="Database">Database</option>
|
| 317 |
-
<option value="Static Documents">Static Documents</option>
|
| 318 |
-
<option value="API">API</option>
|
| 319 |
-
</select>
|
| 320 |
-
|
| 321 |
-
<div class="invalid-feedback">
|
| 322 |
-
Please select at least one LLM tool.
|
| 323 |
-
</div>
|
| 324 |
-
</div>
|
| 325 |
-
|
| 326 |
-
<div class="form-group">
|
| 327 |
-
<label for="domain">UserName<span class="text-danger">*</span></label>
|
| 328 |
-
<input type="text" class="form-control" id="username" name="username" required>
|
| 329 |
-
</div>
|
| 330 |
-
</form>
|
| 331 |
-
</div>
|
| 332 |
-
<div class="modal-footer">
|
| 333 |
-
<button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button>
|
| 334 |
-
<button type="button" id="save" onclick="saveProfile()" class="btn btn-primary">Save</button>
|
| 335 |
-
</div>
|
| 336 |
-
</div>
|
| 337 |
-
</div>
|
| 338 |
-
</div>
|
| 339 |
-
{%include 'footer.html'%}
|
| 340 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 341 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 342 |
-
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
| 343 |
-
<script>
|
| 344 |
-
document.addEventListener('DOMContentLoaded', function () {
|
| 345 |
-
|
| 346 |
-
const role = sessionStorage.getItem('userRole');
|
| 347 |
-
const company_id=sessionStorage.getItem('company_id');
|
| 348 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 349 |
-
document.getElementById('userRole').value = role;
|
| 350 |
-
const passedCompanyName = sessionStorage.getItem('company_name')
|
| 351 |
-
document.getElementById('selectedCompany').innerText = `Company Name: ${passedCompanyName}`;
|
| 352 |
-
$('#addModal').hide(); // Make sure this is called initially
|
| 353 |
-
function checkForAddButton() {
|
| 354 |
-
const addButton = document.getElementById('add');
|
| 355 |
-
|
| 356 |
-
if (addButton) {
|
| 357 |
-
// Stop checking once the element is found
|
| 358 |
-
clearInterval(checkInterval);
|
| 359 |
-
if (role === 'superadmin') {
|
| 360 |
-
console.log("insidse compamy profile super admin");
|
| 361 |
-
|
| 362 |
-
$('#startTable').show();
|
| 363 |
-
$('#addModal').hide();
|
| 364 |
-
$('#add').show();
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
} else {
|
| 368 |
-
console.log("insidse company profile admin");
|
| 369 |
-
$('#add').hide();
|
| 370 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 371 |
-
modalTitle.textContent = 'Company Details';
|
| 372 |
-
viewCompany(company_id);
|
| 373 |
-
}
|
| 374 |
-
}
|
| 375 |
-
}
|
| 376 |
-
const checkInterval = setInterval(checkForAddButton, 100); //
|
| 377 |
-
document.querySelector('.dropdown-button').addEventListener('click', function() {
|
| 378 |
-
const dropdownContent = document.querySelector('.dropdown-content');
|
| 379 |
-
dropdownContent.style.display = dropdownContent.style.display === 'block' ? 'none' : 'block';
|
| 380 |
-
});
|
| 381 |
-
fetchCompanies();
|
| 382 |
-
});
|
| 383 |
-
window.addEventListener('click', function(event) {
|
| 384 |
-
if (!event.target.matches('.dropdown-button')) {
|
| 385 |
-
const dropdownContents = document.querySelectorAll('.dropdown-content');
|
| 386 |
-
dropdownContents.forEach(function(content) {
|
| 387 |
-
content.style.display = 'none';
|
| 388 |
-
});
|
| 389 |
-
}
|
| 390 |
-
});
|
| 391 |
-
window.addEventListener('pageshow', function (event) {
|
| 392 |
-
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 393 |
-
window.location.reload();
|
| 394 |
-
}
|
| 395 |
-
});
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
$(document).ready(function () {
|
| 399 |
-
// Initialize DataTable
|
| 400 |
-
//$('#companyTable').DataTable();
|
| 401 |
-
$('#companyTable').DataTable({
|
| 402 |
-
|
| 403 |
-
"paging": true,
|
| 404 |
-
"pageLength":5,
|
| 405 |
-
"lengthChange": false,
|
| 406 |
-
"searching": true,
|
| 407 |
-
"ordering": true,
|
| 408 |
-
"info": true,
|
| 409 |
-
"autoWidth": false,
|
| 410 |
-
"responsive": true
|
| 411 |
-
});
|
| 412 |
-
|
| 413 |
-
// Initialize Select2
|
| 414 |
-
$('select').select2({
|
| 415 |
-
theme: 'bootstrap4',
|
| 416 |
-
placeholder: 'Select',
|
| 417 |
-
allowClear: true,
|
| 418 |
-
dropdownParent: $('#addModal')
|
| 419 |
-
});
|
| 420 |
-
|
| 421 |
-
// Show modal function
|
| 422 |
-
$('#add').on('click', function () {
|
| 423 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 424 |
-
modalTitle.textContent = 'Add Company Details';
|
| 425 |
-
console.log('Modal title after setting:', modalTitle.textContent); // This should log the new title
|
| 426 |
-
$('#company_name').removeAttr('readonly');
|
| 427 |
-
$('#company_code').removeAttr('readonly');
|
| 428 |
-
$('#domain').removeAttr('readonly');
|
| 429 |
-
$('select').prop('disabled', false);
|
| 430 |
-
$('#username').removeAttr('readonly');
|
| 431 |
-
$('#addModal').modal('show');
|
| 432 |
-
$('#save').show();
|
| 433 |
-
$('#saveupdate').hide();
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
clearmodal();
|
| 437 |
-
$('#save').prop('disabled', false); // Disable the "Save" button when the modal opens
|
| 438 |
-
});
|
| 439 |
-
$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {
|
| 440 |
-
$('#addModal').modal('hide');
|
| 441 |
-
});
|
| 442 |
-
$('#addModal').on('shown.bs.modal', function() {
|
| 443 |
-
$('#companyTable').DataTable().columns.adjust().draw();
|
| 444 |
-
// Initialize Select2 only if not already initialized
|
| 445 |
-
if (!$('#llm_tools').hasClass('select2-hidden-accessible')) {
|
| 446 |
-
$('select').select2({
|
| 447 |
-
theme: 'bootstrap4',
|
| 448 |
-
placeholder: 'Select LLM Tools',
|
| 449 |
-
allowClear: true,
|
| 450 |
-
dropdownParent: $('#addModal')
|
| 451 |
-
});
|
| 452 |
-
}
|
| 453 |
-
});
|
| 454 |
-
|
| 455 |
-
$(document).on('click', '.btn-view', function () {
|
| 456 |
-
const companyId = $(this).data('id');
|
| 457 |
-
console.log("company_id in view", companyId);
|
| 458 |
-
viewCompany(companyId);
|
| 459 |
-
});
|
| 460 |
-
|
| 461 |
-
// Edit company details
|
| 462 |
-
$(document).on('click', '.btn-edit', function () {
|
| 463 |
-
const companyId = $(this).data('id');
|
| 464 |
-
console.log("company_id in edit", companyId);
|
| 465 |
-
if (companyId)
|
| 466 |
-
{
|
| 467 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 468 |
-
modalTitle.textContent = 'Edit Company Details';
|
| 469 |
-
console.log('Modal title:', modalTitle.textContent);
|
| 470 |
-
|
| 471 |
-
Editcompany(companyId);
|
| 472 |
-
}
|
| 473 |
-
});
|
| 474 |
-
|
| 475 |
-
// Delete company
|
| 476 |
-
$(document).on('click', '.btn-delete', function () {
|
| 477 |
-
const companyId = $(this).data('id'); // Get the company ID from the da
|
| 478 |
-
console.log("company_id in delete", companyId);
|
| 479 |
-
if (confirm("Are you sure you want to delete this company?")) {
|
| 480 |
-
deleteCompany(companyId); // Call the delete function with the company ID
|
| 481 |
-
}
|
| 482 |
-
});
|
| 483 |
-
});
|
| 484 |
-
// View company details
|
| 485 |
-
function viewCompany(companyId) {
|
| 486 |
-
const username = sessionStorage.getItem('username');
|
| 487 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 488 |
-
modalTitle.textContent = 'View Company Details';
|
| 489 |
-
|
| 490 |
-
// Fetch company details by ID
|
| 491 |
-
$.getJSON(`/api/getcompanydetails/${companyId}`, function (company) {
|
| 492 |
-
console.log("Fetched company details:", company);
|
| 493 |
-
|
| 494 |
-
// Set the company fields to readonly
|
| 495 |
-
$('#company_name').val(company.company_name).attr('readonly', 'readonly');
|
| 496 |
-
$('#company_code').val(company.company_code).attr('readonly', 'readonly');
|
| 497 |
-
$('#domain').val(company.domain).attr('readonly', 'readonly');
|
| 498 |
-
$('select').val(company.llm_tools.split(',')).trigger('change');
|
| 499 |
-
$('select').prop('disabled', true);
|
| 500 |
-
$('#username').val(username).attr('readonly', 'readonly');
|
| 501 |
-
|
| 502 |
-
// Show the modal
|
| 503 |
-
$('#saveupdate').hide();
|
| 504 |
-
$('#save').hide();
|
| 505 |
-
$('#addModal').modal('show');
|
| 506 |
-
}).fail(function () {
|
| 507 |
-
console.error("Error retrieving company details.");
|
| 508 |
-
});
|
| 509 |
-
}
|
| 510 |
-
// Edit company details
|
| 511 |
-
function Editcompany(companyId) {
|
| 512 |
-
|
| 513 |
-
const username=sessionStorage.getItem('username');
|
| 514 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 515 |
-
modalTitle.textContent = 'Edit Company Details';
|
| 516 |
-
console.log('Modal title after setting:', modalTitle.textContent); // Should log "Edit Company Details"
|
| 517 |
-
// Fetch company details by ID
|
| 518 |
-
$.getJSON(`/api/getcompanydetails/${companyId}`, function (company) {
|
| 519 |
-
$('#company_name').removeAttr('readonly');
|
| 520 |
-
$('#company_code').removeAttr('readonly');
|
| 521 |
-
$('#domain').removeAttr('readonly');
|
| 522 |
-
$('select').prop('disabled', false);
|
| 523 |
-
$('#save').hide();
|
| 524 |
-
$('#saveupdate').show();
|
| 525 |
-
// Populate the form with the company's details
|
| 526 |
-
$('#company_name').val(company.company_name);
|
| 527 |
-
$('#company_code').val(company.company_code);
|
| 528 |
-
$('#domain').val(company.domain);
|
| 529 |
-
$('select').val(company.llm_tools.split(',')).trigger('change');
|
| 530 |
-
$('#username').val(username).attr('readonly', 'readonly');// Disable the select input
|
| 531 |
-
|
| 532 |
-
//sessionStorage.setItem('llmTools', company.llm_tools); // Store as a string
|
| 533 |
-
$('#addModal').modal('show');
|
| 534 |
-
|
| 535 |
-
// Update the save button to save the edited company
|
| 536 |
-
$('#saveupdate').off('click').on('click', function () {
|
| 537 |
-
|
| 538 |
-
saveupdate(companyId); // Pass the company ID for updating
|
| 539 |
-
});
|
| 540 |
-
}).fail(function () {
|
| 541 |
-
alert("Error retrieving company details.");
|
| 542 |
-
});
|
| 543 |
-
}
|
| 544 |
-
|
| 545 |
-
// Delete company
|
| 546 |
-
function deleteCompany(companyId) {
|
| 547 |
-
console.log("company_id deleted", companyId);
|
| 548 |
-
$.ajax({
|
| 549 |
-
type: "DELETE",
|
| 550 |
-
url: `/api/delcompanydetails/${companyId}`,
|
| 551 |
-
success: function () {
|
| 552 |
-
// alert("Company deleted successfully.");
|
| 553 |
-
const messageContainer = document.getElementById('message-container');
|
| 554 |
-
if (messageContainer)
|
| 555 |
-
messageContainer.innerHTML = `
|
| 556 |
-
<div class='alert alert-danger'>
|
| 557 |
-
Company details deleted successfully.
|
| 558 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 559 |
-
</div>`;
|
| 560 |
-
fetchCompanies(); // Refresh the table
|
| 561 |
-
},
|
| 562 |
-
error: function (xhr) {
|
| 563 |
-
alert("Error deleting company: " + xhr.responseJSON.detail);
|
| 564 |
-
}
|
| 565 |
-
});
|
| 566 |
-
}
|
| 567 |
-
function saveupdate(companyId) {
|
| 568 |
-
console.log("company_id", companyId);
|
| 569 |
-
const llm_tools= $('#llm_tools').select2("val");
|
| 570 |
-
var formData = new FormData();
|
| 571 |
-
formData.append('company_name', $('#company_name').val());
|
| 572 |
-
formData.append('company_code', $('#company_code').val());
|
| 573 |
-
formData.append('domain', $('#domain').val());
|
| 574 |
-
formData.append('llm_tools',llm_tools); // Assuming llm_tools is a multi-select
|
| 575 |
-
|
| 576 |
-
console.log("company_data", formData);
|
| 577 |
-
|
| 578 |
-
$.ajax({
|
| 579 |
-
url: `/api/putcompanydetails/${companyId}`,
|
| 580 |
-
type: 'PUT',
|
| 581 |
-
data: formData,
|
| 582 |
-
processData: false, // Important for FormData
|
| 583 |
-
contentType: false,
|
| 584 |
-
success: function (response) {
|
| 585 |
-
// alert('Company details updated successfully.');
|
| 586 |
-
const messageContainer = document.getElementById('message-container');
|
| 587 |
-
if (messageContainer)
|
| 588 |
-
messageContainer.innerHTML = `
|
| 589 |
-
<div class='alert alert-success'>
|
| 590 |
-
Company Data Updated successfully
|
| 591 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 592 |
-
</div>`;
|
| 593 |
-
$('#addModal').modal('hide'); // Close the modal after saving
|
| 594 |
-
fetchCompanies();
|
| 595 |
-
},
|
| 596 |
-
error: function () {
|
| 597 |
-
|
| 598 |
-
const messageContainer = document.getElementById('message-container');
|
| 599 |
-
if (messageContainer)
|
| 600 |
-
messageContainer.innerHTML = `
|
| 601 |
-
<div class='alert alert-danger'>
|
| 602 |
-
No changes have been made to update company details.
|
| 603 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 604 |
-
</div>`;
|
| 605 |
-
$('#addModal').modal('hide');
|
| 606 |
-
//alert('No changes have been made to update company details.');
|
| 607 |
-
}
|
| 608 |
-
});
|
| 609 |
-
}
|
| 610 |
-
|
| 611 |
-
function saveProfile() {
|
| 612 |
-
const form = document.getElementById('companyForm');
|
| 613 |
-
|
| 614 |
-
// Check if the form is valid
|
| 615 |
-
if (!form.checkValidity()) {
|
| 616 |
-
// If the form is invalid, show validation messages and stop the submission
|
| 617 |
-
form.reportValidity();
|
| 618 |
-
return;
|
| 619 |
-
}
|
| 620 |
-
|
| 621 |
-
// Gather form data
|
| 622 |
-
const company_name = document.getElementById('company_name').value;
|
| 623 |
-
const company_code = document.getElementById('company_code').value;
|
| 624 |
-
const domain = document.getElementById('domain').value;
|
| 625 |
-
const llm_tools = $('#llm_tools').select2("val");
|
| 626 |
-
console.log("Selected LLM Tools:", llm_tools);
|
| 627 |
-
// console.log("llm_tools element:", document.getElementById('llm_tools'));
|
| 628 |
-
const username=$('#username').val();
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
// Prepare FormData
|
| 632 |
-
let formData = new FormData();
|
| 633 |
-
const password="password";
|
| 634 |
-
const rolesave="admin";
|
| 635 |
-
formData.append("company_name", company_name);
|
| 636 |
-
formData.append("company_code", company_code);
|
| 637 |
-
formData.append("domain", domain);
|
| 638 |
-
formData.append("llm_tools", llm_tools);
|
| 639 |
-
formData.append("username",username);
|
| 640 |
-
formData.append("password",password);
|
| 641 |
-
formData.append("role",rolesave);
|
| 642 |
-
|
| 643 |
-
$.ajax({
|
| 644 |
-
type: "POST",
|
| 645 |
-
url: "/submit_company_profile",
|
| 646 |
-
data: formData,
|
| 647 |
-
processData: false,
|
| 648 |
-
contentType: false,
|
| 649 |
-
success: function (response) {
|
| 650 |
-
// alert("Data saved successfully"); // Show success message
|
| 651 |
-
const messageContainer = document.getElementById('message-container');
|
| 652 |
-
if (messageContainer)
|
| 653 |
-
messageContainer.innerHTML = `
|
| 654 |
-
<div class='alert alert-success'>
|
| 655 |
-
Data saved successfully
|
| 656 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 657 |
-
</div>`;
|
| 658 |
-
fetchCompanies(); // Refresh table data
|
| 659 |
-
|
| 660 |
-
// Clear the form and close the modal
|
| 661 |
-
// $('#companyForm')[0].reset();
|
| 662 |
-
$('#addModal').modal('hide');
|
| 663 |
-
},
|
| 664 |
-
error: function (xhr) {
|
| 665 |
-
alert("An error occurred: " + xhr.responseJSON.detail); // Show error message
|
| 666 |
-
}
|
| 667 |
-
});
|
| 668 |
-
}
|
| 669 |
-
function dismissMessage() {
|
| 670 |
-
const messageContainer = document.getElementById('message-container');
|
| 671 |
-
if (messageContainer) {
|
| 672 |
-
messageContainer.innerHTML = '';
|
| 673 |
-
}
|
| 674 |
-
}
|
| 675 |
-
async function fetchCompanies() {
|
| 676 |
-
try {
|
| 677 |
-
console.log("Fetching companies...");
|
| 678 |
-
const response = await fetch(`/api/companydetails`);
|
| 679 |
-
const companies = await response.json();
|
| 680 |
-
console.log(companies); // Inspect the data here
|
| 681 |
-
|
| 682 |
-
if (!Array.isArray(companies)) {
|
| 683 |
-
throw new TypeError('Expected an array of companies');
|
| 684 |
-
}
|
| 685 |
-
|
| 686 |
-
const table = $('#companyTable').DataTable();
|
| 687 |
-
table.clear(); // Clear existing table data
|
| 688 |
-
|
| 689 |
-
companies.forEach((company, index) => {
|
| 690 |
-
table.row.add([
|
| 691 |
-
index + 1,
|
| 692 |
-
company.company_name,
|
| 693 |
-
company.company_code,
|
| 694 |
-
company.domain,
|
| 695 |
-
company.llm_tools, // Join array of tools into a string
|
| 696 |
-
`<a href='#' class='btn btn-info btn-sm'onclick='viewCompany(${company.company_id})'><i class='fas fa-eye'></i></a>`,
|
| 697 |
-
`<a href='#' class='btn btn-warning btn-sm'onclick='Editcompany(${company.company_id})'><i class='fas fa-edit'></i></a>`,
|
| 698 |
-
`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`
|
| 699 |
-
|
| 700 |
-
])
|
| 701 |
-
});table.draw(false);
|
| 702 |
-
} catch (error) {
|
| 703 |
-
console.error('Error fetching companies:', error);
|
| 704 |
-
}
|
| 705 |
-
}
|
| 706 |
-
function clearmodal() {
|
| 707 |
-
$('#companyForm')[0].reset(); // Reset all form fields
|
| 708 |
-
$('#llm_tools').val(null).trigger('change'); // Clear and reset the Select2 field without reinitializing
|
| 709 |
-
}
|
| 710 |
-
|
| 711 |
-
document.querySelectorAll('.dropdown-content a').forEach(function(item) {
|
| 712 |
-
item.addEventListener('click', function() {
|
| 713 |
-
const length = item.getAttribute('data-length');
|
| 714 |
-
// Set the DataTable page length
|
| 715 |
-
$('#companyTable').DataTable().page.len(parseInt(length)).draw();
|
| 716 |
-
document.querySelector('.dropdown-button').textContent = length;
|
| 717 |
-
});
|
| 718 |
-
});
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
</script>
|
| 722 |
-
</body>
|
| 723 |
-
|
| 724 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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4 |
-
<head>
|
| 5 |
-
<meta charset="UTF-8">
|
| 6 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
-
<title>Dashboard</title>
|
| 8 |
-
<!-- CSS -->
|
| 9 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 10 |
-
<link rel="stylesheet" type="text/css" href="../static/css/style.css" />
|
| 11 |
-
<link rel="stylesheet" type="text/css" href="../static/css/dashboard.css" />
|
| 12 |
-
<link rel="stylesheet" type="text/css" href="../static/css/perfect-scrollbar.css" />
|
| 13 |
-
<style>
|
| 14 |
-
.btn-primary {
|
| 15 |
-
background-color: #0d6efd;
|
| 16 |
-
border-radius:5px;
|
| 17 |
-
border-color: #0d6efd;
|
| 18 |
-
}
|
| 19 |
-
#sidebarToggle
|
| 20 |
-
{
|
| 21 |
-
border-radius:4px;
|
| 22 |
-
margin-left:250px;
|
| 23 |
-
}
|
| 24 |
-
.main-sidebar.toggled .menu-text {
|
| 25 |
-
display: none;
|
| 26 |
-
}
|
| 27 |
-
#selectedCompany.toggled .menu-text {
|
| 28 |
-
display: none;
|
| 29 |
-
}
|
| 30 |
-
.wrapper {
|
| 31 |
-
flex: 1;
|
| 32 |
-
padding: 10px;
|
| 33 |
-
margin-left: 300px; /* Default sidebar width */
|
| 34 |
-
transition: margin-left 0.3s ease;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
.main-header {
|
| 38 |
-
border-bottom: none;
|
| 39 |
-
border-top: none;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
.card {
|
| 43 |
-
margin-bottom: 15px;
|
| 44 |
-
border-radius: 8px;
|
| 45 |
-
overflow: hidden;
|
| 46 |
-
transition: background-color 0.3s ease;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
.card-body {
|
| 50 |
-
padding: 15px;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
.feature-icon {
|
| 54 |
-
display: inline-flex;
|
| 55 |
-
align-items: center;
|
| 56 |
-
justify-content: center;
|
| 57 |
-
width: 50px;
|
| 58 |
-
height: 50px;
|
| 59 |
-
background: rgba(255, 255, 255, 0.1);
|
| 60 |
-
border-radius: 50%;
|
| 61 |
-
}
|
| 62 |
-
.sidebarPanel
|
| 63 |
-
{
|
| 64 |
-
display:none;
|
| 65 |
-
}
|
| 66 |
-
.media-body {
|
| 67 |
-
text-align: right;
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
.fs-30 {
|
| 71 |
-
font-size: 1.875rem;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.fs-48 {
|
| 75 |
-
font-size: 3rem;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
/* Responsive Styles */
|
| 80 |
-
@media (max-width: 992px) {
|
| 81 |
-
.wrapper {
|
| 82 |
-
margin-left: 200px;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
.main-header {
|
| 86 |
-
padding: 15px;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
@media (max-width: 768px) {
|
| 92 |
-
.feature-icon {
|
| 93 |
-
width: 40px;
|
| 94 |
-
height: 40px;
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
.fs-30 {
|
| 98 |
-
font-size: 1.5rem;
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
.fs-48 {
|
| 102 |
-
font-size: 2.5rem;
|
| 103 |
-
}
|
| 104 |
-
}
|
| 105 |
-
</style>
|
| 106 |
-
</head>
|
| 107 |
-
|
| 108 |
-
<body>
|
| 109 |
-
{% set company_name = company_name %}
|
| 110 |
-
{% include 'sidepane.html' %}
|
| 111 |
-
|
| 112 |
-
<div class="wrapper">
|
| 113 |
-
<section class="main-header">
|
| 114 |
-
<div class="container-fluid">
|
| 115 |
-
<div id="company-block" class="form-group left-align" style="display: none;">
|
| 116 |
-
<label for="company" class="ml-3" style="display: inline-block; margin-right: 10px;">
|
| 117 |
-
Select the Company Name to view the details <span class="text-danger">*</span>
|
| 118 |
-
</label>
|
| 119 |
-
<select type="text" id="company" name="company" class="ml-3 form-control"
|
| 120 |
-
style="display: inline-block; width: 20%;" required>
|
| 121 |
-
<option value="" selected>Select</option>
|
| 122 |
-
</select>
|
| 123 |
-
</div>
|
| 124 |
-
|
| 125 |
-
<div class="row">
|
| 126 |
-
<div class="col-md-6">
|
| 127 |
-
<div class="card bg-primary">
|
| 128 |
-
<div class="card-body">
|
| 129 |
-
<div class="media align-items-center">
|
| 130 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 131 |
-
<img src="../static/logos/calendar-silhouette.svg" />
|
| 132 |
-
</span>
|
| 133 |
-
<div class="media-body">
|
| 134 |
-
<p class="fs-30 text-white mb-2">KnowledgeBase</p>
|
| 135 |
-
<span id="knowledgeBaseCount" class="fs-48 text-white font-w600">{{table_count_of_each_table.knowledge_base}}</span>
|
| 136 |
-
</div>
|
| 137 |
-
</div>
|
| 138 |
-
</div>
|
| 139 |
-
</div>
|
| 140 |
-
</div>
|
| 141 |
-
<div class="col-md-6">
|
| 142 |
-
<div class="card bg-info">
|
| 143 |
-
<div class="card-body">
|
| 144 |
-
<div class="media align-items-center">
|
| 145 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 146 |
-
<img src="../static/logos/calendar-silhouette.svg" />
|
| 147 |
-
</span>
|
| 148 |
-
<div class="media-body">
|
| 149 |
-
<p class="fs-30 text-white mb-2">Data connectors</p>
|
| 150 |
-
<span id="dataConnectorsCount" class="fs-48 text-white font-w600">{{table_count_of_each_table.data_connectors}}</span>
|
| 151 |
-
</div>
|
| 152 |
-
</div>
|
| 153 |
-
</div>
|
| 154 |
-
</div>
|
| 155 |
-
</div>
|
| 156 |
-
</div>
|
| 157 |
-
<div class="row">
|
| 158 |
-
<div class="col-md-6 ">
|
| 159 |
-
<div class="card bg-success">
|
| 160 |
-
<div class="card-body">
|
| 161 |
-
<div class="media align-items-center">
|
| 162 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 163 |
-
<img src="../static/logos/email.svg" />
|
| 164 |
-
</span>
|
| 165 |
-
<div class="media-body">
|
| 166 |
-
<p class="fs-30 text-white mb-2">API Connectors</p>
|
| 167 |
-
<span id="apiConnectorsCount" class="fs-48 text-white font-w600">{{table_count_of_each_table.api_connectors}}</span>
|
| 168 |
-
</div>
|
| 169 |
-
</div>
|
| 170 |
-
</div>
|
| 171 |
-
</div>
|
| 172 |
-
</div>
|
| 173 |
-
<div class="col-md-6 ">
|
| 174 |
-
<div class="card bg-secondary">
|
| 175 |
-
<div class="card-body">
|
| 176 |
-
<div class="media align-items-center">
|
| 177 |
-
<span class="p-3 mr-3 feature-icon rounded">
|
| 178 |
-
<img src="../static/logos/dots.svg" />
|
| 179 |
-
</span>
|
| 180 |
-
<div class="media-body">
|
| 181 |
-
<p class="fs-30 text-white mb-2">Prompt_Templates</p>
|
| 182 |
-
<span id="promptTemplatesCount" class="fs-48 text-white font-w600">{{table_count_of_each_table.prompt_templates}}</span>
|
| 183 |
-
</div>
|
| 184 |
-
</div>
|
| 185 |
-
</div>
|
| 186 |
-
</div>
|
| 187 |
-
</div>
|
| 188 |
-
</div>
|
| 189 |
-
</div>
|
| 190 |
-
</section>
|
| 191 |
-
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 192 |
-
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 193 |
-
<input type="hidden" id="username" name="username" value={{username}}>
|
| 194 |
-
<input type="hidden" id="company_name" name="company_name" value={{company_name}}>
|
| 195 |
-
|
| 196 |
-
</div>
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
{% include 'footer.html' %}
|
| 200 |
-
|
| 201 |
-
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/js/adminlte.min.js"></script>
|
| 202 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 203 |
-
<script>
|
| 204 |
-
document.getElementById("add").style.display = "none";
|
| 205 |
-
|
| 206 |
-
// function updateCompanyName(newCompanyName) {
|
| 207 |
-
// sessionStorage.setItem('company_name', newCompanyName);
|
| 208 |
-
// document.getElementById('selectedCompany').innerText = `Company name: ${newCompanyName}`;
|
| 209 |
-
// const sidePaneCompanyName = document.querySelector('.sidebar .company-name');
|
| 210 |
-
// if (sidePaneCompanyName) {
|
| 211 |
-
// sidePaneCompanyName.innerText = newCompanyName;
|
| 212 |
-
// }
|
| 213 |
-
// }
|
| 214 |
-
function updateSidepane(companyName) {
|
| 215 |
-
const sidepaneCompanyElement = document.getElementById('selectedCompany');
|
| 216 |
-
if (sidepaneCompanyElement) {
|
| 217 |
-
sidepaneCompanyElement.innerText = `Company Name: ${companyName}`;
|
| 218 |
-
}
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
window.addEventListener('pageshow', function (event) {
|
| 222 |
-
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
| 223 |
-
window.location.reload();
|
| 224 |
-
}
|
| 225 |
-
});
|
| 226 |
-
|
| 227 |
-
document.addEventListener('DOMContentLoaded', function () {
|
| 228 |
-
var role1 = document.getElementById("userRole").value;
|
| 229 |
-
var company_id1 = document.getElementById("company_id").value;
|
| 230 |
-
var company_name1=document.getElementById("company_name").value;
|
| 231 |
-
var username1=document.getElementById("username").value;
|
| 232 |
-
console.log("companyid in dasshboard",username1);
|
| 233 |
-
sessionStorage.setItem('userRole', role1);
|
| 234 |
-
// sessionStorage.setItem('siderole',role1);
|
| 235 |
-
// sessionStorage.setItem('sidecompanyId',company_id1);
|
| 236 |
-
sessionStorage.setItem('company_id', company_id1);
|
| 237 |
-
sessionStorage.setItem('company_name',company_name1);
|
| 238 |
-
sessionStorage.setItem('username',username1);
|
| 239 |
-
const companyName = sessionStorage.getItem('company_name');
|
| 240 |
-
if (companyName) {
|
| 241 |
-
|
| 242 |
-
updateSidepane(companyName);
|
| 243 |
-
}
|
| 244 |
-
else{
|
| 245 |
-
document.getElementById(selectedCompany).value="Select a company";
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
if (!role1) {
|
| 250 |
-
var roleFromInput = sessionStorage.getItem('userRole');
|
| 251 |
-
sessionStorage.setItem('userRole', roleFromInput);
|
| 252 |
-
console.log("Role set in sessionStorage:", roleFromInput);
|
| 253 |
-
} else {
|
| 254 |
-
sessionStorage.setItem('userRole', role1);
|
| 255 |
-
console.log("Retrieved user role from input:", role1); // Debugging
|
| 256 |
-
}
|
| 257 |
-
if (role1 === "superadmin") {
|
| 258 |
-
document.getElementById('company-block').style.display = 'block';
|
| 259 |
-
fetchCompanies();
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
});
|
| 263 |
-
document.getElementById('company').addEventListener('change', async function () {
|
| 264 |
-
const selectedCompany = this.value;
|
| 265 |
-
sessionStorage.setItem("company_name",selectedCompany);
|
| 266 |
-
// Update the sidepane immediately
|
| 267 |
-
updateSidepane(selectedCompany);
|
| 268 |
-
if (selectedCompany!== "Select") {
|
| 269 |
-
try {
|
| 270 |
-
const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompany)}`);
|
| 271 |
-
if (!response.ok) {
|
| 272 |
-
contentSection.style.display = 'none';
|
| 273 |
-
displayErrorMessage("Document details do not exist for this company. Please fill in the details.");
|
| 274 |
-
throw new Error('Network response was not ok');
|
| 275 |
-
}
|
| 276 |
-
const data = await response.json();
|
| 277 |
-
console.log('data returned', data);
|
| 278 |
-
const companyId = data.company_id;
|
| 279 |
-
sessionStorage.setItem("company_id",companyId);
|
| 280 |
-
console.log("company id for superadmin", company_id);
|
| 281 |
-
//document.getElementById('company_id').value = companyId;
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
if (companyId) {
|
| 285 |
-
try {
|
| 286 |
-
const countResponse = await fetch(`/api/company_record_count/${companyId}`);
|
| 287 |
-
if (!countResponse.ok) {
|
| 288 |
-
throw new Error('Network response was not ok');
|
| 289 |
-
}
|
| 290 |
-
const countData = await countResponse.json();
|
| 291 |
-
console.log('Count data:', countData); // Log the response data
|
| 292 |
-
updateRecordCounts(countData.table_counts);
|
| 293 |
-
} catch (error) {
|
| 294 |
-
console.error('Error fetching record counts:', error);
|
| 295 |
-
}
|
| 296 |
-
} else {
|
| 297 |
-
clearRecordCounts();
|
| 298 |
-
}
|
| 299 |
-
} catch (error) {
|
| 300 |
-
console.error('No details for this company ID or data documents:', error);
|
| 301 |
-
// displayEmptyTable();
|
| 302 |
-
|
| 303 |
-
displayErrorMessage("company details do not exist for this company.");
|
| 304 |
-
|
| 305 |
-
}
|
| 306 |
-
}
|
| 307 |
-
});
|
| 308 |
-
|
| 309 |
-
function updateRecordCounts(counts) {
|
| 310 |
-
// Update the counts displayed in the dashboard
|
| 311 |
-
document.getElementById('knowledgeBaseCount').textContent = counts.knowledge_base || 0;
|
| 312 |
-
document.getElementById('dataConnectorsCount').textContent = counts.data_connectors || 0;
|
| 313 |
-
document.getElementById('apiConnectorsCount').textContent = counts.api_connectors || 0;
|
| 314 |
-
document.getElementById('promptTemplatesCount').textContent = counts.prompt_templates || 0;
|
| 315 |
-
}
|
| 316 |
-
|
| 317 |
-
function clearRecordCounts() {
|
| 318 |
-
document.getElementById('knowledgeBaseCount').textContent = 0;
|
| 319 |
-
document.getElementById('dataConnectorsCount').textContent = 0;
|
| 320 |
-
document.getElementById('apiConnectorsCount').textContent = 0;
|
| 321 |
-
document.getElementById('promptTemplatesCount').textContent = 0;
|
| 322 |
-
}
|
| 323 |
-
|
| 324 |
-
async function fetchCompanies() {
|
| 325 |
-
try {
|
| 326 |
-
const response = await fetch('/api/companies');
|
| 327 |
-
if (!response.ok) {
|
| 328 |
-
throw new Error('Network response was not ok');
|
| 329 |
-
}
|
| 330 |
-
const data = await response.json();
|
| 331 |
-
displayCompanies(data.companies);
|
| 332 |
-
} catch (error) {
|
| 333 |
-
console.error('Error fetching companies:', error);
|
| 334 |
-
}
|
| 335 |
-
}
|
| 336 |
-
|
| 337 |
-
function displayCompanies(companies) {
|
| 338 |
-
const companySelect = document.getElementById('company');
|
| 339 |
-
companySelect.innerHTML = '<option value="" selected>Select</option>'; // Reset the dropdown
|
| 340 |
-
companies.forEach(company => {
|
| 341 |
-
const option = document.createElement('option');
|
| 342 |
-
option.value = company.name;
|
| 343 |
-
option.textContent = company.name;
|
| 344 |
-
companySelect.appendChild(option);
|
| 345 |
-
});
|
| 346 |
-
}
|
| 347 |
-
function clearFormFields() {
|
| 348 |
-
document.getElementById('APIName').value = "";
|
| 349 |
-
document.getElementById('APIEndpoint').value = "";
|
| 350 |
-
document.getElementById('Auth_Bearer').value = "";
|
| 351 |
-
document.getElementById('Inputjson').value = "";
|
| 352 |
-
document.getElementById('OutputJson').value = "";
|
| 353 |
-
document.getElementById('Description').value = "";
|
| 354 |
-
}
|
| 355 |
-
|
| 356 |
-
</script>
|
| 357 |
-
</body>
|
| 358 |
-
|
| 359 |
-
</html>
|
| 360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/data_connectors.html
DELETED
|
@@ -1,624 +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>Data Connectors</title>
|
| 8 |
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 9 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 10 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/css/adminlte.min.css">
|
| 11 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
|
| 12 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 13 |
-
|
| 14 |
-
<style>
|
| 15 |
-
#add{
|
| 16 |
-
display: none ;
|
| 17 |
-
}
|
| 18 |
-
html,
|
| 19 |
-
body {
|
| 20 |
-
height: 90%;
|
| 21 |
-
margin: 0;
|
| 22 |
-
display: flex;
|
| 23 |
-
flex-direction: column;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
body {
|
| 27 |
-
display: inline-flex;
|
| 28 |
-
flex-direction: column;
|
| 29 |
-
min-height: 90%;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
.main-content {
|
| 33 |
-
flex: 1;
|
| 34 |
-
display: inline-flex;
|
| 35 |
-
flex-direction: column;
|
| 36 |
-
align-items: center;
|
| 37 |
-
justify-content: flex-start;
|
| 38 |
-
padding: 30px;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
/* .container {
|
| 42 |
-
margin-top: 50px;
|
| 43 |
-
margin-left: 320px;
|
| 44 |
-
max-width: 800px;
|
| 45 |
-
padding: 10px;
|
| 46 |
-
border: 1px solid #ccc;
|
| 47 |
-
border-radius: 5px;
|
| 48 |
-
background-color: #fff;
|
| 49 |
-
position: relative;
|
| 50 |
-
z-index: 1;
|
| 51 |
-
} */
|
| 52 |
-
|
| 53 |
-
.form-group {
|
| 54 |
-
margin-bottom: 20px;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
.form-group label {
|
| 58 |
-
font-weight: bold;
|
| 59 |
-
margin-top: -10px;
|
| 60 |
-
margin-left:-22px;
|
| 61 |
-
display: block;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
.form-group input,
|
| 65 |
-
.form-group select,
|
| 66 |
-
.form-group textarea {
|
| 67 |
-
width: 90%;
|
| 68 |
-
margin-left:-22px;
|
| 69 |
-
padding: 2px;
|
| 70 |
-
border: 1px solid #ccc;
|
| 71 |
-
border-radius: 4px;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
.btn-primary {
|
| 75 |
-
margin-right: 10px;
|
| 76 |
-
color: white;
|
| 77 |
-
font-size: 16px;
|
| 78 |
-
font-weight: bold;
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
/* .btn-container {
|
| 82 |
-
text-align: center;
|
| 83 |
-
margin-top: 20px;
|
| 84 |
-
margin-bottom: 10px;
|
| 85 |
-
} */
|
| 86 |
-
.btn-primary {
|
| 87 |
-
margin-right: 10px;
|
| 88 |
-
color: white;
|
| 89 |
-
font-size: 16px;
|
| 90 |
-
font-weight: bold;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
.btn-container {
|
| 95 |
-
text-align: center;
|
| 96 |
-
margin-top: 30px;
|
| 97 |
-
margin-left: 20px;
|
| 98 |
-
margin-right: 0px;
|
| 99 |
-
margin-bottom: 10px;
|
| 100 |
-
/* color: white; */
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
.btn-container1 {
|
| 104 |
-
text-align: center;
|
| 105 |
-
margin-top: 50px;
|
| 106 |
-
margin-left: 30px;
|
| 107 |
-
margin-right: 30px;
|
| 108 |
-
margin-bottom: 10px;
|
| 109 |
-
color: white;
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
/* #selectedTables,
|
| 113 |
-
#labelselected {
|
| 114 |
-
display: none;
|
| 115 |
-
} */
|
| 116 |
-
.btn-primary:focus,
|
| 117 |
-
.btn-primary:active {
|
| 118 |
-
color: white;
|
| 119 |
-
background-color: #007bff;
|
| 120 |
-
border-color: #007bff;
|
| 121 |
-
box-shadow: none;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
#saveBtn1 {
|
| 125 |
-
|
| 126 |
-
margin: 0 auto;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
/* footer {
|
| 130 |
-
position: relative;
|
| 131 |
-
margin-top: auto;
|
| 132 |
-
width: 100%;
|
| 133 |
-
color: black;
|
| 134 |
-
text-align: right;
|
| 135 |
-
padding-right: 245px;
|
| 136 |
-
padding-top: 20px;
|
| 137 |
-
background-color: #f8f9fa;
|
| 138 |
-
border: none !important;
|
| 139 |
-
}
|
| 140 |
-
*/
|
| 141 |
-
.small-select {
|
| 142 |
-
margin-top: 5px;
|
| 143 |
-
width: 200px;
|
| 144 |
-
/* Adjust the width as needed */
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
.custom-dropdown {
|
| 148 |
-
width: 250px;
|
| 149 |
-
/* Adjust the width as needed */
|
| 150 |
-
}
|
| 151 |
-
/* Ensure the new row aligns with the previous row */
|
| 152 |
-
#schema-table-section {
|
| 153 |
-
|
| 154 |
-
margin-left: -20px; /* Adjust this if you need spacing between rows */
|
| 155 |
-
padding-top: 5px; /* Adjust padding if needed */
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
.alert {
|
| 159 |
-
position: relative;
|
| 160 |
-
padding: 15px;
|
| 161 |
-
margin-bottom: 20px;
|
| 162 |
-
border: 1px solid transparent;
|
| 163 |
-
border-radius: 4px;
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
.alert-success {
|
| 167 |
-
color: #3c763d;
|
| 168 |
-
background-color: #dff0d8;
|
| 169 |
-
border-color: #d6e9c6;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
.alert-danger {
|
| 173 |
-
color: #a94442;
|
| 174 |
-
background-color: #f2dede;
|
| 175 |
-
border-color: #ebccd1;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
.close {
|
| 179 |
-
position: absolute;
|
| 180 |
-
bottom: 10px;
|
| 181 |
-
right: 10px;
|
| 182 |
-
border: none;
|
| 183 |
-
background: none;
|
| 184 |
-
font-size: 16px;
|
| 185 |
-
cursor: pointer;
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
</style>
|
| 190 |
-
</head>
|
| 191 |
-
|
| 192 |
-
<body>
|
| 193 |
-
{% include 'sidepane.html' %}
|
| 194 |
-
<div class="wrapper">
|
| 195 |
-
<div class="main-header" style="border-bottom: none;">
|
| 196 |
-
<!-- Content Header (Page header) -->
|
| 197 |
-
<div class="content-header">
|
| 198 |
-
<div class="container-fluid">
|
| 199 |
-
<div class="container mt-2">
|
| 200 |
-
<!-- <div class="form-group left-align">
|
| 201 |
-
<label for="company" class="mr-1" style="margin-left:-60px;margin-top:-1px;">Company Name <span class="text-danger">*</span></label>
|
| 202 |
-
<select type="text" id="company" name="company" class="form-control "style="width: 20%;margin-left:-60px;margin-bottom:-35px" required>
|
| 203 |
-
<option value="" selected>Select</option>
|
| 204 |
-
</select>
|
| 205 |
-
</div> -->
|
| 206 |
-
<div class="row">
|
| 207 |
-
<div id="message-container" style="padding:10px 10px;margin-left: 150px;width:500px;margin-bottom:-20px; margin-top: -30px;"></div>
|
| 208 |
-
</div>
|
| 209 |
-
</div>
|
| 210 |
-
</div>
|
| 211 |
-
</div>
|
| 212 |
-
|
| 213 |
-
<form id="databaseconnectorForm" class="needs-validation" novalidate action="/save_data_connectors"
|
| 214 |
-
method="post" >
|
| 215 |
-
<div class="form-group">
|
| 216 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 217 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 218 |
-
</div>
|
| 219 |
-
<h4 id="selectedCompany" style="margin-left: 300px;margin-bottom: 50px;margin-top: -50px;"></h4>
|
| 220 |
-
<div class="row">
|
| 221 |
-
<div class="col-md-3">
|
| 222 |
-
<div class="form-group">
|
| 223 |
-
<label for="database">Database Type<span class="text-danger">*</span></label>
|
| 224 |
-
<select type="text" id="database" name="database" class="form-control" required>
|
| 225 |
-
<option value="" selected>Select</option>
|
| 226 |
-
<option value="Postgres">Postgres</option>
|
| 227 |
-
<option value="mysql">mysql</option>
|
| 228 |
-
</select>
|
| 229 |
-
</div>
|
| 230 |
-
</div>
|
| 231 |
-
<div class="col-md-3">
|
| 232 |
-
<div class="form-group">
|
| 233 |
-
<label for="server">Server IP <span class="text-danger">*</span></label>
|
| 234 |
-
<input type="text" id="server" name="server" class="form-control" required>
|
| 235 |
-
</div>
|
| 236 |
-
</div>
|
| 237 |
-
<div class="col-md-3">
|
| 238 |
-
<div class="form-group">
|
| 239 |
-
<label for="port">Port <span class="text-danger">*</span></label>
|
| 240 |
-
<input type="text" id="port" name="port" class="form-control" required>
|
| 241 |
-
</div>
|
| 242 |
-
</div>
|
| 243 |
-
<div class="col-md-3">
|
| 244 |
-
<div class="form-group">
|
| 245 |
-
<label for="databaseName">Database Name <span class="text-danger">*</span></label>
|
| 246 |
-
<input type="text" id="databaseName" name="databaseName" class="form-control" required>
|
| 247 |
-
</div>
|
| 248 |
-
</div>
|
| 249 |
-
</div>
|
| 250 |
-
<div class="row">
|
| 251 |
-
<div class="col-md-3">
|
| 252 |
-
<div class="form-group">
|
| 253 |
-
<label for="userame">UserName <span class="text-danger">*</span></label>
|
| 254 |
-
<input type="text" id="username" name="username" class="form-control" required>
|
| 255 |
-
</div>
|
| 256 |
-
</div>
|
| 257 |
-
<div class="col-md-3">
|
| 258 |
-
<div class="form-group">
|
| 259 |
-
<label for="password">Password <span class="text-danger">*</span></label>
|
| 260 |
-
<input type="password" id="password" name="password" class="form-control" required>
|
| 261 |
-
</div>
|
| 262 |
-
</div>
|
| 263 |
-
|
| 264 |
-
<div class="col-md-6">
|
| 265 |
-
<div class="form-group d-flex justify-content-between">
|
| 266 |
-
<div class="form-group btn-container">
|
| 267 |
-
<button type="button" id="connectBtn" class="btn btn-primary">Connect</button>
|
| 268 |
-
<button type="reset" class="btn btn-primary">Clear</button>
|
| 269 |
-
</div>
|
| 270 |
-
</div>
|
| 271 |
-
</div>
|
| 272 |
-
</div>
|
| 273 |
-
|
| 274 |
-
<div id="schema-table-section" style="display: none;">
|
| 275 |
-
<div class="row">
|
| 276 |
-
<div class="col-md-3">
|
| 277 |
-
<div class="form-group1">
|
| 278 |
-
<label for="schemas">Select Schemas <span class="text-danger">*</span></label>
|
| 279 |
-
<select type="text" id="schemas" name="schemas" class="form-control" required>
|
| 280 |
-
<option value="" selected>Select</option>
|
| 281 |
-
<option value="schema1">Lookup</option>
|
| 282 |
-
<option value="schema2">Public</option>
|
| 283 |
-
<option value="schema3" selected>tenant_default</option>
|
| 284 |
-
</select>
|
| 285 |
-
</div>
|
| 286 |
-
</div>
|
| 287 |
-
|
| 288 |
-
<div class="col-md-3">
|
| 289 |
-
<div class="form-group1">
|
| 290 |
-
<label for="tableschema" style="margin-left: 30px;margin-right: 30px;">Select Tables <span
|
| 291 |
-
class="text-danger">*</span></label>
|
| 292 |
-
<div class="dropdown custom-dropdown">
|
| 293 |
-
<button class="btn btn-secondary dropdown-toggle"
|
| 294 |
-
style="margin-left: 30px;margin-right: 0px;" type="button" id="tablesDropdown"
|
| 295 |
-
data-bs-toggle="dropdown" aria-expanded="false">
|
| 296 |
-
Select Tables
|
| 297 |
-
</button>
|
| 298 |
-
<ul class="dropdown-menu" aria-labelledby="tablesDropdown">
|
| 299 |
-
<li>
|
| 300 |
-
<select type="text" id="tableschema" name="tableschema" class="form-control"
|
| 301 |
-
multiple required>
|
| 302 |
-
<option value="customer_master">customer_master</option>
|
| 303 |
-
<option value="efs_company_master">efs_company_master</option>
|
| 304 |
-
<option value="efs_group_company_master">efs_group_company_master</option>
|
| 305 |
-
<option value="efs_region_master">efs_region_master</option>
|
| 306 |
-
<option value="party_address_detail">party_address_detail</option>
|
| 307 |
-
<option value="wms_warehouse_master">wms_warehouse_master</option>
|
| 308 |
-
</select>
|
| 309 |
-
</li>
|
| 310 |
-
</ul>
|
| 311 |
-
</div>
|
| 312 |
-
</div>
|
| 313 |
-
</div>
|
| 314 |
-
<!-- <div class="col-md-3">
|
| 315 |
-
<div class="btn-container1">
|
| 316 |
-
<button type="button" id="saveBtn" class="btn btn-primary">Save</button>
|
| 317 |
-
</div>
|
| 318 |
-
</div>
|
| 319 |
-
</div>
|
| 320 |
-
<div class="row">-->
|
| 321 |
-
<div class="col-md-3">
|
| 322 |
-
<div class="form-group1">
|
| 323 |
-
<label for="selectedTables" id="labelselected">Selected Tables</label>
|
| 324 |
-
<textarea type="text" id="selectedTables" name="selectedTables" class="form-control"
|
| 325 |
-
rows="4" readonly></textarea>
|
| 326 |
-
</div>
|
| 327 |
-
</div>
|
| 328 |
-
|
| 329 |
-
<div class="col-md-3">
|
| 330 |
-
<div class="form-group">
|
| 331 |
-
<div class="btn-container1">
|
| 332 |
-
<button type="submit" id="saveBtn" class="btn btn-primary">Save</button>
|
| 333 |
-
</div>
|
| 334 |
-
</div>
|
| 335 |
-
</div>
|
| 336 |
-
</div>
|
| 337 |
-
</div>
|
| 338 |
-
</form>
|
| 339 |
-
</div>
|
| 340 |
-
</div>
|
| 341 |
-
</div>
|
| 342 |
-
<footer class="footer">
|
| 343 |
-
{%include 'footer.html'%}
|
| 344 |
-
</footer>
|
| 345 |
-
<script>
|
| 346 |
-
|
| 347 |
-
document.addEventListener('DOMContentLoaded', function () {
|
| 348 |
-
// fetchCompanies();
|
| 349 |
-
// const companySelect = document.getElementById('company');
|
| 350 |
-
// const databaseconnectorForm = document.getElementById('databaseconnectorForm');
|
| 351 |
-
// database.addEventListener('change', async function () {
|
| 352 |
-
// $("#message-container").empty();
|
| 353 |
-
// });
|
| 354 |
-
// companySelect.addEventListener('change', async function () {
|
| 355 |
-
// $("#message-container").empty();
|
| 356 |
-
// const selectedCompanyName = companySelect.options[companySelect.selectedIndex].text;
|
| 357 |
-
// console.log(`Selected Company Name: ${selectedCompanyName}`);
|
| 358 |
-
|
| 359 |
-
// if (selectedCompanyName !== "Select") {
|
| 360 |
-
// $("#schema-table-section").hide();
|
| 361 |
-
// try {
|
| 362 |
-
// const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompanyName)}`);
|
| 363 |
-
// if (!response.ok) {
|
| 364 |
-
// throw new Error('Network response was not ok');
|
| 365 |
-
// }
|
| 366 |
-
// const data = await response.json();
|
| 367 |
-
// console.log(`Company ID: ${data.company_id}`);
|
| 368 |
-
// const companyId = data.company_id;
|
| 369 |
-
// document.getElementById('company_id').value = companyId;
|
| 370 |
-
var table = $('#databaseconnecorsform').show();
|
| 371 |
-
const role = sessionStorage.getItem('userRole');
|
| 372 |
-
const passedCompanyName=sessionStorage.getItem('company_name')
|
| 373 |
-
document.getElementById('selectedCompany').innerText = `Company Name: ${passedCompanyName}`;
|
| 374 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 375 |
-
const storecompany_id=sessionStorage.getItem('company_id');
|
| 376 |
-
document.getElementById("company_id").value=storecompany_id;
|
| 377 |
-
|
| 378 |
-
data_get_from_db(storecompany_id,passedCompanyName);
|
| 379 |
-
});
|
| 380 |
-
async function data_get_from_db(storecompany_id,selectedCompanyName) {
|
| 381 |
-
|
| 382 |
-
if (storecompany_id) {
|
| 383 |
-
try {
|
| 384 |
-
const connectorsResponse = await fetch(`/api/check_data_connectors?company_id=${storecompany_id}&company_name=${selectedCompanyName}`);
|
| 385 |
-
if (!connectorsResponse.ok) {
|
| 386 |
-
throw new Error('data connector Network response was not ok');
|
| 387 |
-
}
|
| 388 |
-
const connectorsData = await connectorsResponse.json();
|
| 389 |
-
//setMultiSelectValues(document.getElementById('database'), connectorsData.databasetype); // Ensure this is an array
|
| 390 |
-
//setMultiSelectValues(document.getElementById('databaseName'), connectorsData.database_name); // Ensure this is an array
|
| 391 |
-
document.getElementById('database').value = connectorsData.databasetype;
|
| 392 |
-
document.getElementById('server').value=connectorsData.serverip; // document.getElementById('server').value = connectorsData.serverip;
|
| 393 |
-
document.getElementById('port').value = connectorsData.port;
|
| 394 |
-
document.getElementById('databaseName').value = connectorsData.database_name;
|
| 395 |
-
document.getElementById('username').value = connectorsData.username;
|
| 396 |
-
document.getElementById('password').value = connectorsData.password;
|
| 397 |
-
document.getElementById('selectedTables').value = connectorsData.dbtablename;
|
| 398 |
-
databaseconnectorForm.style.display = 'block';
|
| 399 |
-
|
| 400 |
-
} catch (error) {
|
| 401 |
-
document.getElementById('database').value = " ";
|
| 402 |
-
document.getElementById('server').value = " ";
|
| 403 |
-
document.getElementById('port').value = " ";
|
| 404 |
-
document.getElementById('databaseName').value = " ";
|
| 405 |
-
document.getElementById('username').value = " ";
|
| 406 |
-
document.getElementById('password').value = "";
|
| 407 |
-
document.getElementById('selectedTables').value = " ";
|
| 408 |
-
console.error('Error fetching data from data connectors:', error);
|
| 409 |
-
("Company name does not exist. Please fill in the details.");
|
| 410 |
-
|
| 411 |
-
// Optionally, you can insert a message into the DOM
|
| 412 |
-
const messageContainer = document.getElementById('message-container');
|
| 413 |
-
if (messageContainer) {
|
| 414 |
-
messageContainer.innerHTML = "<div class='alert alert-danger'>Database details does not exist for this Company name.. Please fill in the details.</div>";
|
| 415 |
-
}
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
databaseconnectorForm.style.display = 'block';
|
| 419 |
-
}
|
| 420 |
-
} else {
|
| 421 |
-
console.log(`Company ID does not exist, you can create and save data: ${data.company_id}`);
|
| 422 |
-
databaseconnectorForm.style.display = 'none';
|
| 423 |
-
}
|
| 424 |
-
}
|
| 425 |
-
|
| 426 |
-
// } catch (error) {
|
| 427 |
-
|
| 428 |
-
// console.error('Error fetching company ID or data connectors:', error);
|
| 429 |
-
// databaseconnectorForm.style.display = 'none';
|
| 430 |
-
// }
|
| 431 |
-
// } else {
|
| 432 |
-
// databaseconnectorForm.style.display = 'none';
|
| 433 |
-
// }
|
| 434 |
-
// });
|
| 435 |
-
|
| 436 |
-
// document.getElementById("connectBtn").addEventListener("click", function (event) {
|
| 437 |
-
// var database = document.getElementById("database").value;
|
| 438 |
-
// var server = document.getElementById("server").value;
|
| 439 |
-
// var port = document.getElementById("port").value;
|
| 440 |
-
// var databaseName = document.getElementById("databaseName").value;
|
| 441 |
-
// var username = document.getElementById("username").value;
|
| 442 |
-
// var password = document.getElementById("password").value;
|
| 443 |
-
|
| 444 |
-
// if (!database || !server || !port || !databaseName || !username || !password) {
|
| 445 |
-
// alert("Please fill in all required fields.");
|
| 446 |
-
// return;
|
| 447 |
-
// }
|
| 448 |
-
|
| 449 |
-
// document.getElementById("schema-table-section").style.display = "block";
|
| 450 |
-
// });
|
| 451 |
-
$("#tableschema").change(function () {
|
| 452 |
-
var selectedTables = $(this).val();
|
| 453 |
-
var currentText = $("#selectedTables").val();
|
| 454 |
-
selectedTables.forEach(function (table) {
|
| 455 |
-
if (!currentText.includes(table)) {
|
| 456 |
-
if (currentText.length > 1) {
|
| 457 |
-
currentText += ", " + table;
|
| 458 |
-
} else {
|
| 459 |
-
currentText = table;
|
| 460 |
-
}
|
| 461 |
-
}
|
| 462 |
-
});
|
| 463 |
-
$("#selectedTables").val(currentText);
|
| 464 |
-
});
|
| 465 |
-
document.getElementById("connectBtn").addEventListener("click", function (event) {
|
| 466 |
-
var database = document.getElementById("database").value;
|
| 467 |
-
var server = document.getElementById("server").value;
|
| 468 |
-
var port = document.getElementById("port").value;
|
| 469 |
-
var databaseName = document.getElementById("databaseName").value;
|
| 470 |
-
var username = document.getElementById("username").value;
|
| 471 |
-
var password = document.getElementById("password").value || "";
|
| 472 |
-
|
| 473 |
-
if (!database || !server || !port || !databaseName || !username) {
|
| 474 |
-
alert("Please fill in all required fields.");
|
| 475 |
-
return;
|
| 476 |
-
}
|
| 477 |
-
// document.getElementById("schema-table-section").style.display = "block";
|
| 478 |
-
fetch("/api/connect", {
|
| 479 |
-
method: "POST",
|
| 480 |
-
headers: {
|
| 481 |
-
"Content-Type": "application/json"
|
| 482 |
-
},
|
| 483 |
-
body: JSON.stringify({
|
| 484 |
-
database_type: database,
|
| 485 |
-
server: server,
|
| 486 |
-
port: port,
|
| 487 |
-
databaseName: databaseName,
|
| 488 |
-
username: username,
|
| 489 |
-
password: password
|
| 490 |
-
})
|
| 491 |
-
})
|
| 492 |
-
.then(response => response.json())
|
| 493 |
-
.then(data => {
|
| 494 |
-
if (data.success) {
|
| 495 |
-
document.getElementById("schema-table-section").style.display = "block";
|
| 496 |
-
populateSchemaDropdown(data.schemas);
|
| 497 |
-
// Set default selection for tables
|
| 498 |
-
if (data.schemas.length > 0) {
|
| 499 |
-
updateTablesDropdown(data.schema_tables, data.schemas[0]);
|
| 500 |
-
schemas.addEventListener("change", function (event) {
|
| 501 |
-
var selectedSchema = event.target.value;
|
| 502 |
-
updateTablesDropdown(data.schema_tables, selectedSchema);
|
| 503 |
-
});
|
| 504 |
-
}
|
| 505 |
-
} else {
|
| 506 |
-
alert("Failed to connect to the database. Please check your credentials.");
|
| 507 |
-
document.getElementById("schema-table-section").style.display = "none";
|
| 508 |
-
}
|
| 509 |
-
})
|
| 510 |
-
.catch(error => {
|
| 511 |
-
console.error("Error:", error);
|
| 512 |
-
alert("An error occurred while connecting to the database.");
|
| 513 |
-
});
|
| 514 |
-
});
|
| 515 |
-
|
| 516 |
-
function populateSchemaDropdown(schemas) {
|
| 517 |
-
var schemaSelect = document.getElementById("schemas");
|
| 518 |
-
schemaSelect.innerHTML = ""; // Clear any existing options
|
| 519 |
-
|
| 520 |
-
schemas.forEach(function (schema) {
|
| 521 |
-
var option = document.createElement("option");
|
| 522 |
-
option.value = schema;
|
| 523 |
-
option.textContent = schema;
|
| 524 |
-
schemaSelect.appendChild(option);
|
| 525 |
-
});
|
| 526 |
-
|
| 527 |
-
}
|
| 528 |
-
|
| 529 |
-
function updateTablesDropdown(schemaTables, selectedSchema) {
|
| 530 |
-
var tableSchemaSelect = document.getElementById("tableschema");
|
| 531 |
-
tableSchemaSelect.innerHTML = ""; // Clear any existing options
|
| 532 |
-
|
| 533 |
-
if (schemaTables[selectedSchema]) {
|
| 534 |
-
schemaTables[selectedSchema].forEach(function (table) {
|
| 535 |
-
var option = document.createElement("option");
|
| 536 |
-
option.value = table;
|
| 537 |
-
option.textContent = table;
|
| 538 |
-
tableSchemaSelect.appendChild(option);
|
| 539 |
-
});
|
| 540 |
-
}
|
| 541 |
-
}
|
| 542 |
-
|
| 543 |
-
document.getElementById("saveBtn").addEventListener("click", async function (event) {
|
| 544 |
-
event.preventDefault(); // Prevent the default form submission
|
| 545 |
-
|
| 546 |
-
// Set the password value
|
| 547 |
-
//document.getElementById("password").value = "root";
|
| 548 |
-
|
| 549 |
-
const form = document.getElementById('databaseconnectorForm');
|
| 550 |
-
const formData = new FormData(form);
|
| 551 |
-
formData.append("company_id", document.getElementById('company_id').value);
|
| 552 |
-
try {
|
| 553 |
-
console.log("inside save",formData);
|
| 554 |
-
console.log("comaonyid", document.getElementById('company_id').value);
|
| 555 |
-
for (const [key, value] of formData.entries()) {
|
| 556 |
-
console.log(`${key}: ${value}`);
|
| 557 |
-
}
|
| 558 |
-
const response = await fetch(form.action, {
|
| 559 |
-
method: "POST",
|
| 560 |
-
body: formData
|
| 561 |
-
});
|
| 562 |
-
|
| 563 |
-
if (!response.ok) {
|
| 564 |
-
throw new Error('Network response was not ok');
|
| 565 |
-
}
|
| 566 |
-
|
| 567 |
-
const data = await response.json();
|
| 568 |
-
|
| 569 |
-
console.log("result", response);
|
| 570 |
-
|
| 571 |
-
const messageContainer = document.getElementById('message-container');
|
| 572 |
-
if (data.created) {
|
| 573 |
-
if (messageContainer) {
|
| 574 |
-
const messageType = data.created ? 'alert-success' : 'alert-danger';
|
| 575 |
-
messageContainer.innerHTML = `
|
| 576 |
-
<div class='alert ${messageType}'>
|
| 577 |
-
${data.msg}
|
| 578 |
-
<button class='close'style='font-size:medium;margin-top:6px;'onclick='dismissMessage()'>OK</button>
|
| 579 |
-
</div>`;
|
| 580 |
-
}
|
| 581 |
-
}
|
| 582 |
-
|
| 583 |
-
} catch (error) {
|
| 584 |
-
console.error('Error saving data:', error);
|
| 585 |
-
const messageContainer = document.getElementById('message-container');
|
| 586 |
-
if (messageContainer) {
|
| 587 |
-
messageContainer.innerHTML = `
|
| 588 |
-
<div class='alert alert-danger'>
|
| 589 |
-
An error occurred while saving data in database.
|
| 590 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 591 |
-
</div>`;
|
| 592 |
-
}
|
| 593 |
-
}
|
| 594 |
-
});
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
function dismissMessage() {
|
| 598 |
-
const messageContainer = document.getElementById('message-container');
|
| 599 |
-
if (messageContainer) {
|
| 600 |
-
messageContainer.innerHTML = '';
|
| 601 |
-
}
|
| 602 |
-
}
|
| 603 |
-
function handleError() {
|
| 604 |
-
document.getElementById('database').value = " ";
|
| 605 |
-
document.getElementById('server').value = " ";
|
| 606 |
-
document.getElementById('port').value = " ";
|
| 607 |
-
document.getElementById('databaseName').value = " ";
|
| 608 |
-
document.getElementById('username').value = " ";
|
| 609 |
-
document.getElementById('password').value = " ";
|
| 610 |
-
}
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
function setMultiSelectValues(selectElement, values) {
|
| 614 |
-
// Ensure values is an array
|
| 615 |
-
if (!Array.isArray(values)) {
|
| 616 |
-
values = [values];
|
| 617 |
-
}
|
| 618 |
-
Array.from(selectElement.options).forEach(option => {
|
| 619 |
-
option.selected = values.includes(option.value);
|
| 620 |
-
});
|
| 621 |
-
}
|
| 622 |
-
</script>
|
| 623 |
-
</body>
|
| 624 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/footer.html
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
<!-- footer.html -->
|
| 2 |
-
|
| 3 |
-
<!--
|
| 4 |
-
This is the HTML code for the footer section of a web page.
|
| 5 |
-
It displays the version number and copyright information.
|
| 6 |
-
|
| 7 |
-
HTML Structure:
|
| 8 |
-
- The footer element has a class of "main-footer".
|
| 9 |
-
- Inside the footer, there is a div element with classes "float-right" and "d-none d-sm-block".
|
| 10 |
-
- Inside the div, there is a bold tag (<b>) displaying the version number.
|
| 11 |
-
- After the div, there is a strong tag (<strong>) displaying the copyright information.
|
| 12 |
-
- The copyright information includes the year and a link to the company's website.
|
| 13 |
-
|
| 14 |
-
Example Usage:
|
| 15 |
-
<footer class="main-footer">
|
| 16 |
-
<div class="float-right d-none d-sm-block">
|
| 17 |
-
<b>Version</b> 3.0.5
|
| 18 |
-
</div>
|
| 19 |
-
<strong>© 2023 <a href="https://yourcompany.com">Your Company</a>.</strong> All rights reserved.
|
| 20 |
-
</footer>
|
| 21 |
-
|
| 22 |
-
<footer class="main-footer" style="position: absolute; bottom: 0; width: 100%; color: black; text-align: right; padding-right:245px ;">
|
| 23 |
-
<div class="container-fluid">
|
| 24 |
-
<a href="https://redmindtechnologies.com" target="_blank" style="color: black; text-decoration: none;">Visit Redmind Technologies at https://redmindtechnologies.com</a>
|
| 25 |
-
</div>
|
| 26 |
-
</footer>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/index.html
DELETED
|
@@ -1,359 +0,0 @@
|
|
| 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">
|
| 6 |
-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
| 7 |
-
<title>Sign In/Up Form</title>
|
| 8 |
-
<!-- Google Font -->
|
| 9 |
-
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,800" rel="stylesheet">
|
| 10 |
-
<!-- Font Awesome -->
|
| 11 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
| 12 |
-
<style>
|
| 13 |
-
* {
|
| 14 |
-
box-sizing: border-box;
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
body {
|
| 18 |
-
background: #f6f5f7;
|
| 19 |
-
display: flex;
|
| 20 |
-
justify-content: center;
|
| 21 |
-
align-items: center;
|
| 22 |
-
flex-direction: column;
|
| 23 |
-
font-family: 'Montserrat', sans-serif;
|
| 24 |
-
height: 100vh;
|
| 25 |
-
margin: -20px 0 50px;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
h1 {
|
| 29 |
-
font-weight: bold;
|
| 30 |
-
margin: 0;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
h2 {
|
| 34 |
-
text-align: center;
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
p {
|
| 38 |
-
font-size: 14px;
|
| 39 |
-
font-weight: 100;
|
| 40 |
-
line-height: 20px;
|
| 41 |
-
letter-spacing: 0.5px;
|
| 42 |
-
margin: 20px 0 30px;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
span {
|
| 46 |
-
font-size: 12px;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
a {
|
| 50 |
-
color: #333;
|
| 51 |
-
font-size: 14px;
|
| 52 |
-
text-decoration: none;
|
| 53 |
-
margin: 15px 0;
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
button {
|
| 57 |
-
border-radius: 20px;
|
| 58 |
-
border: 1px solid #1c6bae;
|
| 59 |
-
background-color: #1c6bae;
|
| 60 |
-
color: #FFFFFF;
|
| 61 |
-
font-size: 12px;
|
| 62 |
-
font-weight: bold;
|
| 63 |
-
padding: 12px 45px;
|
| 64 |
-
margin-top: 30px;
|
| 65 |
-
letter-spacing: 1px;
|
| 66 |
-
text-transform: uppercase;
|
| 67 |
-
transition: transform 80ms ease-in;
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
button:active {
|
| 71 |
-
transform: scale(0.95);
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
button:focus {
|
| 75 |
-
outline: none;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
button.ghost {
|
| 79 |
-
background-color: transparent;
|
| 80 |
-
border-color: #FFFFFF;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
form {
|
| 84 |
-
/* background-color: #FFFFFF;*/
|
| 85 |
-
display: flex;
|
| 86 |
-
align-items: center;
|
| 87 |
-
justify-content: center;
|
| 88 |
-
flex-direction: column;
|
| 89 |
-
padding: 0 50px;
|
| 90 |
-
height: 100%;
|
| 91 |
-
text-align: center;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
input {
|
| 95 |
-
background-color: #eee;
|
| 96 |
-
border: none;
|
| 97 |
-
padding: 12px 15px;
|
| 98 |
-
margin: 8px 0;
|
| 99 |
-
width: 100%;
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
.container {
|
| 103 |
-
background-color: #fff;
|
| 104 |
-
border-radius: 10px;
|
| 105 |
-
box-shadow: 0 14px 28px rgba(0,0,0,0.25),
|
| 106 |
-
0 10px 10px rgba(0,0,0,0.22);
|
| 107 |
-
position: relative;
|
| 108 |
-
overflow: hidden;
|
| 109 |
-
width: 528px;
|
| 110 |
-
max-width: 100%;
|
| 111 |
-
min-height: 400px;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
.form-container {
|
| 115 |
-
position: absolute;
|
| 116 |
-
top: 0;
|
| 117 |
-
height: 100%;
|
| 118 |
-
transition: all 0.6s ease-in-out;
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
.sign-in-container {
|
| 122 |
-
left: 0;
|
| 123 |
-
width: 50%;
|
| 124 |
-
z-index: 2;
|
| 125 |
-
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
.container.right-panel-active .sign-in-container {
|
| 129 |
-
transform: translateX(100%);
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
.sign-up-container {
|
| 133 |
-
left: 0;
|
| 134 |
-
width: 50%;
|
| 135 |
-
opacity: 0;
|
| 136 |
-
z-index: 1;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
.container.right-panel-active .sign-up-container {
|
| 140 |
-
transform: translateX(100%);
|
| 141 |
-
opacity: 1;
|
| 142 |
-
z-index: 5;
|
| 143 |
-
animation: show 0.6s;
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
@keyframes show {
|
| 147 |
-
0%, 49.99% {
|
| 148 |
-
opacity: 0;
|
| 149 |
-
z-index: 1;
|
| 150 |
-
}
|
| 151 |
-
50%, 100% {
|
| 152 |
-
opacity: 1;
|
| 153 |
-
z-index: 5;
|
| 154 |
-
}
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
.overlay-container {
|
| 158 |
-
position: absolute;
|
| 159 |
-
top: 0;
|
| 160 |
-
left: 50%;
|
| 161 |
-
width: 50%;
|
| 162 |
-
height: 100%;
|
| 163 |
-
overflow: hidden;
|
| 164 |
-
transition: transform 0.6s ease-in-out;
|
| 165 |
-
z-index: 100;
|
| 166 |
-
}
|
| 167 |
-
|
| 168 |
-
.container.right-panel-active .overlay-container {
|
| 169 |
-
transform: translateX(-100%);
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
.overlay {
|
| 173 |
-
background: #FF416C;
|
| 174 |
-
background: -webkit-linear-gradient(to right,#1c6bae, #1c6bae);
|
| 175 |
-
background: linear-gradient(to right, #1c6bae, #1c6bae);
|
| 176 |
-
background-repeat: no-repeat;
|
| 177 |
-
background-size: cover;
|
| 178 |
-
background-position: 0 0;
|
| 179 |
-
color: #FFFFFF;
|
| 180 |
-
position: relative;
|
| 181 |
-
left: -100%;
|
| 182 |
-
height: 100%;
|
| 183 |
-
width: 200%;
|
| 184 |
-
transform: translateX(0);
|
| 185 |
-
transition: transform 0.6s ease-in-out;
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
.container.right-panel-active .overlay {
|
| 189 |
-
transform: translateX(50%);
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
.overlay-panel {
|
| 193 |
-
position: absolute;
|
| 194 |
-
display: flex;
|
| 195 |
-
align-items: center;
|
| 196 |
-
justify-content: center;
|
| 197 |
-
flex-direction: column;
|
| 198 |
-
padding: 0 40px;
|
| 199 |
-
text-align: center;
|
| 200 |
-
top: 0;
|
| 201 |
-
height: 100%;
|
| 202 |
-
width: 50%;
|
| 203 |
-
transform: translateX(0);
|
| 204 |
-
transition: transform 0.6s ease-in-out;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
.overlay-left {
|
| 208 |
-
transform: translateX(-20%);
|
| 209 |
-
}
|
| 210 |
-
|
| 211 |
-
.container.right-panel-active .overlay-left {
|
| 212 |
-
transform: translateX(0);
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
.overlay-right {
|
| 216 |
-
right: 0;
|
| 217 |
-
transform: translateX(0);
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
.container.right-panel-active .overlay-right {
|
| 221 |
-
transform: translateX(20%);
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
.social-container {
|
| 225 |
-
margin: 20px 0;
|
| 226 |
-
}
|
| 227 |
-
|
| 228 |
-
.social-container a {
|
| 229 |
-
border: 1px solid #DDDDDD;
|
| 230 |
-
border-radius: 50%;
|
| 231 |
-
display: inline-flex;
|
| 232 |
-
justify-content: center;
|
| 233 |
-
align-items: center;
|
| 234 |
-
margin: 0 5px;
|
| 235 |
-
height: 40px;
|
| 236 |
-
width: 40px;
|
| 237 |
-
}
|
| 238 |
-
|
| 239 |
-
/* Styling the logo inside a circle */
|
| 240 |
-
.logo-container {
|
| 241 |
-
display: flex;
|
| 242 |
-
justify-content: center;
|
| 243 |
-
align-items: center;
|
| 244 |
-
margin-bottom: 20px; /* Add spacing between logo and text */
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
.logo {
|
| 248 |
-
border-radius: 50%; /* Make the image circular */
|
| 249 |
-
background-color: white; /* White background for the circle */
|
| 250 |
-
padding: 20px; /* Adjust the padding to create the circle effect */
|
| 251 |
-
width: 200px; /* Adjust size as needed */
|
| 252 |
-
height: 200px; /* Adjust size as needed */
|
| 253 |
-
object-fit: contain; /* Keep the image aspect ratio */
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
footer {
|
| 258 |
-
background-color: #222;
|
| 259 |
-
color: #fff;
|
| 260 |
-
font-size: 14px;
|
| 261 |
-
bottom: 0;
|
| 262 |
-
position: fixed;
|
| 263 |
-
left: 0;
|
| 264 |
-
right: 0;
|
| 265 |
-
text-align: center;
|
| 266 |
-
z-index: 999;
|
| 267 |
-
}
|
| 268 |
-
|
| 269 |
-
footer p {
|
| 270 |
-
margin: 10px 0;
|
| 271 |
-
}
|
| 272 |
-
|
| 273 |
-
footer i {
|
| 274 |
-
color: red;
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
footer a {
|
| 278 |
-
color: #3c97bf;
|
| 279 |
-
text-decoration: none;
|
| 280 |
-
}
|
| 281 |
-
</style>
|
| 282 |
-
</head>
|
| 283 |
-
<body class="hold-transition login-page" style="background-image: url('static/img/AI.jpg'); background-size: cover;">
|
| 284 |
-
<!-- <h2>Weekly Coding Challenge #1: Sign in/up Form</h2> -->
|
| 285 |
-
<form action='/validate-user' name='loginForm' method="post" onsubmit="return validateForm()">
|
| 286 |
-
<div class="container" id="container">
|
| 287 |
-
<div class="form-container sign-up-container">
|
| 288 |
-
|
| 289 |
-
<h1>Create Account</h1>
|
| 290 |
-
<div class="social-container">
|
| 291 |
-
<a href="#" class="social"><i class="fab fa-facebook-f"></i></a>
|
| 292 |
-
<a href="#" class="social"><i class="fab fa-google-plus-g"></i></a>
|
| 293 |
-
<a href="#" class="social"><i class="fab fa-linkedin-in"></i></a>
|
| 294 |
-
</div>
|
| 295 |
-
<span>or use your email for registration</span>
|
| 296 |
-
<input type="text" placeholder="Name" />
|
| 297 |
-
<input type="password" placeholder="Password" />
|
| 298 |
-
<button>Sign Up</button>
|
| 299 |
-
</form>
|
| 300 |
-
</div>
|
| 301 |
-
<div class="form-container sign-in-container">
|
| 302 |
-
|
| 303 |
-
<h1>Sign in</h1>
|
| 304 |
-
<div class="social-container">
|
| 305 |
-
<a href="#" class="social"><i class="fab fa-facebook-f"></i></a>
|
| 306 |
-
<a href="#" class="social"><i class="fab fa-google-plus-g"></i></a>
|
| 307 |
-
<a href="#" class="social"><i class="fab fa-linkedin-in"></i></a>
|
| 308 |
-
</div>
|
| 309 |
-
<span>or use your account</span>
|
| 310 |
-
<input type="text" name="username" placeholder="Username" />
|
| 311 |
-
<input type="password" name="password" placeholder="Password" />
|
| 312 |
-
<a href="#">Forgot your password?</a>
|
| 313 |
-
<button type="submit">Sign In</button>
|
| 314 |
-
</form>
|
| 315 |
-
</div>
|
| 316 |
-
<div class="overlay-container">
|
| 317 |
-
<div class="overlay">
|
| 318 |
-
<div class="overlay-panel overlay-left">
|
| 319 |
-
<h1>Welcome Back!</h1>
|
| 320 |
-
<p>To keep connected with us please login with your personal info</p>
|
| 321 |
-
<button type="submit" class="ghost" id="signIn">Sign In</button>
|
| 322 |
-
</div>
|
| 323 |
-
<div class="overlay-panel overlay-right">
|
| 324 |
-
<div class="logo-container">
|
| 325 |
-
<img src="/static/img/redmindlogo3.jpg" alt="Logo" class="logo">
|
| 326 |
-
</div>
|
| 327 |
-
<h1>RedMindGPT</h1>
|
| 328 |
-
<p> Start Journey With Us</p>
|
| 329 |
-
<button class="ghost" id="signUp">Sign Up</button>
|
| 330 |
-
</div>
|
| 331 |
-
</div>
|
| 332 |
-
</div>
|
| 333 |
-
</div>
|
| 334 |
-
|
| 335 |
-
<footer>
|
| 336 |
-
<p>
|
| 337 |
-
Created with <i class="fa fa-heart"></i> by RedMind Technologies</p>
|
| 338 |
-
</footer>
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
<!-- jQuery -->
|
| 343 |
-
</form>
|
| 344 |
-
<script>
|
| 345 |
-
function validateForm() {
|
| 346 |
-
//alert("Validating form");
|
| 347 |
-
var username = document.forms["loginForm"]["username"].value;
|
| 348 |
-
var password = document.forms["loginForm"]["password"].value;
|
| 349 |
-
if (username == "" || password == "") {
|
| 350 |
-
alert("Username and Password must be filled out");
|
| 351 |
-
return false;
|
| 352 |
-
}
|
| 353 |
-
|
| 354 |
-
}
|
| 355 |
-
|
| 356 |
-
</script>
|
| 357 |
-
|
| 358 |
-
</body>
|
| 359 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/knowledgebase.html
DELETED
|
@@ -1,710 +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/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 8 |
-
<!-- Include AdminLTE CSS -->
|
| 9 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/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/admin-lte@3.1/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 |
-
<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 |
-
flex: 1;
|
| 25 |
-
overflow-y: auto;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
.wrapper {
|
| 29 |
-
display: flex;
|
| 30 |
-
flex-direction: column;
|
| 31 |
-
height: 100vh;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
.modal-content {
|
| 36 |
-
background-color: #fff;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
.content-header {
|
| 40 |
-
padding: 1rem;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
h1 {
|
| 44 |
-
text-align: center;
|
| 45 |
-
margin-bottom: 30px;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
.card {
|
| 49 |
-
padding: 0;
|
| 50 |
-
margin-top: -15px;
|
| 51 |
-
margin-left: -40px;
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
.table-responsive {
|
| 55 |
-
width: 100%;
|
| 56 |
-
overflow-x: auto;
|
| 57 |
-
/*overflow-y: scroll;*/
|
| 58 |
-
/* Allows horizontal scrolling if necessary */
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
.table,
|
| 62 |
-
.table-bordered {
|
| 63 |
-
width: 100%;
|
| 64 |
-
border-collapse: collapse;
|
| 65 |
-
margin-right: 7.5px;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
.text-wrap {
|
| 70 |
-
white-space: normal !important;
|
| 71 |
-
word-break: break-word;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 75 |
-
width: 60px;
|
| 76 |
-
display: inline-block;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
th {
|
| 80 |
-
white-space: nowrap;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
th:nth-child(1),
|
| 84 |
-
td:nth-child(1) {
|
| 85 |
-
/* Sno column */
|
| 86 |
-
width: 2%;
|
| 87 |
-
}
|
| 88 |
-
|
| 89 |
-
th:nth-child(2),
|
| 90 |
-
td:nth-child(2) {
|
| 91 |
-
/* Document Name column */
|
| 92 |
-
width: auto;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
th:nth-child(3),
|
| 96 |
-
td:nth-child(3) {
|
| 97 |
-
/* Document Description column */
|
| 98 |
-
width: auto;
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
th:nth-child(4),
|
| 102 |
-
td:nth-child(4) {
|
| 103 |
-
/* Document Version column */
|
| 104 |
-
width: 20%;
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
th:nth-child(5),
|
| 108 |
-
td:nth-child(5) {
|
| 109 |
-
/* VectorDB Flag column */
|
| 110 |
-
width: auto;
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
th:nth-child(6),
|
| 114 |
-
td:nth-child(6) {
|
| 115 |
-
/* View column */
|
| 116 |
-
width: 10%;
|
| 117 |
-
}
|
| 118 |
-
|
| 119 |
-
th:nth-child(7),
|
| 120 |
-
td:nth-child(7) {
|
| 121 |
-
/* Edit column */
|
| 122 |
-
width: 10%;
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
th:nth-child(8),
|
| 126 |
-
td:nth-child(8) {
|
| 127 |
-
/* Delete column */
|
| 128 |
-
width: auto;
|
| 129 |
-
}
|
| 130 |
-
|
| 131 |
-
.alert {
|
| 132 |
-
position: relative;
|
| 133 |
-
padding: 15px;
|
| 134 |
-
margin-bottom: 20px;
|
| 135 |
-
border: 1px solid transparent;
|
| 136 |
-
border-radius: 4px;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
.alert-success {
|
| 140 |
-
color: #3c763d;
|
| 141 |
-
background-color: #dff0d8;
|
| 142 |
-
border-color: #d6e9c6;
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
.alert-danger {
|
| 146 |
-
color: #a94442;
|
| 147 |
-
background-color: #f2dede;
|
| 148 |
-
border-color: #ebccd1;
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
/* .close {
|
| 152 |
-
position: absolute;
|
| 153 |
-
bottom: 10px;
|
| 154 |
-
right: 10px;
|
| 155 |
-
border: none;
|
| 156 |
-
background: none;
|
| 157 |
-
font-size: 16px;
|
| 158 |
-
cursor: pointer;
|
| 159 |
-
} */
|
| 160 |
-
</style>
|
| 161 |
-
</head>
|
| 162 |
-
|
| 163 |
-
<body>
|
| 164 |
-
{% include 'sidepane.html' %}
|
| 165 |
-
<div class="wrapper">
|
| 166 |
-
<div class="main-header" style="border-bottom: none;">
|
| 167 |
-
<div class="container mt-2">
|
| 168 |
-
<div id="company-select" class="form-group left-align">
|
| 169 |
-
<!-- <label for="company" class="mr-1" style="margin-left:-40px; margin-top: 12px;">Company Name <span class="text-danger">*</span></label>
|
| 170 |
-
<select type="text" id="company" name="company" class="form-control" style="width:20%;margin-left:-40px;"required>
|
| 171 |
-
<option value="" selected>Select</option>
|
| 172 |
-
</select> -->
|
| 173 |
-
<!-- <div class="col-12 d-flex justify-content-end mb-3">
|
| 174 |
-
<button class="btn btn-primary" style="margin-top:10px;margin-right: -10px;position: fixed;"
|
| 175 |
-
id="add" data-action="add">Add</button>
|
| 176 |
-
</div> -->
|
| 177 |
-
</div>
|
| 178 |
-
</div>
|
| 179 |
-
<div class="row">
|
| 180 |
-
<div id="message-container" style="margin-left: 200px;width:600px;"></div>
|
| 181 |
-
</div>
|
| 182 |
-
<h3 id="company_name" style="margin-left: 400px;">{{company_name}}</h3>
|
| 183 |
-
<section class="content" id="contentSection" style="display: none;">
|
| 184 |
-
<div class="container-fluid">
|
| 185 |
-
<div>
|
| 186 |
-
<div class="form-group">
|
| 187 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 188 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 189 |
-
</div>
|
| 190 |
-
<h4 id="selectedCompany" style="margin-left: 300px;"></h4>
|
| 191 |
-
<div class="row" style="margin-top: 50px;">
|
| 192 |
-
<div class="col-12">
|
| 193 |
-
<div class="card">
|
| 194 |
-
<div id="message-container">
|
| 195 |
-
<div class="card-body table-container">
|
| 196 |
-
<table id="knowledgeTable" class="table table-bordered table-striped">
|
| 197 |
-
<thead>
|
| 198 |
-
<tr>
|
| 199 |
-
|
| 200 |
-
<th>Sno</th>
|
| 201 |
-
<th>Document Name</th>
|
| 202 |
-
<th>Document Description</th>
|
| 203 |
-
<th>Document Version</th>
|
| 204 |
-
<th>VectorDB Flag</th>
|
| 205 |
-
<th>View</th>
|
| 206 |
-
<th>Edit</th>
|
| 207 |
-
<th>Delete</th>
|
| 208 |
-
<!-- <th style="display:none;">Company ID</th> -->
|
| 209 |
-
</tr>
|
| 210 |
-
</thead>
|
| 211 |
-
<tbody>
|
| 212 |
-
|
| 213 |
-
</tbody>
|
| 214 |
-
</table>
|
| 215 |
-
</div>
|
| 216 |
-
</div>
|
| 217 |
-
</div>
|
| 218 |
-
</div>
|
| 219 |
-
</div>
|
| 220 |
-
</section>
|
| 221 |
-
</div>
|
| 222 |
-
|
| 223 |
-
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 224 |
-
aria-hidden="true">
|
| 225 |
-
<div class="modal-dialog" role="document">
|
| 226 |
-
<div class="modal-content">
|
| 227 |
-
<div class="modal-header">
|
| 228 |
-
<h5 class="modal-title" id="addModalLabel">Add Document Details</h5>
|
| 229 |
-
<button type="button" class="btn-close" data-dismiss="modal">
|
| 230 |
-
<span aria-hidden="true" data-backdrop="static" data-keyboard="false"></span>
|
| 231 |
-
</button>
|
| 232 |
-
</div>
|
| 233 |
-
<div class="modal-body">
|
| 234 |
-
<div class="form-group">
|
| 235 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 236 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 237 |
-
</div>
|
| 238 |
-
<form id="documentForm">
|
| 239 |
-
<div class="form-group">
|
| 240 |
-
<label for="uploadFile">Upload File<span class="text-danger">*</span></label>
|
| 241 |
-
<span id="file-name"></span>
|
| 242 |
-
<input type="hidden" id="file_name" name="file_name" class="form-control" required>
|
| 243 |
-
<input type="file" class="form-control-file" id="uploadFile" name="uploadFile" required
|
| 244 |
-
accept=".pdf,.doc,.docx">
|
| 245 |
-
<small class="form-text text-muted">Accepted formats: .pdf, .doc, .docx</small>
|
| 246 |
-
</div>
|
| 247 |
-
<div class="form-group">
|
| 248 |
-
<label for="documentName">Document Name<span class="text-danger">*</span></label>
|
| 249 |
-
<input type="text" class="form-control" id="documentName" name="documentName" required>
|
| 250 |
-
</div>
|
| 251 |
-
<div class="form-group">
|
| 252 |
-
<label for="documentDescription">Document Description<span
|
| 253 |
-
class="text-danger">*</span></label>
|
| 254 |
-
<textarea class="form-control" id="documentDescription" name="documentDescription"
|
| 255 |
-
rows="3" required></textarea>
|
| 256 |
-
</div>
|
| 257 |
-
<div class="form-group">
|
| 258 |
-
<label for="department">Department<span class="text-danger">*</span></label>
|
| 259 |
-
<input type="text" class="form-control" id="department" name="department" required>
|
| 260 |
-
</div>
|
| 261 |
-
<div class="form-group">
|
| 262 |
-
<label for="version">Version<span class="text-danger">*</span></label>
|
| 263 |
-
<input type="text" class="form-control" id="version" name="version" required>
|
| 264 |
-
</div>
|
| 265 |
-
<div class="form-group">
|
| 266 |
-
<label for="lastUpdated">Last Updated<span class="text-danger">*</span></label>
|
| 267 |
-
<input type="text" class="form-control" id="lastUpdated" name="lastUpdated" required>
|
| 268 |
-
</div>
|
| 269 |
-
</form>
|
| 270 |
-
</div>
|
| 271 |
-
<div class="modal-footer">
|
| 272 |
-
<!-- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> -->
|
| 273 |
-
<button type="button" id="saveupdate" class="btn btn-primary"
|
| 274 |
-
style="display: none;">Update</button>
|
| 275 |
-
<button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button>
|
| 276 |
-
</div>
|
| 277 |
-
</div>
|
| 278 |
-
</div>
|
| 279 |
-
</div>
|
| 280 |
-
</div>
|
| 281 |
-
|
| 282 |
-
{%include 'footer.html'%}
|
| 283 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 284 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 285 |
-
|
| 286 |
-
<script>
|
| 287 |
-
var table = $('#knowledgeTable').DataTable();
|
| 288 |
-
const role = sessionStorage.getItem('userRole');
|
| 289 |
-
const company_name=sessionStorage.getItem('company_name');
|
| 290 |
-
console.log("company_name",company_name);
|
| 291 |
-
// document.getElementById('company_name').textContent = company_name;
|
| 292 |
-
|
| 293 |
-
document.addEventListener("DOMContentLoaded", function () {
|
| 294 |
-
now = new Date().toISOString().replace('T', ' ').substr(0, 19);
|
| 295 |
-
document.getElementById('lastUpdated').value = now;
|
| 296 |
-
const inputs = document.querySelectorAll("#documentForm input, textarea");
|
| 297 |
-
inputs.forEach((input, index) => {
|
| 298 |
-
input.addEventListener("keydown", function (event) {
|
| 299 |
-
if (event.key === "Enter") {
|
| 300 |
-
event.preventDefault();
|
| 301 |
-
moveToNextInput(inputs, index);
|
| 302 |
-
}
|
| 303 |
-
});
|
| 304 |
-
});
|
| 305 |
-
|
| 306 |
-
const passedCompanyName=sessionStorage.getItem('company_name')
|
| 307 |
-
document.getElementById('selectedCompany').innerText = `Company Name: ${passedCompanyName}`;
|
| 308 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 309 |
-
const company_id=sessionStorage.getItem('company_id');
|
| 310 |
-
document.getElementById("company_id").value=company_id;
|
| 311 |
-
console.log("inside knowledgebaae sessionstorage",company_id);
|
| 312 |
-
data_get_from_db(company_id);
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
const companySelect = document.getElementById('company');
|
| 318 |
-
const documentForm = document.getElementById('documentForm');
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
});
|
| 322 |
-
function moveToNextInput(inputs, currentIndex) {
|
| 323 |
-
const nextInput = inputs[currentIndex + 1];
|
| 324 |
-
if (nextInput) {
|
| 325 |
-
nextInput.focus();
|
| 326 |
-
} else {
|
| 327 |
-
// Optionally, submit the form or trigger the save button
|
| 328 |
-
document.getElementById("save").focus();
|
| 329 |
-
}
|
| 330 |
-
}
|
| 331 |
-
|
| 332 |
-
async function data_get_from_db(company_id) {
|
| 333 |
-
if (company_id) {
|
| 334 |
-
try {
|
| 335 |
-
const Response = await fetch(`/api/document_upload?company_id=${company_id}`);
|
| 336 |
-
console.log("responce from api :==> ", Response)
|
| 337 |
-
const connectorsResponse = await Response.json();
|
| 338 |
-
console.log("knowledge data table after connecting to table", connectorsResponse);
|
| 339 |
-
const table = $('#knowledgeTable').DataTable(); // Initialize DataTable at the start
|
| 340 |
-
table.clear();
|
| 341 |
-
if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {
|
| 342 |
-
// displayEmptyTable();
|
| 343 |
-
displayErrorMessage("Document details do not exist for this company. Please fill in the details.");
|
| 344 |
-
contentSection.style.display = 'none';
|
| 345 |
-
} else {
|
| 346 |
-
console.log('company data retrived succesfully ! .........')
|
| 347 |
-
connectorsResponse.forEach((company, index) => {
|
| 348 |
-
table.row.add([
|
| 349 |
-
index + 1,
|
| 350 |
-
company.document_name,
|
| 351 |
-
company.document_desc,
|
| 352 |
-
company.version,
|
| 353 |
-
company.vectorDBflag,
|
| 354 |
-
`<a href='#' class='btn btn-info btn-sm'data-kid-id='${company.row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`,
|
| 355 |
-
`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${company.row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 356 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 357 |
-
company.row_id
|
| 358 |
-
// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",
|
| 359 |
-
// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",
|
| 360 |
-
// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"
|
| 361 |
-
]).draw(false);
|
| 362 |
-
});
|
| 363 |
-
contentSection.style.display = 'block';
|
| 364 |
-
}
|
| 365 |
-
} catch (error) {
|
| 366 |
-
console.error('Error fetching company documents:', error);
|
| 367 |
-
//displayEmptyTable();
|
| 368 |
-
|
| 369 |
-
displayErrorMessage("Document details1 do not exist for this company. Please fill in the details.");
|
| 370 |
-
contentSection.style.display = 'none';
|
| 371 |
-
}
|
| 372 |
-
} else {
|
| 373 |
-
// displayEmptyTable();
|
| 374 |
-
|
| 375 |
-
displayErrorMessage("Details for knowledgebase do not exist for this company. Please fill in the details.");
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
}
|
| 379 |
-
|
| 380 |
-
function displayErrorMessage(message) {
|
| 381 |
-
const messageContainer = document.getElementById('message-container');
|
| 382 |
-
if (messageContainer) {
|
| 383 |
-
messageContainer.innerHTML = `<div class='alert alert-danger'>${message}</div>`;
|
| 384 |
-
}
|
| 385 |
-
}
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
function clearFormFields() {
|
| 390 |
-
document.getElementById('file-name').textContent = ""
|
| 391 |
-
document.getElementById('uploadFile').value = "";
|
| 392 |
-
document.getElementById('documentName').value = "";
|
| 393 |
-
document.getElementById('documentDescription').value = "";
|
| 394 |
-
document.getElementById('department').value = "";
|
| 395 |
-
document.getElementById('version').value = "";
|
| 396 |
-
// document.getElementById('lastUpdated').value = "";
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
$(document).ready(function () {
|
| 401 |
-
// Show modal function
|
| 402 |
-
$('#add').on('click', function () {
|
| 403 |
-
$('#documentName').removeAttr('readonly');
|
| 404 |
-
$('#documentDescription').removeAttr('readonly');
|
| 405 |
-
$('#department').removeAttr('readonly');
|
| 406 |
-
$('#version').removeAttr('readonly');
|
| 407 |
-
$('#lastUpdated').removeAttr('readonly');
|
| 408 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 409 |
-
modalTitle.textContent = 'Add Document Details';
|
| 410 |
-
$('#save').show();
|
| 411 |
-
$('#uploadFile').show();
|
| 412 |
-
$('#saveupdate').hide();
|
| 413 |
-
clearFormFields();
|
| 414 |
-
$('#message-container').empty(); // Clear the message container
|
| 415 |
-
$('#addModal').modal('show');
|
| 416 |
-
});
|
| 417 |
-
$('.modal-footer .btn-secondary, .modal-header .btn-close').on('click', function () {
|
| 418 |
-
$('#addModal').modal('hide');
|
| 419 |
-
});
|
| 420 |
-
// $('#knowledgeTable').DataTable({
|
| 421 |
-
// autoWidth: false
|
| 422 |
-
// });
|
| 423 |
-
|
| 424 |
-
});
|
| 425 |
-
function viewCompany(button) {
|
| 426 |
-
var companyId = $(button).data('kid-id');
|
| 427 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 428 |
-
modalTitle.textContent = 'View Document Details';
|
| 429 |
-
if(companyId)
|
| 430 |
-
{
|
| 431 |
-
$.getJSON(`/api/getknowledgebase/${companyId}`, function (company) {
|
| 432 |
-
$('#uploadFile').hide();
|
| 433 |
-
$('#file-name').text(company.file_path).attr('readonly', 'readonly');
|
| 434 |
-
$('#documentName').val(company.document_name).attr('readonly', 'readonly');
|
| 435 |
-
$('#documentDescription').val(company.document_desc).attr('readonly', 'readonly');
|
| 436 |
-
$('#department').val(company.department).attr('readonly', 'readonly');
|
| 437 |
-
$('#version').val(company.version).attr('readonly', 'readonly');
|
| 438 |
-
//$('#lastUpdated').val(company.last_updated).attr('readonly', 'readonly');
|
| 439 |
-
var lastUpdated = company.last_updated;
|
| 440 |
-
$('#lastUpdated').val(lastUpdated).attr('readonly', 'readonly');
|
| 441 |
-
$('#save').hide();// Disable the "Save" button when the modal opens
|
| 442 |
-
$('#addModal').modal('show');
|
| 443 |
-
}).fail(function () {
|
| 444 |
-
alert("Error retrieving knowledge base check the sidepane working.");
|
| 445 |
-
});
|
| 446 |
-
}
|
| 447 |
-
}
|
| 448 |
-
|
| 449 |
-
// Edit knowledge base details
|
| 450 |
-
function editCompany(button) {
|
| 451 |
-
var companyId = $(button).data('kid-id');
|
| 452 |
-
|
| 453 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 454 |
-
modalTitle.textContent = 'Edit Document Details';
|
| 455 |
-
|
| 456 |
-
// Fetch company details by ID
|
| 457 |
-
if(companyId)
|
| 458 |
-
{
|
| 459 |
-
$.getJSON(`/api/getknowledgebase/${companyId}`, function (company) {
|
| 460 |
-
|
| 461 |
-
const fileName = company.file_path.split('/').pop();
|
| 462 |
-
const fileContent = new Blob([""], { type: 'text/plain' });
|
| 463 |
-
const file = new File([fileContent], fileName, { type: fileContent.type });
|
| 464 |
-
const dataTransfer = new DataTransfer();
|
| 465 |
-
dataTransfer.items.add(file);
|
| 466 |
-
|
| 467 |
-
// Set the file input's files property to the created file
|
| 468 |
-
const fileInput = document.getElementById('uploadFile');
|
| 469 |
-
fileInput.files = dataTransfer.files;
|
| 470 |
-
|
| 471 |
-
// Check if the input element is of type 'file'
|
| 472 |
-
if (fileInput.type === 'file') {
|
| 473 |
-
console.log("The input is of type 'file'.");
|
| 474 |
-
} else {
|
| 475 |
-
console.log("The input is NOT of type 'file'.");
|
| 476 |
-
}
|
| 477 |
-
|
| 478 |
-
// Check if the value is of type 'File'
|
| 479 |
-
const files = fileInput.files;
|
| 480 |
-
if (files.length > 0 && files[0] instanceof File) {
|
| 481 |
-
console.log("The value is of type 'File':", files[0].name);
|
| 482 |
-
} else {
|
| 483 |
-
console.log("No file is selected or the value is not of type 'File'.");
|
| 484 |
-
}
|
| 485 |
-
|
| 486 |
-
$('#uploadFileLabel').text(files[0].name);
|
| 487 |
-
$('#uploadFile').text(files[0].name)
|
| 488 |
-
$('#documentName').val(company.document_name);
|
| 489 |
-
$('#documentDescription').val(company.document_desc);
|
| 490 |
-
$('#department').val(company.department);
|
| 491 |
-
$('#version').val(company.version);
|
| 492 |
-
$('#lastUpdated').val(company.last_updated).attr('readonly', 'readonly');
|
| 493 |
-
$('#company_id').val(company.company_id);
|
| 494 |
-
|
| 495 |
-
// Show/hide appropriate elements
|
| 496 |
-
$('#uploadFile').show(); // Hide the file upload field
|
| 497 |
-
$('#save').hide(); // Hide the default save button
|
| 498 |
-
$('#saveupdate').show(); // Show the update button
|
| 499 |
-
|
| 500 |
-
// Ensure fields are editable
|
| 501 |
-
$('#documentName').removeAttr('readonly');
|
| 502 |
-
$('#documentDescription').removeAttr('readonly');
|
| 503 |
-
$('#department').removeAttr('readonly');
|
| 504 |
-
$('#version').removeAttr('readonly');
|
| 505 |
-
// $('#lastUpdated').removeAttr('readonly');
|
| 506 |
-
$('#company_id').val(company.company_id); // Ensure company_id is included if necessary
|
| 507 |
-
|
| 508 |
-
// Show the modal
|
| 509 |
-
$('#addModal').modal('show');
|
| 510 |
-
|
| 511 |
-
// Set up the click event for the update button
|
| 512 |
-
$('#saveupdate').off('click').on('click', function () {
|
| 513 |
-
saveupdate(companyId, files[0].name); // Pass the company ID for updating
|
| 514 |
-
});
|
| 515 |
-
}).fail(function () {
|
| 516 |
-
alert("Error retrieving knowledge base error 2 details.");
|
| 517 |
-
});
|
| 518 |
-
}
|
| 519 |
-
}
|
| 520 |
-
|
| 521 |
-
// Delete company
|
| 522 |
-
function deleteCompany(button) {
|
| 523 |
-
var companyId = $(button).data('kid-id');
|
| 524 |
-
console.log("k_id deleted", companyId);
|
| 525 |
-
$.ajax({
|
| 526 |
-
type: "DELETE",
|
| 527 |
-
url: `/api/delknowledgebase/${companyId}`,
|
| 528 |
-
success: function () {
|
| 529 |
-
var table = $('#knowledgeTable').DataTable();
|
| 530 |
-
table.row($(button).closest('tr')).remove().draw();
|
| 531 |
-
//alert("Company deleted successfully.");
|
| 532 |
-
const messageContainer = document.getElementById('message-container');
|
| 533 |
-
if (messageContainer)
|
| 534 |
-
messageContainer.innerHTML = `
|
| 535 |
-
<div class='alert alert-danger'>
|
| 536 |
-
Prompt details deleted successfully
|
| 537 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 538 |
-
</div>`;
|
| 539 |
-
// fetchCompanies(); // Refresh the table
|
| 540 |
-
},
|
| 541 |
-
error: function (xhr) {
|
| 542 |
-
alert("Error deleting company: " + xhr.responseJSON.detail);
|
| 543 |
-
}
|
| 544 |
-
});
|
| 545 |
-
}
|
| 546 |
-
function saveupdate(companyId, filename) {
|
| 547 |
-
const formData = new FormData();
|
| 548 |
-
const fileInput = document.getElementById("uploadFile");
|
| 549 |
-
const uploadFile = fileInput.files[0]; // Get the file object
|
| 550 |
-
const company_id = document.getElementById("company_id").value;
|
| 551 |
-
formData.append("company_id", $('#company_id').val());
|
| 552 |
-
formData.append("documentName", $('#documentName').val());
|
| 553 |
-
formData.append("documentDescription", $('#documentDescription').val());
|
| 554 |
-
formData.append("department", $('#department').val());
|
| 555 |
-
formData.append("version", $('#version').val());
|
| 556 |
-
formData.append("vectorDBFlag", 'NO');
|
| 557 |
-
formData.append("lastUpdated", $('#lastUpdated').val());
|
| 558 |
-
console.log("company_id to table refresh", company_id)
|
| 559 |
-
// Append the file only if it exists, otherwise, append the filename
|
| 560 |
-
if (uploadFile) {
|
| 561 |
-
formData.append("file_path", uploadFile); // Append the file object
|
| 562 |
-
} else {
|
| 563 |
-
formData.append("file_path", filename); // Append the existing filename
|
| 564 |
-
}
|
| 565 |
-
|
| 566 |
-
$.ajax({
|
| 567 |
-
url: `/api/putknowledgebase/${companyId}`,
|
| 568 |
-
type: 'PUT',
|
| 569 |
-
data: formData,
|
| 570 |
-
processData: false, // Required for FormData
|
| 571 |
-
contentType: false, // Required for FormData
|
| 572 |
-
success: function (response) {
|
| 573 |
-
// alert('Knowledgebase details updated successfully.');
|
| 574 |
-
const messageContainer = document.getElementById('message-container');
|
| 575 |
-
if (messageContainer)
|
| 576 |
-
messageContainer.innerHTML = `
|
| 577 |
-
<div class='alert alert-success'>
|
| 578 |
-
Data saved successfully
|
| 579 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 580 |
-
</div>`;
|
| 581 |
-
$('#addModal').modal('hide'); // Close the modal after saving
|
| 582 |
-
fetchUpdatedDocuments(company_id);
|
| 583 |
-
},
|
| 584 |
-
error: function () {
|
| 585 |
-
alert('Form has no changes to update knowledge base details.');
|
| 586 |
-
}
|
| 587 |
-
});
|
| 588 |
-
}
|
| 589 |
-
|
| 590 |
-
async function fetchUpdatedDocuments(company_id) {
|
| 591 |
-
console.log("company_id", company_id);
|
| 592 |
-
var table = $('#knowledgeTable').DataTable();
|
| 593 |
-
const Response = await fetch(`/api/document_update?company_id=${company_id}`);
|
| 594 |
-
const connectorsResponse = await Response.json();
|
| 595 |
-
console.log("knowledge data table after connecting to table", connectorsResponse);
|
| 596 |
-
table.clear();
|
| 597 |
-
if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {
|
| 598 |
-
//displayEmptyTable();
|
| 599 |
-
|
| 600 |
-
displayErrorMessage("Document details do not exist for this company. Please fill in the details.");
|
| 601 |
-
contentSection.style.display = 'none';
|
| 602 |
-
} else {
|
| 603 |
-
|
| 604 |
-
connectorsResponse.forEach((company, index) => {
|
| 605 |
-
table.row.add([
|
| 606 |
-
index + 1,
|
| 607 |
-
company.document_name,
|
| 608 |
-
company.document_desc,
|
| 609 |
-
company.version,
|
| 610 |
-
company.vectorDBflag,
|
| 611 |
-
`<a href='#' class='btn btn-info btn-sm'data-kid-id='${company.row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`,
|
| 612 |
-
`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${company.row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 613 |
-
//`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`,
|
| 614 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 615 |
-
company.row_id
|
| 616 |
-
// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",
|
| 617 |
-
// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",
|
| 618 |
-
// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"
|
| 619 |
-
]).draw(false);
|
| 620 |
-
});
|
| 621 |
-
contentSection.style.display = 'block';
|
| 622 |
-
}
|
| 623 |
-
}
|
| 624 |
-
|
| 625 |
-
function save_file() {
|
| 626 |
-
const form = document.getElementById('documentForm');
|
| 627 |
-
|
| 628 |
-
// Check if the form is valid
|
| 629 |
-
if (!form.checkValidity()) {
|
| 630 |
-
// If the form is invalid, show validation messages and stop the submission
|
| 631 |
-
form.reportValidity();
|
| 632 |
-
return;
|
| 633 |
-
}
|
| 634 |
-
const uploadFile = document.getElementById("uploadFile").files[0];
|
| 635 |
-
const documentName = document.getElementById("documentName").value;
|
| 636 |
-
const documentDescription = document.getElementById("documentDescription").value;
|
| 637 |
-
const department = document.getElementById("department").value;
|
| 638 |
-
const version = document.getElementById("version").value;
|
| 639 |
-
const lastUpdated = document.getElementById("lastUpdated").value;
|
| 640 |
-
const company_id = document.getElementById("company_id").value;
|
| 641 |
-
|
| 642 |
-
//const formData = new FormData();
|
| 643 |
-
var formData = new FormData($('#documentForm')[0]);
|
| 644 |
-
const vectorDBFlag = "NO"; // Example value
|
| 645 |
-
// const view = "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>";
|
| 646 |
-
// const edit = "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>";
|
| 647 |
-
// const dele= "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></a>";
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
formData.append("uploadFile", uploadFile);
|
| 651 |
-
formData.append("documentName", documentName);
|
| 652 |
-
formData.append("documentDescription", documentDescription);
|
| 653 |
-
formData.append("department", department);
|
| 654 |
-
formData.append("version", version);
|
| 655 |
-
formData.append("lastUpdated", lastUpdated);
|
| 656 |
-
formData.append("vectorDBflag", vectorDBFlag);
|
| 657 |
-
formData.append("company_id", company_id);
|
| 658 |
-
console.log("formdata",formData);
|
| 659 |
-
fetch('/upload_document', {
|
| 660 |
-
method: 'POST',
|
| 661 |
-
body: formData
|
| 662 |
-
})
|
| 663 |
-
.then(response => {
|
| 664 |
-
if (!response.ok) {
|
| 665 |
-
throw new Error('Network response was not ok');
|
| 666 |
-
}
|
| 667 |
-
return response.json();
|
| 668 |
-
})
|
| 669 |
-
.then(data => {
|
| 670 |
-
const row_id=data.row_id;
|
| 671 |
-
var table = $('#knowledgeTable').DataTable();
|
| 672 |
-
var rowCount = table.rows().count();
|
| 673 |
-
const view=`<a href='#' class='btn btn-info btn-sm'data-kid-id='${row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`;
|
| 674 |
-
const edit=`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`;
|
| 675 |
-
const dele= `<a href='#' class='btn btn-danger btn-sm' data-kid-id='${row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`;
|
| 676 |
-
table.row.add([
|
| 677 |
-
rowCount + 1,
|
| 678 |
-
documentName,
|
| 679 |
-
documentDescription,
|
| 680 |
-
version,
|
| 681 |
-
vectorDBFlag,
|
| 682 |
-
view,
|
| 683 |
-
edit,
|
| 684 |
-
dele
|
| 685 |
-
]).draw(false);
|
| 686 |
-
|
| 687 |
-
const messageContainer = document.getElementById('message-container');
|
| 688 |
-
if(messageContainer)
|
| 689 |
-
messageContainer.innerHTML = `
|
| 690 |
-
<div class='alert alert-success'>
|
| 691 |
-
Knowledgebase Data saved successfully
|
| 692 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 693 |
-
</div>`;
|
| 694 |
-
// alert('Document saved successfully');
|
| 695 |
-
$('#addModal').modal('hide');
|
| 696 |
-
document.getElementById('contentSection').style.display = 'block'; // Show the table section
|
| 697 |
-
})
|
| 698 |
-
.catch(error => console.error('Error:', error));
|
| 699 |
-
}
|
| 700 |
-
function dismissMessage() {
|
| 701 |
-
const messageContainer = document.getElementById('message-container');
|
| 702 |
-
if (messageContainer) {
|
| 703 |
-
messageContainer.innerHTML = '';
|
| 704 |
-
}
|
| 705 |
-
}
|
| 706 |
-
|
| 707 |
-
</script>
|
| 708 |
-
</body>
|
| 709 |
-
|
| 710 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/prompt_template.html
DELETED
|
@@ -1,643 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
<head>
|
| 5 |
-
<title>Prompt Template</title>
|
| 6 |
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 7 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 8 |
-
<!-- Include AdminLTE CSS -->
|
| 9 |
-
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/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 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 13 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 14 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" />
|
| 15 |
-
<style>
|
| 16 |
-
.header-row {
|
| 17 |
-
display: flex;
|
| 18 |
-
justify-content: space-between;
|
| 19 |
-
align-items: center;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
.card {
|
| 23 |
-
padding: 0;
|
| 24 |
-
margin-top: -15px;
|
| 25 |
-
margin-left: -40px;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
.table-container {
|
| 29 |
-
width: 100%;
|
| 30 |
-
overflow-x: auto;
|
| 31 |
-
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
.wrapper {
|
| 35 |
-
display: flex;
|
| 36 |
-
flex-direction: column;
|
| 37 |
-
height: 100vh;
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
.content-wrapper {
|
| 41 |
-
flex: 1;
|
| 42 |
-
overflow-y: auto;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
.content-header {
|
| 46 |
-
padding: 5px;
|
| 47 |
-
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 51 |
-
width: 60px;
|
| 52 |
-
display: inline-block;
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
th,
|
| 56 |
-
td {
|
| 57 |
-
white-space: nowrap;
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
th:nth-child(1),
|
| 61 |
-
td:nth-child(1) {
|
| 62 |
-
/* Sno column */
|
| 63 |
-
width: 1%;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
th:nth-child(2),
|
| 67 |
-
td:nth-child(2) {
|
| 68 |
-
/* API Name column */
|
| 69 |
-
width: 20%;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
th:nth-child(3),
|
| 73 |
-
td:nth-child(3) {
|
| 74 |
-
/* API Endpoint column */
|
| 75 |
-
width: 45%;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
th:nth-child(4),
|
| 79 |
-
td:nth-child(4) {
|
| 80 |
-
/* view column*/
|
| 81 |
-
width: 5%;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
th:nth-child(5),
|
| 85 |
-
td:nth-child(5) {
|
| 86 |
-
/* view column*/
|
| 87 |
-
width: 5%;
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
th:nth-child(6),
|
| 91 |
-
td:nth-child(6) {
|
| 92 |
-
/* view column*/
|
| 93 |
-
width: 5%;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
.reduced-width {
|
| 97 |
-
width: 25%;
|
| 98 |
-
}
|
| 99 |
-
|
| 100 |
-
.viewButton {
|
| 101 |
-
size: 2px;
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
div.dataTables_wrapper div.dataTables_length select {
|
| 105 |
-
width: 60px;
|
| 106 |
-
display: inline-block;
|
| 107 |
-
}
|
| 108 |
-
</style>
|
| 109 |
-
</head>
|
| 110 |
-
|
| 111 |
-
<body>
|
| 112 |
-
{% include 'sidepane.html' %}
|
| 113 |
-
|
| 114 |
-
<div class="wrapper">
|
| 115 |
-
<div class="main-header" style="border-bottom: none;">
|
| 116 |
-
<!-- Content Header (Page header) -->
|
| 117 |
-
<div class="content-header">
|
| 118 |
-
<div class="container-fluid">
|
| 119 |
-
<div class="container mt-2">
|
| 120 |
-
<div class="form-group left-align" id="company-select">
|
| 121 |
-
<!-- <label for="company" class="mr-1" style="margin-left:-60px;margin-top:-11px;">Company Name
|
| 122 |
-
<span class="text-danger">*</span></label>
|
| 123 |
-
<select type="text" id="company" name="company" class="form-control "
|
| 124 |
-
style="width: 20%;margin-left:-60px;" required>
|
| 125 |
-
<option value="" selected>Select</option>
|
| 126 |
-
</select> -->
|
| 127 |
-
<h4 id="selectedCompany" style="margin-left: 300px;"></h4>
|
| 128 |
-
<!-- <div class="col-12 d-flex justify-content-end mb-2">
|
| 129 |
-
<button class="btn btn-primary"
|
| 130 |
-
style="margin-top:-40px;margin-right: -25px;position: fixed;" id="add">Add</button>
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
</div> -->
|
| 134 |
-
</div>
|
| 135 |
-
<div class="row">
|
| 136 |
-
<div id="message-container" style="margin-left: 150px;width:500px;"></div>
|
| 137 |
-
</div>
|
| 138 |
-
</div>
|
| 139 |
-
</div>
|
| 140 |
-
</div>
|
| 141 |
-
<section class="content" id="contentSection" style="display: none;">
|
| 142 |
-
<div class="container-fluid">
|
| 143 |
-
<div class="form-group">
|
| 144 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 145 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 146 |
-
</div>
|
| 147 |
-
</div>
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
<!-- Main content-->
|
| 151 |
-
<section class="content">
|
| 152 |
-
<div class="container-fluid">
|
| 153 |
-
<div class="row">
|
| 154 |
-
<div class="col-12">
|
| 155 |
-
<div class="card">
|
| 156 |
-
<div class="card-body table-container">
|
| 157 |
-
<table id="promptTable" class="table table-bordered table-striped">
|
| 158 |
-
<thead>
|
| 159 |
-
<tr>
|
| 160 |
-
<th>Sno</th>
|
| 161 |
-
<th>Datasource</th>
|
| 162 |
-
<th>Sample Prompt</th>
|
| 163 |
-
<th>View</th>
|
| 164 |
-
<th>Edit</th>
|
| 165 |
-
<th>Delete</th>
|
| 166 |
-
</tr>
|
| 167 |
-
</thead>
|
| 168 |
-
<tbody>
|
| 169 |
-
<!-- <tr>
|
| 170 |
-
<td>1</td>
|
| 171 |
-
<td>API</td>
|
| 172 |
-
<td>What are the details of ASN24080200002?</td>
|
| 173 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 174 |
-
</tr>
|
| 175 |
-
<tr>
|
| 176 |
-
<td>2</td>
|
| 177 |
-
<td>API</td>
|
| 178 |
-
<td>What is the expected receiving date of ASN24080200002</td>
|
| 179 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 180 |
-
</tr>
|
| 181 |
-
<tr>
|
| 182 |
-
<td>3</td>
|
| 183 |
-
<td>Document</td>
|
| 184 |
-
<td>Explain Pre-Receiving Yard Management</td>
|
| 185 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 186 |
-
</tr>
|
| 187 |
-
<tr>
|
| 188 |
-
<td>4</td>
|
| 189 |
-
<td>Document</td>
|
| 190 |
-
<td>Can you explain the process of unloading a vehicle in more detail?</td>
|
| 191 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 192 |
-
</tr>
|
| 193 |
-
<tr>
|
| 194 |
-
<td>5</td>
|
| 195 |
-
<td>Visual Analysis</td>
|
| 196 |
-
<td>I want to analyze item name and quantity in a bar chart in warehouse Allcargo Logistics</td>
|
| 197 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 198 |
-
</tr>
|
| 199 |
-
<tr>
|
| 200 |
-
<td>6</td>
|
| 201 |
-
<td>Visual Analysis</td>
|
| 202 |
-
<td>Can you generate a pie chart with item names and quantities in warehouse Allcargo Logistics</td>
|
| 203 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 204 |
-
</tr>
|
| 205 |
-
<tr>
|
| 206 |
-
<td>7</td>
|
| 207 |
-
<td>Database</td>
|
| 208 |
-
<td>What are the active warehouses available</td>
|
| 209 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 210 |
-
</tr>
|
| 211 |
-
<tr>
|
| 212 |
-
<td>8</td>
|
| 213 |
-
<td>Database</td>
|
| 214 |
-
<td>What are the warehouses available</td>
|
| 215 |
-
<td><button class="btn btn-primary viewButton">View</button></td>
|
| 216 |
-
</tr>
|
| 217 |
-
-->
|
| 218 |
-
</tbody>
|
| 219 |
-
</table>
|
| 220 |
-
</div>
|
| 221 |
-
</div>
|
| 222 |
-
</div>
|
| 223 |
-
</div>
|
| 224 |
-
</div>
|
| 225 |
-
</section>
|
| 226 |
-
</section>
|
| 227 |
-
</div>
|
| 228 |
-
|
| 229 |
-
</div>
|
| 230 |
-
|
| 231 |
-
<!-- Modal -->
|
| 232 |
-
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
|
| 233 |
-
aria-hidden="true">
|
| 234 |
-
<div class="modal-dialog" role="document">
|
| 235 |
-
<div class="modal-content">
|
| 236 |
-
<div class="modal-header">
|
| 237 |
-
<h5 class="modal-title" id="addModalLabel">Add Prompt templates</h5>
|
| 238 |
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
|
| 239 |
-
<span aria-hidden="true" data-backdrop="static" data-keyboard="false">×</span>
|
| 240 |
-
</div>
|
| 241 |
-
<div class="modal-body">
|
| 242 |
-
<div class="form-group">
|
| 243 |
-
<!-- <label for="company_id">company_id</label>--->
|
| 244 |
-
<input type="hidden" id="company_id" name="company_id" class="form-control" required>
|
| 245 |
-
</div>
|
| 246 |
-
<form id="addPromptForm">
|
| 247 |
-
<div class="form-group">
|
| 248 |
-
<label for="scenario">Scenario <span class="text-danger">*</span></label>
|
| 249 |
-
<input type="text" class="form-control" id="scenario" name="scenario" required>
|
| 250 |
-
</div>
|
| 251 |
-
<div class="form-group">
|
| 252 |
-
<label for="prompt">Sample Prompt <span class="text-danger">*</span></label>
|
| 253 |
-
<input type="text" class="form-control" id="prompt" name="sampleprompt" required>
|
| 254 |
-
</div>
|
| 255 |
-
<div class="form-group">
|
| 256 |
-
<label for="comments">Comments <span class="text-danger">*</span></label>
|
| 257 |
-
<input type="text" class="form-control" id="comments" name="comments" required>
|
| 258 |
-
</div>
|
| 259 |
-
</form>
|
| 260 |
-
</div>
|
| 261 |
-
<div class="modal-footer">
|
| 262 |
-
<button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button>
|
| 263 |
-
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> -->
|
| 264 |
-
<button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button>
|
| 265 |
-
</div>
|
| 266 |
-
</div>
|
| 267 |
-
</div>
|
| 268 |
-
</div>
|
| 269 |
-
|
| 270 |
-
{ %include 'footer.html'%}
|
| 271 |
-
<!-- Include DataTables JS and your custom script -->
|
| 272 |
-
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
|
| 273 |
-
<script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
|
| 274 |
-
<script>
|
| 275 |
-
|
| 276 |
-
var table = $('#promptTable').DataTable();
|
| 277 |
-
const role = sessionStorage.getItem('userRole');
|
| 278 |
-
console.log('Current role:', role); // Debug statement to check the role
|
| 279 |
-
const passedCompanyName = sessionStorage.getItem('company_name')
|
| 280 |
-
document.getElementById('selectedCompany').innerText = `Company Name: ${passedCompanyName}`;
|
| 281 |
-
const company_id = sessionStorage.getItem('company_id');
|
| 282 |
-
document.getElementById("company_id").value = company_id;
|
| 283 |
-
|
| 284 |
-
data_get_from_db(company_id);
|
| 285 |
-
|
| 286 |
-
// if (role === 'superadmin') {
|
| 287 |
-
// const storecompany_id = sessionStorage.getItem('company_id');
|
| 288 |
-
// data_get_from_db(storecompany_id);
|
| 289 |
-
// document.getElementById('company-select').style.display = 'block';
|
| 290 |
-
// //var companyId = getCookie('company_id')
|
| 291 |
-
// //console.log("company id for superadmin",storecompany_id);
|
| 292 |
-
// fetchCompanies();
|
| 293 |
-
|
| 294 |
-
// } else {
|
| 295 |
-
// document.getElementById('company-select').style.display = 'block';
|
| 296 |
-
// const storecompany_id = sessionStorage.getItem('company_id');
|
| 297 |
-
// console.log('Current company_id:', storecompany_id); // Debug statement to check the role
|
| 298 |
-
// data_get_from_db(storecompany_id);
|
| 299 |
-
// }
|
| 300 |
-
|
| 301 |
-
function moveToNextInput(inputs, currentIndex) {
|
| 302 |
-
const nextInput = inputs[currentIndex + 1];
|
| 303 |
-
if (nextInput) {
|
| 304 |
-
nextInput.focus();
|
| 305 |
-
} else {
|
| 306 |
-
// Optionally, submit the form or trigger the save button
|
| 307 |
-
document.getElementById("save").focus();
|
| 308 |
-
}
|
| 309 |
-
}
|
| 310 |
-
|
| 311 |
-
const companySelect = document.getElementById('company');
|
| 312 |
-
const addPromptForm = document.getElementById('addPromptForm');
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
async function data_get_from_db(companyId) {
|
| 318 |
-
|
| 319 |
-
if (companyId) {
|
| 320 |
-
try {
|
| 321 |
-
const Response = await fetch(`/api/get_prompt_templates?company_id=${companyId}`);
|
| 322 |
-
console.log("responce from api :==> ", Response)
|
| 323 |
-
const connectorsResponse = await Response.json();
|
| 324 |
-
console.log("knowledge data table after connecting to table", connectorsResponse);
|
| 325 |
-
console.log("prompt template data table after connecting to table", connectorsResponse);
|
| 326 |
-
const table = $('#promptTable').DataTable(); // Initialize DataTable at the start
|
| 327 |
-
table.clear();
|
| 328 |
-
if (!Array.isArray(connectorsResponse)) {
|
| 329 |
-
throw new TypeError('Expected an array of companies');
|
| 330 |
-
displayErrorMessage("prompt template details do not exist for this company. Please fill in the details.");
|
| 331 |
-
contentSection.style.display = 'none';
|
| 332 |
-
} else {
|
| 333 |
-
|
| 334 |
-
connectorsResponse.forEach((company, index) => {
|
| 335 |
-
table.row.add([
|
| 336 |
-
index + 1,
|
| 337 |
-
company.scenario,
|
| 338 |
-
company.prompt,
|
| 339 |
-
`<a href='#' class='btn btn-info btn-sm'data-kid-id='${company.row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`,
|
| 340 |
-
`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${company.row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 341 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 342 |
-
// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye' fa-eye'></i></a>",
|
| 343 |
-
// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",
|
| 344 |
-
// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"
|
| 345 |
-
]).draw(false);
|
| 346 |
-
});
|
| 347 |
-
contentSection.style.display = 'block';
|
| 348 |
-
}
|
| 349 |
-
|
| 350 |
-
} catch (error) {
|
| 351 |
-
console.error('Error fetching company documents:', error);
|
| 352 |
-
//displayEmptyTable();
|
| 353 |
-
|
| 354 |
-
displayErrorMessage("Prompt template do not exist for this company. Please fill in the details by clicking add button.");
|
| 355 |
-
contentSection.style.display = 'none';
|
| 356 |
-
}
|
| 357 |
-
}
|
| 358 |
-
else {
|
| 359 |
-
// displayEmptyTable();
|
| 360 |
-
|
| 361 |
-
displayErrorMessage("Company id do not exist for this company. Please fill in the details by clicking add button.");
|
| 362 |
-
}
|
| 363 |
-
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
-
function displayErrorMessage(message) {
|
| 367 |
-
const messageContainer = document.getElementById('message-container');
|
| 368 |
-
if (messageContainer) {
|
| 369 |
-
messageContainer.innerHTML = `<div class='alert alert-danger'>${message}</div>`;
|
| 370 |
-
}
|
| 371 |
-
}
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
// Delete company
|
| 375 |
-
function deleteCompany(button) {
|
| 376 |
-
var companyId = $(button).data('kid-id');
|
| 377 |
-
console.log("k_id deleted", companyId);
|
| 378 |
-
$.ajax({
|
| 379 |
-
type: "DELETE",
|
| 380 |
-
url: `/api/prompt_template_for_del/${companyId}`,
|
| 381 |
-
success: function () {
|
| 382 |
-
var table = $('#promptTable').DataTable();
|
| 383 |
-
table.row($(button).closest('tr')).remove().draw();
|
| 384 |
-
|
| 385 |
-
//alert("Company deleted successfully.");
|
| 386 |
-
const messageContainer = document.getElementById('message-container');
|
| 387 |
-
if (messageContainer)
|
| 388 |
-
messageContainer.innerHTML = `
|
| 389 |
-
<div class='alert alert-danger'>
|
| 390 |
-
Prompt details deleted successfully
|
| 391 |
-
<button class='close' onclick='dismissMessage()'>OK</button>
|
| 392 |
-
</div>`;
|
| 393 |
-
fetchCompanies(); // Refresh the table
|
| 394 |
-
},
|
| 395 |
-
error: function (xhr) {
|
| 396 |
-
alert("Error deleting company: " + xhr.responseJSON.detail);
|
| 397 |
-
}
|
| 398 |
-
});
|
| 399 |
-
}
|
| 400 |
-
// view company ! ...
|
| 401 |
-
function viewCompany(button) {
|
| 402 |
-
var companyId = $(button).data('kid-id');
|
| 403 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 404 |
-
modalTitle.textContent = 'View Prompt Template Details';
|
| 405 |
-
console.log("view promt id (Rowid) ===> ", companyId)
|
| 406 |
-
if(companyId)
|
| 407 |
-
{
|
| 408 |
-
$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {
|
| 409 |
-
console.log("view data scenario =====> ", company.scenario)
|
| 410 |
-
console.log("view data prompt =====> ", company.prompt)
|
| 411 |
-
console.log("view data comments =====> ", company.comments)
|
| 412 |
-
$('#scenario').val(company.scenario).attr('readonly', 'readonly');
|
| 413 |
-
$('#prompt').val(company.prompts).attr('readonly', 'readonly');
|
| 414 |
-
$('#comments').val(company.comments).attr('readonly', 'readonly');
|
| 415 |
-
$('#save').hide();// Disable the "Save" button when the modal opens
|
| 416 |
-
$('#addModal').modal('show');
|
| 417 |
-
$('#saveupdate').hide();
|
| 418 |
-
}).fail(function () {
|
| 419 |
-
alert("Error retrieving company details.");
|
| 420 |
-
});
|
| 421 |
-
}
|
| 422 |
-
}
|
| 423 |
-
// Edit company details
|
| 424 |
-
|
| 425 |
-
function editCompany(button) {
|
| 426 |
-
var companyId = $(button).data('kid-id');
|
| 427 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 428 |
-
modalTitle.textContent = 'Edit Prompt Templates Details';
|
| 429 |
-
|
| 430 |
-
console.info("company id ====#> ", companyId);
|
| 431 |
-
if(companyId)
|
| 432 |
-
{
|
| 433 |
-
$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {
|
| 434 |
-
$('#scenario').val(company.scenario).removeAttr('readonly');
|
| 435 |
-
$('#prompt').val(company.prompts).removeAttr('readonly');
|
| 436 |
-
$('#comments').val(company.comments).removeAttr('readonly');
|
| 437 |
-
$('#save').hide();
|
| 438 |
-
$('#saveupdate').show();
|
| 439 |
-
|
| 440 |
-
$('#addModal').modal('show');
|
| 441 |
-
|
| 442 |
-
// Update the save button to save the edited company
|
| 443 |
-
$('#saveupdate').off('click').on('click', function () {
|
| 444 |
-
saveupdate(companyId); // Pass the company ID for updating
|
| 445 |
-
});
|
| 446 |
-
console.log(" edit process completed !")
|
| 447 |
-
}).fail(function () {
|
| 448 |
-
alert("Error retrieving company details.");
|
| 449 |
-
});
|
| 450 |
-
}
|
| 451 |
-
}
|
| 452 |
-
|
| 453 |
-
// Save the updated details
|
| 454 |
-
function saveupdate(companyId) {
|
| 455 |
-
console.log("k_id for updating process _ id ! ..,..", companyId);
|
| 456 |
-
const company_id = document.getElementById("company_id").value;
|
| 457 |
-
var formData = new FormData();
|
| 458 |
-
formData.append('scenario', $('#scenario').val());
|
| 459 |
-
formData.append('prompt', $('#prompt').val());
|
| 460 |
-
formData.append('comments', $('#comments').val());
|
| 461 |
-
console.log("edited form data saved process begin ! ....", formData);
|
| 462 |
-
|
| 463 |
-
$.ajax({
|
| 464 |
-
url: `/api/putprompttemplates/${companyId}`,
|
| 465 |
-
type: 'PUT',
|
| 466 |
-
data: formData,
|
| 467 |
-
processData: false, // Required for FormData
|
| 468 |
-
contentType: false, // Required for FormData
|
| 469 |
-
success: function (response) {
|
| 470 |
-
// alert('Prompt details updated successfully.');
|
| 471 |
-
const messageContainer = document.getElementById('message-container');
|
| 472 |
-
if (messageContainer)
|
| 473 |
-
messageContainer.innerHTML = `
|
| 474 |
-
<div class='alert alert-success'>
|
| 475 |
-
Prompt Data updated successfully
|
| 476 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 477 |
-
</div>`;
|
| 478 |
-
$('#addModal').modal('hide'); // Close the modal after saving
|
| 479 |
-
fetchUpdatedDocuments(company_id);
|
| 480 |
-
},
|
| 481 |
-
error: function () {
|
| 482 |
-
alert('Form has no changes to update prompt details.');
|
| 483 |
-
}
|
| 484 |
-
});
|
| 485 |
-
}
|
| 486 |
-
function dismissMessage() {
|
| 487 |
-
const messageContainer = document.getElementById('message-container');
|
| 488 |
-
if (messageContainer) {
|
| 489 |
-
messageContainer.innerHTML = '';
|
| 490 |
-
}
|
| 491 |
-
}
|
| 492 |
-
async function fetchUpdatedDocuments(company_id) {
|
| 493 |
-
console.log("company_id", company_id);
|
| 494 |
-
var table = $('#promptTable').DataTable();
|
| 495 |
-
const Response = await fetch(`/api/prompt_update?company_id=${company_id}`);
|
| 496 |
-
const connectorsResponse = await Response.json();
|
| 497 |
-
console.log("prompt data table after connecting to table", connectorsResponse);
|
| 498 |
-
table.clear();
|
| 499 |
-
if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {
|
| 500 |
-
//displayEmptyTable();
|
| 501 |
-
|
| 502 |
-
displayErrorMessage("Promptdetails do not exist for this company. Please fill in the details.");
|
| 503 |
-
contentSection.style.display = 'none';
|
| 504 |
-
} else {
|
| 505 |
-
|
| 506 |
-
connectorsResponse.forEach((company, index) => {
|
| 507 |
-
table.row.add([
|
| 508 |
-
|
| 509 |
-
index + 1,
|
| 510 |
-
company.scenario,
|
| 511 |
-
company.prompts,
|
| 512 |
-
`<a href='#' class='btn btn-info btn-sm'data-kid-id='${company.id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`,
|
| 513 |
-
`<a href='#' class='btn btn-warning btn-sm'data-kid-id='${company.id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`,
|
| 514 |
-
//`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`,
|
| 515 |
-
`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,
|
| 516 |
-
company.id
|
| 517 |
-
// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",
|
| 518 |
-
// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",
|
| 519 |
-
// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"
|
| 520 |
-
]).draw(false);
|
| 521 |
-
});
|
| 522 |
-
contentSection.style.display = 'block';
|
| 523 |
-
}
|
| 524 |
-
}
|
| 525 |
-
function save_file() {
|
| 526 |
-
const form = document.getElementById('addPromptForm');
|
| 527 |
-
|
| 528 |
-
// Check if the form is valid
|
| 529 |
-
if (!form.checkValidity()) {
|
| 530 |
-
// If the form is invalid, show validation messages and stop the submission
|
| 531 |
-
form.reportValidity();
|
| 532 |
-
return;
|
| 533 |
-
}
|
| 534 |
-
const company_id = $('#company_id').val();
|
| 535 |
-
const scenario = $('#scenario').val();
|
| 536 |
-
const prompt = $('#prompt').val();
|
| 537 |
-
const comments = $('#comments').val();
|
| 538 |
-
|
| 539 |
-
// const view = "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>";
|
| 540 |
-
// const edit = "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>";
|
| 541 |
-
// const dele = "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></a>";
|
| 542 |
-
|
| 543 |
-
var formData = new FormData($('#addPromptForm')[0]);
|
| 544 |
-
const messageContainer = document.getElementById('message-container');
|
| 545 |
-
formData.append("company_id", company_id),
|
| 546 |
-
formData.append("scenario", scenario),
|
| 547 |
-
formData.append("prompt", prompt),
|
| 548 |
-
formData.append("comments", comments),
|
| 549 |
-
|
| 550 |
-
//const formData = new FormData();
|
| 551 |
-
fetch('/api/save_prompt_details', {
|
| 552 |
-
method: 'POST',
|
| 553 |
-
body: formData
|
| 554 |
-
})
|
| 555 |
-
.then(response => {
|
| 556 |
-
if (!response.ok) {
|
| 557 |
-
throw new Error('Network response was not ok');
|
| 558 |
-
}
|
| 559 |
-
return response.json();
|
| 560 |
-
})
|
| 561 |
-
.then(data => {
|
| 562 |
-
const row_id = data.row_id;
|
| 563 |
-
console.log("rowid", row_id);
|
| 564 |
-
var table = $('#promptTable').DataTable();
|
| 565 |
-
var rowCount = table.rows().count();
|
| 566 |
-
const view = `<a href='#' class='btn btn-info btn-sm'data-kid-id='${row_id}' data-action="view" onclick='viewCompany(this)''><i class='fas fa-eye'></i></a>`;
|
| 567 |
-
const edit = `<a href='#' class='btn btn-warning btn-sm'data-kid-id='${row_id}' data-action="edit" onclick='editCompany(this)'><i class='fas fa-edit'></i></a>`;
|
| 568 |
-
const dele = `<a href='#' class='btn btn-danger btn-sm' data-kid-id='${row_id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`;
|
| 569 |
-
table.row.add([
|
| 570 |
-
rowCount + 1,
|
| 571 |
-
scenario,
|
| 572 |
-
prompt,
|
| 573 |
-
view,
|
| 574 |
-
edit,
|
| 575 |
-
dele
|
| 576 |
-
]).draw(false);
|
| 577 |
-
|
| 578 |
-
// const messageContainer = document.getElementById('message-container');
|
| 579 |
-
if (messageContainer)
|
| 580 |
-
messageContainer.innerHTML = `
|
| 581 |
-
<div class='alert alert-success'>
|
| 582 |
-
Data saved successfully
|
| 583 |
-
<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button>
|
| 584 |
-
</div>`;
|
| 585 |
-
$('#addModal').modal('hide');
|
| 586 |
-
document.getElementById('contentSection').style.display = 'block'; // Show the table section
|
| 587 |
-
})
|
| 588 |
-
.catch(error => console.error('Error:', error));
|
| 589 |
-
}
|
| 590 |
-
async function fetchCompanies() {
|
| 591 |
-
try {
|
| 592 |
-
const response = await fetch('/api/companies');
|
| 593 |
-
if (!response.ok) {
|
| 594 |
-
throw new Error('Network response was not ok');
|
| 595 |
-
}
|
| 596 |
-
const data = await response.json();
|
| 597 |
-
displayCompanies(data.companies);
|
| 598 |
-
} catch (error) {
|
| 599 |
-
console.error('Error fetching companies:', error);
|
| 600 |
-
}
|
| 601 |
-
}
|
| 602 |
-
|
| 603 |
-
function displayCompanies(companies) {
|
| 604 |
-
const companySelect = document.getElementById('company');
|
| 605 |
-
companySelect.innerHTML = '<option value="" selected>Select</option>'; // Reset the dropdown
|
| 606 |
-
companies.forEach(company => {
|
| 607 |
-
const option = document.createElement('option');
|
| 608 |
-
option.value = company.name;
|
| 609 |
-
option.textContent = company.name;
|
| 610 |
-
companySelect.appendChild(option);
|
| 611 |
-
});
|
| 612 |
-
}
|
| 613 |
-
function clearFormFields() {
|
| 614 |
-
document.getElementById('scenario').value = "";
|
| 615 |
-
document.getElementById('prompt').value = "";
|
| 616 |
-
document.getElementById('comments').value = "";
|
| 617 |
-
|
| 618 |
-
}
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
$(document).ready(function () {
|
| 622 |
-
$('#add').on('click', function () {
|
| 623 |
-
const modalTitle = document.getElementById('addModalLabel');
|
| 624 |
-
modalTitle.textContent = 'Add Prompt Template Details';
|
| 625 |
-
$('#scenario').removeAttr('readonly');
|
| 626 |
-
$('#prompt').removeAttr('readonly');
|
| 627 |
-
$('#comments').removeAttr('readonly');
|
| 628 |
-
$('#saveupdate').hide();
|
| 629 |
-
$('#save').show();
|
| 630 |
-
clearFormFields();
|
| 631 |
-
$('#message-container').empty(); // Clear the message container
|
| 632 |
-
$('#addModal').modal('show');
|
| 633 |
-
});
|
| 634 |
-
$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {
|
| 635 |
-
$('#addModal').modal('hide');
|
| 636 |
-
});
|
| 637 |
-
|
| 638 |
-
});
|
| 639 |
-
|
| 640 |
-
</script>
|
| 641 |
-
</body>
|
| 642 |
-
|
| 643 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/redmindlogo2.jpg
DELETED
|
Binary file (82.6 kB)
|
|
|
templates/redmindlogo3.jpg
DELETED
|
Binary file (82.6 kB)
|
|
|
templates/sidepane.html
DELETED
|
@@ -1,347 +0,0 @@
|
|
| 1 |
-
<!-- sidepane.html -->
|
| 2 |
-
<!-- This file represents the sidepane component of a web application. It contains the navigation menu and sidebar. -->
|
| 3 |
-
<!-- <!DOCTYPE html>
|
| 4 |
-
<html lang="en"> -->
|
| 5 |
-
|
| 6 |
-
<head>
|
| 7 |
-
|
| 8 |
-
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 9 |
-
<!-- Include Bootstrap JS -->
|
| 10 |
-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
|
| 11 |
-
|
| 12 |
-
<style>
|
| 13 |
-
|
| 14 |
-
/* Sidebar Styles */
|
| 15 |
-
.main-sidebar {
|
| 16 |
-
background: #222; /* Dark background for sidebar */
|
| 17 |
-
color: #fff;
|
| 18 |
-
width: 250px; /* Default width */
|
| 19 |
-
height: 600px !important;
|
| 20 |
-
position: fixed;
|
| 21 |
-
top: 0;
|
| 22 |
-
left: 0;
|
| 23 |
-
transition: all 0.3s ease;
|
| 24 |
-
/* Ensure sidebar content scrolls if needed */
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
.main-sidebar.toggled {
|
| 28 |
-
width: 60px; /* Minimized width */
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
.sidebar-header {
|
| 32 |
-
text-align: center;
|
| 33 |
-
padding: 15px;
|
| 34 |
-
background: #333; /* Dark background for header */
|
| 35 |
-
color: #fff;
|
| 36 |
-
border-radius: 5px;
|
| 37 |
-
margin-bottom: 15px;
|
| 38 |
-
display: flex;
|
| 39 |
-
align-items: center;
|
| 40 |
-
justify-content: center;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
.sidebar-header i {
|
| 44 |
-
font-size: 1.5rem;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
.sidebar-header .menu-text {
|
| 48 |
-
font-size: 14px;
|
| 49 |
-
font-weight: bold;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
/* Navigation Menu */
|
| 53 |
-
.nav-link {
|
| 54 |
-
display: flex;
|
| 55 |
-
align-items: center;
|
| 56 |
-
color: #fff;
|
| 57 |
-
padding: 10px;
|
| 58 |
-
border-radius: 5px;
|
| 59 |
-
transition: background-color 0.3s ease;
|
| 60 |
-
text-decoration: none;
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
.nav-link:hover {
|
| 64 |
-
background-color: #F8BE12; /* Highlight color on hover */
|
| 65 |
-
color: #fff;
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
.menu-text {
|
| 69 |
-
margin-left: 10px;
|
| 70 |
-
font-weight: bold;
|
| 71 |
-
color: #fff;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
/* Sidebar Icon Sizes */
|
| 75 |
-
.nav-icon {
|
| 76 |
-
font-size: 20px;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/* Hide menu text when sidebar is collapsed */
|
| 80 |
-
.main-sidebar.toggled .menu-text {
|
| 81 |
-
display: none;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
/* Content Wrapper */
|
| 85 |
-
#content-wrapper {
|
| 86 |
-
margin-left: 250px;
|
| 87 |
-
padding: 15px;
|
| 88 |
-
height: 700px !important;
|
| 89 |
-
transition: margin-left 0.3s ease;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
#content-wrapper.toggled {
|
| 93 |
-
margin-left: 60px;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
/* Responsive Design */
|
| 97 |
-
@media (max-width: 991px) {
|
| 98 |
-
.main-sidebar {
|
| 99 |
-
width: 60px; /* Default to minimized on small screens */
|
| 100 |
-
|
| 101 |
-
}
|
| 102 |
-
|
| 103 |
-
#content-wrapper {
|
| 104 |
-
margin-left: 60px;
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
.main-sidebar.toggled + #content-wrapper {
|
| 108 |
-
margin-left: 0;
|
| 109 |
-
}
|
| 110 |
-
}
|
| 111 |
-
</style>
|
| 112 |
-
|
| 113 |
-
<nav class="main-header navbar navbar-expand navbar-light bg-white shadow-sm" style="padding: 15px; ">
|
| 114 |
-
<div class="container-fluid d-flex justify-content-between align-items-center">
|
| 115 |
-
<!-- Toggle Sidebar Button -->
|
| 116 |
-
<button class="btn btn-outline-secondary" id="sidebarToggle" style="margin-right: 15px;">
|
| 117 |
-
<i class="fas fa-bars"></i>
|
| 118 |
-
</button>
|
| 119 |
-
|
| 120 |
-
<!-- Logo and Title Section -->
|
| 121 |
-
<div class="d-flex align-items-center">
|
| 122 |
-
<img src="/static/img/redmindlogo3.jpg" alt="Logo" style="width: 70px; height: auto; margin-right: 15px;">
|
| 123 |
-
<h3 class="m-0" style="font-weight: 500;">RedMindGPT - {{title}}</h3>
|
| 124 |
-
</div>
|
| 125 |
-
|
| 126 |
-
<!-- Buttons Section -->
|
| 127 |
-
<div>
|
| 128 |
-
<button class="btn btn-primary me-3" id="add">Add</button>
|
| 129 |
-
<button class="btn btn-primary" onclick="logout()">Logout</button>
|
| 130 |
-
</div>
|
| 131 |
-
</div>
|
| 132 |
-
</nav>
|
| 133 |
-
<div id="wrapper">
|
| 134 |
-
<!-- Main Sidebar Container -->
|
| 135 |
-
<aside class="main-sidebar sidebar-custom elevation-4" id="sidebarPanel">
|
| 136 |
-
<!-- Sidebar -->
|
| 137 |
-
<div class="sidebar">
|
| 138 |
-
<!-- Sidebar Menu -->
|
| 139 |
-
<nav class="mt-2">
|
| 140 |
-
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false" id="sidebarMenu">
|
| 141 |
-
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 142 |
-
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 143 |
-
<div class="form-group"style="display: none;">
|
| 144 |
-
<label for="llm_tools" >LLM Tools<span class="text-danger">*</span></label>
|
| 145 |
-
<select class="form-control" id="llm_tools" name="llm_tools" multiple required style="display: none;">
|
| 146 |
-
<option value="Database">Database</option>
|
| 147 |
-
<option value="Static Documents">Static Documents</option>
|
| 148 |
-
<option value="API">API</option>
|
| 149 |
-
</select>
|
| 150 |
-
<div class="invalid-feedback">
|
| 151 |
-
Please select at least one LLM tool.
|
| 152 |
-
</div>
|
| 153 |
-
</div>
|
| 154 |
-
|
| 155 |
-
<li class="nav-item">
|
| 156 |
-
<a href="{{url_for('dashboard')}}" class="nav-link">
|
| 157 |
-
<i class="nav-icon fas fa-home"></i>
|
| 158 |
-
<p>Dashboard</p>
|
| 159 |
-
</a>
|
| 160 |
-
</li>
|
| 161 |
-
<li class="nav-item">
|
| 162 |
-
<div class="sidebar-header">
|
| 163 |
-
<i class="nav-icon fas fa-building"></i>
|
| 164 |
-
<span class="menu-text" id="selectedCompany">Select a company</span> <!-- Initial text as fallback -->
|
| 165 |
-
<!-- <span class="menu-text" id="selectedCompany">{{company_name}}</span> -->
|
| 166 |
-
</div>
|
| 167 |
-
</li>
|
| 168 |
-
|
| 169 |
-
<li class="nav-item" >
|
| 170 |
-
<a href="{{ url_for('company_profile') }}" class="nav-link">
|
| 171 |
-
<i class="nav-icon fas fa-users"></i>
|
| 172 |
-
<p>Company Profile</p>
|
| 173 |
-
</a>
|
| 174 |
-
</li>
|
| 175 |
-
<li class="nav-item" id="knowledgebase_link">
|
| 176 |
-
<a href="{{ url_for('knowledgebase') }}" class="nav-link">
|
| 177 |
-
<i class="nav-icon fas fa-cogs"></i>
|
| 178 |
-
<p>KnowledgeBase</p>
|
| 179 |
-
</a>
|
| 180 |
-
</li>
|
| 181 |
-
<li class="nav-item" id="data_connectors_link">
|
| 182 |
-
<a href="{{ url_for('data_connectors') }}" class="nav-link">
|
| 183 |
-
<i class="nav-icon fas fa-cogs"></i>
|
| 184 |
-
<p>Data Connectors</p>
|
| 185 |
-
</a>
|
| 186 |
-
</li>
|
| 187 |
-
<li class="nav-item" id="api_connectors_link">
|
| 188 |
-
<a href="{{ url_for('API_connectors') }}" class="nav-link">
|
| 189 |
-
<i class="nav-icon fas fa-cogs"></i>
|
| 190 |
-
<p>API Connectors</p>
|
| 191 |
-
</a>
|
| 192 |
-
</li>
|
| 193 |
-
<li class="nav-item">
|
| 194 |
-
<a href="{{url_for('prompt_template')}}" class="nav-link">
|
| 195 |
-
<i class="nav-icon fas fa-cogs"></i>
|
| 196 |
-
<p>Prompt Templates</p>
|
| 197 |
-
</a>
|
| 198 |
-
</li>
|
| 199 |
-
<!--<li class="nav-item">
|
| 200 |
-
<a href="#" class="nav-link">
|
| 201 |
-
<i class="nav-icon fas fa-cogs"></i>
|
| 202 |
-
<p>LLM Settings</p>
|
| 203 |
-
</a>
|
| 204 |
-
<ul class="nav nav-treeview">
|
| 205 |
-
<li class="nav-item">
|
| 206 |
-
<a href="#" class="nav-link">
|
| 207 |
-
<i class="far fa-circle nav-icon"></i>
|
| 208 |
-
<p>Sublink 1</p>
|
| 209 |
-
</a>
|
| 210 |
-
</li>
|
| 211 |
-
<li class="nav-item">
|
| 212 |
-
<a href="#" class="nav-link">
|
| 213 |
-
<i class="far fa-circle nav-icon"></i>
|
| 214 |
-
<p>Sublink 2</p>
|
| 215 |
-
</a>
|
| 216 |
-
</li>
|
| 217 |
-
|
| 218 |
-
</ul>
|
| 219 |
-
</li> -->
|
| 220 |
-
|
| 221 |
-
<!-- Add more navigation links here -->
|
| 222 |
-
</ul>
|
| 223 |
-
</nav>
|
| 224 |
-
<!-- /.sidebar-menu -->
|
| 225 |
-
</div>
|
| 226 |
-
<!-- /.sidebar -->
|
| 227 |
-
</aside>
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
<input type="hidden" id="userRole" name="userRole" value={{role}}>
|
| 231 |
-
<input type="hidden" id="company_id" name="company_id" value={{company_id}}>
|
| 232 |
-
<div class="form-group"style="display: none;">
|
| 233 |
-
<label for="llm_tools" >LLM Tools<span class="text-danger">*</span></label>
|
| 234 |
-
<select class="form-control" id="llm_tools" name="llm_tools" multiple required style="display: none;">
|
| 235 |
-
<option value="Database">Database</option>
|
| 236 |
-
<option value="Static Documents">Static Documents</option>
|
| 237 |
-
<option value="API">API</option>
|
| 238 |
-
</select>
|
| 239 |
-
<div class="invalid-feedback">
|
| 240 |
-
Please select at least one LLM tool.
|
| 241 |
-
</div>
|
| 242 |
-
</div>
|
| 243 |
-
</div>
|
| 244 |
-
|
| 245 |
-
<!-- AdminLTE JS -->
|
| 246 |
-
|
| 247 |
-
<script >
|
| 248 |
-
|
| 249 |
-
function logout() {
|
| 250 |
-
sessionStorage.removeItem('role');
|
| 251 |
-
sessionStorage.clear();
|
| 252 |
-
window.location.href = '/';
|
| 253 |
-
}
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
document.addEventListener("DOMContentLoaded", function() {
|
| 257 |
-
|
| 258 |
-
const company_id1 = document.getElementById("company_id").value;
|
| 259 |
-
const role1 = document.getElementById("userRole").value;
|
| 260 |
-
sessionStorage.setItem('siderole1',role1);
|
| 261 |
-
sessionStorage.setItem('sidecompanyId1',company_id1);
|
| 262 |
-
|
| 263 |
-
const sidecompanyId = sessionStorage.getItem('sidecompanyId1');
|
| 264 |
-
const siderole = sessionStorage.getItem('siderole1');
|
| 265 |
-
if (siderole==='admin') {
|
| 266 |
-
console.log("Company ID inside sidepane:", sidecompanyId);
|
| 267 |
-
console.log("Role inside sidepane:",siderole);
|
| 268 |
-
editCompany(sidecompanyId,siderole);
|
| 269 |
-
|
| 270 |
-
console.log("inside admin after edit");
|
| 271 |
-
updateLinkVisibility(siderole);
|
| 272 |
-
|
| 273 |
-
}
|
| 274 |
-
|
| 275 |
-
});
|
| 276 |
-
|
| 277 |
-
async function updateLinkVisibility(siderole) {
|
| 278 |
-
//const role = sessionStorage.getItem('role');
|
| 279 |
-
if(siderole==='admin')
|
| 280 |
-
{
|
| 281 |
-
const displayState = JSON.parse(sessionStorage.getItem('displayState'));
|
| 282 |
-
|
| 283 |
-
// Update the visibility of links based on the stored state
|
| 284 |
-
document.getElementById('api_connectors_link').style.display = displayState.apiConnectors;
|
| 285 |
-
document.getElementById('knowledgebase_link').style.display = displayState.knowledgeBase;
|
| 286 |
-
document.getElementById('data_connectors_link').style.display = displayState.dataConnectors
|
| 287 |
-
}
|
| 288 |
-
}
|
| 289 |
-
async function editCompany(sidecompanyId,siderole) {
|
| 290 |
-
console.log("inside edit company id", sidecompanyId);
|
| 291 |
-
console.log("inside edit role role",siderole);
|
| 292 |
-
$.getJSON(`/api/getcompanydetails/${sidecompanyId}`, function (company) {
|
| 293 |
-
// Set the value of #llm_tools and trigger change event
|
| 294 |
-
$('#llm_tools').val(company.llm_tools.split(',')).trigger('change');
|
| 295 |
-
|
| 296 |
-
// Get the selected values from #llm_tools
|
| 297 |
-
const llmTools = $('#llm_tools').val(); // This is an array
|
| 298 |
-
|
| 299 |
-
console.log("inside sidepane edit llmTools", llmTools);
|
| 300 |
-
//const role =sessionStorage.getItem('role');
|
| 301 |
-
|
| 302 |
-
if (llmTools && llmTools.length > 0) {
|
| 303 |
-
console.log("inside if");
|
| 304 |
-
|
| 305 |
-
// Example: Conditionally display some links based on llm_tools
|
| 306 |
-
if (api_connectors_link) {
|
| 307 |
-
api_connectors_link.style.display = llmTools.includes('API') ? 'block' : 'none';
|
| 308 |
-
console.log("state api",api_connectors_link.style.display );
|
| 309 |
-
}
|
| 310 |
-
|
| 311 |
-
if (knowledgebase_link) {
|
| 312 |
-
knowledgebase_link.style.display = llmTools.includes('Static Documents') ? 'block' : 'none';
|
| 313 |
-
console.log("state know", knowledgebase_link.style.display);
|
| 314 |
-
}
|
| 315 |
-
|
| 316 |
-
if (data_connectors_link) {
|
| 317 |
-
data_connectors_link.style.display = llmTools.includes('Database') ? 'block' : 'none';
|
| 318 |
-
console.log("state dataconn", data_connectors_link.style.display);
|
| 319 |
-
}
|
| 320 |
-
|
| 321 |
-
console.log("inside storageadmin");
|
| 322 |
-
sessionStorage.setItem('displayState', JSON.stringify({
|
| 323 |
-
apiConnectors: api_connectors_link.style.display,
|
| 324 |
-
knowledgeBase: knowledgebase_link.style.display ,
|
| 325 |
-
dataConnectors: data_connectors_link.style.display
|
| 326 |
-
|
| 327 |
-
}));
|
| 328 |
-
updateLinkVisibility(siderole);
|
| 329 |
-
}
|
| 330 |
-
|
| 331 |
-
}).fail(function () {
|
| 332 |
-
alert("Error retrieving company details.");
|
| 333 |
-
});
|
| 334 |
-
|
| 335 |
-
}
|
| 336 |
-
document.getElementById('sidebarToggle').addEventListener('click', function() {
|
| 337 |
-
const sidebar = document.getElementById('sidebarPanel');
|
| 338 |
-
const contentWrapper = document.getElementById('content-wrapper');
|
| 339 |
-
|
| 340 |
-
// Toggle sidebar width and content margin
|
| 341 |
-
sidebar.classList.toggle('toggled');
|
| 342 |
-
contentWrapper.classList.toggle('toggled');
|
| 343 |
-
});
|
| 344 |
-
</script>
|
| 345 |
-
|
| 346 |
-
</head>
|
| 347 |
-
<!-- </html> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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