profil.php mit abfrage und join von angbot und nachfrage erstellt. db value typen etwas eingeschränkt. nav.php ergänzt und die Angebot abgabe fertig gemacht.
This commit is contained in:
parent
8c6777a48a
commit
9a01011829
|
@ -12,8 +12,36 @@
|
|||
|
||||
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// Einlesen des Angebots-Feld:
|
||||
if (isset($_POST['submit'])) {
|
||||
$angebot = $_POST['submitname_angebot'];
|
||||
$erfassung_id = $_POST['submitname_erfassungs_id'];
|
||||
//abfangen von falschen oder zu wehnig informationen.
|
||||
if($angebot=="") {
|
||||
$error[] = "du musst einen Preis für dein Angebot angeben!";
|
||||
} else if(strlen($angebot) > 9){
|
||||
$error[] = "Dein Preis sollte maximal 7 Stellen und 2 Nachkomastellen haben.";
|
||||
} else {
|
||||
try{
|
||||
$stmt = $db->prepare("INSERT INTO anbieter (benutzer_id, erfassungs_id, angebot_preis) VALUES (:benutzer_id, :erfassung_id, :angebot_preis)");
|
||||
$stmt->bindValue(':benutzer_id',$user_id);
|
||||
$stmt->bindValue(':erfassung_id',$erfassung_id);
|
||||
$stmt->bindValue(':angebot_preis',$angebot);
|
||||
$stmt->execute();
|
||||
/*** close the database connection ***/
|
||||
//$db = null;
|
||||
} catch(PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
$error[] = "Dein Angebot von Fr. $angebot wurde dem Nachfrager unterbreitet. Er wird das Angebot prüfen. Bei einer Annahme werden Sie eine E-Mail erhalten.";
|
||||
}
|
||||
}
|
||||
|
||||
//ID auslesen, welche vom Link mittels GET mitgegeben wurde
|
||||
$id=$_GET['id']
|
||||
if (isset($_GET['id'])) {
|
||||
$erfassung_id=$_GET['id'];
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -27,7 +55,7 @@
|
|||
<h1>Angebot abgeben:</h1>
|
||||
<p>Sie können zum gewählten Objekt nun ein Angebot abgeben.<br/>
|
||||
Bitte seien Sie sich bewusst dass der Nachfrager auf das Lieferdatum
|
||||
zählen wird. <?php echo $id ?>
|
||||
zählen wird.
|
||||
</p>
|
||||
<div class="inhalt">
|
||||
<table class="table">
|
||||
|
@ -38,26 +66,52 @@
|
|||
<th>Qualität</th>
|
||||
<th>Lieferdatum</th>
|
||||
<?php
|
||||
foreach ($db->query("SELECT * FROM nachfrager WHERE erfassungs_id = $id") as $row) {
|
||||
foreach ($db->query("SELECT * FROM nachfrager WHERE erfassungs_id = $erfassung_id") as $row) {
|
||||
echo
|
||||
"<tr>" .
|
||||
"<td>" . substr(htmlentities($row['nachfr_datum']),0,10) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_typ']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_menge']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_quali']) . " " . "</td>" .
|
||||
"<td>" . substr(htmlentities($row['nachfr_datum']),0,10) . " " .
|
||||
"</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_typ']) . " " .
|
||||
"</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_menge']) . " " .
|
||||
"</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_quali']) . " " .
|
||||
"</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_lieferdatum']) . " " .
|
||||
"</td>" .
|
||||
"</tr>" .
|
||||
"<tr>" .
|
||||
"<td colspan='5' class='titel'>" . "Beschreibung:" .
|
||||
"</td>" .
|
||||
"<td colspan='5' class='titel'>" . "Beschreibung:" . "</td>" .
|
||||
"</tr>" .
|
||||
"<tr>" .
|
||||
"<td colspan='5' class='beschreibung'>" . htmlentities($row['nachfr_beschr']) . "</td>" .
|
||||
"<td colspan='5' class='beschreibung'>" . htmlentities($row['nachfr_beschr']) . "</td>" .
|
||||
"</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
||||
<h5>Angebot in Fr.:</h5>
|
||||
<div>
|
||||
<input id="submit_angebot "type="float" name="submitname_angebot" value="" placeholder="zum beispiel: 1000.00"/>
|
||||
<!-- ich übermittle hier versteckt die Erfassungs ID
|
||||
damit die Zeile beim wiederaufruf auch angezeigt
|
||||
wird. -->
|
||||
<input id="submit_erfassungs_id" type="hidden" name = "submitname_erfassungs_id" value = "<?= $erfassung_id ?>" />
|
||||
</div>
|
||||
<div>
|
||||
<input class="btn" type="submit" name="submit" value="Angebot abgeben"/>
|
||||
</div>
|
||||
<br />
|
||||
<div id="error">
|
||||
<?php
|
||||
if(isset($error)){
|
||||
foreach($error as $error){
|
||||
echo $error;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`benutzer` (
|
|||
CREATE TABLE IF NOT EXISTS `bsldb`.`nachfrager` (
|
||||
`erfassungs_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`benutzer_id` int(11) NOT NULL,
|
||||
`nachfr_typ` varchar(15) NOT NULL,
|
||||
`nachfr_quali` varchar(15) NOT NULL,
|
||||
`nachfr_typ` varchar(35) NOT NULL,
|
||||
`nachfr_quali` tinyint(2) NOT NULL,
|
||||
`nachfr_menge` int(11) NOT NULL,
|
||||
`nachfr_lieferdatum` date,
|
||||
`nachfr_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
@ -43,11 +43,12 @@ CREATE TABLE IF NOT EXISTS `bsldb`.`nachfrager` (
|
|||
) ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bsldb`.`anbieter` (
|
||||
`angebot_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`benutzer_id` int(11) NOT NULL,
|
||||
`erfassungs_id` varchar(15) NOT NULL,
|
||||
`angebot_preis` varchar(255) NOT NULL,
|
||||
`angebot_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`angebot_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`benutzer_id` int(11) NOT NULL,
|
||||
`erfassungs_id` int(11) NOT NULL,
|
||||
`angebot_preis` DECIMAL(7,2) NOT NULL,
|
||||
`angebot_datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`angebot_id`),
|
||||
FOREIGN KEY (`benutzer_id`) REFERENCES benutzer(`benutzer_id`)
|
||||
FOREIGN KEY (`benutzer_id`) REFERENCES `benutzer` (benutzer_id),
|
||||
FOREIGN KEY (`erfassungs_id`) REFERENCES `nachfrager` (erfassungs_id)
|
||||
) ;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
<div class="inhalt">
|
||||
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
||||
<table class="table-unvsible"
|
||||
<table class="table table-unvsible"
|
||||
<tr>
|
||||
<td>Typ:</td>
|
||||
<td><input type="text" name="typ" value="" placeholder="zum beispiel: Schraube "/></td>
|
||||
|
@ -85,8 +85,13 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="textbox"><textarea rows="10" cols="60" name="beschrieb"></textarea></div>
|
||||
<span><input class="btn" type="submit" name="submit" /></span>
|
||||
<div id="textbox">
|
||||
<textarea rows="10" cols="60" name="beschrieb">
|
||||
</textarea>
|
||||
</div>
|
||||
<span>
|
||||
<input class="btn" type="submit" name="submit" value="Nachfrage erstellen" />
|
||||
</span>
|
||||
<span id="error">
|
||||
<?php
|
||||
if(isset($error)){
|
||||
|
|
|
@ -19,6 +19,13 @@
|
|||
<span class="menu">
|
||||
</span> erfassen
|
||||
</a>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<a href="profile.php">
|
||||
<span class="menu">
|
||||
</span> profile
|
||||
</a>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
|
|
@ -23,6 +23,39 @@
|
|||
<body>
|
||||
<?php include 'nav.php';?>
|
||||
<h1>Benutzerprofil</h1>
|
||||
<p>Passwortänderung:</p>
|
||||
<div class="inhalt">
|
||||
<table class="table">
|
||||
<caption>Deine Nachfragen:</caption>
|
||||
<th>Eintrag</th>
|
||||
<th>Typ</th>
|
||||
<th>Menge</th>
|
||||
<th>Qualität</th>
|
||||
<th>Lieferdatum</th>
|
||||
<th>Günstigstes Angebot</th>
|
||||
<?php
|
||||
foreach ($db->query("SELECT * FROM nachfrager
|
||||
LEFT JOIN anbieter
|
||||
ON nachfrager.erfassungs_id = anbieter.erfassungs_id
|
||||
WHERE nachfrager.benutzer_id = $user_id") as $row) {
|
||||
echo
|
||||
"<tr>" .
|
||||
"<td>" . substr(htmlentities($row['nachfr_datum']),0,10) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_typ']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_menge']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_quali']) . " " . "</td>" .
|
||||
"<td>" . htmlentities($row['nachfr_lieferdatum']) . " " . "</td>" .
|
||||
"<td>"; if (!empty(htmlentities($row['angebot_preis'])))
|
||||
{echo
|
||||
"Fr. " . htmlentities($row['angebot_preis']) . " " . "</td>";
|
||||
}else{echo
|
||||
"k. Angeb. bisher" . " " . "</td>";
|
||||
}
|
||||
echo
|
||||
"</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -86,7 +86,7 @@ caption{
|
|||
position: fixed;
|
||||
top: 20;
|
||||
left: 20;
|
||||
// width: 100%;
|
||||
width: 100%;
|
||||
border-spacing: 0px;
|
||||
text-align: left;
|
||||
max-width: 800px;
|
||||
|
@ -133,3 +133,13 @@ div > .eingabe{
|
|||
table-layout:fixed;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
.table-unvsible{
|
||||
|
||||
}
|
||||
#textbox{
|
||||
width:730px;
|
||||
}
|
||||
caption{
|
||||
padding: 15px 0px 15px 0px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue