-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_farmers_19102017.php
253 lines (235 loc) · 8.65 KB
/
view_farmers_19102017.php
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
<?php
include('access1.php');
include('include/connection.php');
include('include/query-helper.php');
$feature_name = 'Farmer';
$home_name = "Home";
$title = 'View Farmer';
$home_url = "home.php";
$filename = 'view_farmers.php';
if(!isset($_SESSION['sqyard_user']) && $_SESSION['sqyard_user']=="")
{
?>
<script type="text/javascript">
history.go(-1);
</script>
<?php
}
$ca_id = $_SESSION['ca_id'];
if($_SESSION['userType']=="Admin")
{
$sql = "select * from tbl_farmers order by id desc";
}
else
{
$sql = "select * from tbl_farmers where fm_caid='".$ca_id."' order by id desc";
}
$res = mysqli_query($db_con,$sql) or die(mysqli_error($db_con));
$r = 1;
?>
<!doctype html>
<html>
<head>
<?php
/* This function used to call all header data like css files and links */
headerdata($feature_name);
/* This function used to call all header data like css files and links */
?>
<!--<link type="text/css" href="css/main.css">-->
</head>
<body class="<?php echo $theme_name; ?>" data-theme="<?php echo $theme_name; ?>">
<?php
/*include Bootstrap model pop up for error display*/
modelPopUp();
/*include Bootstrap model pop up for error display*/
/* this function used to add navigation menu to the page*/
navigation_menu();
/* this function used to add navigation menu to the page*/
?> <!-- Navigation Bar -->
<div class="container-fluid" id="content">
<div id="main" style="margin-left:0px !important">
<?php
/* this function used to add navigation menu to the page*/
breadcrumbs($home_url,$home_name,'View Farmers',$filename,$feature_name);
/* this function used to add navigation menu to the page*/
?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="box box-color box-bordered">
<div class="box-title">
<h3>
<i class="icon-table"></i>
Farmers
</h3>
</div>
<div class="box-content nopadding">
<div style="padding:20px">
<a href="add_farmers.php?pag=farmers" class="btn btn-primary">
Add Farmer
</a>
</div>
<div style="padding:10px 15px 10px 15px !important">
<input type="hidden" name="hid_user_type" id="hid_user_type" value="<?php echo $_SESSION['userType'] ?>">
<input type="hidden" name="hid_ca_id" id="hid_ca_id" value="<?php echo $ca_id; ?>">
<input type="hidden" name="hid_page" id="hid_page" value="1">
<input type="hidden" name="cat_parent" id="cat_parent" value="parent">
<select name="rowlimit" id="rowlimit" onChange="loadCategoryData();" class = "select2-me">
<option value="10" selected>10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select> entries per page
<input type="text" class="input-medium" id = "srch" name="srch" placeholder="Search here..." style="float:right;margin-right:10px;margin-top:10px;" >
</div>
<div id="req_resp"></div>
<div class="profileGallery">
<div style="width:99%;" align="center">
<div id="loading"></div>
<div id="container1" class="data_container">
<div class="data"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(e) {
$("#selectall").click(function(){
$(".case").attr("checked",this.checked);
});
$(".case").click(function(){
if($(".case").length==$(".case:checked").length){
$("#selectall").attr("checked","checked");
}
else{
$("#selectall").removeAttr("checked");
}
});
$('#srch').keypress(function(e)
{
if(e.which == 13)
{
$("#hid_page").val("1");
loadFarmerData();
}
});
loadFarmerData();
$('#container1 .pagination li.active').live('click',function()
{
var page = $(this).attr('p');
$("#hid_page").val(page);
loadFarmerData();
});
});
function loadFarmerData()
{
//loading_show();
hid_user_type = $('#hid_user_type').val();
hid_ca_id = $('#hid_ca_id').val();
row_limit = $.trim($('select[name="rowlimit"]').val());
search_text = $.trim($('#srch').val());
page = $.trim($("#hid_page").val());
load_farmer = "1";
if(row_limit == "" && page == "")
{
alert('Can not Get Row Limit and Page number');
//loading_hide();
}
else
{
var sendInfo = {"row_limit":row_limit, "search_text":search_text, "load_farmer":load_farmer, "page":page, "hid_user_type":hid_user_type, "hid_ca_id":hid_ca_id};
var farmer_load = JSON.stringify(sendInfo);
$.ajax({
url: "load_farmer.php?",
type: "POST",
data: farmer_load,
contentType: "application/json; charset=utf-8",
success: function(response)
{
data = JSON.parse(response);
//alert(data.resp);
if(data.Success == "Success")
{
$("#container1").html(data.resp);
//loading_hide();
}
else if(data.Success == "fail")
{
$("#container1").html('<span style="style="color:#F00;">'+data.resp+'</span>');
//loading_hide();
}
},
error: function (request, status, error)
{
//loading_hide();
},
complete: function()
{
//loading_hide();
//alert("complete");
}
});
}
}
</script> <!-- Nice Scroll -->
<script type="text/javascript">
function confirmAction(id)
{
var r = confirm("Do you want to delete?");
if(r==true)
{
window.open('deletevideos.php?id='+id,'_self');
}
else
{
}
}
</script>
<script language="javascript">
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function sord(c_value,c_id,c_type) {
var strURL="findspasorder.php?c_value="+c_value+"&c_id="+c_id+"&c_type="+c_type;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('comp_1').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
</body>
</html>