zet-lib 1.2.87 → 1.2.89
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.
- package/lib/moduleLib.js +6 -2
- package/lib/zCache.js +6 -44
- package/lib/zGeneratorRouter.js +1 -1
- package/lib/zRoute.js +2 -2
- package/package.json +1 -1
package/lib/moduleLib.js
CHANGED
|
@@ -487,10 +487,14 @@ m.selectpicker = function (req, res, elem) {
|
|
|
487
487
|
|
|
488
488
|
m.slugHTML = (req, res, content, at = 'end') => {
|
|
489
489
|
if (content) {
|
|
490
|
+
let head = res.locals.moduleHead
|
|
491
|
+
let end = res.locals.moduleEnd
|
|
490
492
|
if (at == 'end') {
|
|
491
|
-
|
|
493
|
+
end += content
|
|
494
|
+
res.locals.moduleEnd = end
|
|
492
495
|
} else {
|
|
493
|
-
|
|
496
|
+
head += content
|
|
497
|
+
res.locals.moduleHead = head
|
|
494
498
|
}
|
|
495
499
|
}
|
|
496
500
|
}
|
package/lib/zCache.js
CHANGED
|
@@ -19,7 +19,7 @@ zCache.KEYS = {
|
|
|
19
19
|
ZFUNCTIONS: 'ZFUNCTIONS',
|
|
20
20
|
VERSIONS: 'VERSIONS',
|
|
21
21
|
MODELS_RELATIONS: 'MODELS_RELATIONS',
|
|
22
|
-
APPROVAL_LEVELS
|
|
22
|
+
APPROVAL_LEVELS: 'APPROVAL_LEVELS',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
zCache.STATICS = zCache.KEYS
|
|
@@ -62,12 +62,6 @@ const cache = async () => {
|
|
|
62
62
|
} else {
|
|
63
63
|
await zCache.MYMODELS()
|
|
64
64
|
}
|
|
65
|
-
if (myCache.has('CONFIG')) {
|
|
66
|
-
i = i + 1
|
|
67
|
-
} else {
|
|
68
|
-
//console.log("cache CONFIG not exist " + i)
|
|
69
|
-
await zCache.CONFIG()
|
|
70
|
-
}
|
|
71
65
|
if (myCache.has('MENU')) {
|
|
72
66
|
i = i + 1
|
|
73
67
|
} else {
|
|
@@ -87,7 +81,7 @@ const cache = async () => {
|
|
|
87
81
|
await zCache.ZFUNCTIONS()
|
|
88
82
|
}
|
|
89
83
|
if (myCache.has('APPROVAL_LEVELS')) {
|
|
90
|
-
|
|
84
|
+
i = i + 1
|
|
91
85
|
} else {
|
|
92
86
|
await zCache.APPROVAL_LEVELS()
|
|
93
87
|
}
|
|
@@ -176,38 +170,6 @@ zCache.VERSIONS = () => {
|
|
|
176
170
|
}
|
|
177
171
|
}
|
|
178
172
|
|
|
179
|
-
zCache.CONFIG = async () => {
|
|
180
|
-
let results = async () => {
|
|
181
|
-
return await connection.results({
|
|
182
|
-
table: 'zconfig',
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
let companies = await connection.results({
|
|
186
|
-
table: 'zcompany',
|
|
187
|
-
})
|
|
188
|
-
let r = await results()
|
|
189
|
-
let configObj = Util.arrayToObject(r, 'company_id')
|
|
190
|
-
for (let i = 0; i < companies.length; i++) {
|
|
191
|
-
let item = companies[i]
|
|
192
|
-
if (!configObj[item.id]) {
|
|
193
|
-
await connection.insert({
|
|
194
|
-
table: 'zconfig',
|
|
195
|
-
data: {
|
|
196
|
-
company_id: item.id,
|
|
197
|
-
layout: 0,
|
|
198
|
-
json: JSON.stringify(CONFIG),
|
|
199
|
-
created_at: Util.now(),
|
|
200
|
-
updated_at: Util.now(),
|
|
201
|
-
},
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
myCache.set(zCache.KEYS.CONFIG, Util.arrayToObject(await results(), 'company_id'))
|
|
207
|
-
//add to version after set
|
|
208
|
-
zCache.updateVersions(zCache.KEYS.CONFIG)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
173
|
zCache.MENU = async () => {
|
|
212
174
|
let results = async () => {
|
|
213
175
|
return await connection.results({
|
|
@@ -322,15 +284,15 @@ zCache.MODELS_RELATIONS = async () => {
|
|
|
322
284
|
}
|
|
323
285
|
}
|
|
324
286
|
|
|
325
|
-
zCache.APPROVAL_LEVELS = async() => {
|
|
287
|
+
zCache.APPROVAL_LEVELS = async () => {
|
|
326
288
|
if (myCache.has('APPROVAL_LEVELS')) {
|
|
327
289
|
return myCache.get('APPROVAL_LEVELS')
|
|
328
290
|
} else {
|
|
329
291
|
let results = await connection.results({
|
|
330
|
-
select:'id,name,color',
|
|
331
|
-
table:'zapproval_type'
|
|
292
|
+
select: 'id,name,color',
|
|
293
|
+
table: 'zapproval_type',
|
|
332
294
|
})
|
|
333
|
-
let obj = Util.arrayToObject(results,
|
|
295
|
+
let obj = Util.arrayToObject(results, 'id')
|
|
334
296
|
myCache.set('APPROVAL_LEVELS', obj)
|
|
335
297
|
return obj
|
|
336
298
|
}
|
package/lib/zGeneratorRouter.js
CHANGED
|
@@ -16,7 +16,7 @@ const ejs = require('ejs')
|
|
|
16
16
|
var app = express()
|
|
17
17
|
const path = require('path')
|
|
18
18
|
|
|
19
|
-
const nots = ['index', 'uploads', 'js', 'css', 'log', 'generator', 'zmenu', 'zgenerator', 'zfields', 'zrole', 'zfunction', 'zgrid', 'zgrid_default', 'zreport', 'zpage', 'zlayout', 'zerror', 'zuser_company'
|
|
19
|
+
const nots = ['index', 'uploads', 'js', 'css', 'log', 'generator', 'zmenu', 'zgenerator', 'zfields', 'zrole', 'zfunction', 'zgrid', 'zgrid_default', 'zreport', 'zpage', 'zlayout', 'zerror', 'zuser_company']
|
|
20
20
|
//const nots = [];
|
|
21
21
|
//const generatorUrl = 'http://localhost:3005';
|
|
22
22
|
const generatorUrl = 'https://generator.cmsqu.com'
|
package/lib/zRoute.js
CHANGED
|
@@ -2596,9 +2596,9 @@ zRoute.viewFormsSync = async (req, res, MYMODEL, data = {}) => {
|
|
|
2596
2596
|
</div>
|
|
2597
2597
|
|
|
2598
2598
|
<div class="ps-lg-4 my-5 text-lg-start col-lg-3 mb-3 float-end divhistory"><button title="History" class="btn btn-success image-button btn-rounded dimens2x" style="position: fixed;bottom: 100px;right: -40px; transform: rotate(90deg);" data-bs-toggle="modal" data-bs-target="#modal-history"><img src="/assets/icons/history.svg" class="icons-bg-white" alt="Delete"> <span>History Data</span></button></div>
|
|
2599
|
-
`
|
|
2600
2599
|
|
|
2601
|
-
|
|
2600
|
+
`
|
|
2601
|
+
moduleLib.slugHTML(req, res, contentModal)
|
|
2602
2602
|
let contentScript = `$(function(){
|
|
2603
2603
|
ajaxPost("/zhistory-data",{id:${data.id},table:"${MYMODEL.table}"},(data) => {$("#modal-body-history").html(data); if(data == "") {$(".divhistory").remove()}});
|
|
2604
2604
|
$("#${MYMODEL.table}-delete").on("click", (() => {
|