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