add a delivery date to the demands
This commit is contained in:
parent
ae050b7923
commit
b08ea12eda
|
@ -49,6 +49,8 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
Minimum required pieces<br>
|
Minimum required pieces<br>
|
||||||
<input type='number' name='piecesMin' value='' required><br>
|
<input type='number' name='piecesMin' value='' required><br>
|
||||||
<br>
|
<br>
|
||||||
|
Delivery Date in YYYY-MM-DD format<br>
|
||||||
|
<input type='date' name='deliveryDate' value='' required><br>
|
||||||
Description<br>
|
Description<br>
|
||||||
<textarea rows='6' cols='40' name='text' required></textarea><br>
|
<textarea rows='6' cols='40' name='text' required></textarea><br>
|
||||||
<button type='submit' name='submit'>SUBMIT</button>
|
<button type='submit' name='submit'>SUBMIT</button>
|
||||||
|
|
|
@ -38,6 +38,7 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
$demandId = $_POST['demandId'];
|
$demandId = $_POST['demandId'];
|
||||||
$piecesMax = $_POST['piecesMax'];
|
$piecesMax = $_POST['piecesMax'];
|
||||||
$piecesMin = $_POST['piecesMin'];
|
$piecesMin = $_POST['piecesMin'];
|
||||||
|
$deliveryDate = $_POST['deliveryDate'];
|
||||||
$title= $_POST['title'];
|
$title= $_POST['title'];
|
||||||
$text = $_POST['text'];
|
$text = $_POST['text'];
|
||||||
|
|
||||||
|
@ -48,11 +49,13 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
Maximum required pieces<br/>
|
Maximum required pieces<br/>
|
||||||
<input type='number' name='piecesMax' value='".$piecesMax."'> <br />
|
<input type='number' name='piecesMax' value='".$piecesMax."'> <br />
|
||||||
Minimum required pieces<br/>
|
Minimum required pieces<br/>
|
||||||
<input type='number' name='piecesMin' value='".$piecesMin."'>
|
<input type='number' name='piecesMin' value='".$piecesMin."'><br>
|
||||||
|
Delivery Date in YYYY-MM-DD format<br>
|
||||||
|
<input type='date' name='deliveryDate' value='".$deliveryDate."'><br>
|
||||||
<br /> Description<br/>
|
<br /> Description<br/>
|
||||||
<textarea name='text'>".$text."</textarea><br />
|
<textarea name='text'>".$text."</textarea><br />
|
||||||
<button type='submit' name='edit'>Edit</button>
|
<button type='submit' name='edit'>Edit</button>
|
||||||
</form>";
|
</form>";
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -77,6 +77,7 @@ function post_demand ()
|
||||||
$piecesMax = $_POST['piecesMax'];
|
$piecesMax = $_POST['piecesMax'];
|
||||||
$piecesMin = $_POST['piecesMin'];
|
$piecesMin = $_POST['piecesMin'];
|
||||||
$qualityId = $_POST['quality'];
|
$qualityId = $_POST['quality'];
|
||||||
|
$deliveryDate = $_POST['deliveryDate'];
|
||||||
$title = $_POST['title'];
|
$title = $_POST['title'];
|
||||||
$text = $_POST['text'];
|
$text = $_POST['text'];
|
||||||
// Inserts Data into Database
|
// Inserts Data into Database
|
||||||
|
@ -86,9 +87,10 @@ function post_demand ()
|
||||||
</strong>";
|
</strong>";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO demands (piecesMax, piecesMin, demandText,
|
$sql = "INSERT INTO demands (piecesMax, piecesMin, demandText,
|
||||||
demandTitle, userId, qualityId)
|
demandTitle, userId, deliveryDate,
|
||||||
|
qualityId)
|
||||||
VALUES ('$piecesMax', '$piecesMin', '$text', '$title',
|
VALUES ('$piecesMax', '$piecesMin', '$text', '$title',
|
||||||
'$userId', '$qualityId')";
|
'$userId', '$deliveryDate', '$qualityId')";
|
||||||
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
|
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,6 +123,7 @@ function get_demand_titles ()
|
||||||
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
||||||
<input type='hidden' name='piecesMax' value='".$row['piecesMax']."'>
|
<input type='hidden' name='piecesMax' value='".$row['piecesMax']."'>
|
||||||
<input type='hidden' name='piecesMin' value='".$row['piecesMin']."'>
|
<input type='hidden' name='piecesMin' value='".$row['piecesMin']."'>
|
||||||
|
<input type='hidden' name='deliveryDate' value='".$row['deliveryDate']."'>
|
||||||
<input type='hidden' name='title' value='".$row['demandTitle']."'>
|
<input type='hidden' name='title' value='".$row['demandTitle']."'>
|
||||||
<input type='hidden' name='text' value='".$row['demandText']."'>
|
<input type='hidden' name='text' value='".$row['demandText']."'>
|
||||||
<button>Edit</button>
|
<button>Edit</button>
|
||||||
|
@ -138,6 +141,7 @@ function edit_demand ()
|
||||||
$demandId = $_POST['demandId'];
|
$demandId = $_POST['demandId'];
|
||||||
$piecesMax = $_POST['piecesMax'];
|
$piecesMax = $_POST['piecesMax'];
|
||||||
$piecesMin = $_POST['piecesMin'];
|
$piecesMin = $_POST['piecesMin'];
|
||||||
|
$deliveryDate = $_POST['deliveryDate'];
|
||||||
$title = $_POST['title'];
|
$title = $_POST['title'];
|
||||||
$text = $_POST['text'];
|
$text = $_POST['text'];
|
||||||
|
|
||||||
|
@ -151,7 +155,8 @@ function edit_demand ()
|
||||||
SET piecesMax='$piecesMax',
|
SET piecesMax='$piecesMax',
|
||||||
piecesMin='$piecesMin',
|
piecesMin='$piecesMin',
|
||||||
demandTitle='$title',
|
demandTitle='$title',
|
||||||
demandText='$text'
|
demandText='$text',
|
||||||
|
deliveryDate='$deliveryDate'
|
||||||
WHERE demandId='$demandId'";
|
WHERE demandId='$demandId'";
|
||||||
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
|
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
|
||||||
header("Location: board.php");
|
header("Location: board.php");
|
||||||
|
@ -194,13 +199,33 @@ function show_demand ()
|
||||||
echo "<strong>Maximum required pieces: </strong>" . $demand_rows->piecesMax;
|
echo "<strong>Maximum required pieces: </strong>" . $demand_rows->piecesMax;
|
||||||
echo "<br>
|
echo "<br>
|
||||||
<br>";
|
<br>";
|
||||||
echo "<strong>Minimumrequired pieces: </strong>" . $demand_rows->piecesMin;
|
echo "<strong>Minimum required pieces: </strong>" . $demand_rows->piecesMin;
|
||||||
echo "<br>
|
echo "<br>
|
||||||
<br>";
|
<br>";
|
||||||
echo "<strong>Quality: </strong>" . $quality_rows->qualityName;
|
echo "<strong>Desired Date of Delivery: </strong>" . $demand_rows->deliveryDate;
|
||||||
|
echo "<br>
|
||||||
|
<br>";
|
||||||
|
echo "<strong>Desired Quality: </strong>" . $quality_rows->qualityName;
|
||||||
echo "<br>
|
echo "<br>
|
||||||
<br>
|
<br>
|
||||||
<strong>Description:</strong><br>";
|
<strong>Description:</strong><br>";
|
||||||
echo $demand_rows->demandText;
|
echo $demand_rows->demandText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function post_offer()
|
||||||
|
{
|
||||||
|
if (isset($_POST['submit'])) {
|
||||||
|
global $con;
|
||||||
|
$userId = get_userid();
|
||||||
|
$pieces = $_POST['pieces'];
|
||||||
|
$price = $_POST['price'];
|
||||||
|
$qualityId = $_POST['quality'];
|
||||||
|
$text = $_POST['text'];
|
||||||
|
// Inserts Data into Database
|
||||||
|
$sql = "INSERT INTO offers (pieces, text, price, userId, qualityId)
|
||||||
|
VALUES ('$pieces', '$text', '$price', '$userId', '$qualityId')";
|
||||||
|
$result = mysqli_query($con, $sql) or die(mysqli_error($con));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -31,5 +31,9 @@ include 'functions.php';
|
||||||
show_demand();
|
show_demand();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<form method= 'POST' action='add_offer.php'>
|
||||||
|
<button>Post Offer</button>
|
||||||
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -43,6 +43,7 @@ CREATE TABLE if not exists `demands` (
|
||||||
`piecesMin` int(11) NOT NULL,
|
`piecesMin` int(11) NOT NULL,
|
||||||
`piecesMax` int(11) DEFAULT NULL,
|
`piecesMax` int(11) DEFAULT NULL,
|
||||||
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`deliveryDate` varchar(10) NOT NULL,
|
||||||
`qualityId` int(11) NOT NULL,
|
`qualityId` int(11) NOT NULL,
|
||||||
`userId` int(11) NOT NULL,
|
`userId` int(11) NOT NULL,
|
||||||
`tagId` int(11) NULL,
|
`tagId` int(11) NULL,
|
||||||
|
@ -62,8 +63,11 @@ CREATE TABLE if not exists `offers` (
|
||||||
`delivery` bool NOT NULL,
|
`delivery` bool NOT NULL,
|
||||||
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`userId` int(11) NOT NULL,
|
`userId` int(11) NOT NULL,
|
||||||
|
`qualityId` int(11) NOT NULL,
|
||||||
CONSTRAINT `fk_offers_userId`
|
CONSTRAINT `fk_offers_userId`
|
||||||
FOREIGN KEY (userId) REFERENCES users (userId)
|
FOREIGN KEY (userId) REFERENCES users (userId),
|
||||||
|
CONSTRAINT `fk_offers_qualityId`
|
||||||
|
FOREIGN KEY (qualityId) REFERENCES quality (qualityId)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue