-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
314 lines (293 loc) · 13.9 KB
/
test.html
File metadata and controls
314 lines (293 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Prativas Basu">
<title>Control Panel</title>
<!-- Bootstrap Core CSS -->
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/jqueryui/jquery-ui.css" rel="stylesheet">
<link href="assets/easy_crud/easy_crud.css" rel="stylesheet">
<!-- Custom Fonts -->
<script src="assets/jquery/jquery.min.js"></script>
<script src="assets/jquery/jquery-migrate.min.js"></script>
<script src="assets/jqueryui/jquery-ui.js"></script>
<script src="assets/easy_crud/easy_crud.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript" charset="utf-8">
$(function() {
$('#names').avro({
'en': true
}, function(isBangla) {
if (isBangla) {
$('.mode').text('English');
} else {
$('.mode').text('Bangla');
}
});
});
</script>
<script>
$(document).keycut();
$(document).ready(function() {
///// ajax indicator////
$.ajaxSetup({
beforeSend: function() {
// show gif here, eg:
$("#loading").show();
$("#load").show();
},
complete: function() {
// hide gif here, eg:
$("#loading").hide();
$("#load").hide();
}
});
});
</script>
<script>
$(document).ready(function(e) {
form_obj = {
form_data: ['id', 'name', 'username', 'password','adminrole','mobile','status'], //// All Main Form Field name or id ( field name id will be same )
table_data: ['id', 'name', 'username', 'password','adminrole','mobile','status'], /// same sequence as the form_field name to corresponding mysql field name
form_type: ['text', 'text', 'text', 'text','select','text','select'], /// Form field type in same sequence
total_no: 7, /// Total No of Field
table: 'admin_user', /// name of the mysql table where data goes
form_id: 'myform', /// name of the form id value
status_division: 'status_show', /// div id name where form manipulation status shows generally top of main form
validation: { /// validation method discussed above extensively
validation_status: 'Yes',
minimum_letter: [{
'name': 4,'password':3
}],
maximum_letter: [{
'name': 30
}],
validation_type: [{
'name': 'alpha','mobile':'mobile10'
}]
}
}
/////////////////////// Save Form ///////////////////////////////
$('#save').click(function(event) { //// when save button clicked
event.stopPropagation(); /// to stop even repeatation
event.preventDefault(); /// to stop even bubbling
method_obj = {}; /// to clear method object JSON Data
method_obj = { /// starting method object
method: 'Save', //// method name
blank_field: 'id', //// the field which must be blank
duplicate_field: {
duplicate_both: ['name', 'username'], /// If all the field of table have same value AND Logic
duplicate_single: [] /// if only individual field have same value OR logic
},
required_field: ['name','username'], /// this fields must be filled
data_streams: $('#myform').serializeJSON() /// data stream send corresponding form
}
easy_crud("Save", form_obj, method_obj) /// crud function calling
});
//////////////////////// Edit Form ////////////////////////
$('#edit').click(function(event) {
event.stopPropagation(); /// to stop even repeatation
event.preventDefault(); /// to stop even bubbling
method_obj = {}; /// to clear method object JSON Data
method_obj = { /// starting method object
method: "Edit", //// method name
where_field: {
table_where: 'id', //// table field primary /unique field
form_where: 'id' //// the form field name /id
},
duplicate_field: {
duplicate_both: [],
duplicate_single: []
},
//// in case edit you must form field data as we don't want to edit all the field so it is declared in edit field
form_update_data: ['id', 'name', 'username', 'password','adminrole','mobile','status'], /// field of form you want to edit
table_update_data: ['id', 'name', 'username', 'password','adminrole','mobile','status'], /// same sequence of mysql table data
form_update_type: ['text', 'text', 'text', 'text','select','text','select'], /// same sequence of form type data
required_field: ['names'], /// Required field must be filled
data_streams: $('#myform').serializeJSON() /// data stream send to field
}
easy_crud("Edit", form_obj, method_obj);
});
//////////////////////// Reset Form ////////////////////////
$('#reset').click(function(event) {
method_obj = {}; /// clear method JSON object
method_obj = {
method: 'Reset', /// set the name
}
easy_crud("Reset", form_obj, method_obj)
});
//////////////// search form ///////////////////////////////
$('#name_search').keyup(function(event) {
event.stopPropagation(); /// to stop even repeatation
event.preventDefault(); /// to stop even bubbling
method_obj = {}; /// to clear method object JSON Data
method_obj = { /// starting method object
method: 'Search', /// Method Name
table_search: "admin_user", /// table name -may differ from main form table
list_division: 'search_result', //// div id where search result display may be below the search box
search_box_id: 'name_search', //// name of search input box
search_data: ['name', 'username'], /// data to be search which table data to be search
min_letter: 3, /// min number of letter need to be searched
href_value: 'id', //// search table primary key for value linking fields
heading_data: ['ID', 'Name', 'username','role'], /// Listing Heading Row Value
list_data: ['id', 'name', 'username','adminrole'], //// actual table field data to be display
data_streams: $('#searchform').serializeJSON()
}
easy_crud("Search", form_obj, method_obj)
});
////////////////////////////////// search filling the main form //////////////////////////
$('#search_result ul li a').live("click", function(event) {
event.stopPropagation(); /// to stop even repeatation
event.preventDefault(); /// to stop even bubbling
method_obj = {}; /// to clear method object JSON Data
var where_data = $(this).attr('value'); /// get the id of the record
method_obj = { /// starting method object
method: "FillForm", /// Method Name
table_form: "admin_user", /// table name
form_id: 'myform', //// form effected by filling
attr_value: where_data, /// value of the attr to be link
attr_name: 'id', /// name of the field from where arrt_value comes
///// attr_imposed is use to where value given to another form field parameters are (status is Yes/No > imposed or not ,type of control button /textbox , id name of the control , and value attribute value)
attr_imposed: [{
'status': 'Yes',
'type': 'button',
'id': 'expand',
'value': where_data
}]
}
easy_crud("FillForm", form_obj, method_obj);
});
/////////////////// Delete Operation ////////////////////////////
$('#delete').click(function(event) {
event.stopPropagation(); /// to stop even repeatation
event.preventDefault(); /// to stop even bubbling
method_obj = {}; /// to clear method object JSON Data
method_obj = { /// starting method object
method: "Delete", /// Method Name
where_field: {
table_where: 'id', //// table field primary /unique field
form_where: 'id' //// the form field name /id
},
required_field: ['name', 'id'], //// pre required of the form field
data_streams: $('#myform').serializeJSON() /// data stream
}
easy_crud("Delete", form_obj, method_obj);
$('#reset').trigger('click');
});
});
</script>
</head>
<body>
<!-- Page Content -->
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header"> CRUD TESTING </h3>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-4" style="min-height:30px;"> <img id="loading" style="display:none;" src="assets/ajax_indicator/ajax-loader.gif"> </div>
<div class="col-lg-8" style="min-height:33px;">
<div id="status_show" style="padding:6px;;display:none; text-align:center;"> </div>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<form name="searchform" id="searchform">
<!-- search button -->
<div class="form-group">
<label class="col-lg-4 control-label">Search Name</label>
<div class="col-lg-8 ">
<div class="input-group">
<input name="name_search" type="text" class="form-control" id="name_search" maxlength="8" autocomplete="off" required>
<div class="input-group-addon btn btn-group" name="btn-search" id="btn-search"><span class="glyphicon glyphicon-search"></span></div>
</div>
</div>
</div>
</form>
<!-- display result -->
<div id="search_result">search Result</div>
</div>
<div class="col-lg-8" style="min-height:30px;">
<form name="myform" id="myform" enctype="multipart/form-data">
<table class="table table-responsive">
<thead>
<tr>
<th colspan="2" class="alert-info"> <span class="glyphicon glyphicon-file"></span> Subject Name Entry | <small><code>NOTE</code> Press <code>Ctrl+M </code> to switch to <code> <span class="mode"> </span></code>. Hit Space, Enter or Tab to transliterate.</small></th>
</tr>
</thead>
<tbody class="alert-warning">
<tr>
<td>id :</td>
<td><input type="text" size="5" name="id" id="id" readonly></td>
</tr>
<tr>
<td>name : </td>
<td><input type="text" size="20" name="name" id="name"></td>
</tr>
<tr>
<td>Username : </td>
<td><input type="text" size="20" name="username" id="username"></td>
</tr>
<tr>
<td>Password : </td>
<td><input type="password" size="20" name="password" id="password"></td>
</tr>
<tr>
<td>Role : </td>
<td>
<select name="adminrole" id="adminrole">
<option value="">-- --</option>
<option value="Administrator">Administrator</option>
<option value="User">User</option>
</select>
</td>
</tr>
<tr>
<td>Mobile : </td>
<td><input type="text" size="20" name="mobile" id="mobile"></td>
</tr>
<tr>
<td>Status : </td>
<td>
<select name="status" id="status">
<option value="">-- --</option>
<option value="Active">Active</option>
<option value="Hidden">Hidden</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" class="alert-info"><button type="button" name="reset" id="reset" class="btn btn-warning" data-key="r"><span class="glyphicon glyphicon-off"></span> <b><u>R</u></b>eset </button>
<button type="button" name="save" id="save" class="btn btn-success" data-key="s"><span class="glyphicon glyphicon-save"> <b><u>S</u></b>ave </span> </button>
<button type="button" id="edit" name="edit" class="btn btn-primary" data-key="e"><span class="glyphicon glyphicon-edit"> <b><u>E</u></b>dit</span> </button>
<button type="button" name="delete" id="delete" class="btn btn-danger" data-key="d"><span class="glyphicon glyphicon-remove"> <b><u>D</u></b>elete</span> </button>
<button type="button" name="expand" id="expand" class="btn btn-info" data-key="x"><span class="glyphicon glyphicon-search"> Expand</span> </button>
<img id="load" style="display:none;" src="assets/ajax_indicator/ajax-load.gif"></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<!-- end row-->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->
<!-- Bootstrap Core JavaScript -->
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>