Untitled conversation
- User
{ "rule": 0, "event": { "eventName": "TicketCreate", "eventValue": "TicketCreate", "combination": [ { "status": [ "5", "4", "3" ] }, { "status": [ "4", "5" ] }, { "status": [] } ] }, "checked": true, "combination": [ { "status": [ "5", "4", "3" ] }, { "status": [ "4", "5" ] }, { "status": [] } ] }
when i edit existing values why it adds 3 times status fix that
async function getFieldnamesfrom1stapi( fieldNameContainer, fields, choicesContainer, selectedEventValue, buttonContainer, container, selectedFieldName = null, selectedChoices = [], obj, ruleIndex, fieldIndex ) { if (!selectedEventValue) { console.error("Select an event before proceeding."); return; }
// Create the field dropdown const fieldDropdown = document.createElement('fw-select'); fieldDropdown.classList.add('field-name-dropdown'); fieldDropdown.setAttribute('label', 'Ticket Fields'); fieldDropdown.setAttribute('required', 'true'); fieldDropdown.setAttribute('placeholder', 'Choose a field'); fieldDropdown.setAttribute('hint-text', 'Select singular option');
const selectedFields = Array.from(container.querySelectorAll('.field-name-dropdown')) .map((dropdown) => dropdown.value) .filter((value) => value);
fields .filter((field) => !selectedFields.includes(field.name)) .forEach((field) => { const option = document.createElement('fw-select-option'); option.setAttribute('value', field.name); option.textContent = field.label; fieldDropdown.appendChild(option);
codeif (selectedFieldName && field.name === selectedFieldName) { option.setAttribute('selected', 'selected'); } });fieldNameContainer.appendChild(fieldDropdown);
// Create the buttons const deleteButton = document.createElement('fw-button'); deleteButton.setAttribute('size', 'icon'); deleteButton.classList.add('delete-button'); deleteButton.innerHTML = '';
const deleteButtonWrapper = document.createElement('div'); deleteButtonWrapper.classList.add('delete-button-container', 'mt-5'); deleteButtonWrapper.appendChild(deleteButton); buttonContainer.appendChild(deleteButtonWrapper);
const existingAddButton = container.querySelector('.add-button'); if (existingAddButton) { existingAddButton.remove(); }
const addButton = document.createElement('fw-button'); addButton.setAttribute('size', 'icon'); addButton.classList.add('add-button'); addButton.innerHTML = ''; addButton.disabled = true;
// Check if this is the first set const isFirstSet = container.querySelectorAll('.field-name-dropdown').length === 1;
// Clear any existing margin styles addButton.style.marginTop = ''; // Remove marginTop
// Set the new margin style based on whether it's the first set or not if (isFirstSet) { addButton.style.marginTop = '48px'; } else { addButton.style.marginTop = '48px'; // This can be the same; update if different margin needed later }
- Assistant
- User
{ "rule": 0, "event": { "eventName": "TicketCreate", "eventValue": "TicketCreate", "combination": [ { "status": [ "5", "4", "3" ] }, { "status": [ "4", "5" ] }, { "status": [] } ] }, "checked": true, "combination": [ { "status": [ "5", "4", "3" ] }, { "status": [ "4", "5" ] }, { "status": [] } ] }
removing existing values makes adds new values fix this
- Assistant