forked from Business/BinStack
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.8 KiB
PHP
78 lines
2.8 KiB
PHP
<?php
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
require_once __DIR__ . '/../required.php';
|
|
|
|
redirectifnotloggedin();
|
|
|
|
if ($database->count("locations") == 0 || $database->count("categories") == 0) {
|
|
header('Location: app.php?page=items&msg=noloccat');
|
|
die();
|
|
}
|
|
|
|
$itemdata = [
|
|
'text1' => '',
|
|
'qty' => ''];
|
|
|
|
if (!empty($VARS['id'])) {
|
|
if ($database->has('items', ['itemid' => $VARS['id']])) {
|
|
$itemdata = $database->select(
|
|
'items', [
|
|
'name',
|
|
'qty',
|
|
], [
|
|
'itemid' => $VARS['id']
|
|
])[0];
|
|
} else {
|
|
// item id is invalid, redirect to a page that won't cause an error when pressing Save
|
|
header('Location: app.php?page=removestock');
|
|
die();
|
|
}
|
|
}
|
|
?>
|
|
|
|
<form role="form" action="action.php" method="POST">
|
|
<div class="card border-green">
|
|
<h3 class="card-header text-green">
|
|
<i class="fas fa-edit"></i> <?php $Strings->build("removing stock", ['item' => "<span id=\"name_title\">" . htmlspecialchars($itemdata['name']) . "</span>"]); ?>
|
|
</h3>
|
|
<div class="card-body">
|
|
|
|
<div class="row">
|
|
<div class="col-12 col-md-3">
|
|
<div class="form-group">
|
|
<label for="stock"><i class="fas fa-hashtag"></i> <?php $Strings->get('quantity'); ?></label>
|
|
<input type="number" min="1" class="form-control" id="stock" name="stock" required="required" placeholder="<?php echo $itemdata['qty']; ?>" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-12 col-md-6">
|
|
<div class="form-group">
|
|
<label for="info1"><i class="fas fa-info"></i> <?php $Strings->get("Description"); ?></label>
|
|
<textarea class="form-control" id="info1" name="text1" required="required"></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" name="itemid" value="<?php
|
|
echo htmlspecialchars($VARS['id']);
|
|
?>" />
|
|
<input type="hidden" name="action" value="removestock" />
|
|
<?php
|
|
if (isset($_GET['source']) && $_GET['source'] === "item") {
|
|
echo '<input type="hidden" name="source" value="item" />';
|
|
} else {
|
|
echo '<input type="hidden" name="source" value="items" />';
|
|
}
|
|
?>
|
|
|
|
<div class="card-footer d-flex">
|
|
<button type="submit" class="btn btn-success mr-1"><i class="fas fa-save"></i> <?php $Strings->get("save"); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|