|
|
|
@ -3,22 +3,9 @@ |
|
|
|
|
const app = document.getElementById("appContent"); |
|
|
|
|
let userdata; |
|
|
|
|
load(); |
|
|
|
|
const emptyPages = { |
|
|
|
|
"title": {"type": "title"}, |
|
|
|
|
"blank": {"type": "blank"}, |
|
|
|
|
"report": { |
|
|
|
|
"type": "report", |
|
|
|
|
"days": [ [], [], [], [], [], ], |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
let templates; |
|
|
|
|
|
|
|
|
|
// const templates = {
|
|
|
|
|
// "blank": (await fetchTemplate("blank"))
|
|
|
|
|
// };
|
|
|
|
|
// let blank = fetchTemplate("blank").then(b=>{blank=b});
|
|
|
|
|
// let blank = fetchTemplate("blank")
|
|
|
|
|
async function init() { |
|
|
|
|
if (typeof templates === "undefined") { |
|
|
|
|
templates = { |
|
|
|
@ -39,7 +26,11 @@ async function init() { |
|
|
|
|
|
|
|
|
|
function pageAdd(template) { |
|
|
|
|
pageNew(template); |
|
|
|
|
userdata.pages.push(emptyPages[template]); |
|
|
|
|
let newPage = {"type": template}; |
|
|
|
|
if (template === "report") { |
|
|
|
|
newPage["days"] = [ [], [], [], [], [], ]; |
|
|
|
|
} |
|
|
|
|
userdata.pages.push(newPage); |
|
|
|
|
populate(app.children.length); |
|
|
|
|
save(); |
|
|
|
|
} |
|
|
|
|