-
Notifications
You must be signed in to change notification settings - Fork 1
/
seller_addproduct.php
218 lines (204 loc) · 6.65 KB
/
seller_addproduct.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
<?php
include $_SERVER['DOCUMENT_ROOT']."/tokopetra/connect.php";
if(isset($_GET['stat'])){
if($_GET['stat'] == 1){
echo "<script>alert('Pastikan semua field terisi!');</script>";
}
else if($_GET['stat'] == 2){
echo "<script>alert('Produk berhasil ditambahkan!');</script>";
}
else if($_GET['stat'] == 400){
echo "<script>alert('ERROR : Bad Request!');</script>";
}
}
?>
<!doctype html>
<html lang="en">
<head>
<title>Proyek Tekweb</title>
<?php include('assets/header.php'); ?>
<script src="js/home_func.js"></script>
<link rel="stylesheet" type="text/css" href="assets/sidebar_seller.css">
<link rel="stylesheet" type="text/css" href="css/seller_addproduct_style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php include('assets/navbar_seller.php'); ?>
<div class="fluid-container" style="overflow-x: hidden;">
<div class="row">
<?php include('assets/sidebar_seller.php'); ?>
<form action="seller_addproduct_action.php" method="POST" enctype="multipart/form-data">
<div class="col-12 mt-4">
<h4>Add Product</h4>
<!-- Foto Produk -->
<div class="col-10 border border-secondary rounded p-4 my-3">
<h5>Upload Produk</h5>
<br>
<p class="f-12">Format gambar .jpg .jpeg .png dan ukuran minimum 300 x 300px (Untuk gambar optimal gunakan ukuran minimum 700 x 700 px)</p>
<div class="text-center my-3">
<!-- Submit -->
<input type="file" value="+ Pilih Gambar Produk" name="file" id="file" class="btn btn-outline-success rounded text-center">
</div>
</div>
<div class="col-10 border border-secondary rounded p-4">
<h5>Informasi Produk</h5>
<br>
<!-- Nama Produk -->
<div class="row my-3">
<div class="col-4">
<h6>Nama Produk</h6>
</div>
<div class="col-8 text-right">
<input type="text" name="nama" id="nama" placeholder="Input nama produk">
</div>
</div>
<!-- Kategori -->
<div class="row my-3">
<div class="col-4">
<h6>Kategori</h6>
</div>
<div class="col-8">
<select id="kategori" name="kategori">
</select>
</div>
</div>
</div>
<!-- Detail Produk -->
<div class="col-10 border border-secondary rounded p-4 my-3">
<h5>Detail Produk</h5>
<br>
<!-- Kondisi -->
<div class="row my-3">
<div class="col-4">
<h6>Kondisi</h6>
</div>
<div class="col-8">
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input radio-btn" name="kondisi" id="kondisi" value="baru" checked>
Baru
</label>
</div>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input radio-btn" name="kondisi" id="kondisi" value="bekas">
Bekas
</label>
</div>
</div>
</div>
<!-- Deskripsi Produk -->
<div class="row my-3">
<div class="col-4">
<h6>Deskripsi Produk</h6>
<p class="f-12">Pastikan deskripsi produk memuat spesifikasi, ukuran, bahan, masa berlaku, dan lainnya. Semakin detail, semakin berguna bagi pembeli.
</p>
</div>
<div class="col-8">
<textarea rows="13" class="w-100 textarea"
placeholder="Input deskripsi produk" id="deskripsi" name="deskripsi"></textarea>
</div>
</div>
</div>
<!-- Harga -->
<div class="col-10 border border-secondary rounded p-4 my-3">
<h5>Harga</h5>
<br>
<!-- Harga Satuan -->
<div class="row my-3">
<div class="col-4">
<h6>Harga Satuan</h6>
</div>
<div class="col-8">
<div class="box-harga">
<div class="rp">Rp</div>
<input type="text" name="harga" id="harga" placeholder="Masukkan Harga" onkeypress="return isNumber(event)" onpaste="return false;">
</div>
</div>
</div>
</div>
<!-- Pengelolaan Produk -->
<div class="col-10 border border-secondary rounded p-4 my-3">
<h5>Pengelolaan Produk</h5>
<br>
<!-- Stok Produk -->
<div class="row my-3">
<div class="col-4">
<h6>Stok Produk</h6>
</div>
<div class="col-8">
<input type="text" name="stok" id="stok" placeholder="Input jumlah stok" onkeypress="return isNumber(event)" onpaste="return false;">
</div>
</div>
</div>
<!-- Berat & Pengiriman-->
<div class="col-10 border border-secondary rounded p-4 my-3">
<h5>Berat & Pengiriman</h5>
<br>
<!-- Stok Produk -->
<div class="row my-3">
<div class="col-4">
<h6>Berat Produk</h6>
<p class="f-12">Masukkan berat dengan menimbang produk setelah dikemas.</p>
</div>
<div class="col-8">
<input type="text" name="berat" id="berat" class="w-50" placeholder="Input berat produk" onkeypress="return isNumber(event)" onpaste="return false;">
<select id="satuanBerat" name="satuanBerat" style="width: 40%;">
</select>
</div>
</div>
</div>
<div class="row my-3 text-right">
<div class="col-10 footer-btn">
<input type="submit" class="btn btn-success ml-1 f-12 font-weight-bold" id="add-product-btn" value="Simpan">
</div>
</div>
</div>
</form>
</div>
</div>
<script>
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if ( (charCode > 31 && charCode < 48) || charCode > 57) { return false; }
return true;
}
function isnotNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if ( (charCode > 32 && charCode < 65) || charCode > 90 && charCode < 97 || charCode > 122) { return false; }
return true;
}
$(function(){
// get kategori
$.ajax({
url: "get_kategori.php",
method: "GET",
success: function(result) {
$("#kategori").html('<option value="" hidden>Pilih Kategori</option>');
result.forEach(function(kategori){
var row = $("<option value=" + kategori['id'] + ">" + kategori['nama'] +"</option>");
$("#kategori").append(row);
});
},
error: function(result) {
}
});
$.ajax({
url: "get_berat.php",
method: "GET",
success: function(result) {
$("#satuanBerat").html('<option value="" hidden>Pilih Satuan</option>');
result.forEach(function(berat){
var row = $("<option value=" + berat['id'] + ">" + berat['nama'] +"</option>");
$("#satuanBerat").append(row);
});
},
error: function(result) {
}
});
});
</script>
</body>
</html>