(selectedId = "")
| 790 | } |
| 791 | |
| 792 | function refreshBillingTemplateSelect(selectedId = "") { |
| 793 | const selectEl = document.getElementById("billing-template-select"); |
| 794 | if (!selectEl) return; |
| 795 | const templates = getBillingTemplates(); |
| 796 | |
| 797 | const options = ['<option value="">-- 选择已保存模板 --</option>']; |
| 798 | templates.forEach((tpl) => { |
| 799 | options.push(`<option value="${escapeHtml(tpl.id)}">${escapeHtml(tpl.name)}</option>`); |
| 800 | }); |
| 801 | selectEl.innerHTML = options.join(""); |
| 802 | |
| 803 | if (selectedId && templates.some((tpl) => tpl.id === selectedId)) { |
| 804 | selectEl.value = selectedId; |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | function saveCurrentAsTemplate() { |
| 809 | const name = getInputValue("billing-template-name"); |
no test coverage detected