00799: 00800: 00801: 00802: 00803: 00804: 00805: 00806: 00807: 00818: 00819: 00823: 00824: 00828: ... 00978: 00979: 00980: 00981: 00982: 00983: 00984: 00985: 00986: 00997: 00998: 00999:
01000: 01007: ... 01098: 01099: function visibleDefinitions() { 01100: if (!state.activeProject) { 01101: return []; 01102: } 01103: 01104: return state.definitions.filter((definition) => { 01105: return ( 01106: !definition.oi_only || 01107: state.activeProject.osseointegration 01108: ); 01109: }); 01110: } 01111: 01112: function selectedDefinition() { 01113: return state.definitions.find( 01114: (definition) => 01115: definition.key === state.activeMeasurementKey 01116: ); 01117: } 01118: 01119: function selectedMeasurement() { 01120: return ( 01121: state.activeProject?.measurements?.[ ... 01147: button.classList.add("active"); 01148: } 01149: 01150: button.innerHTML = ` 01151: ${escapeHtml(project.name)} 01152: 01153: ${escapeHtml(project.side)} 01154: • 01155: ${escapeHtml(project.cover_class)} 01156: ${project.osseointegration ? " • OI" : ""} 01157: 01158: `; 01159: 01160: button.addEventListener("click", () => { 01161: openProject(project.id); 01162: }); 01163: 01164: elements.projectList.append(button); 01165: } 01166: } 01167: 01168: function renderProject() { 01169: const project = state.activeProject; 01170: ... 01173: 01174: if (!project) { 01175: closeEditor(); 01176: return; 01177: } 01178: 01179: elements.projectTitle.textContent = project.name; 01180: elements.projectSubtitle.textContent = 01181: `${project.side} • ${project.cover_class}` + 01182: (project.osseointegration 01183: ? " • Osseointegration safety workflow" 01184: : " • Conventional prosthesis"); 01185: 01186: elements.projectName.value = project.name; 01187: elements.projectReference.value = project.reference_id; 01188: elements.projectSide.value = project.side; 01189: elements.projectCoverClass.value = project.cover_class; 01190: elements.projectOi.value = 01191: String(project.osseointegration); 01192: elements.projectSpecialist.value = 01193: project.specialist_name; 01194: elements.projectClinic.value = project.clinic_name; 01195: elements.projectExclusion.value = 01196: project.exclusion_zones; 01197: elements.projectComponents.value = 01198: project.component_notes; 01199: elements.projectReview.value = project.review_notes; 01200: 01201: renderMeasurements(); 01202: } 01203: 01204: function renderMeasurements() { 01205: const definitions = visibleDefinitions(); ... 01370: ).value, 01371: side: 01372: document.querySelector( 01373: "#new-project-side" 01374: ).value, 01375: cover_class: 01376: document.querySelector( 01377: "#new-project-cover-class" 01378: ).value, 01379: osseointegration: 01380: document.querySelector( 01381: "#new-project-oi" 01382: ).value === "true", 01383: }), 01384: }); 01385: 01386: elements.newProjectDialog.close(); 01387: elements.newProjectForm.reset(); 01388: 01389: await loadProjects(); 01390: await openProject(project.id); 01391: 01392: showToast("LimbForge project created."); 01393: } ... 01402: { 01403: method: "PUT", 01404: body: JSON.stringify({ 01405: name: elements.projectName.value, 01406: reference_id: 01407: elements.projectReference.value, 01408: side: elements.projectSide.value, 01409: cover_class: 01410: elements.projectCoverClass.value, 01411: osseointegration: 01412: elements.projectOi.value === "true", 01413: specialist_name: 01414: elements.projectSpecialist.value, 01415: clinic_name: 01416: elements.projectClinic.value, 01417: exclusion_zones: 01418: elements.projectExclusion.value, 01419: component_notes: 01420: elements.projectComponents.value, 01421: review_notes: 01422: elements.projectReview.value, 01423: }), 01424: } 01425: );