User management with native gui and further improvements
This commit is contained in:
+16
-2
@@ -61,8 +61,10 @@ switch ($submit = form_get_action()) {
|
||||
$p[':weight'] = min(gpc_get_float($_POST, 'weight'), 999.99); // limit max value
|
||||
$p[':weight_net'] = min(gpc_get_float($_POST, 'weight_net'), 999.99);
|
||||
$p[':unit'] = gpc_get_int($_POST, 'unit');
|
||||
$p[':calories'] = gpc_get_uint($_POST, 'calories');
|
||||
$p[':storedate'] = gpc_get_string($_POST, 'storedate');
|
||||
$p[':shelflife'] = gpc_get_string($_POST, 'shelflife');
|
||||
$p[':price'] = gpc_get_currency($_POST, 'price');
|
||||
$p[':sid'] = gpc_get_int($_POST, 'sid');
|
||||
if ($p[':sid'] <= 0) $p[':sid'] = NULL;
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
@@ -269,7 +271,7 @@ elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$sql = "SELECT provname, provcat, number, target, unit, weight, weight_net,"
|
||||
. " storedate, shelflife, sid, remarks "
|
||||
. " calories, storedate, shelflife, price, sid, remarks "
|
||||
. "FROM provisions "
|
||||
. "WHERE provid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -284,9 +286,11 @@ echo "<tr><th>", _('Target'), "</th><td>", $prov->target, "</td></tr>\n";
|
||||
echo "<tr><th>", _('Weight'), "</th><td>", format_float($prov->weight, 2, 'kg'), "</td></tr>\n";
|
||||
echo "<tr><th>", _('Weight net'), "</th><td>", format_float($prov->weight_net, 2, 'kg'), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Unit'),"</th><td>", $opt_unit[$prov->unit], "</td></tr>\n";
|
||||
echo "<tr><th>", _('Calories'), "</th><td>", $prov->calories, " kcal</td></tr>\n";
|
||||
echo '<tr><th>', _('Category'),"</th><td>", $opt_category[$prov->provcat] ?? 'n/a', "</td></tr>\n";
|
||||
echo '<tr><th>', _('Storedate'),"</th><td>", $prov->storedate, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Shelflife'),"</th><td>", $prov->shelflife, "</td></tr>\n";
|
||||
echo '<tr><th>', _('Price'), "</th><td>", format_currency($prov->price), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Storage'),"</th><td>", ($opt_storage[$prov->sid] ?? ''), "</td></tr>\n";
|
||||
echo '<tr><th>', _('Remarks'),"</th><td>", nl2br($prov->remarks), "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
@@ -297,7 +301,7 @@ elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$sql = "SELECT provname, provcat, number, target, unit, weight, weight_net,"
|
||||
. " storedate, shelflife, sid, remarks "
|
||||
. " calories, storedate, shelflife, price, sid, remarks "
|
||||
. "FROM provisions "
|
||||
. "WHERE provid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -330,6 +334,12 @@ echo '<h2>', _('Edit provision'), "</h2>\n";
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('unit', _('Unit'), $opt_unit, $prov->unit);
|
||||
?>
|
||||
<div class="mb-3">
|
||||
<label for="target"><?=_('Calories per Unit (kcal)')?></label>
|
||||
<input type="number" min="0" max="65000" class="form-control" id="calories" name="calories" value="<?=$prov->calories ?>">
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('provcat', _('Category'), $g_opt_none + $opt_category, $prov->provcat);
|
||||
?>
|
||||
<div class="mb-3">
|
||||
@@ -340,6 +350,10 @@ form_create_select('provcat', _('Category'), $g_opt_none + $opt_category, $prov-
|
||||
<label for="shelflife"><?=_('Shelflife')?></label>
|
||||
<input type="date" class="form-control" id="shelflife" name="shelflife" value="<?=$prov->shelflife ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="price" class="form-label"><?=sprintf(_('Price, %s'), $g_lconv['currency_symbol']); ?></label>
|
||||
<input type="text" class="form-control" id="price" name="price" value="<?=format_float($prov->price) ?>">
|
||||
</div>
|
||||
<?php
|
||||
form_create_select('sid', _('Storage'), $g_opt_none + $opt_storage, $prov->sid);
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user