diff --git a/customprompts/mzta-custom-prompts.css b/customprompts/mzta-custom-prompts.css index 06c260c8..ca159d22 100644 --- a/customprompts/mzta-custom-prompts.css +++ b/customprompts/mzta-custom-prompts.css @@ -1,6 +1,6 @@ @media (prefers-color-scheme: dark) { body { - background-color: rgb(35, 34, 43); + background-color: #1C1B22; color: rgb(251, 251, 254); } @@ -8,5 +8,40 @@ a:visited { color: #409EFF; } a:hover { color: #66B1FF; } a:active { color: #66B1FF; } - + + table { + background-color: #1C1B22; + } + + table th { + background-color: #23222B; + border: 1px solid rgb(251, 251, 254); + color: rgb(194, 194, 194); + padding: 8px; + text-align: left; + } +} + +table { + border-collapse: collapse; + border-spacing: 0; + border: 1px solid #ccc; +} + +table tr { + border-bottom: 1px solid #ccc; +} + +table th { + padding: 8px; + text-align: left; +} + +table td { + border: 1px solid #ddd; + padding: 8px; +} + +table td.properties{ + white-space: nowrap; } diff --git a/customprompts/mzta-custom-prompts.html b/customprompts/mzta-custom-prompts.html index aea8ebee..a7cc8a2d 100644 --- a/customprompts/mzta-custom-prompts.html +++ b/customprompts/mzta-custom-prompts.html @@ -10,7 +10,21 @@

Manage Prompts

Manage your custom prompts.

- +
+ + + + + + + + + + + +
IDNameTextProperties
+
+ diff --git a/customprompts/mzta-custom-prompts.js b/customprompts/mzta-custom-prompts.js index 6a60ecf0..378a4400 100644 --- a/customprompts/mzta-custom-prompts.js +++ b/customprompts/mzta-custom-prompts.js @@ -16,3 +16,58 @@ * along with this program. If not, see . */ +import { defaultPrompts } from "../js/mzta-prompts.js"; + +document.addEventListener('DOMContentLoaded', async () => { + let options = { + valueNames: [ 'id', 'name', 'text', 'type', 'action', { name: 'need_selected', attr: 'checked_val'}, { name: 'need_signature', attr: 'checked_val'}, { name: 'need_custom_text', attr: 'checked_val'}, { name: 'is_default', attr: 'is_default_val'}, { name: 'enabled', attr: 'enabled_val'} ], + item: ` + + + + + Need Select +
+ Need Signature +
+ Need Custom Text +
+ Is Default +
+ Enabled + + ` + }; + + let values = defaultPrompts; // test in browser + //let values = await getPrompts(); // production + + console.log('>>>>>>>>>>>>>>>> values: ' + JSON.stringify(values)); + + let promptsList = new List('all_prompts', options, values); + + checkSelectedBoxes(); + + //i18n.updateDocument(); // production +}, { once: true }); + + +function checkSelectedBoxes() { + // Get all elements with the class 'need_selected' that are checkboxes + const checkboxes = [ + ...document.querySelectorAll('.need_selected[type="checkbox"]'), + ...document.querySelectorAll('.need_signature[type="checkbox"]'), + ...document.querySelectorAll('.need_custom_text[type="checkbox"]'), + ]; + + // Iterate through the checkboxes + checkboxes.forEach(checkbox => { + // Check if the 'checked' attribute is "0" + if (checkbox.getAttribute('checked_val') === "0") { + // Uncheck the checkbox + checkbox.checked = false; + } else { + checkbox.checked = true; + } + }); +} \ No newline at end of file