-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmiedev.html
More file actions
132 lines (119 loc) · 3.71 KB
/
miedev.html
File metadata and controls
132 lines (119 loc) · 3.71 KB
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
<!-- Load YChart Editor from local HTTPS preview server -->
<script src="https://localhost:4173/ychart-editor.js"></script>
<pre id="yaml-editor" style="display: none;">
- id: {{pat_id}}
name: {{full_name}}
title: {{title}}
email: {{email}}
supervisor: {{supervisor_name}}
<WCQUERY QUERY="SELECT
r.pat_id,
CONCAT(p.last_name, ', ', p.first_name) AS full_name,
p.email,
r.related_pat_id AS parent_id,
sup.pat_id AS sup_id,
CONCAT(sup.last_name, ', ', sup.first_name) AS supervisor_name,
'' AS title
FROM pat_pat_relations r
LEFT JOIN patients p
ON p.pat_id = r.pat_id
LEFT JOIN patients AS sup
ON sup.pat_id = r.related_pat_id
WHERE r.related_pat_id = {{%pq pat_id}}
AND r.relation_type_id = (SELECT relation_type_id FROM relation_types WHERE relation_type = 'Supervisor')
AND p.active = 1
AND r.end_date > CURDATE()"
LAYOUT="YAMLTreeLayout" />
</pre>
<script>
function initializeYChartEditor() {
console.log('Initializing YChart Editor from localhost...');
// Get YAML data from the pre element
var preElement = document.getElementById('yaml-editor');
var yamlFromPre = preElement ? preElement.textContent.trim() : '';
// You can use the pre content directly, or combine it with front matter
var yamlData = `---
options:
nodeWidth: 220
nodeHeight: 110
childrenMargin: 50
schema:
id: number | required
name: string | required
title: string | optional
email: string | required
supervisor: string | optional
card:
- div:
class: employee-name
style: font-size:14px;font-weight:bold;color:#333;margin-bottom:4px;
content: $name$
- div:
style: font-size:12px;color:#666;margin-bottom:2px;
content: $title$
- div:
class: contact-info
style: font-size:11px;color:#999;
children:
- span:
style: font-weight:600;
content: "Email: "
- span:
style: color:#667eea;
content: $email$
- div:
class: supervisor-info
style: font-size:10px;color:#999;margin-top:4px;
children:
- span: "Reports to: "
- span:
style: font-weight:600;
content: $supervisor$
---
${yamlFromPre}`;
console.log('YAML Data loaded:', yamlData);
// Initialize YChart Editor with the latest API
var editor = new window.YChartEditor({
nodeWidth: 220,
nodeHeight: 110,
editorTheme: 'dark',
collapsible: true,
toolbarPosition: 'bottomleft',
toolbarOrientation: 'horizontal'
});
// Setup the editor with the new simplified API
editor
.initView('container', yamlData)
.bgPatternStyle('dotted')
.actionBtnPos('bottomleft', 'horizontal');
console.log('✅ YChart Editor initialized successfully!');
console.log('💡 Use built-in toolbar buttons in the canvas');
// Make it accessible globally for debugging
window.ychartEditor = editor;
}
// Initialize after page loads
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeYChartEditor);
} else {
initializeYChartEditor();
}
</script>
<style>
body {
margin: 0;
padding: 0;
}
#container {
width: 100vw;
height: 100vh;
border: 1px solid #ccc;
background-color: whitesmoke;
border-radius: 5px;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
overflow: hidden;
}
</style>
<div id="container"></div>