-
Notifications
You must be signed in to change notification settings - Fork 0
/
products.php
316 lines (224 loc) · 6.85 KB
/
products.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
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
315
316
<?php
require_once 'header.php';
require_once 'sidebar.php'
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content">
<?php
if (isset($_GET['productsInsert'])) {?>
<div class="box box-primary">
<div class="content-header">
<h1 >Ürün ,Hizmet Ekle</h1>
<hr>
</div>
<div class="box-body">
<?php
if (isset($_POST['products_insert'])) {
$sonuc=$db->insert("products",$_POST,[
"form_name" => "products_insert"
]
);
if ($sonuc['status']) {?>
<div class="alert alert-success">
Kayıt Başarılı <a href="<?php $link=explode("?",$_SERVER['REQUEST_URI']); echo $link[0]; ?>">Listele</a>
</div>
<?php } else {?>
<div class="alert alert-danger">
Kayıt Başarısız.<?php echo $sonuc['error'] ?>
</div>
<?php }
}
?>
<!-- <div class="alert alert-success">
Kayıt Başarılı
</div> -->
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Ürün , Hizmet Adı</label>
<div class="row">
<div class="col-xs-12">
<input type="text" name="products_title"class="form-control">
</div>
</div>
</div>
<div class="form-group">
<label>Ürün , Hizmet Detay</label>
<div class="row">
<div class="col-xs-12">
<textarea class="form_control" id="editor1" name="products_content"></textarea>
</div>
</div>
</div>
<div class="form-group">
<label>Ürün Fİyat</label>
<div class="row">
<div class="col-xs-12">
<input type="text" name="products_price"class="form-control">
</div>
</div>
</div>
<script>
CKEDITOR.replace( 'editor1' );
</script>
<div align="right" class="box-footer">
<button type="submit" class="btn btn-success" name="products_insert">Ekle</button>
</div>
</form>
</div>
</div>
<?php } else if (isset($_GET['productsUpdate'])) {
//bağlı id bilgilerini çek...
?>
<div class="box box-primary">
<div class="content-header">
<h1 >Hesap Düzenle</h1>
<hr>
</div>
<div class="box-body">
<?php
if (isset($_POST['products_update'])) {
$sonuc=$db->update("products",$_POST,[
"form_name" => "products_update",
"columns" => "products_id"
]
);
if ($sonuc['status']) {?>
<div class="alert alert-success">
Kayıt Başarılı <a href="<?php $link=explode("?",$_SERVER['REQUEST_URI']); echo $link[0]; ?>">Listele</a>
</div>
<?php } else {?>
<div class="alert alert-danger">
Kayıt Başarısız.<?php echo $sonuc['error'] ?>
</div>
<?php }
}
$sql=$db->wread("products","products_id",$_GET['products_id']);
$row=$sql->fetch(PDO::FETCH_ASSOC);
?>
<!-- update işlem sorgusu -->
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Ürün , Hizmet Adı</label>
<div class="row">
<div class="col-xs-12">
<input type="text" name="products_title" value="<?php echo $row['products_title']; ?>" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<label>Ürün , Hizmet Detay</label>
<div class="row">
<div class="col-xs-12">
<textarea class="form_control" id="editor1" name="products_content"><?php echo $row['products_content']; ?></textarea>
</div>
</div>
</div>
<div class="form-group">
<label>Ürün Fİyat</label>
<div class="row">
<div class="col-xs-12">
<input type="text" name="products_price" value="<?php echo $row['products_price']; ?>" class="form-control">
</div>
</div>
</div>
<script>
CKEDITOR.replace( 'editor1' );
</script>
<input type="hidden" name="products_id" value="<?php echo $row['products_id']; ?>">
<div align="right" class="box-footer">
<button type="submit" class="btn btn-success" name="products_update">Düzenle</button>
</div>
</form>
</div>
</div>
<?php }
?>
<!-- Default box -->
<div class="box box-primary">
<div class="content-header">
<h1 >Ürünler</h1>
<div align="right">
<a href="?productsInsert=true"><button class="btn btn-success">Yeni Ekle</button></a>
<br><br>
</div>
<?php
if (isset($_GET['productsDelete'])) {
$sonuc=$db->delete("products","products_id",$_GET['products_id'],$_GET['file_delete']);
if ($sonuc['status']) {?>
<div class="alert alert-success">
Silme Başarılı
</div>
<?php } else {?>
<div class="alert alert-danger ">
Silme Başarısız.<?php echo $sonuc['error'] ?>
</div>
<?php }
}
?>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th align="center" width="5">#</th>
<th>Ürün Hzimet</th>
<th>Fiyat</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$sql=$db->read("products",[
"columns_name" => "products_id",
"columns_sort" => "DESC"
]);
$say=1;
while ($row=$sql->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $say++; ?></td>
<td width="200"><?php echo $row['products_title'] ?></td>
<td><?php echo $row['products_price'] ?></td>
<td width="20"><a href="products-details.php?products_id=<?php echo $row['products_id']; ?>"><button class="btn btn-primary btn-sm">Hesap Detayı</button></a></td>
<td align="center" width="5"><a href="?productsUpdate=true&products_id=<?php echo $row['products_id'] ?>"><i class="fa fa-pencil-square"></i></a></td>
<td align="center" width="5"><a href="?productsDelete=True&products_id=<?php echo $row['products_id'] ?>&file_delete=<?php echo $row['products_file'] ?>"><i class="fa fa-trash-o"></i></a></td>
</tr>
<?php } ?>
</table>
</div>
<!-- /.box-body -->
</div>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php require_once 'footer.php'; ?>
<script type="text/javascript">
$(function() {
$("#sortable").sortable({
revert:true,
handle:".sortable",
stop:function(event,ui) {
var data=$(this).sortable('serialize');
$.ajax({
type:"POST",
dataType:"json",
data:data,
url:"netting/order-ajax.php?products_must=true",
success:function(msg) {
if (msg.islemMsj) {
alert("Sıralama Başarılı");
} else {
alert("Hata Var...");
}
}
});
}
});
$("#sortable").disableSelection();
});
</script>