hayun-vite 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/assets/Daco_1154502.png +0 -0
  2. package/assets/ear-logo-1.png +0 -0
  3. package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
  4. package/assets/hearing-aid-computer-icons-sound-ears-.png +0 -0
  5. package/assets/logo.svg +1 -0
  6. package/assets/logo192.png +0 -0
  7. package/assets/rasa.png +0 -0
  8. package/assets/styles-test.css +90 -0
  9. package/assets/styles.css +90 -0
  10. package/data/formData1.js +42 -0
  11. package/data/officesObjStore.js +57 -0
  12. package/data/patientsObjStore.js +74 -0
  13. package/data/sampleData.js +95 -0
  14. package/index.js +9 -3
  15. package/package.json +1 -1
  16. package/src/{Audiogram.js → Audiogram/Audiogram.js} +6 -4
  17. package/src/Form/Form.js +277 -0
  18. package/src/Form/Form_N.js +159 -0
  19. package/src/Form/Forms-Test.html +125 -0
  20. package/src/Form/Forms.js +135 -0
  21. package/src/Form/Header.js +92 -0
  22. package/src/Form/Reflex.js +142 -0
  23. package/src/Form/Sections.js +72 -0
  24. package/src/Form/Speech.js +133 -0
  25. package/src/Form/TextBox.js +81 -0
  26. package/src/Form/Tympanogram.js +356 -0
  27. package/src/Form/formStyles.css +122 -0
  28. package/src/Form/globalinfo.js +68 -0
  29. package/src/Form/grid/drawGrid.js +84 -0
  30. package/src/Form/grid/hideGrid.js +9 -0
  31. package/src/Form/printForm.js +76 -0
  32. package/src/Form/rasa-audio-208-293.png +0 -0
  33. package/src/Form/templates/combo.js +248 -0
  34. package/src/Form/templates/dims.js +204 -0
  35. package/src/Form/templates/rasaAud.js +287 -0
  36. package/src/Form/templates/rasaAud.png +0 -0
  37. package/src/Form/templates/rasaTymp.jpg +0 -0
  38. package/src/fonts/Vazirmatn-Regular.woff2 +0 -0
  39. package/src/main.js +87 -74
  40. package/src/note.html +1 -0
  41. package/src/style.css +157 -96
  42. package/src/AudiogramChart-Test.html +0 -56
  43. /package/src/{dims.js → Audiogram/dims.js} +0 -0
@@ -0,0 +1,76 @@
1
+ export default function printForm({ container }) {
2
+ // const paperForm = document.getElementById(elementID);
3
+ const paperForm = container;
4
+
5
+ console.log("Print!");
6
+ console.log(paperForm);
7
+ print(paperForm);
8
+
9
+ function print(paperForm) {
10
+ iframePrint(paperForm);
11
+ return new Date().toLocaleString("fa-IR");
12
+ }
13
+
14
+ function iframePrint(paperForm) {
15
+ const hideFrame = document.createElement("iframe");
16
+ let printDateTime;
17
+ hideFrame.onload = setPrint;
18
+ hideFrame.style.display = "none"; // hide iframe
19
+ // hideFrame.src = "page-print.html";
20
+ let style = `
21
+ @page {
22
+
23
+ size: a4;
24
+ margin: 0;
25
+
26
+ padding: 0;
27
+ break-inside: avoid;
28
+
29
+ /* width: 100%; */
30
+ height: 100%;
31
+ /* max-width: 800px; */
32
+ /* margin: auto; */
33
+
34
+ }
35
+ @media print {
36
+ /* All your print styles go here */
37
+ header, footer {
38
+ display: none; /* Hide header and footer when printing */
39
+ }
40
+ button {
41
+ display: none !important;
42
+ }
43
+ svg {
44
+ margin: 0;
45
+ padding: 0;
46
+ break-inside: avoid;
47
+ }
48
+ body {
49
+ margin: 0;
50
+ padding: 0;
51
+ break-inside: avoid;
52
+ }
53
+ html {
54
+ margin: 0;
55
+ padding: 0;
56
+ break-inside: avoid;
57
+ }
58
+
59
+ }
60
+ `;
61
+ hideFrame.srcdoc = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title></title><style>${style}</style></head><body>${paperForm.outerHTML}</body></html>`;
62
+ document.body.appendChild(hideFrame);
63
+ // setTimeout(() => console.log(printDateTime), 2000)
64
+ // console.log(printDateTime);
65
+ return printDateTime;
66
+ function setPrint() {
67
+ const closePrint = () => { document.body.removeChild(this); };
68
+ this.contentWindow.onbeforeunload = () => closePrint();
69
+ this.contentWindow.onafterprint = () => {
70
+ closePrint();
71
+ printDateTime = (new Date().toLocaleString("fa-IR"));
72
+ }
73
+ this.contentWindow.print();
74
+ }
75
+ }
76
+ }
Binary file
@@ -0,0 +1,248 @@
1
+ import audDims from "../../Audiogram/dims.js";
2
+
3
+ const combo = {
4
+ name: 'combo',
5
+ label: 'Combo',
6
+ // backgroundImage: 'backgroundImage',
7
+ margin: { left: 5, top: 5, right: 5, bottom: 5 },
8
+ paper: { type: 'A4', case: 'portrait', width: 210, height: 297 },
9
+
10
+ // Printable Dimention
11
+ calc1: function () {
12
+ this.width = this.paper.width - (this.margin.left + this.margin.right);
13
+ this.height = this.paper.height - (this.margin.top + this.margin.bottom);
14
+ let width = this.width;
15
+ // ابعاد و پدینگ المنت ها
16
+ // فضای خالی
17
+ this.blank = {
18
+ name: 'blank',
19
+ w: width, h: 10,
20
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
21
+ display: 'block',
22
+ }
23
+ this.header = {
24
+ // hideContext: true,
25
+ name: 'header',
26
+ w: width, h: 20,
27
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
28
+ display: 'block',
29
+ }
30
+ this.patient = {
31
+ name: 'patient',
32
+ w: width, h: 10,
33
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
34
+ display: 'block',
35
+ }
36
+ this.history = {
37
+ name: 'history',
38
+ w: width, h: 10,
39
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
40
+ display: 'block',
41
+ }
42
+
43
+ this.RAudiogram = {}
44
+ Object.assign(this.RAudiogram,
45
+ audDims[this.name],
46
+ {
47
+ name: 'RAudiogram',
48
+ w: width / 2, h: 100,
49
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
50
+ display: 'inline',
51
+ });
52
+
53
+ this.LAudiogram = {}
54
+ Object.assign(this.LAudiogram,
55
+ audDims[this.name],
56
+ {
57
+ name: 'LAudiogram',
58
+ w: width / 2, h: 100, // پهنای سکشن هست
59
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
60
+ display: 'block',
61
+ });
62
+
63
+ this.RSpeech = {
64
+ name: 'RSpeech',
65
+ w: width / 2, h: 15,
66
+ margin: { left: 5, top: 1, right: 5, bottom: 1 },
67
+ display: 'inline',
68
+ stroke: true,
69
+ }
70
+
71
+ this.LSpeech = {
72
+ name: 'LSpeech',
73
+ w: width / 2, h: 15,
74
+ margin: { left: 5, top: 1, right: 5, bottom: 1 },
75
+ display: 'block',
76
+ stroke: true
77
+ }
78
+
79
+ this.RTympanogram = {
80
+ name: 'RTympanogram',
81
+ w: width / 2, h: 60,
82
+ margin: { left: 2, top: 2, right: 2, bottom: 2 },
83
+ display: 'inline',
84
+ }
85
+
86
+ this.LTympanogram = {
87
+ name: 'LTympanogram',
88
+ w: width / 2, h: 60,
89
+ margin: { left: 2, top: 2, right: 2, bottom: 2 },
90
+ display: 'block',
91
+ }
92
+ this.RReflex = {
93
+ name: 'RReflex',
94
+ w: width / 2, h: 30,
95
+ margin: { left: 2, top: 2, right: 2, bottom: 2 },
96
+ display: 'inline'
97
+ }
98
+
99
+ this.LReflex = {
100
+ name: 'LReflex',
101
+ w: width / 2, h: 30,
102
+ margin: { left: 2, top: 2, right: 2, bottom: 2 },
103
+ display: 'block'
104
+ }
105
+
106
+ this.report = {
107
+ name: 'report',
108
+ w: width, h: 20,
109
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
110
+ display: 'block'
111
+ }
112
+
113
+ this.footer = {
114
+ name: 'footer',
115
+ w: width, h: 10,
116
+ margin: { left: 1, top: 1, right: 1, bottom: 1 },
117
+ display: 'block'
118
+ }
119
+ },
120
+
121
+ calc2: function () {
122
+ // let dims = this.dims;
123
+ let width, height;
124
+
125
+ width = this.header.width = this.getWidth(this.header)
126
+ height = this.header.height = this.getHeight(this.header)
127
+
128
+ this.header.elements = [
129
+ { type: 'line', x1: 0, y1: height, x2: width, y2: height },
130
+ { type: 'text', x: 30, y: 5, value: 'تاریخ :' },
131
+ ]
132
+ this.header.inputs = [
133
+ { name: 'officeName', x: width - 20, y: height - 10 },
134
+ { name: 'date', x: 20, y: 5 },
135
+ ]
136
+
137
+ width = this.patient.width = this.getWidth(this.patient)
138
+ this.patient.height = this.getHeight(this.patient)
139
+ this.patient.elements = [
140
+ { type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
141
+ { type: 'text', x: width, y: 5, value: 'نام:' },
142
+ { type: 'text', x: width - 30, y: 5, value: 'نام خانوادگی:' },
143
+ { type: 'text', x: width - 90, y: 5, value: 'سن:' },
144
+ { type: 'text', x: width - 130, y: 5, value: 'ارجاع از:' }
145
+ ]
146
+ this.patient.inputs = [
147
+ { name: 'name', x: width - 5, y: 5 },
148
+ { name: 'lastName', x: width - 47, y: 5 },
149
+ { name: 'age', x: width - 97, y: 5 },
150
+ { name: 'referrer', x: width - 142, y: 5 }
151
+ ]
152
+ this.patient.forceInputs = [
153
+ { name: 'name', x: width - 10, y: 4 },
154
+ { name: 'lastName', x: width - 47, y: 5 },
155
+ { name: 'age', x: width - 97, y: 5 },
156
+ { name: 'referrer', x: width - 142, y: 5 }
157
+ ]
158
+
159
+ width = this.history.width = this.getWidth(this.history)
160
+ this.history.height = this.getHeight(this.history)
161
+ this.history.elements = [
162
+ { type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
163
+ { type: 'text', x: width, y: 5, value: 'شرح حال:' },
164
+ ]
165
+ this.history.inputs = [
166
+ { name: 'description', x: width - 13, y: 5 },
167
+ ]
168
+
169
+ width = this.RAudiogram.width = this.getWidth(this.RAudiogram)
170
+ this.RAudiogram.height = this.getHeight(this.RAudiogram)
171
+
172
+ width = this.LAudiogram.width = this.getWidth(this.LAudiogram)
173
+ this.LAudiogram.height = this.getHeight(this.LAudiogram)
174
+
175
+ width = this.RSpeech.width = this.getWidth(this.RSpeech)
176
+ this.RSpeech.height = this.getHeight(this.RSpeech)
177
+ this.RSpeech.labels = ["SAT", "SRT", "MCL", "UCL", "SDS"]
178
+
179
+ width = this.LSpeech.width = this.getWidth(this.LSpeech)
180
+ this.LSpeech.height = this.getHeight(this.LSpeech)
181
+ this.LSpeech.labels = ["SAT", "SRT", "MCL", "UCL", "SDS"]
182
+
183
+ width = this.RTympanogram.width = this.getWidth(this.RTympanogram)
184
+ this.RTympanogram.height = this.getHeight(this.RTympanogram)
185
+ width = this.LTympanogram.width = this.getWidth(this.LTympanogram)
186
+ this.LTympanogram.height = this.getHeight(this.LTympanogram)
187
+
188
+ width = this.RReflex.width = this.getWidth(this.RReflex)
189
+ this.RReflex.height = this.getHeight(this.RReflex)
190
+ width = this.LReflex.width = this.getWidth(this.LReflex)
191
+ this.LReflex.height = this.getHeight(this.LReflex)
192
+
193
+ width = this.report.width = this.getWidth(this.report)
194
+ this.report.height = this.getHeight(this.report)
195
+ this.report.elements = [
196
+ { type: 'text', x: width, y: 5, value: 'گزارش:' },
197
+ ]
198
+ this.report.inputs = [
199
+ { name: 'description', x: width - 10, y: 5 },
200
+ ]
201
+
202
+ width = this.footer.width = this.getWidth(this.footer)
203
+ this.footer.height = this.getHeight(this.footer)
204
+ this.footer.elements = [
205
+ { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
206
+ { type: 'text', x: width, y: 5, value: 'آدرس:' },
207
+ { type: 'text', x: width - 120, y: 5, value: 'تلفن:' },
208
+ ]
209
+ this.footer.inputs = [
210
+ { name: 'address', x: width - 10, y: 5 },
211
+ { name: 'tel', x: width - 128, y: 5 },
212
+ ]
213
+ },
214
+
215
+ getWidth: function (element) {
216
+ return (element.w - (element.margin.left + element.margin.right))
217
+ },
218
+ getHeight: function (element) {
219
+ return (element.h - (element.margin.top + element.margin.bottom))
220
+ },
221
+
222
+ calcSectionsArray: function () {
223
+ // این آرایه دقیقا ترتیب قرارگیری سکشن ها را بدون اون اوردر قبلی تعیین میکند
224
+ this.sections = [
225
+ this.header,
226
+ this.patient,
227
+ this.history,
228
+ this.RAudiogram,
229
+ this.LAudiogram,
230
+ this.RSpeech,
231
+ this.LSpeech,
232
+ this.RTympanogram, this.LTympanogram,
233
+ this.RReflex, this.LReflex,
234
+ this.report,
235
+ this.footer
236
+
237
+ ]
238
+ },
239
+
240
+ }
241
+
242
+ combo.calc1()
243
+ combo.calc2()
244
+ combo.calcSectionsArray()
245
+ // پهنا و ارتفاع قابل استفاده منهای پد ها میشه پهنا و ارتفاع اصلی
246
+
247
+ export default combo;
248
+
@@ -0,0 +1,204 @@
1
+ const dims = {
2
+ padding: { left: 6, top: 5, right: 6, bottom: 5 },
3
+ paper: { type: 'A4', case: 'portraite', width: 210, height: 295.5, },
4
+ // sections: ['header', 'patient', 'history', ['RAudiogram', 'LAudiogram'], ['RSpeech', 'LSpeech'],],
5
+
6
+ // Printable Dimention
7
+ calc1: function () {
8
+
9
+ this.width = this.paper.width - (this.padding.left + this.padding.right);
10
+ this.height = this.paper.height - (this.padding.top + this.padding.bottom);
11
+
12
+ let width = this.width;
13
+ // ابعاد و پدینگ المنت ها
14
+ this.header = {
15
+ name: 'header',
16
+ w: width, h: 20,
17
+ pad: { left: 1, top: 1, right: 1, bottom: 2 },
18
+ display: 'block',
19
+ }
20
+ this.patient = {
21
+ name: 'patient',
22
+ w: width, h: 10,
23
+ pad: { left: 1, top: 1, right: 1, bottom: 1 },
24
+ display: 'block',
25
+ }
26
+ this.history = {
27
+ name: 'history',
28
+ w: width, h: 10,
29
+ pad: { left: 1, top: 1, right: 1, bottom: 1 },
30
+ display: 'block',
31
+ }
32
+ this.RAudiogram = {
33
+ name: 'RAudiogram',
34
+ w: width / 2, h: 105,
35
+ pad: { left: 1, top: 1, right: 1, bottom: 0 },
36
+ display: 'inline'
37
+ }
38
+ this.LAudiogram = {
39
+ name: 'LAudiogram',
40
+ w: width / 2, h: 105,
41
+ pad: { left: 1, top: 1, right: 1, bottom: 0 },
42
+ display: 'block'
43
+ }
44
+ this.RSpeech = {
45
+ name: 'RSpeech',
46
+ w: width / 2, h: 20,
47
+ pad: { left: 2, top: 1, right: 16, bottom: 1 },
48
+ display: 'inline',
49
+ }
50
+ this.LSpeech = {
51
+ name: 'LSpeech',
52
+ w: width / 2, h: 20,
53
+ pad: { left: 16, top: 1, right: 2, bottom: 1 },
54
+ display: 'block',
55
+ }
56
+ this.RTympanogram = {
57
+ name: 'RTympanogram',
58
+ w: width / 2, h: 60,
59
+ pad: { left: 2, top: 2, right: 2, bottom: 2 },
60
+ display: 'inline',
61
+ }
62
+ this.LTympanogram = {
63
+ name: 'LTympanogram',
64
+ w: width / 2, h: 60,
65
+ pad: { left: 2, top: 2, right: 2, bottom: 2 },
66
+ display: 'block',
67
+ }
68
+ this.RReflex = {
69
+ name: 'RReflex',
70
+ w: width / 2, h: 30,
71
+ pad: { left: 2, top: 2, right: 2, bottom: 2 },
72
+ display: 'inline'
73
+ }
74
+ this.LReflex = {
75
+ name: 'LReflex',
76
+ w: width / 2, h: 30,
77
+ pad: { left: 2, top: 2, right: 2, bottom: 2 },
78
+ display: 'block'
79
+ }
80
+ this.report = {
81
+ name: 'report',
82
+ w: width, h: 20,
83
+ pad: { left: 1, top: 1, right: 1, bottom: 1 },
84
+ display: 'block'
85
+ }
86
+ this.footer = {
87
+ name: 'footer',
88
+ w: width, h: 10,
89
+ pad: { left: 1, top: 1, right: 1, bottom: 1 },
90
+ display: 'block'
91
+ }
92
+ },
93
+
94
+ calc2: function () {
95
+ // let dims = this.dims;
96
+ let width, height;
97
+ //آیتم های روی این تمپلت
98
+ // روش جدید محاسبه ابعاد منطقی تر و تمیز تر
99
+ Object.assign(this.header, {
100
+ width: this.getWidth(this.patient),
101
+ height: this.getHeight(this.header)
102
+ })
103
+
104
+ width = this.patient.width = this.getWidth(this.patient)
105
+ this.patient.height = this.getHeight(this.patient)
106
+ this.patient.labels = {
107
+ line: { x1: 0, y1: 20, x2: width, y2: 20 },
108
+ name: { x: width, y: 5 },
109
+ lastName: { x: width - 30, y: 5 },
110
+ age: { x: width - 90, y: 5 },
111
+ referrer: { x: width - 130, y: 5 }
112
+ }
113
+ this.patient.inputs = {
114
+ name: { x: width - 5, y: 5 },
115
+ lastName: { x: width - 47, y: 5 },
116
+ age: { x: width - 97, y: 5 },
117
+ referrer: { x: width - 142, y: 5 }
118
+ }
119
+
120
+ width = this.history.width = this.getWidth(this.history)
121
+ this.history.height = this.getHeight(this.history)
122
+ this.history.labels = {
123
+ line: { x1: 0, y1: 20, x2: width, y2: 20 },
124
+ text: { x: width, y: 5 },
125
+ }
126
+ this.history.inputs = {
127
+ text: { x: width - 13, y: 5 },
128
+ }
129
+
130
+ width = this.RAudiogram.width = this.getWidth(this.RAudiogram)
131
+ this.RAudiogram.height = this.getHeight(this.RAudiogram)
132
+ width = this.LAudiogram.width = this.getWidth(this.LAudiogram)
133
+ this.LAudiogram.height = this.getHeight(this.RAudiogram)
134
+
135
+ width = this.RSpeech.width = this.getWidth(this.RSpeech)
136
+ this.RSpeech.height = this.getHeight(this.RSpeech)
137
+ this.RSpeech.labels = ["SDS", "SRT", "MCL", "UCL"]
138
+
139
+ width = this.LSpeech.width = this.getWidth(this.LSpeech)
140
+ this.LSpeech.height = this.getHeight(this.LSpeech)
141
+ this.LSpeech.labels = ["SDS", "SRT", "MCL", "UCL", "SAT"]
142
+
143
+ width = this.RTympanogram.width = this.getWidth(this.RTympanogram)
144
+ this.RTympanogram.height = this.getHeight(this.RTympanogram)
145
+ width = this.LTympanogram.width = this.getWidth(this.LTympanogram)
146
+ this.LTympanogram.height = this.getHeight(this.LTympanogram)
147
+
148
+ width = this.RReflex.width = this.getWidth(this.RReflex)
149
+ this.RReflex.height = this.getHeight(this.RReflex)
150
+ width = this.LReflex.width = this.getWidth(this.LReflex)
151
+ this.LReflex.height = this.getHeight(this.LReflex)
152
+
153
+ width = this.report.width = this.getWidth(this.report)
154
+ this.report.height = this.getHeight(this.report)
155
+ this.report.labels = {
156
+ name: { x: width, y: 5 },
157
+ }
158
+ this.report.inputs = {
159
+ name: { x: width - 5, y: 5 },
160
+ }
161
+
162
+ width = this.footer.width = this.getWidth(this.footer)
163
+ this.footer.height = this.getHeight(this.footer)
164
+ this.footer.labels = {
165
+ name: { x: width, y: 5 },
166
+ }
167
+ this.footer.inputs = {
168
+ name: { x: width - 5, y: 5 },
169
+ }
170
+ },
171
+
172
+ getWidth: function (element) {
173
+ return (element.w - (element.pad.left + element.pad.right))
174
+ },
175
+ getHeight: function (element) {
176
+ return (element.h - (element.pad.top + element.pad.bottom))
177
+ },
178
+
179
+ calcSectionsArray: function () {
180
+ // این آرایه دقیقا ترتیب قرارگیری سکشن ها را بدون اون اوردر قبلی تعیین میکند
181
+ this.sections = [
182
+ this.header,
183
+ this.patient,
184
+ this.history,
185
+ this.RAudiogram, this.LAudiogram,
186
+ this.RSpeech, this.LSpeech,
187
+ this.RTympanogram, this.LTympanogram,
188
+ this.RReflex, this.LReflex,
189
+ this.report,
190
+ this.footer
191
+
192
+ ]
193
+ },
194
+
195
+
196
+ }
197
+
198
+ dims.calc1()
199
+ dims.calc2()
200
+ dims.calcSectionsArray()
201
+ // پهنا و ارتفاع قابل استفاده منهای پد ها میشه پهنا و ارتفاع اصلی
202
+
203
+ export default dims;
204
+