SHOW:
|
|
- or go back to the newest paste.
1 | <title>P-Dos # List Of Wells</title> | |
2 | <link rel="stylesheet" href="<?= base_url() ?>components/_mod/jquery-ui/jquery-ui.css" /> | |
3 | <link rel="stylesheet" href="<?= base_url() ?>components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css" /> | |
4 | <link rel="stylesheet" href="<?= base_url() ?>components/_mod/jqgrid/ui.jqgrid.css" /> | |
5 | ||
6 | <!-- ajax layout which only needs content area --> | |
7 | <div class="row"> | |
8 | <div class="col-xs-12"> | |
9 | <!-- PAGE CONTENT BEGINS --> | |
10 | <table id="grid-table"></table> | |
11 | <div id="grid-pager"></div> | |
12 | <!-- PAGE CONTENT ENDS --> | |
13 | </div><!-- /.col --> | |
14 | </div><!-- /.row --> | |
15 | ||
16 | <!-- page specific plugin scripts --> | |
17 | <script type="text/javascript"> | |
18 | - | var JS_SITE_URL = "<?= site_url() ?>"; |
18 | + | var JS_SITE_URL = "<?= site_url() ?>"; |
19 | - | var JS_BASE_URL = "<?= base_url() ?>"; |
19 | + | var JS_BASE_URL = "<?= base_url() ?>"; |
20 | ||
21 | - | var company_id = "<?= $company_id ?>"; |
21 | + | var company_id = "<?= $company_id ?>"; |
22 | - | var region_id = "<?= $region_id ?>"; |
22 | + | var region_id = "<?= $region_id ?>"; |
23 | - | var company_name = "<?= $com->company_name ?>"; |
23 | + | var company_name = "<?= $com->company_name ?>"; |
24 | - | var region_name = "<?= $reg->region_name ?>"; |
24 | + | var region_name = "<?= $reg->region_name ?>"; |
25 | ||
26 | - | var scripts = [null, |
26 | + | var scripts = [null, |
27 | - | JS_BASE_URL + "components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js", |
27 | + | JS_BASE_URL + "components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js", |
28 | - | JS_BASE_URL + "components/jqGrid/js/jquery.jqGrid.js", |
28 | + | JS_BASE_URL + "components/jqGrid/js/jquery.jqGrid.js", |
29 | - | JS_BASE_URL + "components/jqGrid/js/i18n/grid.locale-en.js", null]; |
29 | + | JS_BASE_URL + "components/jqGrid/js/i18n/grid.locale-en.js", null]; |
30 | ||
31 | - | $('.page-content-area').ace_ajax('loadScripts', scripts, function () { |
31 | + | $('.page-content-area').ace_ajax('loadScripts', scripts, function () { |
32 | - | //inline scripts related to this page |
32 | + | //inline scripts related to this page |
33 | - | jQuery(function ($) { |
33 | + | jQuery(function ($) { |
34 | - | var grid_selector = "#grid-table"; |
34 | + | var grid_selector = "#grid-table"; |
35 | - | var pager_selector = "#grid-pager"; |
35 | + | var pager_selector = "#grid-pager"; |
36 | ||
37 | - | //resize to fit page size |
37 | + | //resize to fit page size |
38 | - | $(window).on('resize.jqGrid', function () { |
38 | + | $(window).on('resize.jqGrid', function () { |
39 | - | $(grid_selector).jqGrid('setGridWidth', $(".page-content").width()); |
39 | + | $(grid_selector).jqGrid('setGridWidth', $(".page-content").width()); |
40 | - | }) |
40 | + | }) |
41 | ||
42 | - | //resize on sidebar collapse/expand |
42 | + | //resize on sidebar collapse/expand |
43 | - | var parent_column = $(grid_selector).closest('[class*="col-"]'); |
43 | + | var parent_column = $(grid_selector).closest('[class*="col-"]'); |
44 | - | $(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) { |
44 | + | $(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) { |
45 | - | if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') { |
45 | + | if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') { |
46 | - | //setTimeout is for webkit only to give time for DOM changes and then redraw!!! |
46 | + | //setTimeout is for webkit only to give time for DOM changes and then redraw!!! |
47 | - | setTimeout(function () { |
47 | + | setTimeout(function () { |
48 | - | $(grid_selector).jqGrid('setGridWidth', parent_column.width()); |
48 | + | $(grid_selector).jqGrid('setGridWidth', parent_column.width()); |
49 | - | }, 0); |
49 | + | }, 0); |
50 | - | } |
50 | + | } |
51 | - | }) |
51 | + | }) |
52 | ||
53 | - | var selr = jQuery(grid_selector).jqGrid('getGridParam', 'selrow'); |
53 | + | var selr = jQuery(grid_selector).jqGrid('getGridParam', 'selrow'); |
54 | - | jQuery(grid_selector).setGridParam({datatype: 'json', page: 1}).trigger("reloadGrid"); |
54 | + | jQuery(grid_selector).setGridParam({ |
55 | - | jQuery(grid_selector).jqGrid({ |
55 | + | datatype : 'json', |
56 | - | datatype: "json", |
56 | + | page : 1 |
57 | - | url: JS_SITE_URL + "/well/getListWells", |
57 | + | }).trigger("reloadGrid"); |
58 | - | mtype: "POST", |
58 | + | jQuery(grid_selector).jqGrid({ |
59 | - | height: "100%", |
59 | + | datatype : "json", |
60 | - | colNames: ['', 'Wells Id', 'Wells Name', 'Drilling Rig', 'Drilling Contractor', 'Spud Date', 'TD Date', 'TD Depth'], |
60 | + | url : JS_SITE_URL + "/well/getListWells", |
61 | - | colModel: [ |
61 | + | height : "100%", |
62 | - | {name: '', index: '', width: 100, fixed: true, sortable: false, resize: false, |
62 | + | colNames : ['', 'Wells Id', 'Wells Name', 'Drilling Rig', 'Drilling Contractor', 'Spud Date', 'TD Date', 'TD Depth'], |
63 | - | formatter: 'actions', |
63 | + | colModel :[ |
64 | - | formatoptions: { |
64 | + | {name:'act',index:'act', width:100,sortable:false}, |
65 | - | keys: true, |
65 | + | { |
66 | - | deldata: { |
66 | + | name : 'wells_id', |
67 | - | id: $(selr + 'wells_id').val() |
67 | + | index : 'wells_id', |
68 | - | }, |
68 | + | width : 150 |
69 | - | delOptions: { |
69 | + | }, |
70 | - | recreateForm: true, |
70 | + | {name:'wells_name',index:'wells_name', width:300, editable:true}, |
71 | - | beforeShowForm: beforeDeleteCallback, |
71 | + | { |
72 | - | }, |
72 | + | name : 'drilling_rig', |
73 | - | adwbutton: false |
73 | + | index : 'drilling_rig', |
74 | - | }, |
74 | + | editable : true, |
75 | - | search: false |
75 | + | align : 'left', |
76 | - | }, |
76 | + | width : 300 |
77 | - | {name: 'wells_id', index: 'wells_id', editable: false, align: 'center', width: 150, |
77 | + | }, { |
78 | - | searchoptions: { |
78 | + | name : 'drilling_contractor', |
79 | - | clearSearch: false |
79 | + | index : 'drilling_contractor', |
80 | - | } |
80 | + | editable : true, |
81 | - | }, |
81 | + | align : 'left', |
82 | - | {name: 'wells_name', index: 'wells_name', editable: true, align: 'left', width: 300, |
82 | + | width : 300, |
83 | - | searchoptions: { |
83 | + | editoptions : {} |
84 | - | clearSearch: false |
84 | + | }, { |
85 | - | } |
85 | + | name : 'spud_date', |
86 | - | }, |
86 | + | index : 'spud_date', |
87 | - | {name: 'drilling_rig', index: 'drilling_rig', editable: true, align: 'left', width: 300, |
87 | + | editable : true, |
88 | - | searchoptions: { |
88 | + | align : 'center', |
89 | - | clearSearch: false |
89 | + | width : 150, |
90 | - | } |
90 | + | editoptions : {}, |
91 | - | }, |
91 | + | sorttype : "date", |
92 | - | {name: 'drilling_contractor', index: 'drilling_contractor', editable: true, align: 'left', width: 300, |
92 | + | unformat : pickDate, |
93 | - | editoptions: { |
93 | + | formatter : 'date', |
94 | - | }, |
94 | + | formatoptions : { |
95 | - | searchoptions: { |
95 | + | srcformat : 'ISO8601Long', |
96 | - | clearSearch: false |
96 | + | newformat : 'd-m-Y H:i', |
97 | - | } |
97 | + | defaultValue : null |
98 | - | }, |
98 | + | } |
99 | - | {name: 'spud_date', index: 'spud_date', editable: true, align: 'center', width: 150, |
99 | + | }, { |
100 | - | editoptions: { |
100 | + | name : 'td_date', |
101 | - | }, |
101 | + | index : 'td_date', |
102 | - | searchoptions: { |
102 | + | editable : true, |
103 | - | clearSearch: false |
103 | + | align : 'center', |
104 | - | }, |
104 | + | width : 150, |
105 | - | sorttype: "date", unformat: pickDate, |
105 | + | editoptions : {}, |
106 | - | formatter: 'date', |
106 | + | sorttype : "date", |
107 | - | formatoptions: { |
107 | + | unformat : pickDate, |
108 | - | srcformat: 'ISO8601Long', |
108 | + | formatter : 'date', |
109 | - | newformat: 'd-m-Y H:i', |
109 | + | formatoptions : { |
110 | - | defaultValue: null |
110 | + | srcformat : 'ISO8601Long', |
111 | - | } |
111 | + | newformat : 'd-m-Y H:i', |
112 | - | }, |
112 | + | defaultValue : null |
113 | - | {name: 'td_date', index: 'td_date', editable: true, align: 'center', width: 150, |
113 | + | } |
114 | - | editoptions: { |
114 | + | }, { |
115 | - | }, |
115 | + | name : 'td_depth', |
116 | - | searchoptions: { |
116 | + | index : 'td_depth', |
117 | - | clearSearch: false |
117 | + | editable : true, |
118 | - | }, |
118 | + | align : 'center', |
119 | - | sorttype: "date", unformat: pickDate, |
119 | + | width : 150, |
120 | - | formatter: 'date', |
120 | + | editoptions : {}, |
121 | - | formatoptions: { |
121 | + | } |
122 | - | srcformat: 'ISO8601Long', |
122 | + | ], |
123 | - | newformat: 'd-m-Y H:i', |
123 | + | gridComplete: function(){ |
124 | - | defaultValue: null |
124 | + | var ids = jQuery(grid_selector).jqGrid('getDataIDs'); |
125 | - | } |
125 | + | for(var i=0;i < ids.length;i++){ |
126 | - | }, |
126 | + | var cl = ids[i]; |
127 | - | {name: 'td_depth', index: 'td_depth', editable: true, align: 'center', width: 150, |
127 | + | be = "<input style='height:22px;width:20px;' type='button' value='E' onclick=\"jQuery('#rowed2').editRow('"+cl+"');\" />"; |
128 | - | editoptions: { |
128 | + | se = "<input style='height:22px;width:20px;' type='button' value='S' onclick=\"jQuery('#rowed2').saveRow('"+cl+"');\" />"; |
129 | - | }, |
129 | + | ce = "<input style='height:22px;width:20px;' type='button' value='C' onclick=\"jQuery('#rowed2').restoreRow('"+cl+"');\" />"; |
130 | - | searchoptions: { |
130 | + | jQuery("#rowed2").jqGrid('setRowData',ids[i],{act:be+se+ce}); |
131 | - | clearSearch: false |
131 | + | } |
132 | - | } |
132 | + | }, |
133 | - | } |
133 | + | }); |
134 | - | ], |
134 | + | /* |
135 | - | jsonReader: { |
135 | + | jQuery(grid_selector).jqGrid({ |
136 | - | root: "rows", |
136 | + | datatype : "json", |
137 | - | page: "page", |
137 | + | url : JS_SITE_URL + "/well/getListWells", |
138 | - | total: "total", |
138 | + | mtype : "POST", |
139 | - | records: "records", |
139 | + | height : "100%", |
140 | - | repeatitems: true, |
140 | + | colNames : ['', 'Wells Id', 'Wells Name', 'Drilling Rig', 'Drilling Contractor', 'Spud Date', 'TD Date', 'TD Depth'], |
141 | - | cell: "cell", |
141 | + | colModel : [{ |
142 | - | id: "id", |
142 | + | name : '', |
143 | - | userdata: "userdata" |
143 | + | index : '', |
144 | - | }, |
144 | + | width : 100, |
145 | - | viewrecords: true, |
145 | + | fixed : true, |
146 | - | rowNum: 10, |
146 | + | sortable : false, |
147 | - | rowList: [10, 20, 30, 50, 100], |
147 | + | resize : false, |
148 | - | pager: pager_selector, |
148 | + | formatter : 'actions', |
149 | - | loadonce: false, |
149 | + | formatoptions : { |
150 | - | altRows: true, |
150 | + | keys : true, |
151 | - | closeAfterAdd: true, |
151 | + | deldata : { |
152 | - | closeAfterEdit: true, |
152 | + | id : $(selr + 'wells_id').val() |
153 | - | multiselect: true, |
153 | + | }, |
154 | - | multiboxonly: true, |
154 | + | delOptions : { |
155 | - | shrinkToFit: false, |
155 | + | recreateForm : true, |
156 | - | loadComplete: function () { |
156 | + | beforeShowForm : beforeDeleteCallback, |
157 | - | var table = this; |
157 | + | }, |
158 | - | setTimeout(function () { |
158 | + | adwbutton : false |
159 | - | styleCheckbox(table); |
159 | + | }, |
160 | - | updateActionIcons(table); |
160 | + | search : false |
161 | - | updatePagerIcons(table); |
161 | + | }, { |
162 | - | enableTooltips(table); |
162 | + | name : 'wells_id', |
163 | - | }, 0); |
163 | + | index : 'wells_id', |
164 | - | }, |
164 | + | editable : false, |
165 | - | editurl: JS_SITE_URL + "/well/simpan_wells?cid=" + company_id + "&rid=" + region_id, |
165 | + | align : 'center', |
166 | - | reloadAfterSubmit: true, |
166 | + | width : 150, |
167 | - | caption: "List of Well " + company_name + "#Region : " + region_name, |
167 | + | searchoptions : { |
168 | - | ondblClickRow: function (rowId) { |
168 | + | clearSearch : false |
169 | - | location.href = "#docs/file_wells?wid=" + rowId; |
169 | + | } |
170 | - | }, |
170 | + | }, { |
171 | - | serializeGridData: function (postData) { |
171 | + | name : 'wells_name', |
172 | - | var newPostData = $.extend(postData, { |
172 | + | index : 'wells_name', |
173 | - | companyID: company_id, |
173 | + | editable : true, |
174 | - | regionID: region_id |
174 | + | align : 'left', |
175 | - | }); |
175 | + | width : 300, |
176 | - | return $.param(newPostData); |
176 | + | searchoptions : { |
177 | - | } |
177 | + | clearSearch : false |
178 | - | }); |
178 | + | } |
179 | }, { | |
180 | - | jQuery(grid_selector).jqGrid('filterToolbar', { |
180 | + | name : 'drilling_rig', |
181 | - | autosearch: true, |
181 | + | index : 'drilling_rig', |
182 | - | stringResult: true, |
182 | + | editable : true, |
183 | - | searchOperators: false, |
183 | + | align : 'left', |
184 | - | searchOnEnter: false, |
184 | + | width : 300, |
185 | - | defaultSearch: "cn", |
185 | + | searchoptions : { |
186 | - | enableClear: false |
186 | + | clearSearch : false |
187 | - | }); |
187 | + | } |
188 | }, { | |
189 | - | $(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size |
189 | + | name : 'drilling_contractor', |
190 | - | //enable datepicker |
190 | + | index : 'drilling_contractor', |
191 | - | function pickDate(cellvalue, options, cell) { |
191 | + | editable : true, |
192 | - | setTimeout(function () { |
192 | + | align : 'left', |
193 | - | $(cell).find('input[type=text]') |
193 | + | width : 300, |
194 | - | .datepicker({format: 'dd-mm-yyyy', autoclose: true}); |
194 | + | editoptions : {}, |
195 | - | }, 0); |
195 | + | searchoptions : { |
196 | - | } |
196 | + | clearSearch : false |
197 | } | |
198 | - | jQuery(grid_selector).jqGrid('navGrid', pager_selector, |
198 | + | }, { |
199 | - | {//navbar options |
199 | + | name : 'spud_date', |
200 | - | edit: false, |
200 | + | index : 'spud_date', |
201 | - | editicon: 'ace-icon fa fa-pencil blue', |
201 | + | editable : true, |
202 | - | add: true, |
202 | + | align : 'center', |
203 | - | addicon: 'ace-icon fa fa-plus-circle purple', |
203 | + | width : 150, |
204 | - | del: false, |
204 | + | editoptions : {}, |
205 | - | delicon: 'ace-icon fa fa-trash-o red', |
205 | + | searchoptions : { |
206 | - | search: false, |
206 | + | clearSearch : false |
207 | - | searchicon: 'ace-icon fa fa-search orange', |
207 | + | }, |
208 | - | refresh: true, |
208 | + | sorttype : "date", |
209 | - | refreshicon: 'ace-icon fa fa-refresh green', |
209 | + | unformat : pickDate, |
210 | - | view: false, |
210 | + | formatter : 'date', |
211 | - | viewicon: 'ace-icon fa fa-search-plus grey', |
211 | + | formatoptions : { |
212 | - | }, |
212 | + | srcformat : 'ISO8601Long', |
213 | - | { |
213 | + | newformat : 'd-m-Y H:i', |
214 | - | width: 500, |
214 | + | defaultValue : null |
215 | - | editCaption: 'Edit Wells', |
215 | + | } |
216 | - | bSubmit: "Simpan", |
216 | + | }, { |
217 | - | bCancel: "Batal", |
217 | + | name : 'td_date', |
218 | - | closeAfterEdit: true, |
218 | + | index : 'td_date', |
219 | - | closeOnEscape: true, |
219 | + | editable : true, |
220 | - | reloadAfterSubmit: true, |
220 | + | align : 'center', |
221 | - | refreshtext: 'Reload', |
221 | + | width : 150, |
222 | - | recreateForm: true, |
222 | + | editoptions : {}, |
223 | - | beforeShowForm: function (e) { |
223 | + | searchoptions : { |
224 | - | var form = $(e[0]); |
224 | + | clearSearch : false |
225 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') |
225 | + | }, |
226 | - | style_edit_form(form); |
226 | + | sorttype : "date", |
227 | - | } |
227 | + | unformat : pickDate, |
228 | - | }, |
228 | + | formatter : 'date', |
229 | - | { |
229 | + | formatoptions : { |
230 | - | //new record form |
230 | + | srcformat : 'ISO8601Long', |
231 | - | width: 500, |
231 | + | newformat : 'd-m-Y H:i', |
232 | - | addCaption: 'Add Wells', |
232 | + | defaultValue : null |
233 | - | closeAfterAdd: true, |
233 | + | } |
234 | - | recreateForm: true, |
234 | + | }, { |
235 | - | viewPagerButtons: false, |
235 | + | name : 'td_depth', |
236 | - | beforeShowForm: function (e) { |
236 | + | index : 'td_depth', |
237 | - | var form = $(e[0]); |
237 | + | editable : true, |
238 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar') |
238 | + | align : 'center', |
239 | - | .wrapInner('<div class="widget-header" />') |
239 | + | width : 150, |
240 | - | style_edit_form(form); |
240 | + | editoptions : {}, |
241 | - | } |
241 | + | searchoptions : { |
242 | - | }, |
242 | + | clearSearch : false |
243 | - | { |
243 | + | } |
244 | - | //delete record form |
244 | + | } |
245 | - | width: 300, |
245 | + | ], |
246 | - | caption: "Delete Wells", |
246 | + | jsonReader : { |
247 | - | msg: "Are You Sure?", |
247 | + | root : "rows", |
248 | - | bSubmit: "Hapus", |
248 | + | page : "page", |
249 | - | bCancel: "Batal", |
249 | + | total : "total", |
250 | - | recreateForm: true, |
250 | + | records : "records", |
251 | - | beforeShowForm: function (e) { |
251 | + | repeatitems : true, |
252 | - | var form = $(e[0]); |
252 | + | cell : "cell", |
253 | - | if (form.data('styled')) |
253 | + | id : "id", |
254 | - | return false; |
254 | + | userdata : "userdata" |
255 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') |
255 | + | }, |
256 | - | style_delete_form(form); |
256 | + | viewrecords : true, |
257 | - | } |
257 | + | rowNum : 10, |
258 | - | }, |
258 | + | rowList : [10, 20, 30, 50, 100], |
259 | - | { |
259 | + | pager : pager_selector, |
260 | - | //search form |
260 | + | loadonce : false, |
261 | - | recreateForm: true, |
261 | + | altRows : true, |
262 | - | afterShowSearch: function (e) { |
262 | + | closeAfterAdd : true, |
263 | - | var form = $(e[0]); |
263 | + | closeAfterEdit : true, |
264 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') |
264 | + | multiselect : true, |
265 | - | style_search_form(form); |
265 | + | multiboxonly : true, |
266 | - | }, |
266 | + | shrinkToFit : false, |
267 | - | afterRedraw: function () { |
267 | + | loadComplete : function () { |
268 | - | style_search_filters($(this)); |
268 | + | var table = this; |
269 | - | } |
269 | + | setTimeout(function () { |
270 | - | , |
270 | + | styleCheckbox(table); |
271 | - | multipleSearch: true |
271 | + | updateActionIcons(table); |
272 | - | }, |
272 | + | updatePagerIcons(table); |
273 | - | { |
273 | + | enableTooltips(table); |
274 | - | //view record form |
274 | + | }, 0); |
275 | - | recreateForm: true, |
275 | + | }, |
276 | - | beforeShowForm: function (e) { |
276 | + | editurl : JS_SITE_URL + "/well/simpan_wells?cid=" + company_id + "&rid=" + region_id, |
277 | - | var form = $(e[0]); |
277 | + | reloadAfterSubmit : true, |
278 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') |
278 | + | caption : "List of Well " + company_name + "#Region : " + region_name, |
279 | - | } |
279 | + | ondblClickRow : function (rowId) { |
280 | - | } |
280 | + | location.href = "#docs/file_wells?wid=" + rowId; |
281 | - | ) |
281 | + | }, |
282 | serializeGridData : function (postData) { | |
283 | - | function style_edit_form(form) { |
283 | + | var newPostData = $.extend(postData, { |
284 | - | //update buttons classes |
284 | + | companyID : company_id, |
285 | - | var buttons = form.next().find('.EditButton .fm-button'); |
285 | + | regionID : region_id |
286 | - | buttons.addClass('btn btn-sm').find('[class*="-icon"]').hide();//ui-icon, s-icon |
286 | + | }); |
287 | - | buttons.eq(0).addClass('btn-primary').prepend('<i class="ace-icon fa fa-check"></i>'); |
287 | + | return $.param(newPostData); |
288 | - | buttons.eq(1).prepend('<i class="ace-icon fa fa-times"></i>') |
288 | + | } |
289 | - | buttons = form.next().find('.navButton a'); |
289 | + | }); |
290 | - | buttons.find('.ui-icon').hide(); |
290 | + | */ |
291 | - | buttons.eq(0).append('<i class="ace-icon fa fa-chevron-left"></i>'); |
291 | + | jQuery(grid_selector).jqGrid('filterToolbar', { |
292 | - | buttons.eq(1).append('<i class="ace-icon fa fa-chevron-right"></i>'); |
292 | + | autosearch : true, |
293 | - | } |
293 | + | stringResult : true, |
294 | - | function style_delete_form(form) { |
294 | + | searchOperators : false, |
295 | - | var buttons = form.next().find('.EditButton .fm-button'); |
295 | + | searchOnEnter : false, |
296 | - | buttons.addClass('btn btn-sm btn-white btn-round').find('[class*="-icon"]').hide();//ui-icon, s-icon |
296 | + | defaultSearch : "cn", |
297 | - | buttons.eq(0).addClass('btn-danger').prepend('<i class="ace-icon fa fa-trash-o"></i>'); |
297 | + | enableClear : false |
298 | - | buttons.eq(1).addClass('btn-default').prepend('<i class="ace-icon fa fa-times"></i>') |
298 | + | }); |
299 | - | } |
299 | + | |
300 | - | function style_search_filters(form) { |
300 | + | $(window).triggerHandler('resize.jqGrid'); //trigger window resize to make the grid get the correct size |
301 | - | form.find('.delete-rule').val('X'); |
301 | + | //enable datepicker |
302 | - | form.find('.add-rule').addClass('btn btn-xs btn-primary'); |
302 | + | function pickDate(cellvalue, options, cell) { |
303 | - | form.find('.add-group').addClass('btn btn-xs btn-success'); |
303 | + | setTimeout(function () { |
304 | - | form.find('.delete-group').addClass('btn btn-xs btn-danger'); |
304 | + | $(cell).find('input[type=text]') |
305 | - | } |
305 | + | .datepicker({ |
306 | - | function style_search_form(form) { |
306 | + | format : 'dd-mm-yyyy', |
307 | - | var dialog = form.closest('.ui-jqdialog'); |
307 | + | autoclose : true |
308 | - | var buttons = dialog.find('.EditTable') |
308 | + | }); |
309 | - | buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-sm btn-info').find('.ui-icon').attr('class', 'ace-icon fa fa-retweet'); |
309 | + | }, 0); |
310 | - | buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-sm btn-inverse').find('.ui-icon').attr('class', 'ace-icon fa fa-comment-o'); |
310 | + | } |
311 | - | buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-sm btn-purple').find('.ui-icon').attr('class', 'ace-icon fa fa-search'); |
311 | + | |
312 | - | } |
312 | + | jQuery(grid_selector).jqGrid('navGrid', pager_selector, { //navbar options |
313 | edit : false, | |
314 | - | function beforeDeleteCallback(e) { |
314 | + | editicon : 'ace-icon fa fa-pencil blue', |
315 | - | var form = $(e[0]); |
315 | + | add : true, |
316 | - | if (form.data('styled')) |
316 | + | addicon : 'ace-icon fa fa-plus-circle purple', |
317 | - | return false; |
317 | + | del : false, |
318 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') |
318 | + | delicon : 'ace-icon fa fa-trash-o red', |
319 | - | style_delete_form(form); |
319 | + | search : false, |
320 | - | //form.data('styled', true); |
320 | + | searchicon : 'ace-icon fa fa-search orange', |
321 | - | } |
321 | + | refresh : true, |
322 | refreshicon : 'ace-icon fa fa-refresh green', | |
323 | - | function beforeEditCallback(e) { |
323 | + | view : false, |
324 | - | var form = $(e[0]); |
324 | + | viewicon : 'ace-icon fa fa-search-plus grey', |
325 | - | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') |
325 | + | }, { |
326 | - | style_edit_form(form); |
326 | + | width : 500, |
327 | - | } |
327 | + | editCaption : 'Edit Wells', |
328 | bSubmit : "Simpan", | |
329 | - | //it causes some flicker when reloading or navigating grid |
329 | + | bCancel : "Batal", |
330 | - | //it may be possible to have some custom formatter to do this as the grid is being created to prevent this |
330 | + | closeAfterEdit : true, |
331 | - | //or go back to default browser checkbox styles for the grid |
331 | + | closeOnEscape : true, |
332 | - | function styleCheckbox(table) { |
332 | + | reloadAfterSubmit : true, |
333 | - | } |
333 | + | refreshtext : 'Reload', |
334 | recreateForm : true, | |
335 | - | function updateActionIcons(table) { |
335 | + | beforeShowForm : function (e) { |
336 | - | } |
336 | + | var form = $(e[0]); |
337 | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') | |
338 | - | //replace icons with FontAwesome icons like above |
338 | + | style_edit_form(form); |
339 | - | function updatePagerIcons(table) { |
339 | + | } |
340 | - | var replacement = |
340 | + | }, { |
341 | - | { |
341 | + | //new record form |
342 | - | 'ui-icon-seek-first': 'ace-icon fa fa-angle-double-left bigger-140', |
342 | + | width : 500, |
343 | - | 'ui-icon-seek-prev': 'ace-icon fa fa-angle-left bigger-140', |
343 | + | addCaption : 'Add Wells', |
344 | - | 'ui-icon-seek-next': 'ace-icon fa fa-angle-right bigger-140', |
344 | + | closeAfterAdd : true, |
345 | - | 'ui-icon-seek-end': 'ace-icon fa fa-angle-double-right bigger-140' |
345 | + | recreateForm : true, |
346 | - | }; |
346 | + | viewPagerButtons : false, |
347 | - | $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () { |
347 | + | beforeShowForm : function (e) { |
348 | - | var icon = $(this); |
348 | + | var form = $(e[0]); |
349 | - | var $class = $.trim(icon.attr('class').replace('ui-icon', '')); |
349 | + | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar') |
350 | .wrapInner('<div class="widget-header" />') | |
351 | - | if ($class in replacement) |
351 | + | style_edit_form(form); |
352 | - | icon.attr('class', 'ui-icon ' + replacement[$class]); |
352 | + | } |
353 | - | }); |
353 | + | }, { |
354 | - | } |
354 | + | //delete record form |
355 | width : 300, | |
356 | - | function enableTooltips(table) { |
356 | + | caption : "Delete Wells", |
357 | - | $('.navtable .ui-pg-button').tooltip({container: 'body'}); |
357 | + | msg : "Are You Sure?", |
358 | - | $(table).find('.ui-pg-div').tooltip({container: 'body'}); |
358 | + | bSubmit : "Hapus", |
359 | - | } |
359 | + | bCancel : "Batal", |
360 | recreateForm : true, | |
361 | - | $(document).one('ajaxloadstart.page', function (e) { |
361 | + | beforeShowForm : function (e) { |
362 | - | $.jgrid.gridDestroy(grid_selector); |
362 | + | var form = $(e[0]); |
363 | - | $('.ui-jqdialog').remove(); |
363 | + | if (form.data('styled')) |
364 | - | }); |
364 | + | return false; |
365 | - | }); |
365 | + | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') |
366 | - | }); |
366 | + | style_delete_form(form); |
367 | } | |
368 | }, { | |
369 | //search form | |
370 | recreateForm : true, | |
371 | afterShowSearch : function (e) { | |
372 | var form = $(e[0]); | |
373 | form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') | |
374 | style_search_form(form); | |
375 | }, | |
376 | afterRedraw : function () { | |
377 | style_search_filters($(this)); | |
378 | }, | |
379 | multipleSearch : true | |
380 | }, { | |
381 | //view record form | |
382 | recreateForm : true, | |
383 | beforeShowForm : function (e) { | |
384 | var form = $(e[0]); | |
385 | form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') | |
386 | } | |
387 | }) | |
388 | ||
389 | function style_edit_form(form) { | |
390 | //update buttons classes | |
391 | var buttons = form.next().find('.EditButton .fm-button'); | |
392 | buttons.addClass('btn btn-sm').find('[class*="-icon"]').hide(); //ui-icon, s-icon | |
393 | buttons.eq(0).addClass('btn-primary').prepend('<i class="ace-icon fa fa-check"></i>'); | |
394 | buttons.eq(1).prepend('<i class="ace-icon fa fa-times"></i>') | |
395 | buttons = form.next().find('.navButton a'); | |
396 | buttons.find('.ui-icon').hide(); | |
397 | buttons.eq(0).append('<i class="ace-icon fa fa-chevron-left"></i>'); | |
398 | buttons.eq(1).append('<i class="ace-icon fa fa-chevron-right"></i>'); | |
399 | } | |
400 | function style_delete_form(form) { | |
401 | var buttons = form.next().find('.EditButton .fm-button'); | |
402 | buttons.addClass('btn btn-sm btn-white btn-round').find('[class*="-icon"]').hide(); //ui-icon, s-icon | |
403 | buttons.eq(0).addClass('btn-danger').prepend('<i class="ace-icon fa fa-trash-o"></i>'); | |
404 | buttons.eq(1).addClass('btn-default').prepend('<i class="ace-icon fa fa-times"></i>') | |
405 | } | |
406 | function style_search_filters(form) { | |
407 | form.find('.delete-rule').val('X'); | |
408 | form.find('.add-rule').addClass('btn btn-xs btn-primary'); | |
409 | form.find('.add-group').addClass('btn btn-xs btn-success'); | |
410 | form.find('.delete-group').addClass('btn btn-xs btn-danger'); | |
411 | } | |
412 | function style_search_form(form) { | |
413 | var dialog = form.closest('.ui-jqdialog'); | |
414 | var buttons = dialog.find('.EditTable') | |
415 | buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-sm btn-info').find('.ui-icon').attr('class', 'ace-icon fa fa-retweet'); | |
416 | buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-sm btn-inverse').find('.ui-icon').attr('class', 'ace-icon fa fa-comment-o'); | |
417 | buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-sm btn-purple').find('.ui-icon').attr('class', 'ace-icon fa fa-search'); | |
418 | } | |
419 | ||
420 | function beforeDeleteCallback(e) { | |
421 | var form = $(e[0]); | |
422 | if (form.data('styled')) | |
423 | return false; | |
424 | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') | |
425 | style_delete_form(form); | |
426 | //form.data('styled', true); | |
427 | } | |
428 | ||
429 | function beforeEditCallback(e) { | |
430 | var form = $(e[0]); | |
431 | form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') | |
432 | style_edit_form(form); | |
433 | } | |
434 | ||
435 | //it causes some flicker when reloading or navigating grid | |
436 | //it may be possible to have some custom formatter to do this as the grid is being created to prevent this | |
437 | //or go back to default browser checkbox styles for the grid | |
438 | function styleCheckbox(table) {} | |
439 | ||
440 | function updateActionIcons(table) {} | |
441 | ||
442 | //replace icons with FontAwesome icons like above | |
443 | function updatePagerIcons(table) { | |
444 | var replacement = { | |
445 | 'ui-icon-seek-first' : 'ace-icon fa fa-angle-double-left bigger-140', | |
446 | 'ui-icon-seek-prev' : 'ace-icon fa fa-angle-left bigger-140', | |
447 | 'ui-icon-seek-next' : 'ace-icon fa fa-angle-right bigger-140', | |
448 | 'ui-icon-seek-end' : 'ace-icon fa fa-angle-double-right bigger-140' | |
449 | }; | |
450 | $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () { | |
451 | var icon = $(this); | |
452 | var $class = $.trim(icon.attr('class').replace('ui-icon', '')); | |
453 | ||
454 | if ($class in replacement) | |
455 | icon.attr('class', 'ui-icon ' + replacement[$class]); | |
456 | }); | |
457 | } | |
458 | ||
459 | function enableTooltips(table) { | |
460 | $('.navtable .ui-pg-button').tooltip({ | |
461 | container : 'body' | |
462 | }); | |
463 | $(table).find('.ui-pg-div').tooltip({ | |
464 | container : 'body' | |
465 | }); | |
466 | } | |
467 | ||
468 | $(document).one('ajaxloadstart.page', function (e) { | |
469 | $.jgrid.gridDestroy(grid_selector); | |
470 | $('.ui-jqdialog').remove(); | |
471 | }); | |
472 | }); | |
473 | }); | |
474 | ||
475 | </script> |