-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfarmer_view.php
251 lines (223 loc) · 12.9 KB
/
farmer_view.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
<?php
include('header.php');
$clientId = $_GET["view"];
$findClient = selectOne('farmer', ['id' => $clientId]);
?>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800"><?php echo $findClient['firstname'] . " " . $findClient['middlename'] . " " . $findClient['lastname'] ?></h1>
<div class="row">
<div class="col-lg-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Bio Info</h6>
</div>
<div class="card-body">
<form action="">
<div class="form-group">
<label for="">Contact Details</label>
</div>
<p>
<i class="fas fa-mobile-alt"></i> : <a href="tel:<?php echo $findClient['phone_no'] ?>"><?php echo $findClient['phone_no'] ?></a>
</p>
<p>
<i class="fas fa-envelope"></i> : <a href="mailto:<?php echo $findClient['email'] ?>"><?php echo $findClient['email'] ?></a>
</p>
<!-- <p>
<i class="fas fa-address-book"></i> : <?php //echo $findClient['address']
?>
</p> -->
<hr>
<div class="form-group">
<label for="">Marital Status:</label>
<input type="text" class="form-control form-control-user" name="pc_name" value="<?php echo $findClient['marital_status'] ?>" readonly>
</div>
<div class="form-group">
<label for="">Education Type:</label>
<input type="text" class="form-control form-control-user" name="pc_name" value="<?php echo $findClient['education_type'] ?>" readonly>
</div>
<div class="form-group">
<label for="">Education Grade:</label>
<input type="text" class="form-control form-control-user" name="pc_name" value="<?php echo $findClient['education_grade'] ?>" readonly>
</div>
</form>
</div>
</div>
</div>
<!-- loan info -->
<div class="col-lg-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<div style="float:left">
<h6 class="m-0 font-weight-bold text-primary">FARM & WAREHOUSE</h6>
</div>
<div style="float:right">
<a href="#" class="btn btn-info btn-icon-split" data-toggle="modal" data-target="#bookLoan">
<span class="icon text-white-50">
<i class="fas fa-info-circle"></i>
</span>
<span class="text">Document Farm</span>
</a>
</div>
<!-- Modal -->
<form action="functions/business/loans/book_loan.php" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="modal fade" id="bookLoan" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Document Farm</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<input type="text" value="<?php echo $clientId ?>" name="client" hidden>
<div class="form-group">
<!-- LOAN DATA -->
<label for="">Loan Amount</label>
<input type="text" class="form-control form-control-user" id="principal" name="principal" placeholder="Principal...." required>
</div>
<legend>Farm Data</legend>
<div class="form-group">
<label for="">State</label>
<select name="state" id="state" class="form-control" required>
<?php
$states = selectAll('states');
foreach ($states as $state) {
?>
<option value="<?php echo $state['name'] ?>"><?php echo $state['name'] ?></option>
<?php
}
?>
</select>
</div>
<div id="lga"></div>
<div class="form-group">
<label for="">Crops Grown</label>
<input type="text" class="form-control form-control-user" id="crops" name="crops" placeholder="Crops Grown...." required>
</div>
<script>
$(document).ready(function() {
$('#state').on("click", function() {
var state = $(this).val();
$.ajax({
url: "functions/system/ajax_functions/lga.php",
method: "POST",
data: {
state: state
},
success: function(data) {
$('#lga').html(data);
}
})
});
$('#principal').on("change blur", function() {
var amount = $(this).val();
$.ajax({
url: "functions/system/converter.php",
method: "POST",
data: {
amount: amount
},
success: function(data) {
$('#principal').val(data);
}
})
});
});
</script>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Book</button>
</div>
</div>
</div>
</div>
</form>
<!-- /modal ends here -->
</div>
<div class="card-body">
<?php
$findLoan = selectOne('farm', ['farmer_id' => $clientId]);
if ($findLoan) {
?>
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>State</th>
<th>LGA</th>
<th>Crops</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>State</th>
<th>LGA</th>
<th>Crops</th>
<th>Status</th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
$findFarms = selectAll('farm', ['farmer_id' => $clientId]);
foreach ($findFarms as $details) {
?>
<tr>
<td><?php echo $details['state'] ?></td>
<td><?php echo $details['lga'] ?></td>
<td><?php echo $details['crops_grown'] ?></td>
<td>
<?php
$farmID = $details['id'];
$findSurvey = selectOne('survey_data', ['farm_id' => $farmID]);
if($findSurvey){
if($findSurvey['status'] == 0){
echo "Survey Onging";
}else if($findSurvey['status'] == 1){
echo "Completed and Aprroved";
}else if($findSurvey['status'] == 2){
echo "Completed and Rejected";
}
}else{
echo "Yet to Begin Survey";
}
?>
</td>
<td>
<a href="farm_view.php?view=<?php echo $details['id'] ?>" class="btn btn-info btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-info-circle"></i>
</span>
<span class="text">View</span>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
} else {
?>
FARMER HAS NO EXISTING FARM(S)
<?php
}
?>
</div>
</div>
</div>
<!-- /loan info -->
</div>
</div>
<!-- /.container-fluid -->
<?php
include('footer.php');
?>