-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patharticles.php
More file actions
116 lines (114 loc) · 4.33 KB
/
articles.php
File metadata and controls
116 lines (114 loc) · 4.33 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
<?php
$site_title = "Produkte";
include 'inc/header.inc.php';
$user = check_user();
if (isset($_POST["barcode"])) {
if (!empty($_POST['barcode'])) {
$name = $_POST['name'];
$description = $_POST['description'];
$barcode = $_POST['barcode'];
$price = $_POST['price'];
$quantity = $_POST['quantity'];
$article_color = $_POST['color'];
global $pdo;
$statement = $pdo->prepare( "INSERT INTO `articles` (`id`, `name`, `description`, `barcode`, `price`, `quantity`, `color`) VALUES (NULL, :name, :description, :barcode, :price, :quantity, :color);" );
$result = $statement->execute( array(
'name' => $name,
'description' => $description,
'barcode' => $barcode,
'price' => $price,
'quantity' => $quantity,
'color' => $article_color
));
}
}
?>
<div class="row">
<div class="col s9">
<div class="row article-row">
<?php
$sql = "SELECT * FROM articles";
foreach ($pdo->query($sql) as $row) {
echo '
<div class="">
<div class="card-panel article" style="background-color: '.$row['color'].'!important;">
<h6 class="white-text">Artikel '.$row['id'].': <i>'.$row['name'].'</i></h6>
<span class="white-text">Ausführung: '.$row['description'].'</span>
<br>
<span class="white-text">Preis: '.$row['price'].'€</span>
<br>
<span class="white-text">Barcode: '.$row['barcode'].'</span>
<div class="divider"></div>
<div class="card-action row card-row">
<a href="update_article.php?action=delete_article&article_id='.$row['id'].'" class="btn-flat col s4"><i class="material-icons">delete</i></a>
<a href="update_article.php?action=update_quantity&article_id='.$row['id'].'" class="btn-flat col s4"><i class="material-icons">library_add</i></a>
<a href="update_article.php?action=update_article&article_id='.$row['id'].'" class="btn-flat col s4"><i class="material-icons">edit</i></a>
</div>
</div>
</div>
';
}
?>
</div>
</div>
<div class="col s3">
<div class="collection">
<a href="#add-article" class="collection-item modal-trigger">
<i class="material-icons green-text">add</i>
<span class="grey-text">Artikel hinzufügen</span>
</a>
<a href="#!" class="collection-item">
<i class="material-icons blue-text">receipt</i>
<span class="grey-text">Barcode erzeugen</span>
</a>
</div>
</div>
</div>
<div id="add-article" class="modal ">
<div class="modal-content">
<h4>Artikel hinzufügen</h4>
<p>Füllen Sie alle Felder aus!</p>
<div class="row">
<form class="col s12" id="add-article" action="articles.php" method="post">
<div class="row">
<div class="input-field col s6">
<input id="name" name="name" type="text" class="validate" required>
<label for="name">Name des Artikels</label>
</div>
<div class="input-field col s6">
<input id="description" name="description" type="text" class="validate" required>
<label for="description">Ausführung des Artikels</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<input id="price" type="text" name="price" class="validate" required>
<label for="price">Preis des Artikels</label>
</div>
<div class="input-field col s6">
<input id="quantity" name="quantity" type="text" class="validate" required>
<label for="quantity">Anzahl des Artikels</label>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input id="barcode" name="barcode" type="text" class="validate" required>
<label for="barcode">Barcode des Artikels</label>
</div>
</div>
<div class="row">
<div class="input-fiel col s12 m3">
<label for="color-picker">Farbe auswählen:</label>
<input type="color" value="#ff8a80" id="color-picker" name="color">
</div>
</div>
<div class="divider"></div>
<br>
<button type="submit" class="waves-effect waves-light green btn-flat col s12">Submit</button>
</form>
</div>
</div>
</div>
<?php
include 'inc/footer.inc.php';
?>