zet-lib 1.5.29 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/Modal.js +85 -30
  2. package/lib/Model.js +118 -2
  3. package/lib/config_generator.js +24 -0
  4. package/lib/generatorApi.js +1328 -0
  5. package/lib/generatorApp.js +1342 -0
  6. package/lib/generatorModel.js +733 -0
  7. package/lib/lang_en.js +115 -0
  8. package/lib/routes/api.js +52 -0
  9. package/lib/routes/index.js +9 -0
  10. package/lib/views/error.ejs +3 -0
  11. package/lib/views/generatorjs.ejs +855 -852
  12. package/lib/views/zgenerator/bootstrap3/_form.ejs +24 -0
  13. package/lib/views/zgenerator/bootstrap3/create.ejs +9 -0
  14. package/lib/views/zgenerator/bootstrap3/createjs.ejs +3 -0
  15. package/lib/views/zgenerator/bootstrap3/import.ejs +52 -0
  16. package/lib/views/zgenerator/bootstrap3/importjs.ejs +3 -0
  17. package/lib/views/zgenerator/bootstrap3/index.ejs +29 -0
  18. package/lib/views/zgenerator/bootstrap3/indexcss.ejs +1 -0
  19. package/lib/views/zgenerator/bootstrap3/indexjs.ejs +307 -0
  20. package/lib/views/zgenerator/bootstrap3/update.ejs +8 -0
  21. package/lib/views/zgenerator/bootstrap3/updatejs.ejs +3 -0
  22. package/lib/views/zgenerator/bootstrap3/view.ejs +57 -0
  23. package/lib/views/zgenerator/head.ejs +12 -0
  24. package/lib/views/zgenerator/index.ejs +271 -0
  25. package/lib/views/zgenerator/indexcss.ejs +87 -0
  26. package/lib/views/zgenerator/indexjs.ejs +705 -0
  27. package/lib/views/zgenerator/layout.ejs +198 -0
  28. package/lib/views/zgenerator/manual_basic.ejs +2 -0
  29. package/lib/views/zgenerator/manual_dropdown.ejs +126 -0
  30. package/lib/views/zgenerator/manual_modules.ejs +192 -0
  31. package/lib/views/zgenerator/manual_virtual.ejs +143 -0
  32. package/lib/views/zgenerator/mini.ejs +341 -0
  33. package/lib/views/zgenerator/routerApp.ejs +359 -0
  34. package/lib/views/zgenerator/views/_form.ejs +25 -0
  35. package/lib/views/zgenerator/views/approval.ejs +42 -0
  36. package/lib/views/zgenerator/views/create.ejs +7 -0
  37. package/lib/views/zgenerator/views/createjs.ejs +16 -0
  38. package/lib/views/zgenerator/views/import.ejs +49 -0
  39. package/lib/views/zgenerator/views/importjs.ejs +4 -0
  40. package/lib/views/zgenerator/views/index.ejs +9 -0
  41. package/lib/views/zgenerator/views/indexcss.ejs +2 -0
  42. package/lib/views/zgenerator/views/indexjs.ejs +2 -0
  43. package/lib/views/zgenerator/views/preview.ejs +34 -0
  44. package/lib/views/zgenerator/views/update.ejs +7 -0
  45. package/lib/views/zgenerator/views/updatejs.ejs +16 -0
  46. package/lib/views/zgenerator/views/view.ejs +36 -0
  47. package/lib/zGeneratorRouter.js +177 -153
  48. package/lib/zRoute.js +14 -3
  49. package/package.json +1 -1
@@ -1,928 +1,931 @@
1
1
  <!-- set to localStorage -->
2
2
  <script>
3
- var datas = {}
4
- var is_approval = '<%- approvalDatas.is_approval %>'
5
- var sorting = '<%- sorting%>'
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
- 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);
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
- 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)
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
- _super($item, container)
245
- },
246
- })
82
+ )
83
+ }
247
84
 
248
- //tab draggable
249
- $('ul.sortable-list').sortable()
250
- //end tab draggable
251
- loadForm()
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 nextDragged() {
256
- setTimeout(() => {
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
- '/<%- routeName%>/tab-draggable',
259
- {
260
- tabs: $('.sortable-list')
261
- .find('input[name="tabs[]"]')
262
- .each((index, elm) => $(elm).val()),
263
- },
264
- () => location.href
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
- }, 1000)
146
+ $('#modal_setting').modal('show')
267
147
  }
268
148
 
269
- function buildOneRow(columncount) {
270
- let html = ``
271
- let time = new Date().getTime()
272
- let col_md = `col-md-${12 / columncount}`
273
- let 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>`
277
- }
278
- html += `</div></li>`
279
- return html
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
- $('#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()
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
- for (let key in myObj) {
305
- options += `<option value="${key}">${key}</option>`
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
- $('#moveintocontainer').on('click', function () {
313
- let myval = $('#container-select').val()
314
- if (myval) {
315
- let myelement = fieldsObjectInput[myval]
316
- //let myname = `${container_time}___${container_column}___${container_split}___${container_index}`;
317
- myelement.find('input[type=hidden]').attr('name', 'ONE_COLUMN')
318
- myelement.appendTo(parentContainer)
319
- }
320
- $('.btncontainer-close').click()
321
- setTimeout(function () {
322
- saveContainer()
323
- }, 2000)
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
- $('#table').on('change', function () {
327
- location.href = '/<%- routeName%>?table=' + $(this).val()
328
- loadForm()
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
- $('#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()
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
- $('#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
358
- }
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
- })
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
- $('#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
- })
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
- function saveFields() {
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: 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
- $('#save').on('click', function () {
422
- saveFields()
423
- })
424
- $('#save_script').on('click', function () {
425
- saveFields()
426
- })
329
+ $('#table').on('change', function () {
330
+ location.href = '/<%- routeName%>?table=' + $(this).val()
331
+ loadForm()
332
+ })
427
333
 
428
- $('.btn-reset').on('click', function () {
429
- if (window.confirm('Reset to factory settings ?')) {
430
- ajaxPost(
431
- '/<%- routeName%>/reset',
432
- {
433
- table: $('#table').val(),
434
- },
435
- function (data) {
436
- if (data.status == 0) {
437
- toastr.error(data.message, data.title)
438
- } else {
439
- toastr.success(data.title, data.message)
440
- location.href = ''
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
- $('.btn-minify').on('click', function () {
448
- if (window.confirm('Minify all views in one line make your website faster ?')) {
449
- ajaxPost('/<%- routeName%>/minify', {}, function (data) {
450
- if (data.status == 0) {
451
- toastr.error(data.message, data.title)
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
- $('.btn-generate-assets').on('click', function () {
460
- if (window.confirm('Replace javascript assets with this one ?')) {
461
- ajaxPost('/<%- routeName%>/generate-assets', {}, function (data) {
462
- if (data.status == 0) {
463
- toastr.error(data.message, data.title)
464
- } else {
465
- toastr.success(data.title, data.message)
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
- selectTable($('#table').val())
472
- function changeUrl(title, url) {
473
- var origin = window.location.origin
474
- if (typeof history.pushState != 'undefined') {
475
- var obj = { Title: title, Url: origin + '/<%- routeName%>?table=' + url }
476
- window.history.pushState(obj, obj.Title, obj.Url)
477
- } else {
478
- alert('Browser does not support HTML5.')
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
- $('#modal-table').on('change', function () {
483
- $('#modal-route').val(toName($(this).val()))
484
- })
485
- $('#modal-table').on('input', function () {
486
- $('#modal-route').val(toName($(this).val()))
487
- })
488
- $('#delete_module').on('click', function () {
489
- if (window.confirm('sure to delete ?')) {
490
- ajaxDelete('/<%- routeName%>/delete-table', { table: $('#table').val() }, function (data) {
491
- toastrForm(data)
492
- if (data.status == 1) {
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
- $('#modal-save').on('click', function () {
500
- let reservedWord = ['order', 'left', 'right', 'by', 'zrole', 'role', 'zuser', 'zcompany_access']
501
- let moduleName = $('#modal-table').val()
502
- moduleName = moduleName.toLowerCase()
503
- let arrModules = reservedWord.filter((item) => item == moduleName)
504
- if (arrModules.length) {
505
- toastrForm({
506
- status: 0,
507
- title: 'Error Module Name reserved',
508
- message: 'Please change your module name',
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
- $('#modal-add').on('click', function () {
521
- let others = fixContainer()
522
- ajaxPost(
523
- '/<%- routeName%>/add_field',
524
- {
525
- table: $('#table').val(),
526
- name: $('#modal_name').val(),
527
- type: $('#modal_type').val(),
528
- position: $('#modal_position').val(),
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
- $('body').on('click', '.modal_setting', function () {
547
- click_setting($(this))
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
- $('body').on('click', '.select-plus', function () {
551
- let name = $(this).data('name')
552
- let item = $(this).data('item')
553
- let num = $('.group-select').length || 0
554
- html = `<div class="input-group group-select"><div class="input-group-prepend">
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
- $('.divselect').append(html)
561
- })
563
+ $('.divselect').append(html)
564
+ })
562
565
 
563
- $('body').on('click', '.trash-select', function () {
564
- let name = $(this).data('name')
565
- let item = $(this).data('item')
566
- $(this).closest('.group-select').remove()
567
- $('.group-select').each(function (index, value) {
568
- $(this)
569
- .closest('div')
570
- .find('input.cvalue')
571
- .attr('name', name + '[' + item + '][' + index + '][value]')
572
- $(this)
573
- .closest('div')
574
- .find('input.clabel')
575
- .attr('name', name + '[' + item + '][' + index + '][label]')
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
- $('body').on('click', '#modal-setting-save', function () {
580
- let datas = $('#modal-setting-form').serializeArray()
581
- ajaxPost('/<%- routeName%>/save_setting?table=' + $('#table').val(), datas, function (data) {
582
- toastrForm(data)
583
- if (data.status == 1) {
584
- $('#modal_setting').modal('hide')
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
- $('body').on('change', '#modal_type', function () {
590
- if ($(this).val() == 'relation') {
591
- $('.divrelation').show()
592
- $('.divrelationfield').show()
593
- $('.divconcat').show()
594
- $('.divfield').hide()
595
- dropdownRelations()
596
- } else if ($(this).val() == 'table') {
597
- $('.divrelation').show()
598
- $('.divrelationfield').hide()
599
- $('.divconcat').hide()
600
- $('.divfield').hide()
601
- dropdownRelations()
602
- } else if ($(this).val() == 'multi_line_editor') {
603
- $('.divrelation').show()
604
- $('.divrelationfield').hide()
605
- $('.divconcat').hide()
606
- $('.divfield').hide()
607
- dropdownRelations()
608
- } else if ($(this).val() == 'dropdown_multi') {
609
- $('.divrelation').show()
610
- $('.divrelationfield').show()
611
- $('.divconcat').show()
612
- $('.divfield').hide()
613
- dropdownRelations()
614
- } else if ($(this).val() == 'dropdown_chain') {
615
- $('.divrelation').show()
616
- $('.divrelationfield').show()
617
- $('.divconcat').show()
618
- $('.divfield').show()
619
- dropdownRelations()
620
- } else if ($(this).val() == 'typeahead') {
621
- $('.divrelation').show()
622
- $('.divrelationfield').show()
623
- $('.divconcat').show()
624
- $('.divfield').hide()
625
- dropdownRelations()
626
- } else if ($(this).val() == 'dragdrop') {
627
- $('.divrelation').show()
628
- $('.divrelationfield').show()
629
- $('.divconcat').show()
630
- $('.divfield').hide()
631
- dropdownRelations()
632
- } else {
633
- $('.divrelation').hide()
634
- $('.divconcat').hide()
635
- $('.divfield').hide()
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
- $('body').on('click', '#delete_field', function () {
640
- let name = $(this).data('name')
641
- if (window.confirm('sure delete ? ')) {
642
- ajaxDelete('/<%- routeName%>/delete_field', { name: name, table: $('#table').val() }, function (data) {
643
- toastrForm(data)
644
- if (data.status == 1) {
645
- location.href = ''
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
- $('body').on('click', '.edittab', function () {
652
- $('body').find('#edittab').val($(this).data('name'))
653
- $('body').find('#modal-tab-save').attr('data-id', $(this).data('id'))
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
- $('body').on('click', '#modal-tab-save', function () {
657
- ajaxPost(
658
- '/<%- routeName%>/tab_rename',
659
- {
660
- id: $(this).data('id'),
661
- name: $('body').find('#edittab').val(),
662
- table: $('#table').val(),
663
- },
664
- function (data) {
665
- toastrForm(data)
666
- if (data.status == 1) {
667
- location.href = ''
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
- $('body').on('change', '#relationtable', function () {
674
- dropdownRelations('relationtable', 'relationfield', 'relationconcat', $(this).val(), '', 'CONCAT(' + $('body').find('#relationfield').val() + ')')
675
- })
676
+ $('body').on('change', '#relationtable', function () {
677
+ dropdownRelations('relationtable', 'relationfield', 'relationconcat', $(this).val(), '', 'CONCAT(' + $('body').find('#relationfield').val() + ')')
678
+ })
676
679
 
677
- $('body').on('change', '#relation_table', function () {
678
- dropdownRelations('relation_table', 'relation_name', 'relation_concat', $(this).val(), '', 'CONCAT(' + $('body').find('#relation_field').val() + ')')
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
- $(document).on('change', '#dragdrop_table', function () {
682
- dropdownRelations('dragdrop_table', 'dragdrop_name', 'dragdrop_concat', $(this).val(), '', 'CONCAT(' + $('body').find('#relation_field').val() + ')')
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
- $('body').on('change', '#relation_name', function () {
686
- $('#relation_concat').val('CONCAT(' + $(this).val() + ')')
687
- })
688
+ $('body').on('change', '#relation_name', function () {
689
+ $('#relation_concat').val('CONCAT(' + $(this).val() + ')')
690
+ })
688
691
 
689
- $('body').on('change', '#dragdrop_name', function () {
690
- $('#dragdrop_concat').val('CONCAT(' + $(this).val() + ')')
691
- })
692
+ $('body').on('change', '#dragdrop_name', function () {
693
+ $('#dragdrop_concat').val('CONCAT(' + $(this).val() + ')')
694
+ })
692
695
 
693
- $('body').on('change', '#typeahead_table', function () {
694
- dropdownRelations('typeahead_table', 'typeahead_name', 'typeahead_concat', $(this).val())
695
- })
696
- $('body').on('change', '#dropdown_multi_table', function () {
697
- dropdownRelations('dropdown_multi_table', 'dropdown_multi_name', 'dropdown_multi_concat', $(this).val())
698
- })
699
- $('body').on('change', '#multi_line_editor_table', function () {
700
- dropdownRelations('multi_line_editor_table', 'multi_line_editor_name', 'multi_line_editor_concat', $(this).val())
701
- })
702
- $('body').on('change', '#dropdown_chain_table', function () {
703
- dropdownRelations('dropdown_chain_table', 'dropdown_chain_name', 'dropdown_chain_concat', $(this).val())
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
- $('body').on('change', '#relationfield', function () {
707
- $('#relationconcat').val('CONCAT(' + $(this).val() + ')')
708
- })
709
- $('body').on('change', '#relationname', function () {
710
- $('#relation_concat').val('CONCAT(' + $(this).val() + ')')
711
- })
712
- $('body').on('change', '#typeahead_name', function () {
713
- $('#typeahead_concat').val('CONCAT(' + $(this).val() + ')')
714
- })
715
- $('body').on('change', '#dropdown_multi_name', function () {
716
- $('#dropdown_multi_concat').val('CONCAT(' + $(this).val() + ')')
717
- })
718
- $('body').on('change', '#dropdown_chain_name', function () {
719
- $('#dropdown_chain_concat').val('CONCAT(' + $(this).val() + ')')
720
- })
721
- $('#is_approval').on('switchChange.bootstrapSwitch', function (event, state) {
722
- if (state === true) {
723
- $('.divzapprovals').show()
724
- is_approval = 1
725
- } else {
726
- $('.divzapprovals').hide()
727
- is_approval = 0
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
- $('.export-file').on('click', function (e) {
732
- e.preventDefault()
733
- let table = $('#route').val()
734
- ajaxPost(
735
- '/zgenerator/export',
736
- {
737
- table: table,
738
- },
739
- function (data) {
740
- toastrForm(data)
741
- if (data.status == 1) {
742
- location.href = `/zdownload/zgenerator/${table}`
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
- $('#submit-import').on('click', function () {
749
- $('#modal-form-file').submit()
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
- submitForm('modal-form-file', '', '', function (data) {
752
- toastrForm(data)
753
- if (data.status == 1) {
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
- $('.btn-test').on('click', function () {
762
- fixContainer()
763
- })
764
-
765
- function fixContainer() {
766
- let length = $('.container-nav').length
767
- let obj = {}
768
- let getId = ''
769
- if (length) {
770
- $ols = $('ol.mydragable')
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
- item.push($name)
809
- }
810
- arr.push(item)
811
- }
812
- obj[name].push(arr)
813
- } else {
814
- obj[name].push($(this).find('input[type=text]').attr('name'))
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
- $(function () {
826
- $('.layout21').on('click', function (e) {
827
- e.preventDefault()
828
- if (sorting == '[2,1]') {
829
- } else {
830
- let table = $('#table').val()
831
- ajaxPost(
832
- '/<%- routeName%>/sorting',
833
- {
834
- table: table,
835
- sorting: '[2,1]',
836
- },
837
- function (dt) {
838
- location.href = ''
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
- $('.layout12').on('click', function (e) {
845
- e.preventDefault()
846
- if (sorting == '[1,2]') {
847
- } else {
848
- let table = $('#table').val()
891
+ function saveContainer() {
892
+ others = fixContainer()
849
893
  ajaxPost(
850
- '/<%- routeName%>/sorting',
851
- {
852
- table: table,
853
- sorting: '[1,2]',
854
- },
855
- function (dt) {
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
- $("#modal-joins-save").on("click", function (e) {
863
- let table_join = $('#select_module_joins').val();
864
- let table = $('#table').val()
865
- if (table == table_join) {
866
- toastr.error("Your selected module is equal with current module");
867
- return;
868
- }
869
- ajaxPost(
870
- '/<%- routeName%>/joins',
871
- {
872
- table_join: table_join,
873
- table: table,
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
- loadJoins();
886
- })
887
-
888
- function saveContainer() {
889
- others = fixContainer()
890
- ajaxPost(
891
- '/<%- routeName%>/add_container',
892
- {
893
- table: $('#table').val(),
894
- others: JSON.stringify(others),
895
- },
896
- function (dt) { }
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>