zet-lib 1.2.108 → 1.2.110
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/Form.js +2 -1
- package/lib/zRoute.js +7 -2
- package/lib/zdataTable.js +14 -1
- package/package.json +1 -1
package/lib/Form.js
CHANGED
|
@@ -886,7 +886,8 @@ Form.modal = (obj, LANGUAGE = {}) => {
|
|
|
886
886
|
<input type="hidden" id="serialize_right" name="serialize_right" value=''/>
|
|
887
887
|
</form>
|
|
888
888
|
</div> <!-- .dynagrid-config-form -->`,
|
|
889
|
-
footer: `<
|
|
889
|
+
footer: `<select id="zgrid_default_type" class="form-control select-sm" style="width:100px"><option value="1">Data Table</option><option value="2">Table</option> </select>
|
|
890
|
+
<button type="reset" class="btn btn-default refresh gridreload image-button" title="Abort any changes and reset settings">
|
|
890
891
|
<img src="/assets/icons/refresh.svg" class="icons-bg-black"> ${LANGUAGE.reset || 'Reset'}
|
|
891
892
|
</button>
|
|
892
893
|
<button type="button" class="btn btn-primary grid-submit boxy image-button" title="Save grid settings">
|
package/lib/zRoute.js
CHANGED
|
@@ -341,6 +341,7 @@ zRoute.attributeData = async (res, MYMODEL, obj) => {
|
|
|
341
341
|
obj = obj || null
|
|
342
342
|
const userId = res.locals.userId || 0
|
|
343
343
|
const routeName = MYMODEL.routeName
|
|
344
|
+
let type = 1
|
|
344
345
|
let attributeData, labels, visibles, invisibles, filter
|
|
345
346
|
attributeData = MYMODEL
|
|
346
347
|
const zgrid = await connection.results({
|
|
@@ -351,6 +352,7 @@ zRoute.attributeData = async (res, MYMODEL, obj) => {
|
|
|
351
352
|
visibles = zgrid[0].visibles ? zgrid[0].visibles : MYMODEL.grids.visibles
|
|
352
353
|
invisibles = zgrid[0].invisibles ? zgrid[0].invisibles : MYMODEL.grids.invisibles
|
|
353
354
|
filter = zgrid[0].filter ? zgrid[0].filter : null
|
|
355
|
+
type = zgrid[0].type
|
|
354
356
|
} else {
|
|
355
357
|
visibles = MYMODEL.grids.visibles
|
|
356
358
|
invisibles = MYMODEL.grids.invisibles
|
|
@@ -370,12 +372,12 @@ zRoute.attributeData = async (res, MYMODEL, obj) => {
|
|
|
370
372
|
visibles = visibles.filter((item) => !customs.includes(item))
|
|
371
373
|
invisibles = invisibles.filter((item) => !customs.includes(item))
|
|
372
374
|
}
|
|
373
|
-
|
|
374
375
|
res.locals.routeName = routeName
|
|
375
376
|
res.locals.attributeData = attributeData
|
|
376
377
|
res.locals.visibles = visibles
|
|
377
378
|
res.locals.invisibles = invisibles
|
|
378
379
|
res.locals.gridFilter = filter
|
|
380
|
+
res.locals.gridType = type
|
|
379
381
|
let visiblesObj = []
|
|
380
382
|
visibles.map((item) => {
|
|
381
383
|
visiblesObj.push({
|
|
@@ -1916,7 +1918,7 @@ zRoute.listDataTable = async (req, res, objData = {}) => {
|
|
|
1916
1918
|
let buttons = objData.hasOwnProperty('actionButtons') ? objData.actionButtons(levels, row, MYMODEL.table) : zRoute.actionButtons(levels, row, MYMODEL.table)
|
|
1917
1919
|
arr.push(buttons)
|
|
1918
1920
|
} else {
|
|
1919
|
-
let data = objData.hasOwnProperty('
|
|
1921
|
+
let data = objData.hasOwnProperty('dataTableData') ? objData.dataTableData(item, row[item], MYMODEL, relations) : zRoute.dataTableData(item, row[item], MYMODEL, relations, row.id)
|
|
1920
1922
|
arr.push(data)
|
|
1921
1923
|
}
|
|
1922
1924
|
})
|
|
@@ -2147,6 +2149,9 @@ zRoute.postGrid = async (req, res) => {
|
|
|
2147
2149
|
company_id: 1,
|
|
2148
2150
|
updated_at: Util.now(),
|
|
2149
2151
|
}
|
|
2152
|
+
if (query.serialize_type) {
|
|
2153
|
+
post.type = query.serialize_type
|
|
2154
|
+
}
|
|
2150
2155
|
let results = await connection.results({
|
|
2151
2156
|
table: gridTable,
|
|
2152
2157
|
where: { user_id: res.locals.userId, route_name: res.locals.routeName },
|
package/lib/zdataTable.js
CHANGED
|
@@ -6,12 +6,13 @@ const myCache = require('./cache')
|
|
|
6
6
|
|
|
7
7
|
class dataTable {
|
|
8
8
|
constructor(datas) {
|
|
9
|
+
//console.log(datas)
|
|
9
10
|
this.visibles = datas.visiblesObj //array object
|
|
10
11
|
this.setColumns = ''
|
|
11
12
|
this.setTable = ''
|
|
12
13
|
this.srcScript = '/modules/datatables.min.js'
|
|
13
14
|
this.dataTableScript = '/js/datatable-grids.js'
|
|
14
|
-
this.dataTableButtons = '/js/datatable-buttons.
|
|
15
|
+
this.dataTableButtons = '/js/datatable-buttons.js'
|
|
15
16
|
this.customButtons = ''
|
|
16
17
|
this.MYMODEL = null
|
|
17
18
|
this.searchColumns = {}
|
|
@@ -22,6 +23,7 @@ class dataTable {
|
|
|
22
23
|
this.level_approval = this.roles.approvals && this.roles.approvals[datas.routeName] ? this.roles.approvals[datas.routeName] : {}
|
|
23
24
|
this.hasLevels = Object.keys(this.level_approval).length == 0 ? false : true
|
|
24
25
|
this.visiblesKey = this.visibles.map((item) => item.key)
|
|
26
|
+
this.gridType = datas.gridType || 1
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// for filter html
|
|
@@ -240,6 +242,14 @@ class dataTable {
|
|
|
240
242
|
})</script>${Util.newLine}`
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
/*
|
|
246
|
+
Slug script change data table responsive or not
|
|
247
|
+
*/
|
|
248
|
+
let slugScript = ''
|
|
249
|
+
if (this.gridType == 2) {
|
|
250
|
+
slugScript += `$("#dataTable").removeClass("dataTable");`
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
script += `<script type="text/javascript">
|
|
244
254
|
$(function () {
|
|
245
255
|
$("#ck_all").on('click', function () {
|
|
@@ -274,6 +284,9 @@ $(".btn-save-unlock").on("click", function () {
|
|
|
274
284
|
})
|
|
275
285
|
})
|
|
276
286
|
|
|
287
|
+
$("#zgrid_default_type").val(${this.gridType});
|
|
288
|
+
${slugScript}
|
|
289
|
+
|
|
277
290
|
})</script>${Util.newLine}`
|
|
278
291
|
|
|
279
292
|
return script
|