Make component tested date/time optional
This commit is contained in:
parent
c06d2f7951
commit
6a26365168
14
action.php
14
action.php
@ -68,11 +68,15 @@ switch ($VARS['action']) {
|
||||
$component->setMachineID($VARS['machine']);
|
||||
$component->setSerial($VARS['serial']);
|
||||
$component->setTypeID($VARS['type']);
|
||||
$component->setTestedDate(date(
|
||||
"Y-m-d H:i:s",
|
||||
strtotime($VARS['date'] . " " . $VARS['time'])
|
||||
)
|
||||
);
|
||||
if (!empty($VARS['date'])) {
|
||||
$component->setTestedDate(date(
|
||||
"Y-m-d H:i:s",
|
||||
strtotime(trim($VARS['date'] . " " . $VARS['time']))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$component->clearTestedDate();
|
||||
}
|
||||
$component->setCapacity($VARS['capacity']);
|
||||
$component->setModel($VARS['model']);
|
||||
$component->setPrice($VARS['price'] * 1.0);
|
||||
|
@ -140,6 +140,10 @@ class Component {
|
||||
$this->component["tested"] = date("Y-m-d H:i:s", strtotime($tested));
|
||||
}
|
||||
|
||||
public function clearTestedDate() {
|
||||
$this->component["tested"] = null;
|
||||
}
|
||||
|
||||
public function setCapacity(string $capacity) {
|
||||
$this->component["capacity"] = $capacity;
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ if (!empty($component->getTestedDate())) {
|
||||
}
|
||||
$form->addInput("serial", $component->getSerial(), "text", false, null, null, "Serial", "fas fa-barcode", 4, 0, 200);
|
||||
$form->addInput("type", $component->getTypeID(), "select", false, null, $types, "Type", "fas fa-list");
|
||||
$form->addInput("date", $date, "date", true, null, null, "Tested Date", "fas fa-calendar");
|
||||
$form->addInput("time", $time, "time", true, null, null, "Tested Time", "fas fa-clock");
|
||||
$form->addInput("date", $date, "date", false, null, null, "Tested Date", "fas fa-calendar");
|
||||
$form->addInput("time", $time, "time", false, null, null, "Tested Time", "fas fa-clock");
|
||||
$form->addInput("capacity", $component->getCapacity(), "text", false, null, null, "Capacity", "fas fa-database", 4, 0, 200);
|
||||
$form->addInput("model", $component->getModel(), "text", false, null, null, "Model", "fas fa-hashtag", 4, 0, 200);
|
||||
$form->addInput("price", $component->getPrice(), "number", false, null, null, "Price", "fas fa-money-bill-wave");
|
||||
|
@ -31,7 +31,7 @@ if ($editing) {
|
||||
$form->setID("editmachine");
|
||||
|
||||
$form->addHiddenInput("action", "editmachine");
|
||||
$form->addHiddenInput("source", "editmachine");
|
||||
$form->addHiddenInput("source", "viewmachine");
|
||||
|
||||
$clients = [
|
||||
"" => ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user