zet-lib 1.0.52 → 1.0.53
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/views/generator_layout.ejs +175 -158
- package/lib/views/generatorjs.ejs +677 -605
- package/package.json +1 -1
|
@@ -7,736 +7,796 @@
|
|
|
7
7
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.15.0/ace.js"></script>
|
|
8
8
|
<script>
|
|
9
9
|
var others = {}
|
|
10
|
-
var container_time = ''
|
|
10
|
+
var container_time = ''
|
|
11
11
|
//end container
|
|
12
|
-
var editor_hardcode_grid = ace.edit(
|
|
13
|
-
editor_hardcode_grid.getSession().setMode(
|
|
14
|
-
var editor_router = ace.edit(
|
|
15
|
-
editor_router.getSession().setMode(
|
|
12
|
+
var editor_hardcode_grid = ace.edit('hardcode_grid')
|
|
13
|
+
editor_hardcode_grid.getSession().setMode('ace/mode/javascript')
|
|
14
|
+
var editor_router = ace.edit('router')
|
|
15
|
+
editor_router.getSession().setMode('ace/mode/javascript')
|
|
16
16
|
|
|
17
|
-
var editor_index_ejs = ace.edit(
|
|
18
|
-
editor_index_ejs.getSession().setMode(
|
|
17
|
+
var editor_index_ejs = ace.edit('index_ejs')
|
|
18
|
+
editor_index_ejs.getSession().setMode('ace/mode/ejs')
|
|
19
19
|
//editor_index_ejs.setValue(datas.index_ejs);
|
|
20
20
|
|
|
21
|
-
var editor_indexcss_ejs = ace.edit(
|
|
22
|
-
editor_indexcss_ejs.getSession().setMode(
|
|
21
|
+
var editor_indexcss_ejs = ace.edit('indexcss_ejs')
|
|
22
|
+
editor_indexcss_ejs.getSession().setMode('ace/mode/ejs')
|
|
23
23
|
//editor_indexcss_ejs.setValue(datas.indexcss_ejs);
|
|
24
24
|
|
|
25
|
-
var editor_indexjs_ejs = ace.edit(
|
|
26
|
-
editor_indexjs_ejs.getSession().setMode(
|
|
25
|
+
var editor_indexjs_ejs = ace.edit('indexjs_ejs')
|
|
26
|
+
editor_indexjs_ejs.getSession().setMode('ace/mode/ejs')
|
|
27
27
|
//editor_indexjs_ejs.setValue(datas.indexjs_ejs);
|
|
28
28
|
|
|
29
|
-
var editor_form_ejs = ace.edit(
|
|
30
|
-
editor_form_ejs.getSession().setMode(
|
|
29
|
+
var editor_form_ejs = ace.edit('form_ejs')
|
|
30
|
+
editor_form_ejs.getSession().setMode('ace/mode/ejs')
|
|
31
31
|
//editor_form_ejs.setValue(datas.form_ejs);
|
|
32
32
|
|
|
33
|
-
var editor_create_ejs = ace.edit(
|
|
34
|
-
editor_create_ejs.getSession().setMode(
|
|
33
|
+
var editor_create_ejs = ace.edit('create_ejs')
|
|
34
|
+
editor_create_ejs.getSession().setMode('ace/mode/ejs')
|
|
35
35
|
//editor_create_ejs.setValue(datas.create_ejs);
|
|
36
36
|
|
|
37
|
-
var editor_createjs_ejs = ace.edit(
|
|
38
|
-
editor_createjs_ejs.getSession().setMode(
|
|
37
|
+
var editor_createjs_ejs = ace.edit('createjs_ejs')
|
|
38
|
+
editor_createjs_ejs.getSession().setMode('ace/mode/ejs')
|
|
39
39
|
//editor_createjs_ejs.setValue(datas.createjs_ejs);
|
|
40
40
|
|
|
41
|
-
var editor_update_ejs = ace.edit(
|
|
42
|
-
editor_update_ejs.getSession().setMode(
|
|
41
|
+
var editor_update_ejs = ace.edit('update_ejs')
|
|
42
|
+
editor_update_ejs.getSession().setMode('ace/mode/ejs')
|
|
43
43
|
//editor_update_ejs.setValue(datas.update_ejs);
|
|
44
44
|
|
|
45
|
-
var editor_updatejs_ejs = ace.edit(
|
|
46
|
-
editor_updatejs_ejs.getSession().setMode(
|
|
45
|
+
var editor_updatejs_ejs = ace.edit('updatejs_ejs')
|
|
46
|
+
editor_updatejs_ejs.getSession().setMode('ace/mode/ejs')
|
|
47
47
|
//editor_updatejs_ejs.setValue(datas.updatejs_ejs);
|
|
48
48
|
|
|
49
|
-
var editor_import_ejs = ace.edit(
|
|
50
|
-
editor_import_ejs.getSession().setMode(
|
|
49
|
+
var editor_import_ejs = ace.edit('import_ejs')
|
|
50
|
+
editor_import_ejs.getSession().setMode('ace/mode/ejs')
|
|
51
51
|
//editor_import_ejs.setValue(datas.import_ejs);
|
|
52
52
|
|
|
53
|
-
var editor_importjs_ejs = ace.edit(
|
|
54
|
-
editor_importjs_ejs.getSession().setMode(
|
|
53
|
+
var editor_importjs_ejs = ace.edit('importjs_ejs')
|
|
54
|
+
editor_importjs_ejs.getSession().setMode('ace/mode/ejs')
|
|
55
55
|
//editor_importjs_ejs.setValue(datas.importjs_ejs);
|
|
56
56
|
|
|
57
|
-
var editor_view_ejs = ace.edit(
|
|
58
|
-
editor_view_ejs.getSession().setMode(
|
|
57
|
+
var editor_view_ejs = ace.edit('view_ejs')
|
|
58
|
+
editor_view_ejs.getSession().setMode('ace/mode/ejs')
|
|
59
59
|
//editor_view_ejs.setValue(datas.view_ejs);
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
62
|
<script>
|
|
63
|
-
var loadForm = function(){
|
|
64
|
-
ajaxPost(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
var loadForm = function () {
|
|
64
|
+
ajaxPost(
|
|
65
|
+
'/<%- routeName%>/load-form',
|
|
66
|
+
{
|
|
67
|
+
table: $('#table').val(),
|
|
68
|
+
},
|
|
69
|
+
function (html) {
|
|
70
|
+
var obj = html.data
|
|
71
|
+
editor_router.setValue(obj.router)
|
|
72
|
+
editor_index_ejs.setValue(obj.index_ejs)
|
|
73
|
+
editor_indexcss_ejs.setValue(obj.indexcss_ejs)
|
|
74
|
+
editor_indexjs_ejs.setValue(obj.indexjs_ejs)
|
|
75
|
+
editor_form_ejs.setValue(obj.form_ejs)
|
|
76
|
+
editor_create_ejs.setValue(obj.create_ejs)
|
|
77
|
+
editor_createjs_ejs.setValue(obj.createjs_ejs)
|
|
78
|
+
editor_update_ejs.setValue(obj.update_ejs)
|
|
79
|
+
editor_updatejs_ejs.setValue(obj.updatejs_ejs)
|
|
80
|
+
editor_import_ejs.setValue(obj.import_ejs)
|
|
81
|
+
editor_importjs_ejs.setValue(obj.importjs_ejs)
|
|
82
|
+
editor_view_ejs.setValue(obj.view_ejs)
|
|
83
|
+
}
|
|
84
|
+
)
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
function toName(str, separator) {
|
|
84
|
-
if(str && str.length) {
|
|
85
|
-
separator = separator ||
|
|
86
|
-
str = str.trim()
|
|
87
|
-
return str.replace(/\s+/g, separator).toLowerCase()
|
|
88
|
+
if (str && str.length) {
|
|
89
|
+
separator = separator || '_'
|
|
90
|
+
str = str.trim()
|
|
91
|
+
return str.replace(/\s+/g, separator).toLowerCase()
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
function click_setting(elem) {
|
|
92
|
-
var name = elem.data(
|
|
93
|
-
label = elem.data(
|
|
94
|
-
table = $(
|
|
95
|
-
caption = elem.data(
|
|
96
|
-
$(
|
|
97
|
-
$(
|
|
98
|
-
$(
|
|
99
|
-
|
|
100
|
-
ajaxPost(
|
|
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
|
-
|
|
96
|
+
var name = elem.data('name'),
|
|
97
|
+
label = elem.data('label'),
|
|
98
|
+
table = $('#table').val(),
|
|
99
|
+
caption = elem.data('type')
|
|
100
|
+
$('#modal_setting_label').html(`Setting ${label} <span class="badge bg-primary text-dark">${caption}</span>`)
|
|
101
|
+
$('#body_content').html('Loading...')
|
|
102
|
+
$('body').find('#delete_field').attr('data-name', name)
|
|
103
|
+
|
|
104
|
+
ajaxPost(
|
|
105
|
+
'/<%- routeName%>/setting_field',
|
|
106
|
+
{
|
|
107
|
+
name: name,
|
|
108
|
+
table: table,
|
|
109
|
+
},
|
|
110
|
+
function (html) {
|
|
111
|
+
$('#body_content').html(html)
|
|
112
|
+
let val = 'id'
|
|
113
|
+
if ($('#relation_table').length) {
|
|
114
|
+
dropdownRelations('relation_table', 'relation_name', 'relation_concat', $('#relation_table').data('value'), $('#relation_name').data('value'), $('#relation_concat').data('value'))
|
|
115
|
+
}
|
|
116
|
+
if ($('#typeahead_table').length) {
|
|
117
|
+
val = $('body').find('#typeahead_concat').attr('value')
|
|
118
|
+
dropdownRelations('typeahead_table', 'typeahead_name', 'typeahead_concat', $('#typeahead_table').data('value'), $('#typeahead_name').data('value'), val)
|
|
119
|
+
}
|
|
120
|
+
if ($('#table_table').length) {
|
|
121
|
+
dropdownRelations('table_table', 'relation_name', '', $('#table_table').data('value'))
|
|
122
|
+
}
|
|
123
|
+
if ($('#multi_line_editor_table').length) {
|
|
124
|
+
dropdownRelations('multi_line_editor_table', 'relation_name', '', $('#multi_line_editor_table').data('value'))
|
|
125
|
+
$('.editor').froalaEditor({ height: 400 })
|
|
126
|
+
var samp = $('<samp></samp>')
|
|
127
|
+
var text = `<p><h3>List Fields :</h3></p>`
|
|
128
|
+
text += getFieldsFromTable($('#multi_line_editor_table').val(), name)
|
|
129
|
+
$('#multi_line_editor_table').closest('div').append(samp)
|
|
130
|
+
samp.html(text)
|
|
131
|
+
|
|
132
|
+
$('#multi_line_editor_table').on('change', function () {
|
|
133
|
+
var text = `<p><h3>List Fields :</h3></p>`
|
|
134
|
+
text += getFieldsFromTable($(this).val(), name)
|
|
135
|
+
samp.html(text)
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
if ($('#dropdown_multi_table').length) {
|
|
139
|
+
dropdownRelations('dropdown_multi_table', 'dropdown_multi_name', '', $('#dropdown_multi_table').data('value'), $('#dropdown_multi_name').data('value'))
|
|
140
|
+
}
|
|
133
141
|
}
|
|
134
|
-
|
|
135
|
-
$(
|
|
142
|
+
)
|
|
143
|
+
$('#modal_setting').modal('show')
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
function dropdownRelations(elemTable, elemField, elemConcat, value, fieldValue, concatValue) {
|
|
139
|
-
elemTable = elemTable ||
|
|
140
|
-
elemField = elemField ||
|
|
141
|
-
elemConcat = elemConcat ||
|
|
142
|
-
value = value ||
|
|
143
|
-
fieldValue = fieldValue ||
|
|
144
|
-
concatValue = concatValue ||
|
|
145
|
-
|
|
146
|
-
let html = ''
|
|
147
|
-
let elementTable = $(
|
|
148
|
-
if(!elementTable.length){
|
|
149
|
-
return
|
|
147
|
+
elemTable = elemTable || 'relationtable'
|
|
148
|
+
elemField = elemField || 'relationfield'
|
|
149
|
+
elemConcat = elemConcat || 'relationconcat'
|
|
150
|
+
value = value || ''
|
|
151
|
+
fieldValue = fieldValue || ''
|
|
152
|
+
concatValue = concatValue || 'id'
|
|
153
|
+
|
|
154
|
+
let html = ''
|
|
155
|
+
let elementTable = $('body').find('#' + elemTable)
|
|
156
|
+
if (!elementTable.length) {
|
|
157
|
+
return
|
|
150
158
|
}
|
|
151
|
-
let tableHtml = ''
|
|
152
|
-
for(let key in ZFIELDS) {
|
|
153
|
-
let selected = value == key ?
|
|
154
|
-
tableHtml += `<option value="${key}" ${selected}>${ZFIELDS[key].name}</option
|
|
159
|
+
let tableHtml = ''
|
|
160
|
+
for (let key in ZFIELDS) {
|
|
161
|
+
let selected = value == key ? ' selected ' : ''
|
|
162
|
+
tableHtml += `<option value="${key}" ${selected}>${ZFIELDS[key].name}</option>`
|
|
155
163
|
}
|
|
156
|
-
elementTable.html(tableHtml)
|
|
157
|
-
let currentRelation = elementTable.val()
|
|
158
|
-
let elementField = $(
|
|
164
|
+
elementTable.html(tableHtml)
|
|
165
|
+
let currentRelation = elementTable.val()
|
|
166
|
+
let elementField = $('body').find('#' + elemField)
|
|
159
167
|
//var concatValue = "id";
|
|
160
|
-
for(let key in ZFIELDS[currentRelation].labels) {
|
|
161
|
-
let selected = fieldValue == key ?
|
|
168
|
+
for (let key in ZFIELDS[currentRelation].labels) {
|
|
169
|
+
let selected = fieldValue == key ? ' selected ' : ''
|
|
162
170
|
//concatValue = fieldValue == key ? key : "id";
|
|
163
|
-
html += `<option value="${key}" ${selected}>${ZFIELDS[currentRelation].labels[key]}</option
|
|
171
|
+
html += `<option value="${key}" ${selected}>${ZFIELDS[currentRelation].labels[key]}</option>`
|
|
164
172
|
}
|
|
165
|
-
elementField.html(html)
|
|
166
|
-
$(
|
|
167
|
-
$(
|
|
173
|
+
elementField.html(html)
|
|
174
|
+
$('#' + elemConcat).val(concatValue)
|
|
175
|
+
$('#' + elemConcat).attr('value', concatValue)
|
|
168
176
|
}
|
|
169
177
|
|
|
170
178
|
function getFieldsFromTable(table, name) {
|
|
171
|
-
let html
|
|
172
|
-
let nots = [
|
|
173
|
-
for(let key in ZFIELDS[table].labels) {
|
|
174
|
-
if(nots.indexOf(key) <= -1) {
|
|
175
|
-
html += `<li class="list-group-item"><button onclick="copyToClipboard('[[[${key}_${name}]]]');" type="button" class="btn-copy-code btn btn-outline-grey btn-sm px-2 waves-effect" title="Copy Text" ><i class="fa fa-copy mr-1"></i> ${key} </button> <input type="text" name="${name}[fields][${key}_${name}]" value="${ZFIELDS[table].labels[key]}"></li
|
|
179
|
+
let html = `<ul class="list-group">`
|
|
180
|
+
let nots = ['id', 'company_id', 'created_by', 'created_at', 'updated_by', 'updated_at']
|
|
181
|
+
for (let key in ZFIELDS[table].labels) {
|
|
182
|
+
if (nots.indexOf(key) <= -1) {
|
|
183
|
+
html += `<li class="list-group-item"><button onclick="copyToClipboard('[[[${key}_${name}]]]');" type="button" class="btn-copy-code btn btn-outline-grey btn-sm px-2 waves-effect" title="Copy Text" ><i class="fa fa-copy mr-1"></i> ${key} </button> <input type="text" name="${name}[fields][${key}_${name}]" value="${ZFIELDS[table].labels[key]}"></li>`
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
html += `</ul>`
|
|
179
|
-
return html
|
|
187
|
+
return html
|
|
180
188
|
}
|
|
181
189
|
|
|
182
|
-
|
|
183
190
|
$(function () {
|
|
184
|
-
let counter = $(
|
|
191
|
+
let counter = $('.divtabs').length || 1
|
|
185
192
|
function selectTable(table) {
|
|
186
|
-
if (!table) return false
|
|
187
|
-
ajaxPost('/<%- routeName%>/fields',{table: table}, function (json) {
|
|
188
|
-
$(
|
|
189
|
-
$(
|
|
190
|
-
$(
|
|
191
|
-
$(
|
|
192
|
-
$(
|
|
193
|
-
$(
|
|
194
|
-
counter = json.count
|
|
195
|
-
$(
|
|
193
|
+
if (!table) return false
|
|
194
|
+
ajaxPost('/<%- routeName%>/fields', { table: table }, function (json) {
|
|
195
|
+
$('#divfields').show()
|
|
196
|
+
$('.card-script').show()
|
|
197
|
+
$('#results').hide()
|
|
198
|
+
$('#contentfields').html(json.html)
|
|
199
|
+
$('#tabs').html(json.tabview)
|
|
200
|
+
$('#divtablist').html(json.tabBox)
|
|
201
|
+
counter = json.count
|
|
202
|
+
$('ol.mydragable').sortable({
|
|
196
203
|
group: 'mydragable',
|
|
197
204
|
nested: false,
|
|
198
205
|
//pullPlaceholder: false,
|
|
199
206
|
isValidTarget: function ($item, container) {
|
|
200
|
-
if($item.hasClass(
|
|
201
|
-
return false
|
|
202
|
-
} else if($item.hasClass(
|
|
203
|
-
return false
|
|
207
|
+
if ($item.hasClass('add-container')) {
|
|
208
|
+
return false
|
|
209
|
+
} else if ($item.hasClass('icon-trash')) {
|
|
210
|
+
return false
|
|
204
211
|
} else {
|
|
205
|
-
return true
|
|
212
|
+
return true
|
|
206
213
|
}
|
|
207
214
|
},
|
|
208
215
|
onMousedown: function ($item, _super, event) {
|
|
209
|
-
if($(event.target).is(
|
|
210
|
-
let elem = $(event.target)
|
|
216
|
+
if ($(event.target).is('i')) {
|
|
217
|
+
let elem = $(event.target)
|
|
211
218
|
//console.log(elem.attr("class"))
|
|
212
|
-
if(elem.hasClass(
|
|
213
|
-
click_setting(elem)
|
|
219
|
+
if (elem.hasClass('modal_setting')) {
|
|
220
|
+
click_setting(elem)
|
|
214
221
|
}
|
|
215
|
-
return false
|
|
222
|
+
return false
|
|
216
223
|
}
|
|
217
|
-
return true
|
|
224
|
+
return true
|
|
218
225
|
},
|
|
219
226
|
onDrop: function ($item, container, _super) {
|
|
220
227
|
//class container-nav
|
|
221
|
-
let time = new Date().getTime()
|
|
222
|
-
let $itemclass = $item.attr(
|
|
223
|
-
let getidname = $item.parents().attr('id') ||
|
|
224
|
-
let iname = $item.find('input[type=text]').attr('data-name')
|
|
225
|
-
let containertype = $item.parents().data('name')
|
|
226
|
-
let newname = getidname ? iname +
|
|
227
|
-
let leftright = $item.find('input[type=hidden]').attr('name')
|
|
228
|
+
let time = new Date().getTime()
|
|
229
|
+
let $itemclass = $item.attr('class')
|
|
230
|
+
let getidname = $item.parents().attr('id') || ''
|
|
231
|
+
let iname = $item.find('input[type=text]').attr('data-name')
|
|
232
|
+
let containertype = $item.parents().data('name')
|
|
233
|
+
let newname = getidname ? iname + '___' + getidname : iname
|
|
234
|
+
let leftright = $item.find('input[type=hidden]').attr('name')
|
|
228
235
|
//container-box
|
|
229
|
-
if($itemclass.indexOf('container-nav') > -1) {
|
|
230
|
-
let parentId = $item.parents().parents()
|
|
231
|
-
$item.find('input[type=text]').attr('name', newname)
|
|
232
|
-
$item.find('input[type=hidden]').attr('name', containertype)
|
|
236
|
+
if ($itemclass.indexOf('container-nav') > -1) {
|
|
237
|
+
let parentId = $item.parents().parents()
|
|
238
|
+
$item.find('input[type=text]').attr('name', newname)
|
|
239
|
+
$item.find('input[type=hidden]').attr('name', containertype)
|
|
233
240
|
} else {
|
|
234
|
-
$item.find('input[type=text]').attr('name', newname)
|
|
235
|
-
$item.find('input[type=hidden]').attr('name', containertype)
|
|
241
|
+
$item.find('input[type=text]').attr('name', newname)
|
|
242
|
+
$item.find('input[type=hidden]').attr('name', containertype)
|
|
236
243
|
}
|
|
237
|
-
_super($item, container)
|
|
238
|
-
}
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
_super($item, container)
|
|
245
|
+
},
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
//tab draggable
|
|
249
|
+
$('ul.sortable-list').sortable()
|
|
250
|
+
//end tab draggable
|
|
251
|
+
loadForm()
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function nextDragged() {
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
ajaxPost(
|
|
258
|
+
'/<%- routeName%>/tab-draggable',
|
|
259
|
+
{
|
|
260
|
+
tabs: $('.sortable-list')
|
|
261
|
+
.find('input[name="tabs[]"]')
|
|
262
|
+
.each((index, elm) => $(elm).val()),
|
|
263
|
+
},
|
|
264
|
+
() => location.href
|
|
265
|
+
)
|
|
266
|
+
}, 1000)
|
|
242
267
|
}
|
|
243
268
|
|
|
244
269
|
function buildOneRow(columncount) {
|
|
245
|
-
let html =
|
|
246
|
-
let time = new Date().getTime()
|
|
247
|
-
let col_md = `col-md-${
|
|
248
|
-
container_time = `container_${time}
|
|
249
|
-
html += `<li class="container-nav"><i class="fa fa-arrows icon-float"></i><div class="row mt-1 mb-1"
|
|
250
|
-
for(let i =1; i <= columncount; i++) {
|
|
251
|
-
html += `<div class="${col_md}" style="background-color: rgba(0,0,0,.03)" ><ol class="divboxlittle container-box"><li><i data-container="${container_time}" data-id="${i}" data-split="${columncount}" data-column="ONE_COLUMN" class="fa fa-plus-circle fa-2x add-container text-success"></i></li></ol> </div
|
|
270
|
+
let html = ``
|
|
271
|
+
let time = new Date().getTime()
|
|
272
|
+
let col_md = `col-md-${12 / columncount}`
|
|
273
|
+
container_time = `container_${time}`
|
|
274
|
+
html += `<li class="container-nav"><i class="fa fa-arrows icon-float"></i><div class="row mt-1 mb-1">`
|
|
275
|
+
for (let i = 1; i <= columncount; i++) {
|
|
276
|
+
html += `<div class="${col_md}" style="background-color: rgba(0,0,0,.03)" ><ol class="divboxlittle container-box"><li><i data-container="${container_time}" data-id="${i}" data-split="${columncount}" data-column="ONE_COLUMN" class="fa fa-plus-circle fa-2x add-container text-success"></i></li></ol> </div>`
|
|
252
277
|
}
|
|
253
|
-
html += `</div></li
|
|
254
|
-
return html
|
|
278
|
+
html += `</div></li>`
|
|
279
|
+
return html
|
|
255
280
|
}
|
|
256
281
|
|
|
257
|
-
$(
|
|
258
|
-
let columncount = $(
|
|
259
|
-
let html = buildOneRow(columncount)
|
|
260
|
-
let length = $(
|
|
261
|
-
$(
|
|
262
|
-
|
|
282
|
+
$('#modal-container-save').on('click', function () {
|
|
283
|
+
let columncount = $('#column-count').val()
|
|
284
|
+
let html = buildOneRow(columncount)
|
|
285
|
+
let length = $('ol').length
|
|
286
|
+
$('ol')
|
|
287
|
+
.eq(length - 1)
|
|
288
|
+
.append(html)
|
|
289
|
+
$('.btn-modal-container-close').click()
|
|
263
290
|
})
|
|
264
291
|
|
|
265
|
-
$(
|
|
266
|
-
parentContainer = $(this).closest(
|
|
267
|
-
let options = ''
|
|
268
|
-
let ols = $(
|
|
292
|
+
$('body').on('click', '.add-container', function () {
|
|
293
|
+
parentContainer = $(this).closest('ol')
|
|
294
|
+
let options = ''
|
|
295
|
+
let ols = $('ol.mydragable > li')
|
|
269
296
|
let myObj = {}
|
|
270
297
|
ols.each(function () {
|
|
271
|
-
let span = $(this).find(
|
|
272
|
-
let name = span.data(
|
|
273
|
-
if(name) {
|
|
274
|
-
myObj[name] = $(this)
|
|
298
|
+
let span = $(this).find('div').find('div').find('span')
|
|
299
|
+
let name = span.data('name')
|
|
300
|
+
if (name) {
|
|
301
|
+
myObj[name] = $(this)
|
|
275
302
|
}
|
|
276
303
|
})
|
|
277
|
-
for(let key in myObj) {
|
|
304
|
+
for (let key in myObj) {
|
|
278
305
|
options += `<option value="${key}">${key}</option>`
|
|
279
306
|
}
|
|
280
|
-
fieldsObjectInput = myObj
|
|
281
|
-
$(
|
|
282
|
-
$('#modal_container_into').modal('show')
|
|
307
|
+
fieldsObjectInput = myObj
|
|
308
|
+
$('#container-select').html(options)
|
|
309
|
+
$('#modal_container_into').modal('show')
|
|
283
310
|
})
|
|
284
311
|
|
|
285
|
-
$(
|
|
286
|
-
let myval = $(
|
|
287
|
-
if(myval) {
|
|
288
|
-
let myelement = fieldsObjectInput[myval]
|
|
312
|
+
$('#moveintocontainer').on('click', function () {
|
|
313
|
+
let myval = $('#container-select').val()
|
|
314
|
+
if (myval) {
|
|
315
|
+
let myelement = fieldsObjectInput[myval]
|
|
289
316
|
//let myname = `${container_time}___${container_column}___${container_split}___${container_index}`;
|
|
290
|
-
myelement.find('input[type=hidden]').attr('name', 'ONE_COLUMN')
|
|
291
|
-
myelement.appendTo(parentContainer)
|
|
317
|
+
myelement.find('input[type=hidden]').attr('name', 'ONE_COLUMN')
|
|
318
|
+
myelement.appendTo(parentContainer)
|
|
292
319
|
}
|
|
293
|
-
$(
|
|
320
|
+
$('.btncontainer-close').click()
|
|
294
321
|
setTimeout(function () {
|
|
295
|
-
saveContainer()
|
|
296
|
-
},2000)
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
322
|
+
saveContainer()
|
|
323
|
+
}, 2000)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
$('#table').on('change', function () {
|
|
327
|
+
location.href = '/<%- routeName%>?table=' + $(this).val()
|
|
328
|
+
loadForm()
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
$('#generate').on('click', function () {
|
|
332
|
+
ajaxPost(
|
|
333
|
+
'/<%- routeName%>',
|
|
334
|
+
{
|
|
335
|
+
table: $('#table').val(),
|
|
336
|
+
route: $('#route').val(),
|
|
337
|
+
},
|
|
338
|
+
function (data) {
|
|
339
|
+
if (data.status == 0) {
|
|
340
|
+
$('#results').hide()
|
|
341
|
+
toastr.error(data.message, data.title)
|
|
342
|
+
} else {
|
|
343
|
+
$('#results').show()
|
|
344
|
+
toastr.success(data.title, data.message)
|
|
345
|
+
$('#resultsbody').html(data.datas)
|
|
346
|
+
}
|
|
347
|
+
$('#divfields').hide()
|
|
317
348
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return false;
|
|
349
|
+
)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
$('#add').on('click', function () {
|
|
353
|
+
var tabname = $('#tabname')
|
|
354
|
+
var tabsvalue = $('#tabsvalue')
|
|
355
|
+
if (tabname.val() == '') {
|
|
356
|
+
alert('tab name is empty!')
|
|
357
|
+
return false
|
|
328
358
|
}
|
|
329
|
-
$(
|
|
330
|
-
tabname.val(
|
|
331
|
-
$(
|
|
332
|
-
counter
|
|
333
|
-
})
|
|
334
|
-
|
|
335
|
-
$(
|
|
336
|
-
ajaxPost('/<%- routeName%>/tabs'
|
|
337
|
-
if (data.status == 1)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
});
|
|
342
|
-
});
|
|
359
|
+
$('#tabs').append("<div class='divtabs'> " + counter + '. ' + tabname.val() + " <input type='hidden' name='tabs[]' value='" + tabname.val() + "' /> <button type='button' onclick='$(this).parent().remove();' class='trashtab'><i class='fas fa-trash'></i> </button></div><br>")
|
|
360
|
+
tabname.val('')
|
|
361
|
+
$('#savetab').click()
|
|
362
|
+
counter++
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
$('#savetab').on('click', function () {
|
|
366
|
+
ajaxPost('/<%- routeName%>/tabs', $('#formgenerator').serializeArray(), function (data) {
|
|
367
|
+
if (data.status == 1) location.href = ''
|
|
368
|
+
else alert(data.title)
|
|
369
|
+
})
|
|
370
|
+
})
|
|
343
371
|
|
|
344
372
|
function saveFields() {
|
|
345
|
-
let approvers = $("input[name='zapprovals[approvers][]']")
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
let approvers = $("input[name='zapprovals[approvers][]']")
|
|
374
|
+
.map(function () {
|
|
375
|
+
return $(this).val()
|
|
376
|
+
})
|
|
377
|
+
.get()
|
|
378
|
+
let knowings = $("input[name='zapprovals[knowings][]']")
|
|
379
|
+
.map(function () {
|
|
380
|
+
return $(this).val()
|
|
381
|
+
})
|
|
382
|
+
.get()
|
|
383
|
+
others = fixContainer()
|
|
384
|
+
ajaxPost(
|
|
385
|
+
'/<%- routeName%>/save_and_generate',
|
|
386
|
+
{
|
|
387
|
+
details: $('#formfields').serializeArray(),
|
|
388
|
+
table: $('#table').val(),
|
|
389
|
+
hardcode_grid: editor_hardcode_grid.getValue(),
|
|
390
|
+
router: editor_router.getValue(),
|
|
391
|
+
index_ejs: editor_index_ejs.getValue(),
|
|
392
|
+
indexcss_ejs: editor_indexcss_ejs.getValue(),
|
|
393
|
+
indexjs_ejs: editor_indexjs_ejs.getValue(),
|
|
394
|
+
form_ejs: editor_form_ejs.getValue(),
|
|
395
|
+
create_ejs: editor_create_ejs.getValue(),
|
|
396
|
+
createjs_ejs: editor_createjs_ejs.getValue(),
|
|
397
|
+
update_ejs: editor_update_ejs.getValue(),
|
|
398
|
+
updatejs_ejs: editor_updatejs_ejs.getValue(),
|
|
399
|
+
import_ejs: editor_import_ejs.getValue(),
|
|
400
|
+
importjs_ejs: editor_importjs_ejs.getValue(),
|
|
401
|
+
view_ejs: editor_view_ejs.getValue(),
|
|
402
|
+
is_approval: is_approval,
|
|
403
|
+
template: $('#template').val(),
|
|
404
|
+
approval_title: $('#approval_title').val(),
|
|
405
|
+
type: $('#type').val(),
|
|
406
|
+
approvers: approvers,
|
|
407
|
+
knowings: knowings,
|
|
408
|
+
others: JSON.stringify(others),
|
|
409
|
+
},
|
|
410
|
+
function (data) {
|
|
411
|
+
if (data.status == 0) {
|
|
412
|
+
toastr.error(data.message, data.title)
|
|
413
|
+
} else {
|
|
414
|
+
toastr.success(data.title, data.message)
|
|
415
|
+
}
|
|
376
416
|
}
|
|
377
|
-
|
|
417
|
+
)
|
|
378
418
|
}
|
|
379
419
|
|
|
380
|
-
$(
|
|
381
|
-
saveFields()
|
|
382
|
-
})
|
|
383
|
-
$(
|
|
384
|
-
saveFields()
|
|
385
|
-
})
|
|
386
|
-
|
|
387
|
-
$(
|
|
388
|
-
if(window.confirm(
|
|
389
|
-
ajaxPost(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
420
|
+
$('#save').on('click', function () {
|
|
421
|
+
saveFields()
|
|
422
|
+
})
|
|
423
|
+
$('#save_script').on('click', function () {
|
|
424
|
+
saveFields()
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
$('.btn-reset').on('click', function () {
|
|
428
|
+
if (window.confirm('Reset to factory settings ?')) {
|
|
429
|
+
ajaxPost(
|
|
430
|
+
'/<%- routeName%>/reset',
|
|
431
|
+
{
|
|
432
|
+
table: $('#table').val(),
|
|
433
|
+
},
|
|
434
|
+
function (data) {
|
|
435
|
+
if (data.status == 0) {
|
|
436
|
+
toastr.error(data.message, data.title)
|
|
437
|
+
} else {
|
|
438
|
+
toastr.success(data.title, data.message)
|
|
439
|
+
location.href = ''
|
|
440
|
+
}
|
|
397
441
|
}
|
|
398
|
-
|
|
442
|
+
)
|
|
399
443
|
}
|
|
400
444
|
})
|
|
401
445
|
|
|
402
|
-
$(
|
|
403
|
-
if(window.confirm(
|
|
404
|
-
ajaxPost(
|
|
405
|
-
}, function (data) {
|
|
446
|
+
$('.btn-minify').on('click', function () {
|
|
447
|
+
if (window.confirm('Minify all views in one line make your website faster ?')) {
|
|
448
|
+
ajaxPost('/<%- routeName%>/minify', {}, function (data) {
|
|
406
449
|
if (data.status == 0) {
|
|
407
|
-
toastr.error(data.message, data.title)
|
|
450
|
+
toastr.error(data.message, data.title)
|
|
408
451
|
} else {
|
|
409
|
-
toastr.success(data.title, data.message)
|
|
452
|
+
toastr.success(data.title, data.message)
|
|
410
453
|
}
|
|
411
|
-
})
|
|
454
|
+
})
|
|
412
455
|
}
|
|
413
|
-
})
|
|
456
|
+
})
|
|
414
457
|
|
|
415
|
-
$(
|
|
416
|
-
if(window.confirm(
|
|
417
|
-
ajaxPost(
|
|
418
|
-
}, function (data) {
|
|
458
|
+
$('.btn-generate-assets').on('click', function () {
|
|
459
|
+
if (window.confirm('Replace javascript assets with this one ?')) {
|
|
460
|
+
ajaxPost('/<%- routeName%>/generate-assets', {}, function (data) {
|
|
419
461
|
if (data.status == 0) {
|
|
420
|
-
toastr.error(data.message, data.title)
|
|
462
|
+
toastr.error(data.message, data.title)
|
|
421
463
|
} else {
|
|
422
|
-
toastr.success(data.title, data.message)
|
|
464
|
+
toastr.success(data.title, data.message)
|
|
423
465
|
}
|
|
424
|
-
})
|
|
466
|
+
})
|
|
425
467
|
}
|
|
426
|
-
})
|
|
468
|
+
})
|
|
427
469
|
|
|
428
|
-
selectTable($(
|
|
470
|
+
selectTable($('#table').val())
|
|
429
471
|
function changeUrl(title, url) {
|
|
430
|
-
var origin = window.location.origin
|
|
431
|
-
if (typeof
|
|
432
|
-
var obj = {Title: title, Url: origin + '/<%- routeName%>?table=' + url}
|
|
433
|
-
window.history.pushState(obj, obj.Title, obj.Url)
|
|
472
|
+
var origin = window.location.origin
|
|
473
|
+
if (typeof history.pushState != 'undefined') {
|
|
474
|
+
var obj = { Title: title, Url: origin + '/<%- routeName%>?table=' + url }
|
|
475
|
+
window.history.pushState(obj, obj.Title, obj.Url)
|
|
434
476
|
} else {
|
|
435
|
-
alert(
|
|
477
|
+
alert('Browser does not support HTML5.')
|
|
436
478
|
}
|
|
437
479
|
}
|
|
438
480
|
|
|
439
|
-
$(
|
|
440
|
-
$(
|
|
441
|
-
})
|
|
442
|
-
$('#modal-table').on('input', function() {
|
|
443
|
-
$(
|
|
444
|
-
})
|
|
445
|
-
$(
|
|
446
|
-
if(window.confirm(
|
|
447
|
-
ajaxDelete(
|
|
448
|
-
toastrForm(data)
|
|
449
|
-
if(data.status == 1) {
|
|
450
|
-
location.href = '/<%- routeName%>'
|
|
481
|
+
$('#modal-table').on('change', function () {
|
|
482
|
+
$('#modal-route').val(toName($(this).val()))
|
|
483
|
+
})
|
|
484
|
+
$('#modal-table').on('input', function () {
|
|
485
|
+
$('#modal-route').val(toName($(this).val()))
|
|
486
|
+
})
|
|
487
|
+
$('#delete_module').on('click', function () {
|
|
488
|
+
if (window.confirm('sure to delete ?')) {
|
|
489
|
+
ajaxDelete('/<%- routeName%>/delete-table', { table: $('#table').val() }, function (data) {
|
|
490
|
+
toastrForm(data)
|
|
491
|
+
if (data.status == 1) {
|
|
492
|
+
location.href = '/<%- routeName%>'
|
|
451
493
|
}
|
|
452
|
-
})
|
|
494
|
+
})
|
|
453
495
|
}
|
|
454
|
-
})
|
|
455
|
-
|
|
456
|
-
$(
|
|
457
|
-
let reservedWord = ['order','left','right','by','zrole','role','zuser','zcompany_access']
|
|
458
|
-
let moduleName = $(
|
|
459
|
-
moduleName = moduleName.toLowerCase()
|
|
460
|
-
let arrModules = reservedWord.filter((item) => item == moduleName)
|
|
461
|
-
if(arrModules.length) {
|
|
496
|
+
})
|
|
497
|
+
|
|
498
|
+
$('#modal-save').on('click', function () {
|
|
499
|
+
let reservedWord = ['order', 'left', 'right', 'by', 'zrole', 'role', 'zuser', 'zcompany_access']
|
|
500
|
+
let moduleName = $('#modal-table').val()
|
|
501
|
+
moduleName = moduleName.toLowerCase()
|
|
502
|
+
let arrModules = reservedWord.filter((item) => item == moduleName)
|
|
503
|
+
if (arrModules.length) {
|
|
462
504
|
toastrForm({
|
|
463
|
-
status
|
|
464
|
-
title:
|
|
465
|
-
message:
|
|
505
|
+
status: 0,
|
|
506
|
+
title: 'Error Module Name reserved',
|
|
507
|
+
message: 'Please change your module name',
|
|
466
508
|
})
|
|
467
|
-
return false
|
|
509
|
+
return false
|
|
468
510
|
}
|
|
469
|
-
ajaxPost(
|
|
470
|
-
toastrForm(data)
|
|
471
|
-
if(data.status == 1) {
|
|
472
|
-
location.href = '/<%- routeName%>?table=' + $(
|
|
511
|
+
ajaxPost('/<%- routeName%>', { name: $('#modal-table').val(), route: $('#modal-route').val() }, function (data) {
|
|
512
|
+
toastrForm(data)
|
|
513
|
+
if (data.status == 1) {
|
|
514
|
+
location.href = '/<%- routeName%>?table=' + $('#modal-route').val()
|
|
473
515
|
}
|
|
474
|
-
})
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
$(
|
|
478
|
-
let others = fixContainer()
|
|
479
|
-
ajaxPost(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
516
|
+
})
|
|
517
|
+
})
|
|
518
|
+
|
|
519
|
+
$('#modal-add').on('click', function () {
|
|
520
|
+
let others = fixContainer()
|
|
521
|
+
ajaxPost(
|
|
522
|
+
'/<%- routeName%>/add_field',
|
|
523
|
+
{
|
|
524
|
+
table: $('#table').val(),
|
|
525
|
+
name: $('#modal_name').val(),
|
|
526
|
+
type: $('#modal_type').val(),
|
|
527
|
+
position: $('#modal_position').val(),
|
|
528
|
+
relationtable: $('#relationtable').val(),
|
|
529
|
+
relationfield: $('#relationfield').val(),
|
|
530
|
+
relationconcat: $('#relationconcat').val(),
|
|
531
|
+
relationfields: $('#relationfields').val(),
|
|
532
|
+
others: JSON.stringify(others),
|
|
533
|
+
},
|
|
534
|
+
function (data) {
|
|
535
|
+
$(this).show()
|
|
536
|
+
toastrForm(data)
|
|
537
|
+
if (data.status == 1) {
|
|
538
|
+
var type = $('#modal_type').val()
|
|
539
|
+
location.href = ''
|
|
540
|
+
}
|
|
495
541
|
}
|
|
496
|
-
|
|
497
|
-
})
|
|
542
|
+
)
|
|
543
|
+
})
|
|
498
544
|
|
|
499
|
-
$(
|
|
500
|
-
click_setting($(this))
|
|
501
|
-
})
|
|
545
|
+
$('body').on('click', '.modal_setting', function () {
|
|
546
|
+
click_setting($(this))
|
|
547
|
+
})
|
|
502
548
|
|
|
503
|
-
$(
|
|
504
|
-
let name = $(this).data(
|
|
505
|
-
let item = $(this).data(
|
|
506
|
-
let num = $(
|
|
549
|
+
$('body').on('click', '.select-plus', function () {
|
|
550
|
+
let name = $(this).data('name')
|
|
551
|
+
let item = $(this).data('item')
|
|
552
|
+
let num = $('.group-select').length || 0
|
|
507
553
|
html = `<div class="input-group group-select"><div class="input-group-prepend">
|
|
508
554
|
<input type="number" class="form-control cvalue" placeholder="Value" name="${name}[${item}][${num}][value]">
|
|
509
555
|
<input type="text" class="form-control clabel" placeholder="Label" name="${name}[${item}][${num}][label]">
|
|
510
556
|
<span class="input-group-text trash-select" data-name="${name}" data-item="${item}"><i class="fa fa-trash text-danger"></i> </span>
|
|
511
|
-
</div></div
|
|
512
|
-
|
|
513
|
-
$(
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
$(
|
|
517
|
-
let name = $(this).data(
|
|
518
|
-
let item = $(this).data(
|
|
519
|
-
$(this).closest(
|
|
520
|
-
$(
|
|
521
|
-
$(this)
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
557
|
+
</div></div>`
|
|
558
|
+
|
|
559
|
+
$('.divselect').append(html)
|
|
560
|
+
})
|
|
561
|
+
|
|
562
|
+
$('body').on('click', '.trash-select', function () {
|
|
563
|
+
let name = $(this).data('name')
|
|
564
|
+
let item = $(this).data('item')
|
|
565
|
+
$(this).closest('.group-select').remove()
|
|
566
|
+
$('.group-select').each(function (index, value) {
|
|
567
|
+
$(this)
|
|
568
|
+
.closest('div')
|
|
569
|
+
.find('input.cvalue')
|
|
570
|
+
.attr('name', name + '[' + item + '][' + index + '][value]')
|
|
571
|
+
$(this)
|
|
572
|
+
.closest('div')
|
|
573
|
+
.find('input.clabel')
|
|
574
|
+
.attr('name', name + '[' + item + '][' + index + '][label]')
|
|
575
|
+
})
|
|
576
|
+
})
|
|
577
|
+
|
|
578
|
+
$('body').on('click', '#modal-setting-save', function () {
|
|
579
|
+
let datas = $('#modal-setting-form').serializeArray()
|
|
580
|
+
ajaxPost('/<%- routeName%>/save_setting?table=' + $('#table').val(), datas, function (data) {
|
|
581
|
+
toastrForm(data)
|
|
582
|
+
if (data.status == 1) {
|
|
583
|
+
$('#modal_setting').modal('hide')
|
|
532
584
|
}
|
|
533
|
-
})
|
|
534
|
-
})
|
|
535
|
-
|
|
536
|
-
$(
|
|
537
|
-
if($(this).val() ==
|
|
538
|
-
$(
|
|
539
|
-
$(
|
|
540
|
-
$(
|
|
541
|
-
$(
|
|
542
|
-
dropdownRelations()
|
|
543
|
-
} else if($(this).val() ==
|
|
544
|
-
$(
|
|
545
|
-
$(
|
|
546
|
-
$(
|
|
547
|
-
$(
|
|
548
|
-
dropdownRelations()
|
|
549
|
-
} else if($(this).val() ==
|
|
550
|
-
$(
|
|
551
|
-
$(
|
|
552
|
-
$(
|
|
553
|
-
$(
|
|
554
|
-
dropdownRelations()
|
|
555
|
-
} else if($(this).val() ==
|
|
556
|
-
$(
|
|
557
|
-
$(
|
|
558
|
-
$(
|
|
559
|
-
$(
|
|
560
|
-
dropdownRelations()
|
|
561
|
-
} else if($(this).val() ==
|
|
562
|
-
$(
|
|
563
|
-
$(
|
|
564
|
-
$(
|
|
565
|
-
$(
|
|
566
|
-
dropdownRelations()
|
|
567
|
-
} else if($(this).val() ==
|
|
568
|
-
$(
|
|
569
|
-
$(
|
|
570
|
-
$(
|
|
571
|
-
$(
|
|
572
|
-
dropdownRelations()
|
|
585
|
+
})
|
|
586
|
+
})
|
|
587
|
+
|
|
588
|
+
$('body').on('change', '#modal_type', function () {
|
|
589
|
+
if ($(this).val() == 'relation') {
|
|
590
|
+
$('.divrelation').show()
|
|
591
|
+
$('.divrelationfield').show()
|
|
592
|
+
$('.divconcat').show()
|
|
593
|
+
$('.divfield').hide()
|
|
594
|
+
dropdownRelations()
|
|
595
|
+
} else if ($(this).val() == 'table') {
|
|
596
|
+
$('.divrelation').show()
|
|
597
|
+
$('.divrelationfield').hide()
|
|
598
|
+
$('.divconcat').hide()
|
|
599
|
+
$('.divfield').hide()
|
|
600
|
+
dropdownRelations()
|
|
601
|
+
} else if ($(this).val() == 'multi_line_editor') {
|
|
602
|
+
$('.divrelation').show()
|
|
603
|
+
$('.divrelationfield').hide()
|
|
604
|
+
$('.divconcat').hide()
|
|
605
|
+
$('.divfield').hide()
|
|
606
|
+
dropdownRelations()
|
|
607
|
+
} else if ($(this).val() == 'dropdown_multi') {
|
|
608
|
+
$('.divrelation').show()
|
|
609
|
+
$('.divrelationfield').show()
|
|
610
|
+
$('.divconcat').show()
|
|
611
|
+
$('.divfield').hide()
|
|
612
|
+
dropdownRelations()
|
|
613
|
+
} else if ($(this).val() == 'dropdown_chain') {
|
|
614
|
+
$('.divrelation').show()
|
|
615
|
+
$('.divrelationfield').show()
|
|
616
|
+
$('.divconcat').show()
|
|
617
|
+
$('.divfield').show()
|
|
618
|
+
dropdownRelations()
|
|
619
|
+
} else if ($(this).val() == 'typeahead') {
|
|
620
|
+
$('.divrelation').show()
|
|
621
|
+
$('.divrelationfield').show()
|
|
622
|
+
$('.divconcat').show()
|
|
623
|
+
$('.divfield').hide()
|
|
624
|
+
dropdownRelations()
|
|
573
625
|
} else {
|
|
574
|
-
$(
|
|
575
|
-
$(
|
|
576
|
-
$(
|
|
626
|
+
$('.divrelation').hide()
|
|
627
|
+
$('.divconcat').hide()
|
|
628
|
+
$('.divfield').hide()
|
|
577
629
|
}
|
|
578
|
-
})
|
|
579
|
-
|
|
580
|
-
$(
|
|
581
|
-
let name = $(this).data(
|
|
582
|
-
if(window.confirm(
|
|
583
|
-
ajaxDelete(
|
|
584
|
-
toastrForm(data)
|
|
585
|
-
if(data.status ==1){
|
|
586
|
-
location.href = ''
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
$('body').on('click', '#delete_field', function () {
|
|
633
|
+
let name = $(this).data('name')
|
|
634
|
+
if (window.confirm('sure delete ? ')) {
|
|
635
|
+
ajaxDelete('/<%- routeName%>/delete_field', { name: name, table: $('#table').val() }, function (data) {
|
|
636
|
+
toastrForm(data)
|
|
637
|
+
if (data.status == 1) {
|
|
638
|
+
location.href = ''
|
|
587
639
|
}
|
|
588
|
-
})
|
|
640
|
+
})
|
|
589
641
|
}
|
|
590
|
-
})
|
|
591
|
-
|
|
592
|
-
$(
|
|
593
|
-
$(
|
|
594
|
-
$(
|
|
595
|
-
})
|
|
596
|
-
|
|
597
|
-
$(
|
|
598
|
-
ajaxPost(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
642
|
+
})
|
|
643
|
+
|
|
644
|
+
$('body').on('click', '.edittab', function () {
|
|
645
|
+
$('body').find('#edittab').val($(this).data('name'))
|
|
646
|
+
$('body').find('#modal-tab-save').attr('data-id', $(this).data('id'))
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
$('body').on('click', '#modal-tab-save', function () {
|
|
650
|
+
ajaxPost(
|
|
651
|
+
'/<%- routeName%>/tab_rename',
|
|
652
|
+
{
|
|
653
|
+
id: $(this).data('id'),
|
|
654
|
+
name: $('body').find('#edittab').val(),
|
|
655
|
+
table: $('#table').val(),
|
|
656
|
+
},
|
|
657
|
+
function (data) {
|
|
658
|
+
toastrForm(data)
|
|
659
|
+
if (data.status == 1) {
|
|
660
|
+
location.href = ''
|
|
661
|
+
}
|
|
606
662
|
}
|
|
607
|
-
|
|
608
|
-
})
|
|
609
|
-
|
|
610
|
-
$(
|
|
611
|
-
dropdownRelations(
|
|
612
|
-
})
|
|
613
|
-
|
|
614
|
-
$(
|
|
615
|
-
dropdownRelations(
|
|
616
|
-
})
|
|
617
|
-
|
|
618
|
-
$(
|
|
619
|
-
$(
|
|
620
|
-
})
|
|
621
|
-
|
|
622
|
-
$(
|
|
623
|
-
dropdownRelations(
|
|
624
|
-
})
|
|
625
|
-
$(
|
|
626
|
-
dropdownRelations(
|
|
627
|
-
})
|
|
628
|
-
$(
|
|
629
|
-
dropdownRelations(
|
|
630
|
-
})
|
|
631
|
-
$(
|
|
632
|
-
dropdownRelations(
|
|
633
|
-
})
|
|
634
|
-
|
|
635
|
-
$(
|
|
636
|
-
$(
|
|
637
|
-
})
|
|
638
|
-
$(
|
|
639
|
-
$(
|
|
640
|
-
})
|
|
641
|
-
$(
|
|
642
|
-
$(
|
|
643
|
-
})
|
|
644
|
-
$(
|
|
645
|
-
$(
|
|
646
|
-
})
|
|
647
|
-
$(
|
|
648
|
-
$(
|
|
649
|
-
})
|
|
650
|
-
$(
|
|
651
|
-
if(state===true) {
|
|
652
|
-
$(
|
|
653
|
-
is_approval = 1
|
|
663
|
+
)
|
|
664
|
+
})
|
|
665
|
+
|
|
666
|
+
$('body').on('change', '#relationtable', function () {
|
|
667
|
+
dropdownRelations('relationtable', 'relationfield', 'relationconcat', $(this).val(), '', 'CONCAT(' + $('body').find('#relationfield').val() + ')')
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
$('body').on('change', '#relation_table', function () {
|
|
671
|
+
dropdownRelations('relation_table', 'relation_name', 'relation_concat', $(this).val(), '', 'CONCAT(' + $('body').find('#relation_field').val() + ')')
|
|
672
|
+
})
|
|
673
|
+
|
|
674
|
+
$('body').on('change', '#relation_name', function () {
|
|
675
|
+
$('#relation_concat').val('CONCAT(' + $(this).val() + ')')
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
$('body').on('change', '#typeahead_table', function () {
|
|
679
|
+
dropdownRelations('typeahead_table', 'typeahead_name', 'typeahead_concat', $(this).val())
|
|
680
|
+
})
|
|
681
|
+
$('body').on('change', '#dropdown_multi_table', function () {
|
|
682
|
+
dropdownRelations('dropdown_multi_table', 'dropdown_multi_name', 'dropdown_multi_concat', $(this).val())
|
|
683
|
+
})
|
|
684
|
+
$('body').on('change', '#multi_line_editor_table', function () {
|
|
685
|
+
dropdownRelations('multi_line_editor_table', 'multi_line_editor_name', 'multi_line_editor_concat', $(this).val())
|
|
686
|
+
})
|
|
687
|
+
$('body').on('change', '#dropdown_chain_table', function () {
|
|
688
|
+
dropdownRelations('dropdown_chain_table', 'dropdown_chain_name', 'dropdown_chain_concat', $(this).val())
|
|
689
|
+
})
|
|
690
|
+
|
|
691
|
+
$('body').on('change', '#relationfield', function () {
|
|
692
|
+
$('#relationconcat').val('CONCAT(' + $(this).val() + ')')
|
|
693
|
+
})
|
|
694
|
+
$('body').on('change', '#relationname', function () {
|
|
695
|
+
$('#relation_concat').val('CONCAT(' + $(this).val() + ')')
|
|
696
|
+
})
|
|
697
|
+
$('body').on('change', '#typeahead_name', function () {
|
|
698
|
+
$('#typeahead_concat').val('CONCAT(' + $(this).val() + ')')
|
|
699
|
+
})
|
|
700
|
+
$('body').on('change', '#dropdown_multi_name', function () {
|
|
701
|
+
$('#dropdown_multi_concat').val('CONCAT(' + $(this).val() + ')')
|
|
702
|
+
})
|
|
703
|
+
$('body').on('change', '#dropdown_chain_name', function () {
|
|
704
|
+
$('#dropdown_chain_concat').val('CONCAT(' + $(this).val() + ')')
|
|
705
|
+
})
|
|
706
|
+
$('#is_approval').on('switchChange.bootstrapSwitch', function (event, state) {
|
|
707
|
+
if (state === true) {
|
|
708
|
+
$('.divzapprovals').show()
|
|
709
|
+
is_approval = 1
|
|
654
710
|
} else {
|
|
655
|
-
$(
|
|
656
|
-
is_approval = 0
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
711
|
+
$('.divzapprovals').hide()
|
|
712
|
+
is_approval = 0
|
|
713
|
+
}
|
|
714
|
+
})
|
|
715
|
+
|
|
716
|
+
$('.export-file').on('click', function (e) {
|
|
717
|
+
e.preventDefault()
|
|
718
|
+
let table = $('#route').val()
|
|
719
|
+
ajaxPost(
|
|
720
|
+
'/zgenerator/export',
|
|
721
|
+
{
|
|
722
|
+
table: table,
|
|
723
|
+
},
|
|
724
|
+
function (data) {
|
|
725
|
+
toastrForm(data)
|
|
726
|
+
if (data.status == 1) {
|
|
727
|
+
location.href = `/zdownload/zgenerator/${table}`
|
|
728
|
+
}
|
|
668
729
|
}
|
|
669
|
-
|
|
670
|
-
})
|
|
730
|
+
)
|
|
731
|
+
})
|
|
671
732
|
|
|
672
|
-
$(
|
|
673
|
-
$(
|
|
733
|
+
$('#submit-import').on('click', function () {
|
|
734
|
+
$('#modal-form-file').submit()
|
|
674
735
|
})
|
|
675
|
-
submitForm(
|
|
676
|
-
toastrForm(data)
|
|
677
|
-
if(data.status == 1) {
|
|
736
|
+
submitForm('modal-form-file', '', '', function (data) {
|
|
737
|
+
toastrForm(data)
|
|
738
|
+
if (data.status == 1) {
|
|
678
739
|
setTimeout(function () {
|
|
679
|
-
location.href = `?table=${data.table}
|
|
680
|
-
},1000)
|
|
740
|
+
location.href = `?table=${data.table}`
|
|
741
|
+
}, 1000)
|
|
681
742
|
}
|
|
682
|
-
})
|
|
683
|
-
})
|
|
684
|
-
|
|
743
|
+
})
|
|
744
|
+
})
|
|
685
745
|
|
|
686
|
-
$(
|
|
687
|
-
fixContainer()
|
|
746
|
+
$('.btn-test').on('click', function () {
|
|
747
|
+
fixContainer()
|
|
688
748
|
})
|
|
689
749
|
|
|
690
750
|
function fixContainer() {
|
|
691
|
-
let length = $(
|
|
751
|
+
let length = $('.container-nav').length
|
|
692
752
|
let obj = {}
|
|
693
|
-
let getId =
|
|
694
|
-
if(length) {
|
|
695
|
-
$ols = $(
|
|
753
|
+
let getId = ''
|
|
754
|
+
if (length) {
|
|
755
|
+
$ols = $('ol.mydragable')
|
|
696
756
|
$ols.each(function () {
|
|
697
|
-
getId = $ols.attr(
|
|
698
|
-
let name = $(this).data(
|
|
699
|
-
if(!Object.prototype.hasOwnProperty.call(obj,name)) {
|
|
700
|
-
obj[name] = []
|
|
757
|
+
getId = $ols.attr('id') ? $ols.attr('id') : ''
|
|
758
|
+
let name = $(this).data('name')
|
|
759
|
+
if (!Object.prototype.hasOwnProperty.call(obj, name)) {
|
|
760
|
+
obj[name] = []
|
|
701
761
|
}
|
|
702
|
-
let lis = $(this).children(
|
|
762
|
+
let lis = $(this).children('li')
|
|
703
763
|
lis.each(function () {
|
|
704
|
-
let className = $(this).attr('class') ? $(this).attr('class') :
|
|
764
|
+
let className = $(this).attr('class') ? $(this).attr('class') : ''
|
|
705
765
|
//console.log(`className ${className}`)
|
|
706
|
-
if(className ==
|
|
707
|
-
let parent_container = $(this).parent(
|
|
708
|
-
let parent_container_id = parent_container.attr('id') ||
|
|
709
|
-
let parent_container_name = parent_container.data('name') ||
|
|
710
|
-
let child_container = $(this)
|
|
711
|
-
child_container.attr('data-name', parent_container.data('name')).attr('id', parent_container.attr('id'))
|
|
712
|
-
let arr = []
|
|
713
|
-
let $containerboxs = $(this).find('.container-box')
|
|
714
|
-
let $containerboxsLength = $containerboxs.length
|
|
715
|
-
for(let i =0
|
|
766
|
+
if (className == 'container-nav') {
|
|
767
|
+
let parent_container = $(this).parent('ol.mydragable')
|
|
768
|
+
let parent_container_id = parent_container.attr('id') || ''
|
|
769
|
+
let parent_container_name = parent_container.data('name') || ''
|
|
770
|
+
let child_container = $(this)
|
|
771
|
+
child_container.attr('data-name', parent_container.data('name')).attr('id', parent_container.attr('id'))
|
|
772
|
+
let arr = []
|
|
773
|
+
let $containerboxs = $(this).find('.container-box')
|
|
774
|
+
let $containerboxsLength = $containerboxs.length
|
|
775
|
+
for (let i = 0; i < $containerboxsLength; i++) {
|
|
716
776
|
//console.log(`$containerboxsLength ${i}`)
|
|
717
|
-
let item
|
|
718
|
-
let $lis = $containerboxs.eq(i).find('li')
|
|
719
|
-
let $lisLength = $lis.length
|
|
720
|
-
for(let x =1; x < $lisLength;x++) {
|
|
721
|
-
let $name =
|
|
722
|
-
if(parent_container_id) {
|
|
723
|
-
let getname= $lis.eq(x).find('input[type=hidden]').val()
|
|
724
|
-
$name = `${getname}___${parent_container_id}
|
|
777
|
+
let item = []
|
|
778
|
+
let $lis = $containerboxs.eq(i).find('li')
|
|
779
|
+
let $lisLength = $lis.length
|
|
780
|
+
for (let x = 1; x < $lisLength; x++) {
|
|
781
|
+
let $name = ''
|
|
782
|
+
if (parent_container_id) {
|
|
783
|
+
let getname = $lis.eq(x).find('input[type=hidden]').val()
|
|
784
|
+
$name = `${getname}___${parent_container_id}`
|
|
725
785
|
//fixed in tab
|
|
726
|
-
$lis.eq(x).find('input[type=text]').attr('name'
|
|
727
|
-
$lis.eq(x).find('input[type=hidden]').attr('name',name)
|
|
786
|
+
$lis.eq(x).find('input[type=text]').attr('name', $name)
|
|
787
|
+
$lis.eq(x).find('input[type=hidden]').attr('name', name)
|
|
728
788
|
} else {
|
|
729
|
-
$name =
|
|
730
|
-
$lis.eq(x).find('input[type=text]').attr('name'
|
|
731
|
-
$lis.eq(x).find('input[type=hidden]').attr('name',name)
|
|
789
|
+
$name = $lis.eq(x).find('input[type=text]').attr('data-name')
|
|
790
|
+
$lis.eq(x).find('input[type=text]').attr('name', $name)
|
|
791
|
+
$lis.eq(x).find('input[type=hidden]').attr('name', name)
|
|
732
792
|
}
|
|
733
|
-
item.push($name)
|
|
793
|
+
item.push($name)
|
|
734
794
|
}
|
|
735
795
|
arr.push(item)
|
|
736
796
|
}
|
|
737
797
|
obj[name].push(arr)
|
|
738
798
|
} else {
|
|
739
|
-
obj[name].push($(this).find(
|
|
799
|
+
obj[name].push($(this).find('input[type=text]').attr('name'))
|
|
740
800
|
}
|
|
741
801
|
})
|
|
742
802
|
})
|
|
@@ -761,51 +821,63 @@
|
|
|
761
821
|
}
|
|
762
822
|
console.log(JSON.stringify(obj))*/
|
|
763
823
|
|
|
764
|
-
others = obj
|
|
765
|
-
return obj
|
|
824
|
+
others = obj
|
|
825
|
+
return obj
|
|
766
826
|
}
|
|
767
|
-
|
|
768
827
|
</script>
|
|
769
828
|
|
|
770
829
|
<script>
|
|
771
830
|
$(function () {
|
|
772
|
-
$(
|
|
773
|
-
e.preventDefault()
|
|
774
|
-
if(sorting ==
|
|
775
|
-
|
|
831
|
+
$('.layout21').on('click', function (e) {
|
|
832
|
+
e.preventDefault()
|
|
833
|
+
if (sorting == '[2,1]') {
|
|
776
834
|
} else {
|
|
777
|
-
let table = $(
|
|
778
|
-
ajaxPost(
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
835
|
+
let table = $('#table').val()
|
|
836
|
+
ajaxPost(
|
|
837
|
+
'/<%- routeName%>/sorting',
|
|
838
|
+
{
|
|
839
|
+
table: table,
|
|
840
|
+
sorting: '[2,1]',
|
|
841
|
+
},
|
|
842
|
+
function (dt) {
|
|
843
|
+
location.href = ''
|
|
844
|
+
}
|
|
845
|
+
)
|
|
784
846
|
}
|
|
785
847
|
})
|
|
786
848
|
|
|
787
|
-
$(
|
|
788
|
-
e.preventDefault()
|
|
789
|
-
if(sorting ==
|
|
849
|
+
$('.layout12').on('click', function (e) {
|
|
850
|
+
e.preventDefault()
|
|
851
|
+
if (sorting == '[1,2]') {
|
|
790
852
|
} else {
|
|
791
|
-
let table = $(
|
|
792
|
-
ajaxPost(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
853
|
+
let table = $('#table').val()
|
|
854
|
+
ajaxPost(
|
|
855
|
+
'/<%- routeName%>/sorting',
|
|
856
|
+
{
|
|
857
|
+
table: table,
|
|
858
|
+
sorting: '[1,2]',
|
|
859
|
+
},
|
|
860
|
+
function (dt) {
|
|
861
|
+
location.href = ''
|
|
862
|
+
}
|
|
863
|
+
)
|
|
798
864
|
}
|
|
799
865
|
})
|
|
800
|
-
})
|
|
866
|
+
})
|
|
801
867
|
|
|
802
868
|
function saveContainer() {
|
|
803
|
-
others = fixContainer()
|
|
804
|
-
ajaxPost(
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
869
|
+
others = fixContainer()
|
|
870
|
+
ajaxPost(
|
|
871
|
+
'/<%- routeName%>/add_container',
|
|
872
|
+
{
|
|
873
|
+
table: $('#table').val(),
|
|
874
|
+
others: JSON.stringify(others),
|
|
875
|
+
},
|
|
876
|
+
function (dt) {}
|
|
877
|
+
)
|
|
810
878
|
}
|
|
811
879
|
</script>
|
|
880
|
+
<script>
|
|
881
|
+
//tab draggable
|
|
882
|
+
$(function () {})
|
|
883
|
+
</script>
|