-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditCustomersFront.php
More file actions
203 lines (152 loc) · 8.42 KB
/
EditCustomersFront.php
File metadata and controls
203 lines (152 loc) · 8.42 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
<?php
session_start();
include_once 'object/Customer.php';
?>
<!DOCTYPE html>
<html lang="en">
<?php include_once 'head.php' ?>
<style>
#activeEditCustomers {
background-color: #6200EA;
}
</style>
<body>
<?php include_once 'header.php' ?>
<?php
$user = new User();
$allCustomers = $user->selectAllCustomer();
?>
<div class="row">
<div class="container pt-4 ">
<form method="POST">
<div class="input-group input-group-sm mb-3 w-25 m-auto ">
<input list="browsers" name="searchCustomer" id="browser" value="<?php if (isset($_GET['editCustomerName'])) echo $_GET['editCustomerName']; ?> " autocomplete="off">
<datalist id="browsers">
<?php if (!empty($allCustomers)) { ?>
<?php foreach ($allCustomers as $customer) { ?>
<option value="<?php echo $customer['name'] ?>">
<?php } ?>
<?php } ?>
</datalist>
<input type="submit" class="bg-primary text-white" name="seacrhForm" value="search">
</div>
</form>
</div>
</div>
<div class="row">
<div class="container pt-4 w-75">
<!-- some php code -->
<?php
if ($_POST) {
$user = new User();
$searchQuery = htmlspecialchars(strip_tags($_POST['searchCustomer']));
$customerEditResult = $user->search($searchQuery);
if (!empty($customerEditResult)) {
foreach ($customerEditResult as $result) {
$totalPayable = $user->totalArrears($result['Customer_ID']);
}
}
}
?>
<!-- some php code end -->
<form method="POST" action="editCustomerUpdateData.php">
<!-- Alert Messages -->
<div style="text-align : center; margin-top:20px !important; width:40%; margin:auto;">
<span><?php if (isset($_SESSION['DataUpdate'])) {
echo "<div class='alert alert-success'>";
echo $_SESSION['DataUpdate'];
echo "</div>";
unset($_SESSION['DataUpdate']);
} ?> </span>
</div>
<!-- Alert Messages End -->
<!-- start of if -->
<?php if (empty($customerEditResult)) { ?>
<div class=" alert alert-danger w-25 m-auto ">
<span>Record Not Found</span>
</div>
<?php } else {
foreach ($customerEditResult as $result) { ?>
<input type="hidden" name="customerID" value="<?php echo $result['Customer_ID']; ?>" />
<div class=" form-row">
<div class="form-group col-md-5">
<label for="inputEmail4">Customer Name</label>
<input type="text" name="customerName" class="form-control" value="<?php echo $result['name'] ?>" id="inputEmail4" required>
</div>
<div class="form-group col-md-4">
<label for="inputPassword4">Mobile Number</label>
<input type="number" name="mobileNumber" value="<?php echo $result['mobile'] ?>" class="form-control" id="inputPassword4" required>
</div>
<div class="form-group col-md-3">
<label for="inputAddress2">Connection Date</label>
<input type="date" name="con_date" value="<?php echo $result['connection_date'] ?>" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="inputEmail4">Monthly Fee</label>
<input type="number" name="totalFee" class="form-control" id="inputEmail4" required>
</div>
<div class="form-group col-md-4">
<label for="inputPassword4">Paid</label>
<input type="number" name="paidFee" class="form-control" id="inputPassword4" required>
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Arrears</label>
<input type="number" name="arrears" value="<?php echo $totalPayable['arrears'] ?>" class="form-control" id="inputPassword4" disabled>
</div>
</div>
<div class=" form-row ">
<div class="form-group col-md-6">
<label for="inputAddress2">Fees Updated</label>
<input type="date" name="paidDate" class="form-control" id="inputAddress2" required>
</div>
<!-- fetching city form table -->
<?php
$user = new User();
$cityResutl = $user->selectAllCity();
$areaResutl = $user->selectAllArea();
?>
<div class="form-group col-md-6">
<label for="inputCity">City</label>
<select id="inputCity" name="city" class="form-control">
<option value="<?php echo $result['city'] ?>" selected><?php echo $result['city'] ?></option>
<?php if (!empty($cityResutl)) { ?>
<?php foreach ($cityResutl as $cresult) { ?>
<option value="<?php echo $cresult['cityName'] ?>"><?php echo $cresult['cityName'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputState">Area</label>
<select id="inputState" name="area" class="form-control" required>
<option value="<?php echo $result['area'] ?>" selected><?php echo $result['area'] ?></option>
<?php if (!empty($areaResutl)) { ?>
<?php foreach ($areaResutl as $aResult) { ?>
<option value="<?php echo $aResult['areaName'] ?>"><?php echo $aResult['areaName'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="form-group col-md-2">
<label for="inputZip">Status</label>
<select id="inputZip" name="status" class="form-control">
<option selected value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
</div>
<div class="d-flex justify-content-center">
<button type="submit" name="customerForm" class="btn btn-primary">Update Data</button>
</div>
<?php } ?>
<?php } ?>
</form>
</div>
</div>
<?php include_once 'footer.php' ?>
</body>
</html>