zet-lib 1.5.30 → 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 (48) 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/zgenerator/bootstrap3/_form.ejs +24 -0
  12. package/lib/views/zgenerator/bootstrap3/create.ejs +9 -0
  13. package/lib/views/zgenerator/bootstrap3/createjs.ejs +3 -0
  14. package/lib/views/zgenerator/bootstrap3/import.ejs +52 -0
  15. package/lib/views/zgenerator/bootstrap3/importjs.ejs +3 -0
  16. package/lib/views/zgenerator/bootstrap3/index.ejs +29 -0
  17. package/lib/views/zgenerator/bootstrap3/indexcss.ejs +1 -0
  18. package/lib/views/zgenerator/bootstrap3/indexjs.ejs +307 -0
  19. package/lib/views/zgenerator/bootstrap3/update.ejs +8 -0
  20. package/lib/views/zgenerator/bootstrap3/updatejs.ejs +3 -0
  21. package/lib/views/zgenerator/bootstrap3/view.ejs +57 -0
  22. package/lib/views/zgenerator/head.ejs +12 -0
  23. package/lib/views/zgenerator/index.ejs +271 -0
  24. package/lib/views/zgenerator/indexcss.ejs +87 -0
  25. package/lib/views/zgenerator/indexjs.ejs +705 -0
  26. package/lib/views/zgenerator/layout.ejs +198 -0
  27. package/lib/views/zgenerator/manual_basic.ejs +2 -0
  28. package/lib/views/zgenerator/manual_dropdown.ejs +126 -0
  29. package/lib/views/zgenerator/manual_modules.ejs +192 -0
  30. package/lib/views/zgenerator/manual_virtual.ejs +143 -0
  31. package/lib/views/zgenerator/mini.ejs +341 -0
  32. package/lib/views/zgenerator/routerApp.ejs +359 -0
  33. package/lib/views/zgenerator/views/_form.ejs +25 -0
  34. package/lib/views/zgenerator/views/approval.ejs +42 -0
  35. package/lib/views/zgenerator/views/create.ejs +7 -0
  36. package/lib/views/zgenerator/views/createjs.ejs +16 -0
  37. package/lib/views/zgenerator/views/import.ejs +49 -0
  38. package/lib/views/zgenerator/views/importjs.ejs +4 -0
  39. package/lib/views/zgenerator/views/index.ejs +9 -0
  40. package/lib/views/zgenerator/views/indexcss.ejs +2 -0
  41. package/lib/views/zgenerator/views/indexjs.ejs +2 -0
  42. package/lib/views/zgenerator/views/preview.ejs +34 -0
  43. package/lib/views/zgenerator/views/update.ejs +7 -0
  44. package/lib/views/zgenerator/views/updatejs.ejs +16 -0
  45. package/lib/views/zgenerator/views/view.ejs +36 -0
  46. package/lib/zGeneratorRouter.js +46 -22
  47. package/lib/zRoute.js +14 -3
  48. package/package.json +1 -1
package/lib/lang_en.js ADDED
@@ -0,0 +1,115 @@
1
+ var langs = {}
2
+ langs['grid_no_session'] = 'You have no session! <br> Grid Can not be Saved';
3
+ langs['grid_list'] = 'List';
4
+ langs['grid_personal'] = '* Setup & Personal Grid';
5
+ langs['grid_saved'] = 'Data grid saved';
6
+ langs['grid_reset'] = 'Successfully to reset grid';
7
+ langs['grid_labels_saved'] = 'Label saved!';
8
+ langs['grid_configure'] ='Configure Order and Display of Grid Columns';
9
+ langs['grid_visible'] ='Visible Columns';
10
+ langs['grid_invisible'] ='Hidden / Fixed Columns';
11
+ langs['grid_export_data'] = 'Export Page Data';
12
+ langs['grid_labeling'] = 'Labeling';
13
+ langs['grid_configure_field_labeling'] = 'Configure Field Labeling';
14
+ langs['grid_personalize_labeling'] = 'Personalize Labeling';
15
+ langs['grid_personalize_setting'] = 'Personalize grid settings';
16
+ langs['grid_refresh'] = 'Refresh grid filter';
17
+ langs.settings = 'Setting';
18
+ langs.settings_info = 'Settings';
19
+ langs.grid_settings = 'Settings Grid';
20
+ langs['grid_fields'] = 'Fields';
21
+ langs['grid_default'] = 'Default';
22
+ langs['grid_custom'] = 'Custom';
23
+ langs['grid_abort'] = 'Abort any changes and reset settings';
24
+ langs['grid_save'] = 'Save grid settings';
25
+
26
+ langs['data_saved'] = 'Data saved...';
27
+ langs['data_delete'] = 'Success, Data deleted';
28
+ langs['data_not_found'] = 'Data not found!';
29
+ langs['data_add'] = 'Add Data';
30
+ langs['download_excel'] = 'Download Excel';
31
+ langs['data_import'] = 'Import Data';
32
+
33
+ langs['form_import'] = 'Parsing / Import Form';
34
+ langs['form_import_title'] = 'Import / Upload Data using excel file';
35
+ langs['form_label_excel_file'] = 'Your Excel File *.xlsx';
36
+ langs['form_create'] = 'Form Create';
37
+ langs['form_update'] = 'Form Update';
38
+ langs['form_add_data'] = 'Add Data';
39
+ langs['form_add_data_select'] = 'Please select data';
40
+ langs['form_not_empty'] = 'Tidak boleh kosong';
41
+
42
+
43
+ langs['import_success'] = 'Import successfully, Please check your data with results!';
44
+ langs['import_no_file'] = 'No excel file is upload!';
45
+ langs['import_process'] = 'File being processed';
46
+ langs['import_results'] = 'Import Results';
47
+ langs['import_example'] = 'Example Format File';
48
+ langs.import = 'Import';
49
+ langs.import_info = 'Import data using excel file'
50
+
51
+ langs['noted'] = 'Noted';
52
+ langs['success'] = 'Success';
53
+ langs['failed'] = 'Failed!';
54
+ langs['reset'] = 'Reset';
55
+ langs['apply'] = 'Apply';
56
+ langs['submit'] = 'Submit';
57
+ langs['home'] = 'Home';
58
+ langs['create'] = 'Create';
59
+ langs.create_info = 'add a new data';
60
+ langs['update'] = 'Update';
61
+ langs['delete'] = 'Delete';
62
+ langs['view'] = 'View';
63
+ langs['upload'] = 'Upload';
64
+ langs['approval'] = 'Approval';
65
+ langs['approve'] = 'Approve';
66
+ langs['logout'] = 'Logout';
67
+ langs.download = 'Download';
68
+ langs.all = 'all';
69
+ langs.profile = 'Profile';
70
+ langs.help_center = 'Help Center';
71
+ langs.switch_company = 'Switch Company';
72
+ langs.notifications = 'Notifications';
73
+ langs.messages = 'Messages';
74
+ langs.upload_verify = 'Upload Verify Sign Approval'
75
+ langs.upload_cropping = 'Clik here to upload a image to start cropping';
76
+ langs.change_password = 'Change Your Password';
77
+ langs.password_equal = 'New Password & Password Repeat must equal';
78
+ langs.verify_info = '* Approval system purpose only';
79
+ langs.forget_password = 'Forget Password ?';
80
+ langs.password_wrong = 'Username or Password wrong';
81
+ langs.login_first = 'Your session is disconnected. Please re-login !!';
82
+ langs.no_access = 'You have no access this page. Setup in role menu';
83
+ langs.change_password_success = 'successfully change your password';
84
+ langs.link_expired = 'Your link has expired!!!';
85
+ langs.password_combine = 'password combine char and number, min 6 chars';
86
+ langs.user_access = "User Access";
87
+
88
+ langs['required_not_empty'] ='Required & can not empty ';
89
+ langs['delete_confirm'] = 'Do you really want to delete selected ?';
90
+
91
+ langs['module_program'] = 'Program';
92
+ langs['menu_home'] = 'Home';
93
+ langs['menu_language'] = 'Language';
94
+ langs['submenu_english'] = 'English';
95
+ langs['submenu_indonesian'] = 'Indonesian';
96
+ langs['submenu_japan'] = 'japan';
97
+ langs['submenu_france'] = 'France';
98
+
99
+ langs['menu_logout'] = 'Logout';
100
+
101
+ langs['module_master'] = 'Master';
102
+ langs['menu_organisation'] = 'Organisation';
103
+ langs['submenu_company'] = 'Company';
104
+ langs['submenu_branch'] = 'Branch';
105
+ langs['submenu_management'] = 'Management';
106
+ langs['submenu_division'] = 'Division';
107
+ langs['submenu_department'] = 'Department';
108
+ langs['submenu_section'] = 'Section';
109
+ langs['submenu_subsection'] = 'Subsection';
110
+ langs['submenu_position'] = 'Position';
111
+ langs['submenu_functional'] = 'Functional';
112
+ langs['submenu_grade'] = 'Grade';
113
+ langs['submenu_cost_center'] = 'Cost Center';
114
+
115
+ module.exports = langs;
@@ -0,0 +1,52 @@
1
+ const express = require('express');
2
+ const router = express.Router();
3
+ const Api = require('../generatorApi');
4
+ const Model = require('../Model');
5
+
6
+ //Home of Generator index
7
+ router.post('/generator/index', (req,res) => {
8
+ let json = {};
9
+ try {
10
+ let datas = {table: '', tabs: [], labels: {}, details: {}, hardcode_grid: ""};
11
+ let table = req.body.table || "", route = "";
12
+ json = {
13
+ datas: datas,
14
+ table: table,
15
+ route: table,
16
+ selects: Model.keys,
17
+ }
18
+
19
+ } catch (e) {
20
+ console.log(e.toString());
21
+ res.status(400).json({message: e.toString()})
22
+ }
23
+
24
+ res.json(json)
25
+ });
26
+ router.post('/generator/modal', async(req,res) => {
27
+ let body = req.body;
28
+ let result = body.result;
29
+ let others = result.others || {};
30
+ let othersArr = Object.keys(others) || [];
31
+ let json = {}
32
+ if(othersArr.length) {
33
+ console.log('masuk ke container')
34
+ json = await Api.modalWithContainer(req,res);
35
+ } else {
36
+ json = await Api.modalClassic(req,res);
37
+ }
38
+ //console.log(JSON.stringify(json))
39
+ res.json(json)
40
+ });
41
+ router.post('/generator/create', (req,res) => {
42
+ res.json(Api.createTable(req.body))
43
+ });
44
+ router.post('/generator/create_field', Api.create_field);
45
+ router.post('/generator/modal_settings', Api.modal_settings);
46
+
47
+ //generate
48
+ router.post('/generator/properties', Api.properties);
49
+ router.post('/generator/generate', Api.generate);
50
+ router.post('/generator/reset', Api.reset);
51
+
52
+ module.exports = router;
@@ -0,0 +1,9 @@
1
+ var express = require('express');
2
+ var router = express.Router();
3
+
4
+ /* GET home page. */
5
+ router.get('/', function(req, res, next) {
6
+ res.render('index', { title: 'Express' });
7
+ });
8
+
9
+ module.exports = router;
@@ -0,0 +1,3 @@
1
+ <h1><%= message %></h1>
2
+ <h2><%= error.status %></h2>
3
+ <pre><%= error.stack %></pre>
@@ -0,0 +1,24 @@
1
+ <form id="form-group" method="post" action="" class="boxy" enctype="multipart/form-data" NO_VALI_DATE_NOVALIDATE >
2
+ <input type="hidden" name="_csrf" value="<%= csrfToken %>">
3
+
4
+ <div class="page-header">
5
+ <h3><%- titleHeader %></h3>
6
+ </div>
7
+
8
+ /*[__GENERATE_FORM__]*/
9
+
10
+ <div class="row">
11
+ <div class="col-md-12">
12
+ <br>
13
+ <%- UI.Form.submit() %>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="row">
18
+ <div class="col-md-12">
19
+ <br>
20
+ <p class="text-muted"><strong>*</strong> <%- LANGUAGE['required_not_empty'] %></p>
21
+ </div>
22
+ </div>
23
+
24
+ </form>
@@ -0,0 +1,9 @@
1
+ <%- UI.Form.breadcrumb(frameworkcss, [{text: LANGUAGE['home'], href:"/dashboard"}, {text: LANGUAGE['grid_list'], href:"/"+routeName}, {text: LANGUAGE['create'], active: true}]) %>
2
+
3
+
4
+ <div class="page-header">
5
+ <h2><%- titleApp %></h2>
6
+ <small><%- companyName %></small>
7
+ </div>
8
+
9
+ <% include _form.ejs %>
@@ -0,0 +1,3 @@
1
+ <script>
2
+ submitForm('form-group', '','/<%- routeName%>');
3
+ </script>
@@ -0,0 +1,52 @@
1
+ <%- UI.Form.breadcrumb(frameworkcss, [{text: LANGUAGE['home'], href:"/dashboard"}, {text: LANGUAGE['grid_list'], href:"/"+routeName}, {text: LANGUAGE['form_import'], active: true}]) %>
2
+
3
+ <div class="page-header">
4
+ <h3><%- LANGUAGE['form_import_title']%></h3>
5
+ <small><%- companyName %></small>
6
+ </div>
7
+
8
+
9
+ <p>&nbsp;</p>
10
+ <form id="form-import" method="post" enctype="multipart/form-data" class="boxy">
11
+
12
+ <div class="row">
13
+ <div class="col-md-10">
14
+ <p>&nbsp;</p>
15
+
16
+ <div class="form-group">
17
+ <label class="control-label col-md-2" for="file"><%- LANGUAGE['form_label_excel_file']%></label>
18
+ <div class="col-md-10">
19
+ <input type="file" id="file" name="excel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" class="form-control">
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="row">
26
+ <div class="col-md-10 col-md-offset-1">
27
+ <button type="submit" class="btn btn-success"><%- LANGUAGE['upload']%></button>
28
+ <p>&nbsp;</p>
29
+ <p>&nbsp;</p></div>
30
+ </div>
31
+
32
+
33
+ <div class="container">
34
+ <h3><%- LANGUAGE['import_results']%>:</h3>
35
+ <div class="results"></div>
36
+ <div class="row">
37
+ <div class="col-md-12">
38
+ <div class="table-responsive">
39
+ <table class="table table-sm table-striped" id="resultsforimport">
40
+
41
+ </table>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+ </form>
48
+
49
+ <hr>
50
+ <div class="row">
51
+ <div class="col-md-10"> <%- LANGUAGE['import_example']%> : <a id="sample-parsing" href="/<%- routeName%>/sample">sample.xlsx</a></div>
52
+ </div>
@@ -0,0 +1,3 @@
1
+ <script>
2
+ submitForm('form-import', 'excel');
3
+ </script>
@@ -0,0 +1,29 @@
1
+ <div class="">
2
+ <%- UI.Form.breadcrumb(frameworkcss, [{text: LANGUAGE['home'], href: "/dashboard"}, {
3
+ text: LANGUAGE['grid_list'],
4
+ active: true
5
+ }]) %>
6
+
7
+ <div class="page-header">
8
+ <h2><%- titleApp %></h2>
9
+ <small><%- companyName %></small>
10
+ </div>
11
+
12
+ <%- UI.Form.grid(frameworkcss, {
13
+ routeName: routeName,
14
+ levels: levels,
15
+ header: menuApp + ' ' + LANGUAGE['grid_list'],
16
+ gridFilters: gridFilters,
17
+ LANGUAGE: LANGUAGE,
18
+ paginationApp: paginationApp,
19
+ advanceSearch : advanceSearch
20
+ }) %>
21
+ </div>
22
+
23
+
24
+ <%- UI.Modal.grid(frameworkcss, {
25
+ attributeData: attributeData,
26
+ visibles: visibles,
27
+ invisibles: invisibles,
28
+ routeName: routeName
29
+ }, LANGUAGE) %>
@@ -0,0 +1 @@
1
+ <link rel="stylesheet" href="/css/kv-html5-sortable.min.css" >
@@ -0,0 +1,307 @@
1
+ <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.23.0/moment.min.js"></script>
2
+ <script src="/js/jquery-sortable.js"></script>
3
+ <script>
4
+ window.onerror = function (message, file, line, col, error) {
5
+ toastr.error(error.message, "Error occurred");
6
+ setTimeout(function () {
7
+ toastr.info("Please wait a moment while we repair.\n Please Relax", "Info");
8
+ ajaxDelete("/<%- routeName %>/grid",{},function (data) {
9
+ toastr.info("Please refresh / reload your browser.\n ", "Info");
10
+ });
11
+ }, 2500);
12
+ setTimeout(function () {
13
+ toastr.clear();
14
+ window.location.href = '/<%- routeName %>';
15
+ }, 4500);
16
+ return false;
17
+ };
18
+ $(function () {
19
+ $(".jsgrid-filter-row td").each(function () {
20
+ $(this).find("input[type=text]").addClass("form-search form-control form-control-sm").attr("placeholder", "search..");
21
+ $(this).find("input[type=number]").addClass("form-search form-control form-control-sm").attr("placeholder", "search..");
22
+ $(this).find("select").addClass("form-search form-control form-control-sm form-select");
23
+ })
24
+ });
25
+ var gridSettings = <%- JSON.stringify(gridFilters) %>;
26
+ var isSave = false;
27
+ var gridFields = {
28
+ no: {name: "no", title: '<%- attributeData.labels['no'] %>', width: 20},
29
+ /*[__GENERATE_INDEXJS__]*/
30
+ actionColumn: {
31
+ type: "control", name: "actionColumn", width: 90, editButton: false,
32
+ itemTemplate: function (value, item) {
33
+ var $result = jsGrid.fields.control.prototype.itemTemplate.apply(this, arguments);
34
+ var $customViewButton = $("<button>").attr({class: "btn btn-info btn-sm"}).html("<span class='fa fa-eye'></span>").click(function (e) {
35
+ location.href = "/<%- routeName %>/view/" + item.id;
36
+ e.stopPropagation();
37
+ });
38
+ var $customEditButton = $("<button>").attr({class: "btn btn-success btn-sm"}).html("<span class='fa fa-pencil'></span>").click(function (e) {
39
+ location.href = "/<%- routeName %>/update/" + item.id;
40
+ e.stopPropagation();
41
+ });
42
+ var $customDeleteButton = $("<button>").attr({class: "btn btn-danger btn-sm"}).html("<span class='fa fa-trash'></span>").click(function (e) {
43
+ if (window.confirm("<%- LANGUAGE['delete_confirm']%>")) {
44
+ ajaxDelete("/<%- routeName %>/delete",{id: item.id}, function (data) {
45
+ if (data.status == 0) {
46
+ toastr.error(data.message, data.title);
47
+ } else {
48
+ $("#jsGrid").jsGrid("loadData");
49
+ toastr.success(data.message, data.title);
50
+ }
51
+ });
52
+ }
53
+ e.stopPropagation();
54
+ });
55
+ var div = $("<div>");
56
+
57
+ <% if(levels.view){ %>div.append($customViewButton).append(" ");<% } %>
58
+ <% if(levels.update){ %>div.append($customEditButton).append(" ");<% } %>
59
+ <% if(levels.delete) { %>div.append($customDeleteButton).append(" ");<% } %>
60
+ return div;
61
+ }
62
+ }
63
+ };
64
+ function fixGrid() {
65
+ var arr = [];
66
+ var visibles = <%- JSON.stringify(visibles) %>;
67
+ for (var i = 0; i < visibles.length; i++) {
68
+ if(gridFields.hasOwnProperty(visibles[i])){
69
+ arr.push(gridFields[visibles[i]]);
70
+ }
71
+ }
72
+ return arr;
73
+ }
74
+ function saveGrid(filter,url){
75
+ $.ajax({
76
+ url:url,
77
+ type:"POST",
78
+ data:filter
79
+ })
80
+ }
81
+ var jsFilter = "";
82
+ $("#jsGrid").jsGrid({
83
+ width: "100%",
84
+ filtering: true,
85
+ inserting: false,
86
+ editing: false,
87
+ sorting: true,
88
+ autoload: true,
89
+ paging: true,
90
+ pageLoading: true,
91
+ css: "kv-grid-table table table-bordered table-striped kv-table-wrap",
92
+ pageIndex : parseInt(gridSettings.pageIndex) || 1,
93
+ pageSize: $("#pageSize").val(),
94
+ pageButtonCount: 15,
95
+ deleteConfirm: "<%- LANGUAGE['delete_confirm']%>",
96
+ controller: {
97
+ loadData: function (filter) {
98
+ var d = $.Deferred();
99
+ if(!isSave){
100
+ if(gridSettings.hasOwnProperty("pageIndex")){
101
+ filter = gridSettings;
102
+ }
103
+ }
104
+ return $.ajax({
105
+ datatype: "json",
106
+ type: "GET",
107
+ url: "/<%- routeName %>/list",
108
+ data: filter,
109
+ success: function (html) {
110
+ var pi = filter.pageIndex;
111
+ var ps = filter.pageSize;
112
+ var showing = "Showing <b>";
113
+ var pis = (pi * ps);
114
+ var i = ((pi - 1) * ps) + 1;
115
+ if (pis > html.itemsCount) pis = html.itemsCount;
116
+ showing += i + " - " + pis;
117
+ showing += "</b> of " + html.itemsCount;
118
+ $(".summary").html(showing);
119
+ $(".jsgrid-pager-container").addClass("paginaton");
120
+ jsFilter = filter;
121
+ if(isSave){
122
+ saveGrid(filter,"/<%- routeName %>/save");
123
+ }
124
+ }
125
+ }).done(function (result) {
126
+ d.resolve($.map(result.data, function (item, itemIndex) {
127
+ var factor = filter.pageSize * (filter.pageIndex - 1);
128
+ return $.extend(item, {"no": (itemIndex + 1) + factor});
129
+ }));
130
+ });
131
+ },
132
+ updateItem: function(item) {
133
+ item.table = "<%- routeName %>";
134
+ item.model = "updateGrid";
135
+ return ajaxPost("/ajax",item,function (data) {
136
+ $("#jsGrid").jsGrid("loadData");
137
+ });
138
+ }
139
+ },
140
+ fields: fixGrid(),
141
+ });
142
+ $("#create_btn").on("click", function () {
143
+ location.href = "/<%- routeName %>/create";
144
+ });
145
+ $("#importExcel").on("click", function () {
146
+ location.href = "/<%- routeName %>/import";
147
+ });
148
+ $("#super_btn").on("click", function () {
149
+ location.href = "/create_fields/<%- routeName %>";
150
+ });
151
+ $(".export-xls").on("click", function () {
152
+ location.href = "/<%- routeName %>/excel?" + jQuery.param(jsFilter);
153
+ });
154
+ $("#backupExcel").on("click", function () {
155
+ location.href = "/<%- routeName %>/excel-query?" + jQuery.param(jsFilter);
156
+ });
157
+ $("#pageSize").on("change", function () {
158
+ $("#jsGrid").jsGrid("option", "pageSize", $(this).val());
159
+ // sorting grid by myField in ascending order
160
+ if(jsFilter.hasOwnProperty("sortField")){
161
+ $("#jsGrid").jsGrid("sort", jsFilter.sortField, jsFilter.sortOrder).done(function() {
162
+ console.log("sorting completed");
163
+ });
164
+ }
165
+ });
166
+
167
+ $(".pageSizeGrid").on("click", function () {
168
+ $("#jsGrid").jsGrid("option", "pageSize", $(this).data("value"));
169
+ $(".pageSizeGrid").removeClass("active");
170
+ $(this).addClass("active");
171
+ $("#dropdownPagination").html("Pagination "+ $(this).data("value"));
172
+ // sorting grid by myField in ascending order
173
+ if(jsFilter.hasOwnProperty("sortField")){
174
+ $("#jsGrid").jsGrid("sort", jsFilter.sortField, jsFilter.sortOrder).done(function() {
175
+ console.log("sorting completed");
176
+ });
177
+ }
178
+ });
179
+
180
+ var group = $("ul.gridsortable").sortable({
181
+ group: 'gridsortable',
182
+ isValidTarget: function ($item, container) {
183
+ if ($item.is(".disabled"))
184
+ return false;
185
+ else
186
+ return true;
187
+ },
188
+ onDrop: function ($item, container, _super) {
189
+ var getidname = $item.parents().attr('id');
190
+ if (getidname == "gridleft") {
191
+ $item.find('span').addClass('fa-eye').removeClass('fa-eye-slash')
192
+ } else {
193
+ $item.find('span').addClass('fa-eye-slash').removeClass('fa-eye')
194
+ }
195
+ _super($item, container);
196
+ }
197
+ });
198
+ $(".grid-submit").on("click", function () {
199
+ var leftvalue = [];
200
+ $("#gridleft li").each(function (i) {
201
+
202
+ var dataname = $(this).attr('data-name');
203
+ if (dataname != '') {
204
+ leftvalue.push(dataname);
205
+ }
206
+ });
207
+ $('#serialize_left').val(JSON.stringify(leftvalue));
208
+
209
+ var rightvalue = [];
210
+
211
+ $("#gridright li").each(function (i) {
212
+ var dataname = $(this).attr('data-name');
213
+ if (dataname != '') {
214
+ rightvalue.push(dataname);
215
+ }
216
+ });
217
+ $('#serialize_right').val(JSON.stringify(rightvalue));
218
+ $("#form-grid").submit();
219
+ });
220
+ $(".grid-reset").on("click", function(){
221
+ ajaxDelete("/<%- routeName %>/grid",{},function (data) {
222
+ if (data.status == 0) {
223
+ toastr.error(data.message, data.title);
224
+ } else {
225
+ $("#jsGrid").jsGrid("loadData");
226
+ toastr.success(data.message, data.title);
227
+ }
228
+ location.href = '';
229
+ });
230
+ });
231
+ $(".label-reset").on("click", function(){
232
+ ajaxDelete("/<%- routeName %>/labels",{},function (data) {
233
+ if (data.status == 0) {
234
+ toastr.error(data.message, data.title);
235
+ } else {
236
+ $("#jsGrid").jsGrid("loadData");
237
+ toastr.success(data.message, data.title);
238
+ }
239
+ location.href = '';
240
+ });
241
+ });
242
+ $(".labels-submit").on("click", function () {
243
+ $("#form-labels").submit();
244
+ });
245
+ $("#reloadgrid").on("click", function (e) {
246
+ e.preventDefault();
247
+ ajaxPost("/<%- routeName%>/reload",{}, function (data) {
248
+ location.href="/<%- routeName%>";
249
+ });
250
+ });
251
+
252
+ submitForm('form-grid', '', '/<%- routeName %>');
253
+ submitForm('form-labels', '', '/<%- routeName %>');
254
+ $(function () {
255
+ if(gridSettings.hasOwnProperty("pageSize")){
256
+ $("#pageSize").val(gridSettings.pageSize)
257
+ }
258
+
259
+ var gridSearchs = <%- JSON.stringify(gridSearchs)%>;
260
+ var searchValue = $("table.jsgrid-table > tr").eq(1).find("td");
261
+ <%- gridSearchs%>
262
+
263
+ isSave = true;
264
+ $(".form-search").on("change", function () {
265
+ setTimeout(function () {
266
+ for(var key in jsFilter) {
267
+ $("#"+key).val(jsFilter[key]);
268
+ }
269
+ },2000);
270
+ });
271
+
272
+ $(".form-advancesearch").on("change","input", function () {
273
+ advanceSearch();
274
+ });
275
+
276
+ $(".form-advancesearch").on("change","select", function () {
277
+ advanceSearch();
278
+ });
279
+ });
280
+
281
+ function advanceSearch() {
282
+ var arr = $(".form-advancesearch").serializeArray();
283
+ var o = {}
284
+ if(arr.length) {
285
+ $.each(arr, function() {
286
+ if (o[this.name]) {
287
+ if (!o[this.name].push) {
288
+ o[this.name] = [o[this.name]];
289
+ }
290
+ o[this.name].push(this.value || '');
291
+ } else {
292
+ o[this.name] = this.value || '';
293
+ }
294
+ });
295
+ }
296
+ var obj = {}
297
+ if(jsFilter.hasOwnProperty("no")) obj.no = jsFilter.no;
298
+ if(jsFilter.hasOwnProperty("pageIndex")) obj.pageIndex = jsFilter.pageIndex;
299
+ if(jsFilter.hasOwnProperty("pageSize")) obj.pageSize = jsFilter.pageSize;
300
+
301
+ jsFilter = Object.assign(obj,o);
302
+ console.log(JSON.stringify(jsFilter));
303
+ $("#jsGrid").jsGrid("search", jsFilter).done(function() {
304
+ console.log("filtering completed");
305
+ });
306
+ }
307
+ </script>
@@ -0,0 +1,8 @@
1
+ <%- UI.Form.breadcrumb(frameworkcss, [{text: LANGUAGE['home'], href:"/dashboard"}, {text: LANGUAGE['grid_list'], href:"/"+routeName}, {text: LANGUAGE['update'], active: true}]) %>
2
+
3
+ <div class="page-header">
4
+ <h2><%- titleApp %></h2>
5
+ <small><%- companyName %></small>
6
+ </div>
7
+
8
+ <% include _form.ejs %>
@@ -0,0 +1,3 @@
1
+ <script>
2
+ submitForm('form-group', '', '/<%- routeName %>');
3
+ </script>