diff --git a/front/static/edit_report.html b/front/static/edit_report.html index b252cd5..9cf6b27 100644 --- a/front/static/edit_report.html +++ b/front/static/edit_report.html @@ -8,6 +8,7 @@ + Reimbursinator diff --git a/front/static/js/viewHistory.js b/front/static/js/viewHistory.js index 8f0747c..45407a3 100644 --- a/front/static/js/viewHistory.js +++ b/front/static/js/viewHistory.js @@ -97,6 +97,18 @@ function createFormGroup(sectionIdStr, field) { formGroup.appendChild(div); break; case "date": + input.type = "date"; + input.placeholder = "mm-dd-yyyy"; + if (field.value === "None") { + input.value = ""; + } else { + input.value = field.value; + } + input.classList.add("form-control"); + formGroup.appendChild(label); + div.appendChild(input) + formGroup.appendChild(div); + break; case "string": input.type = "text"; input.value = field.value; @@ -107,7 +119,11 @@ function createFormGroup(sectionIdStr, field) { break; case "decimal": input.type = "text"; - input.value = field.value; + if (field.value === "0.00") { + input.value = ""; + } else { + input.value = field.value; + } input.classList.add("form-control"); input.pattern = "\\d+(\\.\\d{2})?"; formGroup.appendChild(label); @@ -116,7 +132,11 @@ function createFormGroup(sectionIdStr, field) { break; case "integer": input.type = "number"; - input.value = field.value; + if (field.value === 0) { + input.value = ""; + } else { + input.value = field.value; + } input.classList.add("form-control"); input.step = 1; input.min = 0; @@ -430,6 +450,16 @@ if (newReportForm) { }); } +document.addEventListener("input", function(event) { + if (event.target.type === "date") { + if (!moment(event.target.value, "YYYY-MM-DD", true).isValid()) { + event.target.setCustomValidity("Invalid date format"); + } else { + event.target.setCustomValidity(""); + } + } +}); + document.addEventListener("submit", function(event) { if (event.target.classList.contains("section-form")) { event.preventDefault(); diff --git a/front/static/login.html b/front/static/login.html index a09051e..5e7b130 100644 --- a/front/static/login.html +++ b/front/static/login.html @@ -25,7 +25,7 @@
- +
diff --git a/front/static/new_report.html b/front/static/new_report.html index daf4c54..dc9ca28 100644 --- a/front/static/new_report.html +++ b/front/static/new_report.html @@ -8,6 +8,7 @@ + Reimbursinator @@ -47,7 +48,7 @@
- +
diff --git a/front/static/signup.html b/front/static/signup.html index 12b1119..ac2668c 100644 --- a/front/static/signup.html +++ b/front/static/signup.html @@ -25,7 +25,7 @@