zet-lib 1.3.20 → 1.3.22

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.
@@ -13,30 +13,31 @@
13
13
  <label for="table">Module Name</label>
14
14
  <select name="table" id="table" class="form-control">
15
15
  <option value="">Please Select</option>
16
- <% for(var key in rows) {
17
- var row = rows[key];
18
- var selected = row.table == table ? " selected " : "";
19
- if(row.table != 'zrole') {
20
- %>
21
- <option value="<%= row.table %>" <%= selected %> ><%= row.table %></option>
22
- <% }} %>
16
+ <% for(var key in rows) { var row=rows[key]; var selected=row.table==table
17
+ ? " selected " : "" ; if(row.table !='zrole' ) { %>
18
+ <option value="<%= row.table %>" <%=selected %> ><%= row.table %>
19
+ </option>
20
+ <% }} %>
23
21
  </select>
24
22
  </div>
25
23
 
26
24
  <% if(table) {%>
27
25
  <div class="form-group">
28
26
  <label for="route">Title</label>
29
- <input type="text" class="form-control" id="title" name="title" value="<%- datas.name%>" />
27
+ <input type="text" class="form-control" id="title" name="title"
28
+ value="<%- datas.name%>" />
30
29
  </div>
31
30
  <div class="form-group">
32
31
  <label for="route">Route</label>
33
- <input type="text" class="form-control" readonly id="route" name="route" value="<%- route%>" />
32
+ <input type="text" class="form-control" readonly id="route" name="route"
33
+ value="<%- route%>" />
34
34
  </div>
35
35
 
36
36
  <!-- Default checkbox -->
37
37
  <div class="form-group">
38
38
  <div class="form-check">
39
- <input class="form-check-input" type="checkbox" value="1" <%- checkDummy %> name="json[dummy]" id="dummy" />
39
+ <input class="form-check-input" type="checkbox" value="1" <%- checkDummy %>
40
+ name="json[dummy]" id="dummy" />
40
41
  <label class="form-check-label" for="flexCheckDefault">As Dummy</label>
41
42
  </div>
42
43
  </div>
@@ -44,30 +45,40 @@
44
45
  <div class="form-group">
45
46
  <label for="route">Tabs</label>
46
47
  <div class="input-group mb-3">
47
- <input type="text" class="form-control" id="tabname" placeholder="Enter tab name" aria-label="Enter tab name" aria-describedby="button-addon2">
48
+ <input type="text" class="form-control" id="tabname" placeholder="Enter tab name"
49
+ aria-label="Enter tab name" aria-describedby="button-addon2">
48
50
  <div class="input-group-append">
49
- <button class="btn btn-md btn-secondary m-0 px-3" type="button" id="add"><i class="fa fa-plus"></i></button>
51
+ <button class="btn btn-md btn-secondary m-0 px-3" type="button" id="add"><i
52
+ class="fa fa-plus"></i></button>
50
53
  </div>
51
54
  </div>
52
55
  </div>
53
- <div class="storetabs"><ul id="tabs" class="sortable-list"></ul></div>
54
- <%} %>
55
-
56
- <%if(lock==0) {%>
57
- <div class="text-center mt-4">
58
- <% if(table) {%>
59
- <button class="btn btn-danger text-white" id="delete_module" type="button"><i class="fa fa-trash"></i> Delete Module</button>
60
- <%}%>
61
- <button class="btn btn-success text-white" data-toggle="modal" data-target="#add_table" type="button"><i class="fa fa-plus"></i> Add Module</button>
62
- <% if(table) {%>
63
- <button class="btn btn-info" id="savetab" type="button"><i class="fa fa-paper-plane"></i> Save</button>
64
- <a class="btn btn-warning " href="/<%- table%>" target="__blank" type="button"><i class="fa fa-plane"></i> Go To <%- table%></a>
65
- <%}%>
56
+ <div class="storetabs">
57
+ <ul id="tabs" class="sortable-list"></ul>
66
58
  </div>
67
- <%} else {%>
68
- <button class="btn btn-danger text-white" type="button"><i class="fa fa-warning"></i> This table has been locked!!!</button>
59
+ <%} %>
60
+
61
+ <%if(lock==0) {%>
62
+ <div class="text-center mt-4">
63
+ <% if(table) {%>
64
+ <button class="btn btn-danger text-white" id="delete_module"
65
+ type="button"><i class="fa fa-trash"></i> Delete Module</button>
66
+ <%}%>
67
+ <button class="btn btn-success text-white" data-toggle="modal"
68
+ data-target="#add_table" type="button"><i class="fa fa-plus"></i>
69
+ Add Module</button>
70
+ <% if(table) {%>
71
+ <button class="btn btn-info" id="savetab" type="button"><i
72
+ class="fa fa-paper-plane"></i> Save</button>
73
+ <a class="btn btn-warning " href="/<%- table%>" target="__blank"
74
+ type="button"><i class="fa fa-plane"></i> Go To <%- table%></a>
75
+ <%}%>
76
+ </div>
77
+ <%} else {%>
78
+ <button class="btn btn-danger text-white" type="button"><i
79
+ class="fa fa-warning"></i> This table has been locked!!!</button>
69
80
 
70
- <%} %>
81
+ <%} %>
71
82
  </form>
72
83
  <!-- Default form reply -->
73
84
  </div>
@@ -76,27 +87,40 @@
76
87
  <div class="card mb-3 wow fadeIn" id="divfields" style="display: none">
77
88
  <div class="card-header secondary-color-dark text-white font-weight-bold">Fields</div>
78
89
  <div class="card-body">
79
-
80
90
  <!-- Default form reply -->
81
91
  <form id="formfields" method="post" action="/generator/fields">
82
92
  <div id="divtablist" class="row"></div>
83
93
  <div id="contentfields"></div>
84
- <% if(lock == 0) {%>
94
+ <div id="divjoinmodules">
95
+ <h4>Join Modules</h4>
96
+ <div class="row" id="joinlist"></div>
97
+ </div>
98
+ <% if(lock==0) {%>
85
99
  <div class="text-center mt-4">
86
- <button class="btn btn-danger btn-reset text-white mr-2" type="button"><i class="fas fa-drum"></i> Reset </button>
87
- <button class="btn btn-primary dropdown-toggle mr-2" type="button" data-toggle="dropdown"
88
- aria-haspopup="true" aria-expanded="false"><i class="fas fa-columns"></i> Layout <%- sorting%></button>
100
+ <button class="btn btn-danger btn-reset text-white mr-2" type="button"><i
101
+ class="fas fa-drum"></i> Reset </button>
102
+ <button class="btn btn-primary dropdown-toggle mr-2" type="button"
103
+ data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i
104
+ class="fas fa-columns"></i> Layout <%- sorting%></button>
89
105
  <div class="dropdown-menu">
90
106
  <a class="dropdown-item layout21" href="#">2 : 1</a>
91
107
  <a class="dropdown-item layout12" href="#">1 : 2</a>
92
108
  </div>
93
109
  <!-- Basic dropdown -->
94
- <button class="btn btn-warning m-0 px-3 waves-effect waves-light mr-2" data-toggle="modal" data-target="#modal_joins" type="button"><i class="fas fa-dice"></i> Join Module</button>
95
- <button class="btn m-0 px-3 waves-effect waves-light mr-2" data-toggle="modal" data-target="#modal_container" type="button"><i class="fa fa-plus"></i> Add Container</button>
96
- <button class="btn btn-success px-3 text-white mr-2" data-toggle="modal" data-target="#modal_add_field" type="button"><i class="fa fa-plus"></i> Add Field</button>
97
- <button class="btn secondary-color-dark px-3 text-white mr-2" id="save" type="button"><i class="fa fa-paper-plane"></i> Save & Generate</button>
110
+ <button class="btn btn-warning m-0 px-3 waves-effect waves-light mr-2"
111
+ data-toggle="modal" data-target="#modal_joins" type="button"><i
112
+ class="fas fa-dice"></i> Join Module</button>
113
+ <button class="btn m-0 px-3 waves-effect waves-light mr-2" data-toggle="modal"
114
+ data-target="#modal_container" type="button"><i class="fa fa-plus"></i> Add
115
+ Container</button>
116
+ <button class="btn btn-success px-3 text-white mr-2" data-toggle="modal"
117
+ data-target="#modal_add_field" type="button"><i class="fa fa-plus"></i> Add
118
+ Field</button>
119
+ <button class="btn secondary-color-dark px-3 text-white mr-2" id="save"
120
+ type="button"><i class="fa fa-paper-plane"></i> Save & Generate</button>
98
121
  </div>
99
- <%}%>
122
+ <%}%>
123
+
100
124
  </form>
101
125
  <!-- Default form reply -->
102
126
  </div>
@@ -110,30 +134,32 @@
110
134
  <span> Files Content</span>
111
135
  </div>
112
136
  <div class="card-body">
113
- <h5 class="card-title">Files Generator <span class="badge badge-danger"><small>Using EJS template engine, Let it blank</small></span></h5>
137
+ <h5 class="card-title">Files Generator <span class="badge badge-danger"><small>Using EJS template
138
+ engine, Let it blank</small></span></h5>
114
139
 
115
140
  <hr>
116
141
 
117
142
  <ul class="nav nav-tabs" id="tabfiles" role="tablist">
118
143
  <li class="nav-item">
119
- <a class="nav-link active" data-toggle="tab" href="#tabrouter" role="tab" aria-controls="router"
120
- aria-selected="true">Router</a>
144
+ <a class="nav-link active" data-toggle="tab" href="#tabrouter" role="tab"
145
+ aria-controls="router" aria-selected="true">Router</a>
121
146
  </li>
122
147
  <li class="nav-item">
123
- <a class="nav-link " data-toggle="tab" href="#tabindex" role="tab" aria-controls="index"
124
- aria-selected="true">Index</a>
148
+ <a class="nav-link " data-toggle="tab" href="#tabindex" role="tab" aria-controls="index"
149
+ aria-selected="true">Index</a>
125
150
  </li>
126
151
  <li class="nav-item">
127
- <a class="nav-link" data-toggle="tab" href="#tabform" role="tab" aria-controls="form"
128
- aria-selected="false">Form</a>
152
+ <a class="nav-link" data-toggle="tab" href="#tabform" role="tab" aria-controls="form"
153
+ aria-selected="false">Form</a>
129
154
  </li>
130
155
  <li class="nav-item">
131
- <a class="nav-link" data-toggle="tab" href="#tabview" role="tab" aria-controls="view"
132
- aria-selected="false">View</a>
156
+ <a class="nav-link" data-toggle="tab" href="#tabview" role="tab" aria-controls="view"
157
+ aria-selected="false">View</a>
133
158
  </li>
134
159
  </ul>
135
160
  <div class="tab-content" id="mytabfiles">
136
- <div class="tab-pane fade show active" id="tabrouter" role="tabpanel" aria-labelledby="tab-router">
161
+ <div class="tab-pane fade show active" id="tabrouter" role="tabpanel"
162
+ aria-labelledby="tab-router">
137
163
  <br>
138
164
  <div class="row">
139
165
  <div class="col-md-9">
@@ -249,28 +275,30 @@
249
275
  <label for="approval">Approval Systems</label>
250
276
  <!-- Default checked -->
251
277
  <%- zForms.build["is_approval"] %>
252
- <div class="divzapprovals" <%- approvalDatas.is_approval ? '' : 'style="display: none"' %> >
253
- <%- zForms.build["template"] %>
254
- <div class="row">
255
- <div class="col-md-6">
256
- <div class="form-group divTitle mb-3">
257
- <label>Title</label>
258
- <input type="text" class="form-control" id="approval_title" name="approval_title" value="<%- approvalDatas.title %>">
278
+ <div class="divzapprovals" <%- approvalDatas.is_approval ? '' : 'style="display: none"'
279
+ %> >
280
+ <%- zForms.build["template"] %>
281
+ <div class="row">
282
+ <div class="col-md-6">
283
+ <div class="form-group divTitle mb-3">
284
+ <label>Title</label>
285
+ <input type="text" class="form-control" id="approval_title"
286
+ name="approval_title" value="<%- approvalDatas.title %>">
287
+ </div>
288
+ </div>
289
+ <div class="col-md-6">
290
+ <%- zForms.build["type"] %>
291
+ </div>
259
292
  </div>
260
- </div>
261
- <div class="col-md-6">
262
- <%- zForms.build["type"] %>
263
- </div>
264
- </div>
265
293
 
266
- <div class="row">
267
- <div class="col-md-12">
268
- <%- zForms.build["approvers"] %>
269
- <%- zForms.build["knowings"] %>
270
- </div>
294
+ <div class="row">
295
+ <div class="col-md-12">
296
+ <%- zForms.build["approvers"] %>
297
+ <%- zForms.build["knowings"] %>
298
+ </div>
299
+ </div>
271
300
  </div>
272
- </div>
273
- <%}%>
301
+ <%}%>
274
302
  </div>
275
303
  </div>
276
304
  </div>
@@ -292,24 +320,27 @@
292
320
  <div class="modal-content">
293
321
  <div class="modal-header">
294
322
  <h5 class="modal-title" id="exampleModalLabel">Add Table</h5>
295
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
323
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
324
+ </button>
296
325
  </div>
297
326
  <div class="modal-body">
298
327
  <form id="modal-form" method="post" action="/generator">
299
328
  <div class="form-group">
300
329
  <label for="table">Module Name</label>
301
- <input type="text" class="form-control" id="modal-table" name="table"/>
330
+ <input type="text" class="form-control" id="modal-table" name="table" />
302
331
  </div>
303
332
 
304
333
  <div class="form-group">
305
334
  <label for="route">Route</label>
306
- <input type="text" class="form-control" id="modal-route" name="route"/>
335
+ <input type="text" class="form-control" id="modal-route" name="route" />
307
336
  </div>
308
337
  </form>
309
338
  </div>
310
339
  <div class="modal-footer">
311
- <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
312
- <button type="button" id="modal-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Save</button>
340
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i>
341
+ Close</button>
342
+ <button type="button" id="modal-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i>
343
+ Save</button>
313
344
  </div>
314
345
  </div>
315
346
  </div>
@@ -320,8 +351,9 @@
320
351
  <div class="modal-dialog">
321
352
  <div class="modal-content">
322
353
  <div class="modal-header">
323
- <h5 class="modal-title" >Add Field</h5>
324
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
354
+ <h5 class="modal-title">Add Field</h5>
355
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
356
+ </button>
325
357
  </div>
326
358
  <div class="modal-body">
327
359
 
@@ -336,7 +368,8 @@
336
368
  <option value="ONE_COLUMN">One Column</option>
337
369
  </select>
338
370
  </div>
339
- <input type="text" class="form-control" id="modal_name" placeholder="Field Name" name="name"/>
371
+ <input type="text" class="form-control" id="modal_name" placeholder="Field Name"
372
+ name="name" />
340
373
  </div>
341
374
  </div>
342
375
 
@@ -345,7 +378,7 @@
345
378
  <select class="form-control" id="modal_type">
346
379
  <% for(var key in selects){%>
347
380
  <option value="<%- key%>"><%- selects[key]%></option>
348
- <%}%>
381
+ <%}%>
349
382
  </select>
350
383
  </div>
351
384
 
@@ -367,7 +400,8 @@
367
400
  <div class="col-md-12 divconcat">
368
401
  <div class="form-group ">
369
402
  <label for="route">Concat</label>
370
- <input type="text" class="form-control" id="relationconcat" placeholder='CONCAT(fullname, " (email) : ", email)' >
403
+ <input type="text" class="form-control" id="relationconcat"
404
+ placeholder='CONCAT(fullname, " (email) : ", email)'>
371
405
  </div>
372
406
  </div>
373
407
 
@@ -376,7 +410,8 @@
376
410
 
377
411
  </div>
378
412
  <div class="modal-footer">
379
- <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
413
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i>
414
+ Close</button>
380
415
  <button type="button" id="modal-add" class="btn btn-primary"><i class="fa fa-plus"></i> Add</button>
381
416
  </div>
382
417
  </div>
@@ -389,7 +424,8 @@
389
424
  <div class="modal-content">
390
425
  <div class="modal-header">
391
426
  <h5 class="modal-title" id="modal_setting_label">Setting</h5>
392
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
427
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
428
+ </button>
393
429
  </div>
394
430
  <div class="modal-body">
395
431
  <form id="modal-setting-form" method="post" action="/<%- routeName%>/save_setting">
@@ -397,9 +433,12 @@
397
433
  </form>
398
434
  </div>
399
435
  <div class="modal-footer">
400
- <button class="btn btn-danger text-white" id="delete_field" type="button"><i class="fa fa-trash"></i> Delete</button>
401
- <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
402
- <button type="button" id="modal-setting-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Save</button>
436
+ <button class="btn btn-danger text-white" id="delete_field" type="button"><i class="fa fa-trash"></i>
437
+ Delete</button>
438
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i>
439
+ Close</button>
440
+ <button type="button" id="modal-setting-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i>
441
+ Save</button>
403
442
  </div>
404
443
  </div>
405
444
  </div>
@@ -412,7 +451,8 @@
412
451
  <div class="modal-content">
413
452
  <div class="modal-header">
414
453
  <h5 class="modal-title" id="modal_setting_label">Tab</h5>
415
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
454
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
455
+ </button>
416
456
  </div>
417
457
  <div class="modal-body">
418
458
  <form>
@@ -420,8 +460,10 @@
420
460
  </form>
421
461
  </div>
422
462
  <div class="modal-footer">
423
- <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
424
- <button type="button" id="modal-tab-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Save</button>
463
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i>
464
+ Close</button>
465
+ <button type="button" id="modal-tab-save" class="btn btn-primary"><i class="fa fa-paper-plane"></i>
466
+ Save</button>
425
467
  </div>
426
468
  </div>
427
469
  </div>
@@ -432,20 +474,23 @@
432
474
  <div class="modal-content">
433
475
  <div class="modal-header">
434
476
  <h5 class="modal-title" id="exampleModalLabel">Import zfield File</h5>
435
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
477
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
478
+ </button>
436
479
  </div>
437
480
  <div class="modal-body">
438
481
  <form id="modal-form-file" method="post" action="/zgenerator/import">
439
482
  <input type="hidden" name="_csrf" value="<%= csrfToken %>">
440
483
  <div class="form-group">
441
484
  <label for="table">File</label>
442
- <input type="file" class="form-control" id="import-file" name="import-file" required/>
485
+ <input type="file" class="form-control" id="import-file" name="import-file" required />
443
486
  </div>
444
487
  </form>
445
488
  </div>
446
489
  <div class="modal-footer">
447
- <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
448
- <button type="submit" id="submit-import" class="btn btn-primary"><i class="fa fa-paper-plane"></i> Submit</button>
490
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i>
491
+ Close</button>
492
+ <button type="submit" id="submit-import" class="btn btn-primary"><i class="fa fa-paper-plane"></i>
493
+ Submit</button>
449
494
  </div>
450
495
  </div>
451
496
  </div>
@@ -457,10 +502,11 @@
457
502
  <div class="modal-content">
458
503
  <div class="modal-header">
459
504
  <h5 class="modal-title" id="exampleModalLabel">Add Container</h5>
460
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
505
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
506
+ </button>
461
507
  </div>
462
508
  <div class="modal-body">
463
- <form >
509
+ <form>
464
510
  <div class="form-group">
465
511
  <label for="route">Column</label>
466
512
  <select class="form-control form-select" id="column-count">
@@ -474,8 +520,10 @@
474
520
  </form>
475
521
  </div>
476
522
  <div class="modal-footer">
477
- <button type="button" class="btn btn-secondary btn-modal-container-close" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
478
- <button type="button" id="modal-container-save" class="btn btn-primary"><i class="fa fa-plus-circle"></i> Add</button>
523
+ <button type="button" class="btn btn-secondary btn-modal-container-close" data-dismiss="modal"><i
524
+ class="fa fa-times"></i> Close</button>
525
+ <button type="button" id="modal-container-save" class="btn btn-primary"><i
526
+ class="fa fa-plus-circle"></i> Add</button>
479
527
  </div>
480
528
  </div>
481
529
  </div>
@@ -487,43 +535,47 @@
487
535
  <div class="modal-content">
488
536
  <div class="modal-header">
489
537
  <h5 class="modal-title" id="exampleModalLabel">Join Module</h5>
490
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
538
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
539
+ </button>
491
540
  </div>
492
541
  <div class="modal-body">
493
- <form >
542
+ <form>
494
543
  <div class="form-group">
495
544
  <label for="route">Module</label>
496
545
  <select class="form-control form-select" id="select_module_joins">
497
546
  <option value="">Please Select</option>
498
- <% for(var key in rows) {
499
- var row = rows[key];
500
- var selected = row.table == table ? " selected " : "";
501
- if(row.table != 'zrole') {
502
- %>
503
- <option value="<%= row.table %>" <%= selected %> ><%= row.table %></option>
504
- <% }} %>
547
+ <% for(var key in rows) { var row=rows[key]; var selected=row.table==table ? " selected "
548
+ : "" ; if(row.table !='zrole' ) { %>
549
+ <option value="<%= row.table %>" <%=selected %> ><%= row.table %>
550
+ </option>
551
+ <% }} %>
505
552
  </select>
506
553
  </div>
507
554
  </form>
508
555
  </div>
509
556
  <div class="modal-footer">
510
- <button type="button" class="btn btn-secondary btn-modal-container-close" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
511
- <button type="button" id="modal-joins-save" class="btn btn-primary"><i class="fa fa-plus-circle"></i> Add</button>
557
+ <button type="button" class="btn btn-secondary btn-modal-container-close" data-dismiss="modal"><i
558
+ class="fa fa-times"></i> Close</button>
559
+ <button type="button" id="modal-joins-save" class="btn btn-primary"><i class="fa fa-plus-circle"></i>
560
+ Add</button>
512
561
  </div>
513
562
  </div>
514
563
  </div>
515
564
  </div>
516
565
 
517
566
  <!-- Modal insert data into container --->
518
- <div class="modal fade" id="modal_container_into" tabindex="-1" aria-labelledby="modal_container_into" aria-hidden="true">
567
+ <div class="modal fade" id="modal_container_into" tabindex="-1" aria-labelledby="modal_container_into"
568
+ aria-hidden="true">
519
569
  <div class="modal-dialog">
520
570
  <div class="modal-content">
521
571
  <div class="modal-header">
522
- <h5 class="modal-title" id="exampleModalLabel">Move <span class="badge badge-danger">fields </span> into container</h5>
523
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i> </button>
572
+ <h5 class="modal-title" id="exampleModalLabel">Move <span class="badge badge-danger">fields </span> into
573
+ container</h5>
574
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-times"></i>
575
+ </button>
524
576
  </div>
525
577
  <div class="modal-body">
526
- <form >
578
+ <form>
527
579
  <div class="form-group">
528
580
  <label for="route">Into Container</label>
529
581
  <select class="form-control form-select" id="container-select">
@@ -532,8 +584,10 @@
532
584
  </form>
533
585
  </div>
534
586
  <div class="modal-footer">
535
- <button type="button" class="btn btn-secondary btncontainer-close" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
536
- <button type="button" id="moveintocontainer" class="btn btn-primary"><i class="fa fa-plus-circle"></i> Move</button>
587
+ <button type="button" class="btn btn-secondary btncontainer-close" data-dismiss="modal"><i
588
+ class="fa fa-times"></i> Close</button>
589
+ <button type="button" id="moveintocontainer" class="btn btn-primary"><i class="fa fa-plus-circle"></i>
590
+ Move</button>
537
591
  </div>
538
592
  </div>
539
593
  </div>
@@ -128,6 +128,20 @@
128
128
  .divtabs {
129
129
  display: flex;
130
130
  }
131
+
132
+ #divjoinmodules {
133
+ border: 1px solid red;
134
+ min-height: 50px;
135
+ width: 100%;
136
+ padding: 15px;
137
+ }
138
+
139
+ .joinContainer {
140
+ border: 1px solid yellow;
141
+ min-height: 50px;
142
+ width: 100%;
143
+ padding: 15px;
144
+ }
131
145
  </style>
132
146
  </head>
133
147
  <body class="grey lighten-3">
@@ -877,6 +877,29 @@
877
877
  )
878
878
  }
879
879
  })
880
+ $("#modal-joins-save").on("click", function (e) {
881
+ let table_join = $('#select_module_joins').val();
882
+ let table = $('#table').val()
883
+ if (table == route) {
884
+ toastr.error("Your selected module is equal with current module");
885
+ return;
886
+ }
887
+ ajaxPost(
888
+ '/<%- routeName%>/joins',
889
+ {
890
+ table_join: table_join,
891
+ table: table,
892
+ },
893
+ function (dt) {
894
+ toastrForm(dt);
895
+ if (dt.status == 1) {
896
+ $("#joinlist").html(dt.html);
897
+ }
898
+ }
899
+ )
900
+ })
901
+
902
+ loadJoins();
880
903
  })
881
904
 
882
905
  function saveContainer() {
@@ -890,4 +913,35 @@
890
913
  function (dt) { }
891
914
  )
892
915
  }
916
+
917
+ function loadJoins() {
918
+ ajaxPost(
919
+ '/<%- routeName%>/load-joins',
920
+ {
921
+ table: $('#table').val(),
922
+ },
923
+ function (dt) {
924
+ if (dt.status == 1) {
925
+ $("#joinlist").html(dt.html);
926
+ }
927
+ }
928
+ )
929
+ }
930
+
931
+ function removeJoins(table_join) {
932
+ if (window.confirm('Sure to delete ?')) {
933
+ ajaxPost(
934
+ '/<%- routeName%>/remove-joins',
935
+ {
936
+ table: $('#table').val(),
937
+ table_join: table_join
938
+ },
939
+ function (dt) {
940
+ if (dt.status == 1) {
941
+ location.href = '';
942
+ }
943
+ }
944
+ )
945
+ }
946
+ }
893
947
  </script>
@@ -21,6 +21,8 @@ const nots = ['index', 'uploads', 'js', 'css', 'log', 'generator', 'zmenu', 'zge
21
21
  //const generatorUrl = 'http://localhost:3005';
22
22
  const generatorUrl = 'https://generator.cmsqu.com'
23
23
 
24
+ const bodyView = Util.readFile(require.resolve(__dirname + '/views/generator.ejs'))
25
+
24
26
  router.get('/', csrfProtection, async (req, res) => {
25
27
  let table = req.query.table || '',
26
28
  route = '',
@@ -83,7 +85,7 @@ router.get('/', csrfProtection, async (req, res) => {
83
85
  routeName: res.locals.routeName,
84
86
  }
85
87
 
86
- const bodyHTML = ejs.render(body, renderData)
88
+ const bodyHTML = ejs.render(bodyView, renderData)
87
89
  const endHTML = ejs.render(Util.readFile(require.resolve(__dirname + '/views/generatorjs.ejs')), renderData)
88
90
  let dataRender = renderData
89
91
  dataRender.bodyHTML = bodyHTML
@@ -1342,6 +1344,142 @@ const viewsMini = async () => {
1342
1344
  return notifyObj
1343
1345
  }
1344
1346
 
1345
- const body = Util.readFile(require.resolve(__dirname + '/views/generator.ejs'))
1347
+ router.post('/load-joins', async (req, res) => {
1348
+ let jsonNotif = Util.jsonSuccess('Success')
1349
+ let html = ''
1350
+ try {
1351
+ let body = req.body
1352
+ console.log(body)
1353
+ let table = body.table
1354
+ html = await loadJoins(table)
1355
+ jsonNotif.html = html
1356
+ } catch (e) {
1357
+ console.log(e)
1358
+ }
1359
+ res.json(jsonNotif)
1360
+ })
1361
+
1362
+ router.post('/remove-joins', async (req, res) => {
1363
+ let jsonNotif = Util.jsonSuccess('Success')
1364
+ let html = ''
1365
+ try {
1366
+ let body = req.body
1367
+ console.log(body)
1368
+ let table = body.table
1369
+ let table_join = body.table_join
1370
+ let result = await connection.result({
1371
+ table: 'zfields',
1372
+ where: {
1373
+ table: table,
1374
+ },
1375
+ })
1376
+ let resultJoins = result.joins || {}
1377
+ delete resultJoins[table_join]
1378
+ await connection.update({
1379
+ table: 'zfields',
1380
+ data: {
1381
+ joins: JSON.stringify(resultJoins),
1382
+ },
1383
+ where: {
1384
+ table: table,
1385
+ },
1386
+ })
1387
+ } catch (e) {
1388
+ console.log(e)
1389
+ }
1390
+ res.json(jsonNotif)
1391
+ })
1392
+
1393
+ router.post('/joins', async (req, res) => {
1394
+ let jsonNotif = Util.jsonSuccess('Success')
1395
+ let html = ''
1396
+ try {
1397
+ let body = req.body
1398
+ console.log(body)
1399
+ let table = body.table
1400
+ let table_join = body.table_join
1401
+ let result = await connection.result({
1402
+ table: 'zfields',
1403
+ where: {
1404
+ table: table,
1405
+ },
1406
+ })
1407
+ let resultJoins = result.joins || {}
1408
+ resultJoins[table_join] = {}
1409
+ await connection.update({
1410
+ table: 'zfields',
1411
+ data: {
1412
+ joins: JSON.stringify(resultJoins),
1413
+ },
1414
+ where: {
1415
+ table: table,
1416
+ },
1417
+ })
1418
+ jsonNotif.json = resultJoins
1419
+ html = await joinHTML(resultJoins)
1420
+ } catch (e) {
1421
+ console.log(e)
1422
+ jsonNotif = Util.flashError(e + '')
1423
+ }
1424
+ jsonNotif.html = html
1425
+ res.json(jsonNotif)
1426
+ })
1427
+
1428
+ async function loadJoins(table) {
1429
+ let html = ''
1430
+ try {
1431
+ let result = await connection.result({
1432
+ table: 'zfields',
1433
+ where: {
1434
+ table: table,
1435
+ },
1436
+ })
1437
+ let joinsObj = result.joins || {}
1438
+ html = await joinHTML(joinsObj)
1439
+ } catch (e) {
1440
+ console.log(e)
1441
+ html = e + ''
1442
+ }
1443
+ return html
1444
+ }
1445
+
1446
+ async function joinHTML(json) {
1447
+ let html = ``
1448
+ try {
1449
+ let zfields = await connection.results({
1450
+ table: 'zfields',
1451
+ })
1452
+ let zfieldsObj = Util.arrayToObject(zfields, 'table')
1453
+ for (let key in json) {
1454
+ html += `<div class="joinContainer col-md-4">`
1455
+ html += `<h5>${zfieldsObj[key].name} <button class="btn btn-danger" onclick="removeJoins('${key}')"><i class="fa fa-trash "></i> </button></h5>`
1456
+ html += fieldHTML(zfieldsObj[key])
1457
+ html += `</div>`
1458
+ }
1459
+ } catch (e) {
1460
+ html = e + ''
1461
+ }
1462
+ return html
1463
+ }
1464
+
1465
+ function fieldHTML(obj) {
1466
+ let html = ``
1467
+ try {
1468
+ let labels = obj.labels
1469
+ let table = obj.table
1470
+ for (let key in labels) {
1471
+ html += `<div class="input-group">
1472
+ <div class="input-group-prepend">
1473
+ <span class="input-group-text"><input type="checkbox" name=""></span>
1474
+ <span class="input-group-text">${key}</span>
1475
+ <input type="text" class="form-control" name="joins[${table}][${key}]" id="joins___${table}___${key}" value="${labels[key]}">
1476
+ </div>
1477
+ </div>`
1478
+ }
1479
+ } catch (e) {
1480
+ html = e + ''
1481
+ }
1482
+ return html
1483
+ }
1346
1484
 
1347
1485
  module.exports = router
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zet-lib",
3
- "version": "1.3.20",
3
+ "version": "1.3.22",
4
4
  "description": "zet is a library that part of zet generator.",
5
5
  "engines": {
6
6
  "node": ">=18"