Spaces:
Paused
Paused
File size: 3,825 Bytes
571f20f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FHIR Questionnaire Form</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://lhcfhirtools-static.nlm.nih.gov/lforms-versions/34.0.0/webcomponent/styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<!-- Other head elements -->
</head>
<style>
.done-button {
position: fixed;
top: 10px;
left: 10px;
background-color: #F28C28;
color: #fff;
width: 35px;
height: 35px;
padding: 0;
border: none;
border-radius: 5px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.done-button:hover {
background-color: #E67E22;
transform: scale(1.1);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.done-button i {
font-size: 20px;
color: black;
}
/* Body loaded state */
body.loaded {
opacity: 1;
}
/* Loading spinner styles */
.loader {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 63, 0.95);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
transition: opacity 0.3s ease-out;
}
.loader.hidden {
opacity: 0;
pointer-events: none;
}
.spinner {
width: 50px;
height: 50px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-top: 3px solid #9FE2BF;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<body>
<div id="loader" class="loader"> <div class="spinner"></div></div>
<button class="done-button" onclick="window.close()" title="Close"><i class="fas fa-times"></i></button>
<br><br>
<div id="formContainer"></div>
<script src="https://lhcfhirtools-static.nlm.nih.gov/lforms-versions/34.0.0/webcomponent/assets/lib/zone.min.js"></script>
<script src="https://lhcfhirtools-static.nlm.nih.gov/lforms-versions/34.0.0/webcomponent/lhc-forms.js"></script>
<script src="https://lhcfhirtools-static.nlm.nih.gov/lforms-versions/34.0.0/fhir/lformsFHIRAll.min.js"></script>
<script>
// Initialize loader
window.addEventListener('load', function() {
document.body.classList.add('loaded');
// Hide loader if it exists
const loader = document.getElementById('loader');
if (loader) {
setTimeout(() => {
loader.classList.add('hidden');
}, 150);
}
});
document.addEventListener('DOMContentLoaded', function() {
const chartJsonUrl = "{{ chart_json_url }}?nocache=" + new Date().getTime();
fetch(chartJsonUrl)
/*fetch('{{ url_for('static', filename='chart.json') }}')*/
.then(response => response.json())
.then(fhirQuestionnaire => {
LForms.Util.addFormToPage(fhirQuestionnaire, 'formContainer');
})
.catch(error => console.error('Error loading the FHIR Questionnaire:', error));
// Example of a save function triggered by a button or periodically
window.saveEdits = function() {
const fhirData = LForms.Util.getFormData('formContainer');
fetch('/save-edits', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(fhirData),
})
.then(response => response.json())
.then(data => console.log('Save successful', data))
.catch(error => console.error('Save failed', error));
};
// Optional: Set up a timer for autosave, e.g., save every 5 minutes
setInterval(saveEdits, 5000); // 1000 ms = 1 sec
});
</script>
</body>
</html>
|