-
Notifications
You must be signed in to change notification settings - Fork 0
/
add.php
executable file
·270 lines (269 loc) · 14.2 KB
/
add.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
<?php
require_once 'include/Class_DB.php';
require_once 'include/login/auth.php';
require_once 'include/debug.php';
// Get some personal data. ID, currency, measurement unit
$owner = $_SESSION['SESS_MEMBER_ID'];
$GetPersonal = $db->query('SELECT currency, measurement FROM members WHERE member_id = \'' .(int)$owner. '\'');
$personal = $db->fetch_assoc($GetPersonal);
?>
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="include/style.css" media="screen"/>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="description" content="Add a component to your database."/>
<meta name="keywords" content="electronics, components, database, project, inventory"/>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="img/apple.png" />
<title>Add component - ecDB</title>
<script type="text/javascript" src="include/autocomplete/jquery.js"></script>
<script type="text/javascript" src="include/autocomplete/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="include/autocomplete/jquery.autocomplete.css" />
<script type="text/javascript">
$().ready(function() {
$("#name").autocomplete("include/autocomplete/autocomplete_name.php", {
width: 150,
matchContains: true,
minChars: 2,
selectFirst: false
});
});
</script>
<script type="text/javascript">
$().ready(function() {
$("#package").autocomplete("include/autocomplete/autocomplete_package.php", {
width: 150,
matchContains: true,
minChars: 2,
selectFirst: false
});
});
</script>
<script type="text/javascript">
$().ready(function() {
$("#manufacturer").autocomplete("include/autocomplete/autocomplete_manufacturer.php", {
width: 150,
matchContains: true,
minChars: 2,
selectFirst: false
});
});
</script>
<?php include_once 'include/analytics.php' ?>
</head>
<body onLoad="document.forms.add.name.focus()">
<div id="wrapper">
<!-- Header -->
<?php include 'include/header.php'; ?>
<!-- END -->
<!-- Main menu -->
<?php include 'include/menu.php'; ?>
<!-- END -->
<!-- Main content -->
<div id="content">
<?php
include 'include/include.php';
$Add = new ShowComponents;
$Add->Add();
?>
<form class="globalForms noPadding" action="" method="post" id="add">
<div class="textBoxInput">
<label class="keyWord boldText">Comment</label>
<div class="text">
<textarea name="comment" rows="14" style="resize: both !important;"><?php if(isset($_POST['submit'])) { echo $_POST['comment']; } ?></textarea>
</div>
</div>
<table class="globalTables leftAlign noHover" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="boldText">Name</td>
<td>
<input name="name" id="name" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['name']; } ?>" autofocus tabindex="0"/>
</td>
<td class="boldText">Category</td>
<td>
<select name="category">
<?php
// Include the category selector menu.
include 'include/include_component_add_category_menu.php';
$MenuCat = new AddMenuCat;
$MenuCat->MenuCat();
?>
</select>
</td>
<td class="boldText">Quantity</td>
<td>
<input name="quantity" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['quantity']; } ?>" />
</td>
</tr>
<tr>
<td class="boldText">Manufacturer</td>
<td>
<input name="manufacturer" id="manufacturer" class="medium" type="text" value="<?php if(isset($_POST['submit'])) { echo $_POST['manufacturer']; } ?>" />
</td>
<td class="boldText">Package</td>
<td>
<input name="package" id="package" class="medium" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['package']; } ?>" />
</td>
<td class="boldText">Pins</td>
<td>
<input name="pins" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['pins']; } ?>" />
</td>
</tr>
<tr>
<td class="boldText">Location</td>
<td>
<input name="location" id="location" class="medium" type="text" value="<?php if(isset($_POST['submit'])) { echo $_POST['location']; } ?>" />
</td>
<td class="boldText">Price</td>
<td>
<input name="price" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['price']; } ?>" /> <?php echo $personal['currency']; ?>
</td>
<td class="boldText">To order</td>
<td>
<input name="orderquant" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['orderquant']; } ?>" />
</td>
</tr>
<tr>
<td colspan="6"></td>
</tr>
<tr>
<td class="boldText">SMD</td>
<td>
<?php
if(isset($_POST['submit']) && $_POST['smd'] == 'Yes'){
echo '<input type="radio" name="smd" value="Yes" checked="checked" /> Yes ';
echo '<input type="radio" name="smd" value="No" /> No';
}
else{
echo '<input type="radio" name="smd" value="Yes" /> Yes ';
echo '<input type="radio" name="smd" value="No" checked="checked" /> No';
}
?>
</td>
<td class="boldText">Scrap</td>
<td>
<?php
if(isset($_POST['submit']) && $_POST['scrap'] == 'Yes'){
echo '<input type="radio" name="scrap" value="Yes" checked="checked" /> Yes ';
echo '<input type="radio" name="scrap" value="No" /> No';
}
else{
echo '<input type="radio" name="scrap" value="Yes" /> Yes ';
echo '<input type="radio" name="scrap" value="No" checked="checked" /> No';
}
?>
</td>
<td class="boldText">Public</td>
<td>
<?php
if(isset($_POST['submit']) && $_POST['public'] == 'No'){
echo '<input type="radio" name="public" value="Yes" /> Yes ';
echo '<input type="radio" name="public" value="No" checked="checked" /> No';
}
else{
echo '<input type="radio" name="public" value="Yes" checked="checked" /> Yes ';
echo '<input type="radio" name="public" value="No" /> No';
}
?>
</td>
</tr>
<tr>
<td colspan="6"></td>
</tr>
<tr>
<td class="boldText">Weight</td>
<td>
<input name="weight" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['weight']; } ?>" /> <?php if($personal['measurement'] == 1){echo 'g';} else {echo 'g'; } ?>
</td>
<td class="boldText">Width</td>
<td>
<input name="width" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['width']; } ?>" /> <?php if($personal['measurement'] == 1){echo 'mm';} else {echo 'in'; } ?>
</td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td></td>
<td class="boldText">Depth</td>
<td>
<input name="depth" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['depth']; } ?>" /> <?php if($personal['measurement'] == 1){echo 'mm';} else {echo 'in'; } ?>
</td>
<td><img class="packageImage" border="0" src="img/boxSize.png"/></td>
<td></td>
</tr>
<tr>
<td class="boldText">Datasheet URL</td>
<td>
<input name="datasheet" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['datasheet']; } ?>" />
</td>
<td class="boldText">Height</td>
<td>
<input name="height" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['height']; } ?>" /> <?php if($personal['measurement'] == 1){echo 'mm';} else {echo 'in'; } ?>
</td>
<td colspan="4"></td>
</tr>
<tr>
<td colspan="6"></td>
</tr>
<tr>
<td class="boldText">Image URL 1</td>
<td>
<input name="url1" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['url1']; } ?>" />
</td>
<td class="boldText">Image URL 2</td>
<td>
<input name="url2" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['url2']; } ?>" />
</td>
<td colspan="2"></td>
</tr>
<tr>
<td class="boldText">Image URL 3</td>
<td>
<input name="url3" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['url3']; } ?>" />
</td>
<td class="boldText">Image URL 4</td>
<td>
<input name="url4" type="text" class="medium" value="<?php if(isset($_POST['submit'])) { echo $_POST['url4']; } ?>" />
</td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td class="boldText">Add component to project</td>
<td class="boldText">Quantity</td>
<td colspan="3"></td>
</tr>
<tr>
<td></td>
<td>
<select name="project">
<?php
include('include/include_component_add_project.php');
$MenuProj = new AddMenuProj;
$MenuProj->MenuProj();
?>
</select>
</td>
<td>
<input name="projquant" type="text" class="small" value="<?php if(isset($_POST['submit'])) { echo $_POST['projquant']; } ?>" />
</td>
<td colspan="3"></td>
</tr>
</tbody>
</table>
<div class="buttons">
<div class="input">
<button class="button green" name="submit" type="submit"><span class="icon medium save"></span> Save</button>
</div>
</div>
</form>
</div>
<!-- END -->
<!-- Text outside the main content -->
<?php include 'include/footer.php'; ?>
<!-- END -->
</div>
</body>
</html>