Spaces:
Runtime error
Runtime error
Update templates/prompt_template.html
Browse files17 unmodified lines18192021222324252627282930313212 unmodified lines4546474849505126 unmodified lines78798081828384858687887 unmodified lines969798991001011029 unmodified lines11211311411511611711811912012112212312411 unmodified lines13613713813914014175 unmodified lines21721821922022122222322425 unmodified lines2502512522532542552566 unmodified lines26326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332431 unmodified lines35635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839911 unmodified lines4114124134144154164174184194204214222 unmodified lines4254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305316 unmodified lines5385395405415425435445 unmodified lines5505515525535545555566 unmodified lines5635645655665675685695705715725735743 unmodified lines57857958058158258358458558658758858929 unmodified lines61962062162262362417 unmodified linesjustify-content: space-between;align-items: center;}.card {padding: 0;margin-top: -15px;margin-left: -40px;}.table-container {width: 100%;overflow-x: auto;}.wrapper {12 unmodified lines}div.dataTables_wrapper div.dataTables_length select{width: 60px;display: inline-block;}26 unmodified lines/* view column*/width: 5%;}th:nth-child(5),td:nth-child(5) {/* view column*/width: 5%;}th:nth-child(6),td:nth-child(6) {/* view column*/7 unmodified lines.viewButton {size: 2px;}div.dataTables_wrapper div.dataTables_length select{width: 60px;display: inline-block;}9 unmodified lines<div class="content-header"><div class="container-fluid"><div class="container mt-2"><div class="form-group left-align"><label for="company" class="mr-1" style="margin-left:-60px;margin-top:-11px;">Company Name <span class="text-danger">*</span></label><select type="text" id="company" name="company" class="form-control "style="width: 20%;margin-left:-60px;" required><option value="" selected>Select</option></select><div class="col-12 d-flex justify-content-end mb-2"><button class="btn btn-primary" style="margin-top:-40px;margin-right: -25px;position: fixed;" id="add">Add</button><!-- <button class="btn btn-primary" style="margin-top: 20px;" id="add">Add</button> --></div>11 unmodified lines<input type="hidden" id="company_id" name="company_id" class="form-control" required></div></div><!-- Main content--><section class="content"><div class="container-fluid">75 unmodified lines</div><!-- Modal --><div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"aria-hidden="true">25 unmodified lines</form></div><div class="modal-footer"><button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button><!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> --><button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button></div>6 unmodified lines<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script><script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script><script>$(document).ready(function () {$('#add').on('click', function () {const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'Add Prompt Template Details';$('#scenario').removeAttr('readonly');$('#prompt').removeAttr('readonly');$('#comments').removeAttr('readonly');$('#saveupdate').hide();$('#save').show();clearFormFields();$('#message-container').empty(); // Clear the message container$('#addModal').modal('show');});$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {$('#addModal').modal('hide');});});document.addEventListener("DOMContentLoaded", function () {// clearFormFields();fetchCompanies();const companySelect = document.getElementById('company');const addPromptForm = document.getElementById('addPromptForm');const table = $('#promptTable').DataTable();// Initialize DataTable at the startcompanySelect.addEventListener('change', async function () {$("#message-container").empty();const selectedCompanyName = companySelect.options[companySelect.selectedIndex].text;console.log(`Selected Company Name: ${selectedCompanyName}`);if (selectedCompanyName !== "Select") {try {const response = await fetch(`/api/company_id?company_name=${encodeURIComponent(selectedCompanyName)}`);if (!response.ok) {contentSection.style.display = 'none';("company id does not exist for name does not exist. Please fill in the details.");const messageContainer = document.getElementById('message-container');if (messageContainer) {messageContainer.innerHTML = "<div class='alert alert-danger'>Promptdetails do not exist for this company. Please fill in the details.</div>";}throw new Error('Network response was not ok');}const data = await response.json();console.log('data returned', data);console.log(`Company ID: ${data.company_id}`);const companyId = data.company_id;document.getElementById('company_id').value = companyId;if (companyId) {try {const Response = await fetch(`/api/get_prompt_templates?company_id=${companyId}&company_name=${selectedCompanyName}`);const connectorsResponse = await Response.json();console.log("prompt template data table after connecting to table", connectorsResponse);table.clear();if (!Array.isArray(connectorsResponse)) {throw new TypeError('Expected an array of companies');31 unmodified linesdisplayErrorMessage("Company id do not exist for this company. Please fill in the details by clicking add button.");}} catch (error) {console.error('No details for this company ID or data documents:', error);// displayEmptyTable();displayErrorMessage("Prompt details do not exist for this company. Please fill in the details.");contentSection.style.display = 'none';}} else {table.clear().draw();document.getElementById('contentSection').style.display = 'none';// Optionally, you might want to clear the form fields as wellclearFormFields();}});function displayErrorMessage(message) {const messageContainer = document.getElementById('message-container');if (messageContainer) {messageContainer.innerHTML = `<div class='alert alert-danger'>${message}</div>`;}}});// Delete companyfunction deleteCompany(button) {var companyId = $(button).data('kid-id');console.log("k_id deleted",companyId);$.ajax({type: "DELETE",url: `/api/prompt_template_for_del/${companyId}`,success: function () {var table = $('#promptTable').DataTable();table.row($(button).closest('tr')).remove().draw();//alert("Company deleted successfully.");const messageContainer = document.getElementById('message-container');if(messageContainer)messageContainer.innerHTML = `<div class='alert alert-danger'>Prompt details deleted successfully11 unmodified linesvar companyId = $(button).data('kid-id');const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'View Prompt Template Details';console.log("view promt id (Rowid) ===> " , companyId)$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {console.log("view data scenario =====> ",company.scenario)console.log("view data prompt =====> ",company.prompt)console.log("view data comments =====> ",company.comments)$('#scenario').val(company.scenario).attr('readonly','readonly');$('#prompt').val(company.prompts).attr('readonly', 'readonly');$('#comments').val(company.comments).attr('readonly', 'readonly');$('#save').hide();// Disable the "Save" button when the modal opens2 unmodified lines}).fail(function () {alert("Error retrieving company details.");});}// Edit company detailsfunction editCompany(button) {var companyId = $(button).data('kid-id');const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'Edit Prompt Templates Details';console.info("company id ====#> ", companyId);$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {$('#scenario').val(company.scenario).removeAttr('readonly');$('#prompt').val(company.prompts).removeAttr('readonly');$('#comments').val(company.comments).removeAttr('readonly');$('#save').hide();$('#saveupdate').show();$('#addModal').modal('show');// Update the save button to save the edited company$('#saveupdate').off('click').on('click', function () {saveupdate(companyId); // Pass the company ID for updating});console.log(" edit process completed !")}).fail(function () {alert("Error retrieving company details.");});}// Save the updated detailsfunction saveupdate(companyId) {console.log("k_id for updating process _ id ! ..,..", companyId);const company_id=document.getElementById("company_id").value;var formData = new FormData();formData.append('scenario', $('#scenario').val());formData.append('prompt', $('#prompt').val());formData.append('comments', $('#comments').val());console.log("edited form data saved process begin ! ....", formData);$.ajax({url: `/api/putprompttemplates/${companyId}`,type: 'PUT',data: formData,processData: false, // Required for FormDatacontentType: false, // Required for FormDatasuccess: function (response) {// alert('Prompt details updated successfully.');const messageContainer = document.getElementById('message-container');if(messageContainer)messageContainer.innerHTML = `<div class='alert alert-success'>Prompt Data updated successfully<button class='close' onclick='dismissMessage()'>OK</button></div>`;$('#addModal').modal('hide'); // Close the modal after savingfetchUpdatedDocuments(company_id);},error: function () {alert('Form has no changes to update prompt details.');}});}function dismissMessage() {const messageContainer = document.getElementById('message-container');if (messageContainer) {messageContainer.innerHTML = '';}}async function fetchUpdatedDocuments(company_id) {console.log("company_id",company_id);var table = $('#promptTable').DataTable();const Response = await fetch(`/api/prompt_update?company_id=${company_id}`);const connectorsResponse = await Response.json();console.log("prompt data table after connecting to table", connectorsResponse);table.clear();if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {//displayEmptyTable();displayErrorMessage("Promptdetails do not exist for this company. Please fill in the details.");contentSection.style.display = 'none';} else {connectorsResponse.forEach((company, index) => {table.row.add([index + 1,company.scenario,company.prompts,`<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>`,`<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>`,//`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`,`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,company.id// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"]).draw(false);});contentSection.style.display = 'block';}}function save_file() {const form = document.getElementById('addPromptForm');// Check if the form is valid6 unmodified linesconst scenario = $('#scenario').val();const prompt = $('#prompt').val();const comments = $('#comments').val();// const view = "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>";// const edit = "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>";// const dele = "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></a>";5 unmodified linesformData.append("prompt", prompt),formData.append("comments", comments),//const formData = new FormData();fetch('/api/save_prompt_details', {method: 'POST',body: formData6 unmodified lines}).then(data => {const row_id = data.row_id;console.log("rowid",row_id);var table = $('#promptTable').DataTable();var rowCount = table.rows().count();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>`;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>`;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>`;table.row.add([rowCount + 1,scenario,3 unmodified linesdele]).draw(false);// const messageContainer = document.getElementById('message-container');if(messageContainer)messageContainer.innerHTML = `<div class='alert alert-success'>Data saved successfully<button class='close' onclick='dismissMessage()'>OK</button></div>`;$('#addModal').modal('hide');document.getElementById('contentSection').style.display = 'block'; // Show the table section29 unmodified linesdocument.getElementById('comments').value = "";}</script></body>17 unmodified lines181920212223242526272829303132333412 unmodified lines4748495051525326 unmodified lines808182838485868788899091927 unmodified lines1001011021031041051061079 unmodified lines11711811912012112212312412512612712812913013113213311 unmodified lines14514614714814915015115275 unmodified lines22822923023123223325 unmodified lines2592602612622632642656 unmodified lines27227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832931 unmodified lines36136236336436536636736836937037137237337437537637737837938038138238338438511 unmodified lines3973983994004014024034044054064074084094102 unmodified lines4134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225236 unmodified lines5305315325335345355365 unmodified lines5425435445455465475486 unmodified lines5555565575585595605615625635645655663 unmodified lines57057157257357457557657757857958058129 unmodified lines61161261361461561661761861962062162262362462562662762862963063163263363463563663717 unmodified linesjustify-content: space-between;align-items: center;}.card {padding: 0;margin-top: -15px;margin-left: -40px;}.table-container {width: 100%;overflow-x: auto;}.wrapper {12 unmodified lines}div.dataTables_wrapper div.dataTables_length select {width: 60px;display: inline-block;}26 unmodified lines/* view column*/width: 5%;}th:nth-child(5),td:nth-child(5) {/* view column*/width: 5%;}th:nth-child(6),td:nth-child(6) {/* view column*/7 unmodified lines.viewButton {size: 2px;}div.dataTables_wrapper div.dataTables_length select {width: 60px;display: inline-block;}9 unmodified lines<div class="content-header"><div class="container-fluid"><div class="container mt-2"><div class="form-group left-align" id="company-select"><!-- <label for="company" class="mr-1" style="margin-left:-60px;margin-top:-11px;">Company Name<span class="text-danger">*</span></label><select type="text" id="company" name="company" class="form-control "style="width: 20%;margin-left:-60px;" required><option value="" selected>Select</option></select> --><h4 id="selectedCompany" style="margin-left: 300px;"></h4><div class="col-12 d-flex justify-content-end mb-2"><button class="btn btn-primary"style="margin-top:-40px;margin-right: -25px;position: fixed;" id="add">Add</button><!-- <button class="btn btn-primary" style="margin-top: 20px;" id="add">Add</button> --></div>11 unmodified lines<input type="hidden" id="company_id" name="company_id" class="form-control" required></div></div><!-- Main content--><section class="content"><div class="container-fluid">75 unmodified lines</div><!-- Modal --><div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"aria-hidden="true">25 unmodified lines</form></div><div class="modal-footer"><button type="button" id="saveupdate" class="btn btn-primary" style="display: none;">Update</button><!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> --><button type="button" id="save" onclick="save_file()" class="btn btn-primary">Save</button></div>6 unmodified lines<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script><script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script><script>var table = $('#promptTable').DataTable();const role = sessionStorage.getItem('userRole');console.log('Current role:', role); // Debug statement to check the roleconst passedCompanyName = sessionStorage.getItem('company_name')document.getElementById('selectedCompany').innerText = `Company name: ${passedCompanyName}`;const company_id = sessionStorage.getItem('company_id');document.getElementById("company_id").value = company_id;data_get_from_db(company_id);// if (role === 'superadmin') {// const storecompany_id = sessionStorage.getItem('company_id');// data_get_from_db(storecompany_id);// document.getElementById('company-select').style.display = 'block';// //var companyId = getCookie('company_id')// //console.log("company id for superadmin",storecompany_id);// fetchCompanies();// } else {// document.getElementById('company-select').style.display = 'block';// const storecompany_id = sessionStorage.getItem('company_id');// console.log('Current company_id:', storecompany_id); // Debug statement to check the role// data_get_from_db(storecompany_id);// }function moveToNextInput(inputs, currentIndex) {const nextInput = inputs[currentIndex + 1];if (nextInput) {nextInput.focus();} else {// Optionally, submit the form or trigger the save buttondocument.getElementById("save").focus();}}const companySelect = document.getElementById('company');const addPromptForm = document.getElementById('addPromptForm');async function data_get_from_db(companyId) {if (companyId) {try {const Response = await fetch(`/api/get_prompt_templates?company_id=${companyId}`);console.log("responce from api :==> ", Response)const connectorsResponse = await Response.json();console.log("knowledge data table after connecting to table", connectorsResponse);console.log("prompt template data table after connecting to table", connectorsResponse);const table = $('#promptTable').DataTable(); // Initialize DataTable at the starttable.clear();if (!Array.isArray(connectorsResponse)) {throw new TypeError('Expected an array of companies');31 unmodified linesdisplayErrorMessage("Company id do not exist for this company. Please fill in the details by clicking add button.");}}// Delete companyfunction deleteCompany(button) {var companyId = $(button).data('kid-id');console.log("k_id deleted", companyId);$.ajax({type: "DELETE",url: `/api/prompt_template_for_del/${companyId}`,success: function () {var table = $('#promptTable').DataTable();table.row($(button).closest('tr')).remove().draw();//alert("Company deleted successfully.");const messageContainer = document.getElementById('message-container');if (messageContainer)messageContainer.innerHTML = `<div class='alert alert-danger'>Prompt details deleted successfully11 unmodified linesvar companyId = $(button).data('kid-id');const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'View Prompt Template Details';console.log("view promt id (Rowid) ===> ", companyId)if(companyId){$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {console.log("view data scenario =====> ", company.scenario)console.log("view data prompt =====> ", company.prompt)console.log("view data comments =====> ", company.comments)$('#scenario').val(company.scenario).attr('readonly', 'readonly');$('#prompt').val(company.prompts).attr('readonly', 'readonly');$('#comments').val(company.comments).attr('readonly', 'readonly');$('#save').hide();// Disable the "Save" button when the modal opens2 unmodified lines}).fail(function () {alert("Error retrieving company details.");});}}// Edit company detailsfunction editCompany(button) {var companyId = $(button).data('kid-id');const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'Edit Prompt Templates Details';console.info("company id ====#> ", companyId);if(companyId){$.getJSON(`/api/getpromttemplate/${companyId}`, function (company) {$('#scenario').val(company.scenario).removeAttr('readonly');$('#prompt').val(company.prompts).removeAttr('readonly');$('#comments').val(company.comments).removeAttr('readonly');$('#save').hide();$('#saveupdate').show();$('#addModal').modal('show');// Update the save button to save the edited company$('#saveupdate').off('click').on('click', function () {saveupdate(companyId); // Pass the company ID for updating});console.log(" edit process completed !")}).fail(function () {alert("Error retrieving company details.");});}}// Save the updated detailsfunction saveupdate(companyId) {console.log("k_id for updating process _ id ! ..,..", companyId);const company_id = document.getElementById("company_id").value;var formData = new FormData();formData.append('scenario', $('#scenario').val());formData.append('prompt', $('#prompt').val());formData.append('comments', $('#comments').val());console.log("edited form data saved process begin ! ....", formData);$.ajax({url: `/api/putprompttemplates/${companyId}`,type: 'PUT',data: formData,processData: false, // Required for FormDatacontentType: false, // Required for FormDatasuccess: function (response) {// alert('Prompt details updated successfully.');const messageContainer = document.getElementById('message-container');if (messageContainer)messageContainer.innerHTML = `<div class='alert alert-success'>Prompt Data updated successfully<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button></div>`;$('#addModal').modal('hide'); // Close the modal after savingfetchUpdatedDocuments(company_id);},error: function () {alert('Form has no changes to update prompt details.');}});}function dismissMessage() {const messageContainer = document.getElementById('message-container');if (messageContainer) {messageContainer.innerHTML = '';}}async function fetchUpdatedDocuments(company_id) {console.log("company_id", company_id);var table = $('#promptTable').DataTable();const Response = await fetch(`/api/prompt_update?company_id=${company_id}`);const connectorsResponse = await Response.json();console.log("prompt data table after connecting to table", connectorsResponse);table.clear();if (!Array.isArray(connectorsResponse) || connectorsResponse.length === 0) {//displayEmptyTable();displayErrorMessage("Promptdetails do not exist for this company. Please fill in the details.");contentSection.style.display = 'none';} else {connectorsResponse.forEach((company, index) => {table.row.add([index + 1,company.scenario,company.prompts,`<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>`,`<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>`,//`<a href='#' class='btn btn-danger btn-sm' onclick='deleteCompany(${company.company_id})'><i class='fas fa-trash'></i></a>`,`<a href='#' class='btn btn-danger btn-sm' data-kid-id='${company.id}' onclick='deleteCompany(this)'><i class='fas fa-trash'></i></a>`,company.id// "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>",// "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>",// "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></button>"]).draw(false);});contentSection.style.display = 'block';}}function save_file() {const form = document.getElementById('addPromptForm');// Check if the form is valid6 unmodified linesconst scenario = $('#scenario').val();const prompt = $('#prompt').val();const comments = $('#comments').val();// const view = "<a href='#' class='btn btn-info btn-sm'><i class='fas fa-eye'></i></a>";// const edit = "<a href='#' class='btn btn-warning btn-sm'><i class='fas fa-edit'></i></a>";// const dele = "<a href='#' class='btn btn-danger btn-sm'><i class='fas fa-trash'></i></a>";5 unmodified linesformData.append("prompt", prompt),formData.append("comments", comments),//const formData = new FormData();fetch('/api/save_prompt_details', {method: 'POST',body: formData6 unmodified lines}).then(data => {const row_id = data.row_id;console.log("rowid", row_id);var table = $('#promptTable').DataTable();var rowCount = table.rows().count();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>`;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>`;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>`;table.row.add([rowCount + 1,scenario,3 unmodified linesdele]).draw(false);// const messageContainer = document.getElementById('message-container');if (messageContainer)messageContainer.innerHTML = `<div class='alert alert-success'>Data saved successfully<button class='close' style='font-size:medium;margin-top:6px;' onclick='dismissMessage()'>OK</button></div>`;$('#addModal').modal('hide');document.getElementById('contentSection').style.display = 'block'; // Show the table section29 unmodified linesdocument.getElementById('comments').value = "";}$(document).ready(function () {$('#add').on('click', function () {const modalTitle = document.getElementById('addModalLabel');modalTitle.textContent = 'Add Prompt Template Details';$('#scenario').removeAttr('readonly');$('#prompt').removeAttr('readonly');$('#comments').removeAttr('readonly');$('#saveupdate').hide();$('#save').show();clearFormFields();$('#message-container').empty(); // Clear the message container$('#addModal').modal('show');});$('.modal-footer .btn-secondary, .modal-header .close').on('click', function () {$('#addModal').modal('hide');});});</script></body>
templates/prompt_template.html+204-191