Save project code selection to localStorage

Added data-ls attributes to pcode select and pcode-other input so they
are persisted and restored with the rest of the form. Restoring an
"Other" selection also re-shows the free-text input field.
This commit is contained in:
Claude 2026-05-24 16:17:23 +00:00
parent ff5f4bdb19
commit 3baf821fbd
No known key found for this signature in database

View file

@ -556,14 +556,14 @@ function buildForm() {
<div class="fg"><label id="lbl-icur" for="icur">${t("invoice-currency")}</label>
<select id="icur" data-ls="icur">${curOpts}</select></div>
<div class="fg"><label id="lbl-pcode" for="pcode">${t("project-code")}</label>
<select id="pcode">
<select id="pcode" data-ls="pcode">
<option value="">${t("select")}</option>
${pcOpts}
<option value="__other__">${t("other")}</option>
</select></div>
<div class="fg" id="pcode-other-wrap" style="display:none">
<label id="lbl-pcode-other" for="pcode-other">${t("project-code")} (${t("other")})</label>
<input id="pcode-other" type="text">
<input id="pcode-other" type="text" data-ls="pcode-other">
</div>
<div class="fg"><label id="lbl-ino" for="ino">${t("invoice-no")}</label>
<input id="ino" type="text" data-ls="ino"></div>
@ -1014,6 +1014,12 @@ function restoreStorage() {
if (el) el.value = v;
});
// Restore "Other" project-code visibility
if (d.pcode === "__other__") {
const w = document.getElementById("pcode-other-wrap");
if (w) w.style.display = "block";
}
if (wasGen && d.ino) {
const bumped = bumpNum(d.ino);
const el = document.getElementById("ino");