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AC,MAAM,CAAC;QACxE,CAAC;aAAM,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;YACnC,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACzE,CAAC;aAAM,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;YAClC,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxE,CAAC;aAAM,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;YAClC,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxE,CAAC;aAAM,IAAI,WAAW,IAAI,SAAS,EAAE,CAAC;YACpC,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC1E,CAAC;QACD,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QAC1C,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;gBACnC,IAAI,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;oBAChF,gBAAgB,CAAC,YAAY,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC7D,CAAC;qBAAM,CAAC;oBACN,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF","file":"daytool_printer.js","sourcesContent":["import { reset_casting } from \"../../helpers.js\";\r\nimport { DAYTOOL } from \"../daytool.js\";\r\nimport { daytool_injector } from \"./daytool_injector.js\";\r\n\r\nexport class daytool_printer {\r\n // Reprints list card containers:\r\n static print_clipboard(date: string) {\r\n // in YYYY-MM-DD\r\n // Erase content:\r\n // CONTINUE HERE!!!\r\n // Build new card container\r\n\r\n\r\n var clipboards = document.querySelectorAll('.main_view .clipboard.list_container .entity_clipboard');\r\n\r\n // Clear view\r\n for (var o = 0; o < clipboards.length; o++) {\r\n var node = clipboards[o];\r\n var curr = DAYTOOL.getEntityByIdAndType(parseInt(node.getAttribute('data-entity-id')), node.getAttribute('data-entity-type') );\r\n node.classList.add(\"fadeOut\");\r\n var divs = document.querySelectorAll(`.entity_card[data-entity-id=\"${curr.id}\"][data-entity-type=\"${curr.type}\"]`);\r\n for (var d = 0; d < divs.length; d++) {\r\n var div = divs[d];\r\n div.classList.add(\"on_clipboard\");\r\n }\r\n var pills_to_update = document.querySelectorAll(`.entity_card[data-entity-id=\"${curr.id}\"][data-entity-type=\"${curr.type}\"] [data-action=\"toggle_pinned\"]`);\r\n for (var x = 0; x < pills_to_update.length; x++) {\r\n pills_to_update[x].classList.remove(\"active\");\r\n }\r\n }\r\n\r\n setTimeout(()=>{\r\n var selectors_to_delete = [];\r\n for (var o = 0; o < clipboards.length; o++) {\r\n var node = clipboards[o];\r\n selectors_to_delete.push(`[data-entity-id=\"${node.getAttribute('data-entity-id')}\"][data-entity-type=\"${node.getAttribute('data-entity-type')}\"].entity_clipboard`);\r\n }\r\n for (var s = 0; s < selectors_to_delete.length; s++) {\r\n document.querySelectorAll(selectors_to_delete[s]).forEach(e => e.remove());\r\n }\r\n // Activate items that are part of the day\r\n var key = DAYTOOL.clipboard.date.indexOf(date);\r\n var entity_ids = DAYTOOL.clipboard.entities[key];\r\n if (entity_ids && entity_ids.length > 0) {\r\n for (var e = 0; e < entity_ids.length; e++) {\r\n var entity = DAYTOOL.getEntityByObjectEntityId(entity_ids[e]);\r\n if (entity) {\r\n var casted_entity = reset_casting([entity])[0];\r\n // Needs don't have a list view\r\n if (casted_entity.type !== \"needs\" && casted_entity.imported) {\r\n daytool_injector.addToClipboardDOM(casted_entity);\r\n var divs = document.querySelectorAll(`.entity_card[data-entity-id=\"${casted_entity.id}\"][data-entity-type=\"${casted_entity.type}\"]`);\r\n for (var d = 0; d < divs.length; d++) {\r\n var div = divs[d];\r\n div.classList.add(\"on_clipboard\");\r\n }\r\n\r\n var pills_to_update = document.querySelectorAll(`.entity_card[data-entity-id=\"${casted_entity.id}\"][data-entity-type=\"${casted_entity.type}\"] [data-action=\"toggle_pinned\"]`);\r\n for (var x = 0; x < pills_to_update.length; x++) {\r\n pills_to_update[x].classList.add(\"active\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },500);\r\n }\r\n\r\n\r\n // Print cards\r\n static async print_cards() {\r\n await daytool_printer.lazyLoadCards(\"notes\", 5);\r\n await daytool_printer.lazyLoadCards(\"goals\", 12);\r\n await daytool_printer.lazyLoadCards(\"feeds\", 12);\r\n await daytool_printer.lazyLoadCards(\"events\", 12);\r\n await daytool_printer.lazyLoadCards(\"plans\", 12);\r\n await daytool_printer.lazyLoadCards(\"cases\", 20);\r\n await daytool_printer.lazyLoadCards(\"persons\", 20);\r\n await daytool_printer.lazyLoadCards(\"stats\", 12);\r\n }\r\n\r\n static async lazyLoadCards(entity_type: string, batchSize: number) {\r\n var current_index = 0;\r\n var entities = DAYTOOL.getEntityArrayByType(entity_type);\r\n if (entity_type == \"notes\") {\r\n current_index = document.getElementById(\"list_notes\").children.length;\r\n } else if (entity_type == \"goals\") {\r\n current_index = document.getElementById(\"list_goals\").children.length;\r\n } else if (entity_type == \"stats\") {\r\n current_index = document.getElementById(\"list_stats\").children.length;\r\n } else if (entity_type == \"feeds\") {\r\n current_index = document.getElementById(\"list_feeds\").children.length;\r\n } else if (entity_type == \"events\") {\r\n current_index = document.getElementById(\"list_events\").children.length;\r\n } else if (entity_type == \"plans\") {\r\n current_index = document.getElementById(\"list_plans\").children.length;\r\n } else if (entity_type == \"cases\") {\r\n current_index = document.getElementById(\"list_cases\").children.length;\r\n } else if (entity_type == \"persons\") {\r\n current_index = document.getElementById(\"list_persons\").children.length;\r\n }\r\n current_index == null ? 0 : current_index;\r\n if (entities) {\r\n for (var n = 0; n < batchSize; n++) {\r\n if (entities[current_index + n] && entities[current_index + n].imported == true) {\r\n daytool_injector.addToListDOM(entities[current_index + n]);\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n}"]}