-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprice_detail.php
281 lines (258 loc) · 7.46 KB
/
price_detail.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
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
<!DOCTYPE html>
<?php if(isset($_POST['detail']) or isset($_POST['submit']) or isset($_POST['change_data'])){ ?>
<html lang="en" class="no-js">
<head>
<?php
$header = 20;
$subheader = "Price";
include "desaign/configuration.php";
include "desaign/databases.php";
include "desaign/title.php" ;
include "desaign/css.php";
include "desaign/session.php";
$keterangan = "";
$id = $_POST['id'];
$price = $conf->get_price($con,1,$id);
$list_price = mysqli_fetch_assoc($price);
$readonly = "disabled";
$name_input = "change_data";
$Input = "Change Data";
$id_hidden = "<input type='hidden' name='id' value='$id'/>";
if(isset($_POST['change_data'])){
$readonly = "";
$name_input = "submit";
$Input = "Save Data";
}
if(isset($_POST['submit'])){
$city_send = $_POST['city_send'];
$city_recv = $_POST['city_recv'];
$price_kg = $_POST['price_kg'];
$ship_w = $_POST['ship_w'];
$status = $_POST['status'];
$update = $conf->upd_price($con, $id, $city_send, $city_recv, $price_kg, $ship_w, $status);
if(update){
$keterangan = "success";
} else {
$keterangan = "gagal";
}
}
?>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content page-sidebar-closed-hide-logo page-container-bg-solid">
<?php
include "desaign/nav_header.php";
?>
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<?php
include "desaign/menu.php";
?>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.php">Dashboard</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="price_list.php">Price Detail</a>
</li>
</ul>
</div>
<div class="row">
<div class="portlet box green ">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-dollar"></i> Price Detail
</div>
</div>
<div class="portlet-body form">
<?php if($keterangan == "success"){ ?>
<div class="alert alert-success display-show">
<button class="close" data-close="alert"></button>
<span>
Your Data Has Been Update, Thank You</span>
</div>
<?php echo "<script>window.setTimeout(function () {location.href='price_list.php';}, 700);</script>";
} else if($keterangan == "gagal"){
?>
<div class="alert alert-danger display-show">
<button class="close" data-close="alert"></button>
<span>
Oooppss, data not match, please cek again</span>
</div>
<?php
} else {
}
?>
<form class="form-horizontal" action="" method="post" role="form">
<div class="form-body">
<div class="form-group">
<div class="col-md-2">
<label class="control-label" ><u>Sender's Location</u></label>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label" >City</label>
</div>
<div class="col-md-3">
<select required class="form-control" <?php echo $readonly ?> name="city_send" id="mycity" onchange="cityku()">
<option value=""></option>
<?php
$get_loc_send = $conf->get_location($con,3,1);
while ($row = mysqli_fetch_assoc($get_loc_send)){
$selected = "";
if($list_price['sender']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['location_name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="coupro"></div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label" ><u>Receiver's Location</u></label>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label" >City</label>
</div>
<div class="col-md-3">
<select required class="form-control" <?php echo $readonly ?> name="city_recv" id="mycityy" onchange="citykuu()">
<option value=""></option>
<?php
$get_loc_recv = $conf->get_location($con,3,1);
while ($row = mysqli_fetch_assoc($get_loc_recv)){
$selected = "";
if($list_price['receiver']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['location_name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="city"></div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label" name="price">Price/KG</label>
</div>
<div class="col-md-2">
<input name="price_kg" required <?php echo $readonly ?> value="<?php echo $list_price['price'] ?>" type="number" autocomplete="off" class="form-control">
<?php echo $id_hidden; ?>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label">Shipping With</label>
</div>
<div class="col-md-2">
<select class="form-control" required <?php echo $readonly ?> name="ship_w" >
<?php
$get_shipping = $conf->get_shipping($con);
while ($row = mysqli_fetch_assoc($get_shipping)){
$selected = "";
if($list_price['shipping']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<label class="control-label">Status</label>
</div>
<div class="col-md-2">
<select class="form-control" required <?php echo $readonly ?> name="status" >
<?php
$get_price_stats = $conf->get_price_status($con);
while ($row = mysqli_fetch_assoc($get_price_stats)){
$selected = "";
if($list_price['status']==$row['id']){
$selected = "selected";
}
?>
<option value="<?php echo $row['id'] ?>" <?php echo $selected ?>><?php echo $row['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="form-actions">
<div class="col-md-offset-3 col-md-9">
<button type="submit" name="<?php echo $name_input ?>" value="1" class="btn green"><?php echo $Input ?></button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN DASHBOARD STATS -->
<div class="row">
</div>
</div>
</div>
<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<?php
include "desaign/copyright2.php";
include "desaign/script.php";
?>
</body>
<!-- END BODY -->
</html>
<script type="text/javascript">
function cityku() {
var coupro = document.getElementById("mycity").value;
if(coupro){
$.ajax({
type: 'POST',
url: 'desaign/loc_test.php',
data: {id : coupro, type : "coupro"},
success: function(dataString){
$('.coupro').html(dataString);;
}
});
}
}
function citykuu() {
var city = document.getElementById("mycityy").value;
if(city){
$.ajax({
type: 'POST',
url: 'desaign/loc_test2.php',
data: {id : city, type : "city"},
success: function(dataString){
$('.city').html(dataString);;
}
});
}
}
</script>
<?php } ?>