@agung_dhewe/webapps 1.1.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 (130) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +2 -0
  3. package/jsconfig.json +10 -0
  4. package/libs/fgta5js-dist/fgta5js-v1.8.3.min.css +2 -0
  5. package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js +11 -0
  6. package/libs/fgta5js-dist/fgta5js-v1.8.3.min.js.map +1 -0
  7. package/libs/fgta5js-dist/fonts/karla-italic-latin-ext.woff2 +0 -0
  8. package/libs/fgta5js-dist/fonts/karla-italic-latin.woff2 +0 -0
  9. package/libs/fgta5js-dist/fonts/karla-normal-latin-ext.woff2 +0 -0
  10. package/libs/fgta5js-dist/fonts/karla-normal-latin.woff2 +0 -0
  11. package/libs/fgta5js-dist/fonts/karla.css +142 -0
  12. package/libs/webmodule/module-edit.css +163 -0
  13. package/libs/webmodule/module-footer.css +22 -0
  14. package/libs/webmodule/module-list.css +25 -0
  15. package/libs/webmodule/module.css +52 -0
  16. package/libs/webmodule/module.js +195 -0
  17. package/libs/webmodule/pagehelper.mjs +45 -0
  18. package/modules/generator/appgen-components.mjs +142 -0
  19. package/modules/generator/appgen-icons.mjs +6 -0
  20. package/modules/generator/appgen-io.mjs +784 -0
  21. package/modules/generator/appgen-ui-search.mjs +173 -0
  22. package/modules/generator/appgen-ui-unique.mjs +153 -0
  23. package/modules/generator/appgen-ui.mjs +1181 -0
  24. package/modules/generator/generator-context.mjs +18 -0
  25. package/modules/generator/generator-designtemplate.html +1508 -0
  26. package/modules/generator/generator-ext.html +0 -0
  27. package/modules/generator/generator-ext.mjs +3 -0
  28. package/modules/generator/generator.css +642 -0
  29. package/modules/generator/generator.mjs +195 -0
  30. package/modules/generator/generator.png +0 -0
  31. package/modules/generator/generatorEdit.html +185 -0
  32. package/modules/generator/generatorEdit.mjs +238 -0
  33. package/modules/generator/generatorList.html +32 -0
  34. package/modules/generator/generatorList.mjs +243 -0
  35. package/modules/login/login.css +11 -0
  36. package/modules/login/login.html +12 -0
  37. package/modules/login/login.mjs +111 -0
  38. package/package.json +46 -0
  39. package/percobaan/simmpan-ke-minio.js +24 -0
  40. package/src/api.js +80 -0
  41. package/src/apis/generator.api.js +226 -0
  42. package/src/apis/login.api.js +109 -0
  43. package/src/bucket.js +24 -0
  44. package/src/context.js +26 -0
  45. package/src/datalog.sql +22 -0
  46. package/src/datarecords.js +0 -0
  47. package/src/db.js +61 -0
  48. package/src/generator/createApiExtenderModule.js +54 -0
  49. package/src/generator/createApiModule.js +218 -0
  50. package/src/generator/createIcon.js +62 -0
  51. package/src/generator/createInfoAboutExtender.js +42 -0
  52. package/src/generator/createInfoLogs.js +41 -0
  53. package/src/generator/createInfoRecordExtender.js +41 -0
  54. package/src/generator/createModuleContext.js +48 -0
  55. package/src/generator/createModuleDetilEditHtml.js +110 -0
  56. package/src/generator/createModuleDetilEditMjs.js +172 -0
  57. package/src/generator/createModuleDetilListHtml.js +146 -0
  58. package/src/generator/createModuleDetilListMjs.js +73 -0
  59. package/src/generator/createModuleEjs.js +51 -0
  60. package/src/generator/createModuleExtenderHtml.js +43 -0
  61. package/src/generator/createModuleExtenderMjs.js +43 -0
  62. package/src/generator/createModuleHeaderEditHtml.js +148 -0
  63. package/src/generator/createModuleHeaderEditMjs.js +197 -0
  64. package/src/generator/createModuleHeaderListHtml.js +144 -0
  65. package/src/generator/createModuleHeaderListMjs.js +67 -0
  66. package/src/generator/createModuleMjs.js +67 -0
  67. package/src/generator/createModuleRollup.js +42 -0
  68. package/src/generator/createProgramData.js +96 -0
  69. package/src/generator/createTable.js +156 -0
  70. package/src/generator/ddl.js +475 -0
  71. package/src/generator/helper.js +149 -0
  72. package/src/generator/templates/__rollup-module.ejs +90 -0
  73. package/src/generator/templates/api-extender-module.js.ejs +0 -0
  74. package/src/generator/templates/api-module.js.ejs +818 -0
  75. package/src/generator/templates/module-context.ejs +16 -0
  76. package/src/generator/templates/module-ext-about.ejs +1 -0
  77. package/src/generator/templates/module-ext-record.ejs +1 -0
  78. package/src/generator/templates/module-ext.html.ejs +3 -0
  79. package/src/generator/templates/module-ext.mjs.ejs +21 -0
  80. package/src/generator/templates/module-logs.ejs +14 -0
  81. package/src/generator/templates/module.ejs.ejs +48 -0
  82. package/src/generator/templates/module.mjs.ejs +256 -0
  83. package/src/generator/templates/moduleDetilEdit.html.ejs +34 -0
  84. package/src/generator/templates/moduleDetilEdit.mjs.ejs +792 -0
  85. package/src/generator/templates/moduleDetilList.html.ejs +26 -0
  86. package/src/generator/templates/moduleDetilList.mjs.ejs +319 -0
  87. package/src/generator/templates/moduleHeaderEdit.html.ejs +53 -0
  88. package/src/generator/templates/moduleHeaderEdit.mjs.ejs +807 -0
  89. package/src/generator/templates/moduleHeaderList.html.ejs +24 -0
  90. package/src/generator/templates/moduleHeaderList.mjs.ejs +308 -0
  91. package/src/generator/templates/sqlAddField.ejs +3 -0
  92. package/src/generator/templates/sqlAddForeignKey.ejs +12 -0
  93. package/src/generator/templates/sqlAddUniqueIndex.ejs +4 -0
  94. package/src/generator/templates/sqlCreateTable.ejs +9 -0
  95. package/src/generator/templates/sqlDropForeignKey.ejs +3 -0
  96. package/src/generator/templates/sqlDropUniqueIndex.ejs +4 -0
  97. package/src/generator/templates/sqlModifyField.ejs +6 -0
  98. package/src/generator/trygenerate.js +83 -0
  99. package/src/generator/worker.js +389 -0
  100. package/src/helper.js +82 -0
  101. package/src/logger.js +39 -0
  102. package/src/router.js +84 -0
  103. package/src/routers/defaultLoginApi.js +29 -0
  104. package/src/routers/defaultLoginAsset.js +18 -0
  105. package/src/routers/defaultLoginPage.js +36 -0
  106. package/src/routers/defaultRootIndex.js +16 -0
  107. package/src/routers/downloadHandler.js +51 -0
  108. package/src/routers/fileUploadApi.js +15 -0
  109. package/src/routers/generatorApi.js +30 -0
  110. package/src/routers/generatorAsset.js +18 -0
  111. package/src/routers/generatorPage.js +37 -0
  112. package/src/routers/handleError.js +43 -0
  113. package/src/routers/handleModuleNotfound.js +12 -0
  114. package/src/routers/moduleApi.js +34 -0
  115. package/src/routers/modulePage.js +102 -0
  116. package/src/sequencerdoc.js +311 -0
  117. package/src/sequencerline.js +214 -0
  118. package/src/session.js +57 -0
  119. package/src/startup.js +59 -0
  120. package/src/webapps.js +239 -0
  121. package/src/workermanager.js +83 -0
  122. package/templates/_lib_debug.ejs +11 -0
  123. package/templates/_lib_production.ejs +5 -0
  124. package/templates/application.page.ejs +143 -0
  125. package/templates/generator.page.ejs +131 -0
  126. package/templates/index.page.ejs +24 -0
  127. package/templates/login.page.ejs +102 -0
  128. package/templates/moduleError.ejs +16 -0
  129. package/templates/moduleNotfound.ejs +14 -0
  130. package/webapps.code-workspace +11 -0
@@ -0,0 +1,142 @@
1
+ /* latin-ext */
2
+ /* karla-italic-latin-ext.woff2 */
3
+ @font-face {
4
+ font-family: 'Karla';
5
+ font-style: italic;
6
+ font-weight: 200;
7
+ font-display: swap;
8
+ src: url('karla-italic-latin-ext.woff2') format('woff2');
9
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
10
+ }
11
+ @font-face {
12
+ font-family: 'Karla';
13
+ font-style: italic;
14
+ font-weight: 400;
15
+ font-display: swap;
16
+ src: url('karla-italic-latin-ext.woff2') format('woff2');
17
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
18
+ }
19
+ @font-face {
20
+ font-family: 'Karla';
21
+ font-style: italic;
22
+ font-weight: 700;
23
+ font-display: swap;
24
+ src: url('karla-italic-latin-ext.woff2') format('woff2');
25
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
26
+ }
27
+ @font-face {
28
+ font-family: 'Karla';
29
+ font-style: italic;
30
+ font-weight: 900;
31
+ font-display: swap;
32
+ src: url('karla-italic-latin-ext.woff2') format('woff2');
33
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
34
+ }
35
+
36
+
37
+ /* latin */
38
+ /* karla-italic-latin.woff2 */
39
+ @font-face {
40
+ font-family: 'Karla';
41
+ font-style: italic;
42
+ font-weight: 200;
43
+ font-display: swap;
44
+ src: url('karla-italic-latin.woff2') format('woff2');
45
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
46
+ }
47
+ @font-face {
48
+ font-family: 'Karla';
49
+ font-style: italic;
50
+ font-weight: 400;
51
+ font-display: swap;
52
+ src: url('karla-italic-latin.woff2') format('woff2');
53
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
54
+ }
55
+ @font-face {
56
+ font-family: 'Karla';
57
+ font-style: italic;
58
+ font-weight: 700;
59
+ font-display: swap;
60
+ src: url('karla-italic-latin.woff2') format('woff2');
61
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
62
+ }
63
+ @font-face {
64
+ font-family: 'Karla';
65
+ font-style: italic;
66
+ font-weight: 900;
67
+ font-display: swap;
68
+ src: url('karla-italic-latin.woff2') format('woff2');
69
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
70
+ }
71
+
72
+
73
+ /* latin-ext */
74
+ /* karla-normal-latin-ext.woff2 */
75
+ @font-face {
76
+ font-family: 'Karla';
77
+ font-style: normal;
78
+ font-weight: 200;
79
+ font-display: swap;
80
+ src: url('karla-normal-latin-ext.woff2') format('woff2');
81
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
82
+ }
83
+ @font-face {
84
+ font-family: 'Karla';
85
+ font-style: normal;
86
+ font-weight: 400;
87
+ font-display: swap;
88
+ src: url('karla-normal-latin-ext.woff2') format('woff2');
89
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
90
+ }
91
+ @font-face {
92
+ font-family: 'Karla';
93
+ font-style: normal;
94
+ font-weight: 700;
95
+ font-display: swap;
96
+ src: url('karla-normal-latin-ext.woff2') format('woff2');
97
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
98
+ }
99
+ @font-face {
100
+ font-family: 'Karla';
101
+ font-style: normal;
102
+ font-weight: 900;
103
+ font-display: swap;
104
+ src: url('karla-normal-latin-ext.woff2') format('woff2');
105
+ unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
106
+ }
107
+
108
+ /* latin */
109
+ /* karla-normal-latin.woff2 */
110
+ @font-face {
111
+ font-family: 'Karla';
112
+ font-style: normal;
113
+ font-weight: 200;
114
+ font-display: swap;
115
+ src: url('karla-normal-latin.woff2') format('woff2');
116
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
117
+ }
118
+ @font-face {
119
+ font-family: 'Karla';
120
+ font-style: normal;
121
+ font-weight: 400;
122
+ font-display: swap;
123
+ src: url('karla-normal-latin.woff2') format('woff2');
124
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
125
+ }
126
+ @font-face {
127
+ font-family: 'Karla';
128
+ font-style: normal;
129
+ font-weight: 700;
130
+ font-display: swap;
131
+ src: url('karla-normal-latin.woff2') format('woff2');
132
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
133
+ }
134
+ @font-face {
135
+ font-family: 'Karla';
136
+ font-style: normal;
137
+ font-weight: 900;
138
+ font-display: swap;
139
+ src: url('karla-normal-latin.woff2') format('woff2');
140
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
141
+ }
142
+
@@ -0,0 +1,163 @@
1
+ .module-form {
2
+ display: flex;
3
+ column-gap: 10px;
4
+ row-gap: 5px;
5
+ flex-wrap: wrap;
6
+ margin-bottom: 20px;
7
+ }
8
+
9
+
10
+
11
+
12
+ .input-field {
13
+ display: flex;
14
+ column-gap: 10px;
15
+ /* background-color: aliceblue; */
16
+ }
17
+
18
+ .input-field > label {
19
+ margin-top: 4px;
20
+ font-size: 0.8rem;
21
+ font-weight: bold;
22
+
23
+ }
24
+
25
+ @media screen and (max-width: 500px) {
26
+ .input-field {
27
+ flex-direction: column;
28
+ }
29
+
30
+ .input-field > div[label],
31
+ .input-field > label {
32
+ text-align: left;
33
+ margin-bottom: 5px;
34
+ width: fit-content;
35
+ min-width: unset;
36
+ }
37
+ }
38
+
39
+
40
+ @media screen and (min-width: 501px) {
41
+ .input-field > label {
42
+ text-align: right;
43
+ width: 80px;
44
+ min-width: 80px;
45
+ }
46
+ }
47
+
48
+
49
+
50
+
51
+
52
+
53
+ @media screen and (max-width: 500px) {
54
+ /* Box information detil */
55
+ .panel-detil {
56
+ margin: 50px 0 0 0;
57
+ }
58
+ }
59
+
60
+ @media screen and (min-width: 501px) {
61
+ /* Box information detil */
62
+ .panel-detil {
63
+ margin: 50px 20px 20px 20px;
64
+ }
65
+ }
66
+
67
+
68
+ .panel-detil [panel-title] {
69
+ font-weight: bold;
70
+ background-color: #2c2f60;
71
+ color: #fff;
72
+ border-radius: 10px 10px 0 0;
73
+ padding: 10px 10px 10px 15px;
74
+ font-weight: 1.1rem;
75
+ }
76
+
77
+ .panel-detil [panel-content] {
78
+ background-color: #ececec;
79
+ padding: 5px 0 10px 0;
80
+ border-radius: 0 0 10px 10px;
81
+
82
+ }
83
+
84
+ .panel-detil-row {
85
+ display: grid;
86
+ grid-template-columns: 1fr 1fr; /* 2 kolom */
87
+ grid-template-rows: auto auto; /* 2 baris */
88
+ column-gap: 10px; /* jarak antar item */
89
+ padding: 10px 15px 10px 15px;
90
+ color: rgb(80, 80, 80);
91
+
92
+ }
93
+
94
+ .panel-detil-row [data-info] {
95
+ font-weight: bold;
96
+ text-align: right;
97
+ }
98
+
99
+ .panel-detil-row a {
100
+ font-weight: bold;
101
+ text-decoration: none;
102
+ color: rgb(80, 80, 80);
103
+ }
104
+
105
+ .panel-detil-row-highligted {
106
+ background-color: #2c2f6031;
107
+ color: #fff
108
+ }
109
+
110
+ .panel-detil-row-highligted a {
111
+ color: #fff
112
+ }
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ /* Record Bar */
122
+ .panel-recordbar {
123
+ display: flex;
124
+ }
125
+
126
+
127
+ .panel-recordbar[data-view="nodetil"] {
128
+ margin-top: 60px;
129
+ padding-top: 10px;
130
+ border-top: 1px solid #c4c7e8;
131
+ }
132
+
133
+ @media screen and (max-width: 500px) {
134
+ .panel-recordbar {
135
+ margin-top: 12px;
136
+ }
137
+ }
138
+
139
+ @media screen and (min-width: 501px) {
140
+ .panel-recordbar {
141
+ margin: 12px 20px 20px 20px;
142
+ }
143
+ }
144
+
145
+
146
+ .panel-recordbar > div {
147
+ padding: 2px 10px 2px 10px;
148
+ border-left: 1px solid #bebebe;
149
+
150
+ }
151
+
152
+ .panel-recordbar > div:first-child {
153
+ border-left: 0
154
+ }
155
+
156
+ .panel-recordbar a {
157
+ color: #4a4a4a
158
+ }
159
+
160
+ .panel-recordbar a:hover {
161
+ color: #000
162
+
163
+ }
@@ -0,0 +1,22 @@
1
+ .footer-buttons-container {
2
+ display: flex;
3
+ justify-content: space-between;
4
+ width: 100%;
5
+
6
+ }
7
+
8
+ @media screen and (max-width: 500px) {
9
+ .footer-buttons-container {
10
+ padding-left: 5px;
11
+ padding-right: 5px;
12
+ }
13
+
14
+
15
+ }
16
+
17
+ @media screen and (min-width: 501px) {
18
+ .footer-buttons-container {
19
+ padding-left: 50px;
20
+ padding-right: 50px;
21
+ }
22
+ }
@@ -0,0 +1,25 @@
1
+ .search-container {
2
+ display: flex;
3
+ margin-bottom: 10px;
4
+ margin-top: 10px;
5
+ column-gap: 10px;
6
+ }
7
+
8
+ .search-container > button {
9
+ align-self: flex-start;
10
+ }
11
+
12
+ .search-parameters {
13
+ display: flex;
14
+ column-gap: 10px;
15
+ }
16
+
17
+ @media screen and (max-width: 500px) {
18
+ .search-parameters {
19
+ flex-grow: 1;
20
+ }
21
+ }
22
+
23
+ @media screen and (min-width: 501px) {
24
+
25
+ }
@@ -0,0 +1,52 @@
1
+ @import url('./module-list.css');
2
+ @import url('./module-edit.css');
3
+ @import url('./module-footer.css');
4
+
5
+
6
+ body {
7
+ overflow-x: hidden;
8
+
9
+ }
10
+
11
+
12
+
13
+ #fRecord-section [name="panel"] {
14
+ display: flex;
15
+ }
16
+
17
+
18
+ #fRecord-section [name="row"] {
19
+ display: flex;
20
+ margin-bottom: 5px;
21
+ }
22
+
23
+ #fRecord-section [name="column"] div:nth-child(even) {
24
+ margin-bottom: 15px;
25
+ }
26
+
27
+ #fRecord-section [name="caption"] {
28
+ width: 120px;
29
+ text-align: right;
30
+ padding-right: 10px;
31
+ font-weight: bold;
32
+ font-size: 0.8rem;
33
+ }
34
+
35
+
36
+ .logcell {
37
+ padding: 4px 8px 5px 8px;
38
+ border-bottom: 1px solid #e7e7e7;
39
+ font-size: 0.7rem;
40
+ }
41
+
42
+ .logheader {
43
+ padding: 4px 8px 6px 8px;
44
+ font-weight: bold;
45
+ border-bottom: 1px solid #8d8d8d;
46
+ font-size: 0.8rem;
47
+
48
+ }
49
+
50
+
51
+
52
+
@@ -0,0 +1,195 @@
1
+ const RESET_CONFIRM = 'Sudah ada perubahan data, apakah akan direset?'
2
+ const NEWDATA_CONFIRM = 'Sudah ada perubahan data, apakah akan membuat baru?'
3
+ const BACK_CONFIRM = 'Sudah ada perubahan data, apakah akan kembali ke list?'
4
+ const DELETE_CONFIRM = 'Apakah akan hapus data '
5
+ const EDIT_WARNING = 'Silakan data di save atau di reset dahulu'
6
+
7
+ class Module {
8
+ static get RESET_CONFIRM() { return RESET_CONFIRM }
9
+ static get NEWDATA_CONFIRM() { return NEWDATA_CONFIRM }
10
+ static get BACK_CONFIRM() { return BACK_CONFIRM }
11
+ static get DELETE_CONFIRM() { return DELETE_CONFIRM }
12
+ static get EDIT_WARNING() { return EDIT_WARNING }
13
+
14
+ constructor() {
15
+ }
16
+
17
+ static isMobileDevice() {
18
+ return /Mobi|Android|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent);
19
+ }
20
+
21
+ static renderFooterButtons(footerButtonsContainer) {
22
+ const footer = document.querySelector('footer.fgta5-app-footer')
23
+ footer.innerHTML = ''
24
+
25
+ // masukkan semua footerButtonsContainer ke footer
26
+ for (var bc of Array.from(footerButtonsContainer)) {
27
+ var section = bc.closest('section')
28
+ bc.setAttribute('data-section', section.id)
29
+
30
+ footer.appendChild(bc)
31
+ }
32
+ }
33
+
34
+
35
+ static async sleep(ms) {
36
+ return new Promise(lanjut=>{
37
+ setTimeout(()=>{
38
+ lanjut()
39
+ }, ms)
40
+ })
41
+ }
42
+
43
+
44
+ static async download(url, args) {
45
+ const method = 'POST'
46
+ const body = JSON.stringify(args)
47
+ const headers = {
48
+ 'Content-Type': 'application/json'
49
+ }
50
+
51
+ // tambahkan informasi header
52
+ headers['appid'] = 'fgta'
53
+ headers['timestamp'] = 'timestamp'
54
+ headers['verifier'] = 'verifier'
55
+
56
+ try {
57
+ const response = await fetch(url, {method, headers, body})
58
+ if (!response.ok) {
59
+ const status = response.status
60
+
61
+ let errorMessage
62
+ if (status==401) {
63
+ // belum login, hapus session login
64
+ sessionStorage.removeItem('login');
65
+ sessionStorage.removeItem('login_nexturl');
66
+ errorMessage = 'need authorization to download asset'
67
+ } else {
68
+ errorMessage = 'download fail'
69
+ }
70
+
71
+ const err = new Error(errorMessage)
72
+ err.status = status
73
+ err.code = response.code || 1
74
+ throw err
75
+ }
76
+
77
+ let filename = 'download'; // fallback
78
+ const disposition = response.headers.get('Content-Disposition');
79
+
80
+ if (disposition && disposition.includes('filename=')) {
81
+ const match = disposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
82
+ if (match != null && match[1]) {
83
+ filename = match[1].replace(/['"]/g, ''); // hapus tanda kutip
84
+ }
85
+ }
86
+
87
+ // Ambil file sebagai blob
88
+ const blob = await response.blob();
89
+
90
+
91
+ // Buat link download
92
+ const downloadUrl = URL.createObjectURL(blob)
93
+ const a = document.createElement('a')
94
+ a.setAttribute('target', '_blank')
95
+ a.href = downloadUrl
96
+ a.download = filename // atau nama file yang sesuai
97
+ document.body.appendChild(a)
98
+ a.click()
99
+ a.remove()
100
+ URL.revokeObjectURL(downloadUrl); // bersihkan URL blob
101
+
102
+ } catch (err) {
103
+ await this.processError(err)
104
+ // throw err
105
+ }
106
+ }
107
+
108
+
109
+ static async apiCall(url, args, formData) {
110
+ const inFrane = window.self !== window.top;
111
+ const api = new $fgta5.ApiEndpoint(url)
112
+
113
+ api.setHeader('appid', 'fgta')
114
+ api.setHeader('timestamp', 'timestamp')
115
+ api.setHeader('verifier', 'verifier')
116
+
117
+ try {
118
+ const result = await api.execute(args, formData)
119
+ return result
120
+ } catch (err) {
121
+ this.processError(err)
122
+ throw err
123
+ }
124
+ }
125
+
126
+
127
+ static async processError(err) {
128
+ const inFrane = window.self !== window.top;
129
+ const currentUrl = window.location.href;
130
+ if (err.status==401) {
131
+ console.error(err)
132
+ await $fgta5.MessageBox.error(err.message)
133
+ if (inFrane) {
134
+ window.parent.postMessage({
135
+ action:'REDIRECT_TO_LOGIN',
136
+ href: '/login',
137
+ nexturl: currentUrl
138
+
139
+ }, '*')
140
+ } else {
141
+ location.href = `/login?nexturl=${currentUrl}`
142
+ }
143
+ await this.sleep(10000)
144
+ throw err
145
+ } else {
146
+ throw err
147
+ }
148
+
149
+ }
150
+
151
+
152
+ static async loadTemplate(name) {
153
+ const tpl = document.querySelector(`template[name="${name}"]`)
154
+ if (tpl==null) {
155
+ throw new Error(`template "${name}" is not found!`)
156
+ }
157
+
158
+ const clone = tpl.content.cloneNode(true); // salin isi template
159
+ document.body.appendChild(clone);
160
+ }
161
+
162
+
163
+
164
+ static insertAtCursor(input, char) {
165
+ const start = input.selectionStart;
166
+ const end = input.selectionEnd;
167
+ const value = input.value;
168
+ input.value = value.slice(0, start) + char + value.slice(end);
169
+ input.setSelectionRange(start + 1, start + 1);
170
+ }
171
+
172
+ static deleteAtCursor(input, mode) {
173
+ const start = input.selectionStart;
174
+ const end = input.selectionEnd;
175
+ const value = input.value;
176
+
177
+ if (start === end) {
178
+ if (mode === 'backspace' && start > 0) {
179
+ input.value = value.slice(0, start - 1) + value.slice(end);
180
+ input.setSelectionRange(start - 1, start - 1);
181
+ } else if (mode === 'delete' && start < value.length) {
182
+ input.value = value.slice(0, start) + value.slice(end + 1);
183
+ input.setSelectionRange(start, start);
184
+ }
185
+ } else {
186
+ input.value = value.slice(0, start) + value.slice(end);
187
+ input.setSelectionRange(start, start);
188
+ }
189
+ }
190
+ }
191
+
192
+
193
+
194
+
195
+
@@ -0,0 +1,45 @@
1
+
2
+ export async function openSection(self, sectionName, params, fnOpened) {
3
+ const context = params.Context
4
+ const Crsl = context.Crsl
5
+ const section = Crsl.Items[sectionName]
6
+ section.setSectionReturn(params.sectionReturn)
7
+ section.show({}, fnOpened)
8
+ }
9
+
10
+
11
+ export function renderLog(tbody, data) {
12
+ tbody.innerHTML = ''
13
+
14
+ for (var row of data) {
15
+ const tr = document.createElement('tr')
16
+
17
+ const tdTime = document.createElement('td')
18
+ tdTime.innerHTML = row.log_time
19
+ tdTime.classList.add('logcell')
20
+
21
+ const tdUser = document.createElement('td')
22
+ tdUser.innerHTML = row.log_user_name
23
+ tdUser.classList.add('logcell')
24
+
25
+ const tdAction = document.createElement('td')
26
+ tdAction.innerHTML = row.log_action
27
+ tdAction.classList.add('logcell')
28
+
29
+ const tdIP = document.createElement('td')
30
+ tdIP.innerHTML = row.log_ipaddress
31
+ tdIP.classList.add('logcell')
32
+
33
+ const tdRemark = document.createElement('td')
34
+ tdRemark.innerHTML = row.log_remark
35
+ tdRemark.classList.add('logcell')
36
+
37
+
38
+ tr.appendChild(tdTime)
39
+ tr.appendChild(tdUser)
40
+ tr.appendChild(tdAction)
41
+ tr.appendChild(tdIP)
42
+ tr.appendChild(tdRemark)
43
+ tbody.appendChild(tr)
44
+ }
45
+ }