openCreatePanel function

Last updated: 2026-03-04T23:21:38.431Z

Metrics

LOC: 58 Complexity: 2 Params: 0

Signature

openCreatePanel(): : void

Summary

Abre o painel de criação de template (em branco)

Source Code

function openCreatePanel(): void {
  const existing = document.getElementById("form-create-panel");
  if (existing) {
    existing.scrollIntoView({ behavior: "smooth" });
    return;
  }

  const panel = document.createElement("div");
  panel.id = "form-create-panel";
  panel.className = "edit-panel";
  panel.innerHTML = `
    <h3>${t("createTemplateHeader")}</h3>
    <div class="form-group">
      <label>${t("templateNameLabel")}</label>
      <input type="text" id="create-form-name" placeholder="${t("createTemplateNamePlaceholder")}" />
    </div>
    <div class="form-group">
      <label>${t("urlPatternLabel")}</label>
      <input type="text" id="create-form-url" placeholder="${t("templateUrlPlaceholder")}" />
      <div class="description" style="margin-top:4px;font-size:11px;color:var(--text-muted);">
        ${t("templateUrlDesc")}
      </div>
    </div>
    <div style="margin-bottom:8px;">
      <strong style="font-size:13px;">${t("fieldsTitle")}</strong>
      <div class="description" style="font-size:11px;color:var(--text-muted);margin-top:2px;">
        ${t("templateFieldsDesc")}
      </div>
    </div>
    <table class="template-fields-table" id="create-fields-table">
      <thead>
        <tr>
          <th>${t("fieldDetectedTypeHeader")}</th>
          <th>${t("fieldModeHeader")}</th>
          <th>${t("fieldValueHeader")}</th>
          <th></th>
        </tr>
      </thead>
      <tbody id="create-fields-tbody">
        ${buildTemplateFieldRow({ matchByFieldType: "name", mode: "fixed", fixedValue: "" })}
      </tbody>
    </table>
    <div style="margin-bottom:12px;">
      <button class="btn btn-secondary btn-sm" id="create-add-field-row">+ Adicionar campo</button>
    </div>
    <div class="edit-panel-actions">
      <button class="btn btn-primary" id="create-panel-save">${t("btnSaveTemplate")}</button>
      <button class="btn btn-secondary" id="create-panel-cancel">${t("btnCancel")}</button>
    </div>
  `;

  document.getElementById("saved-forms-list")?.before(panel);
  bindCreatePanelEvents(panel);
  panel.querySelectorAll("tr.template-field-row").forEach((row) => {
    upgradeRowSearchableSelects(row);
  });
  panel.scrollIntoView({ behavior: "smooth" });
}

Dependencies (Outgoing)

graph LR openCreatePanel["openCreatePanel"] buildTemplateFieldRow["buildTemplateFieldRow"] bindCreatePanelEvents["bindCreatePanelEvents"] upgradeRowSearchableSelects["upgradeRowSearchableSelects"] openCreatePanel -->|calls| buildTemplateFieldRow openCreatePanel -->|calls| bindCreatePanelEvents openCreatePanel -->|calls| upgradeRowSearchableSelects style openCreatePanel fill:#dbeafe,stroke:#2563eb,stroke-width:2px click openCreatePanel "16ceabf613d86e61.html" click buildTemplateFieldRow "6e5eee1aa17b57cc.html" click bindCreatePanelEvents "63724b3d20cd4419.html" click upgradeRowSearchableSelects "90e9f01206f5f2c7.html"

Impact (Incoming)

graph LR openCreatePanel["openCreatePanel"] initFormsTab["initFormsTab"] initFormsTab -->|calls| openCreatePanel style openCreatePanel fill:#dbeafe,stroke:#2563eb,stroke-width:2px click openCreatePanel "16ceabf613d86e61.html" click initFormsTab "016a6b967c8f6192.html"
SourceType
initFormsTab calls