|
|
|
@ -52,7 +52,8 @@ class Machine implements JsonSerializable {
|
|
|
|
|
"components" => $this->components,
|
|
|
|
|
"formdata" => [
|
|
|
|
|
"options" => [
|
|
|
|
|
"clientid" => Clients::getAllAsIDNameArray()
|
|
|
|
|
"clientid" => Clients::getAllAsIDNameArray(),
|
|
|
|
|
"type" => Machine::getTypeList()
|
|
|
|
|
],
|
|
|
|
|
"inputtypes" => [
|
|
|
|
|
"model" => "text",
|
|
|
|
@ -63,7 +64,9 @@ class Machine implements JsonSerializable {
|
|
|
|
|
"manufacturer" => "text",
|
|
|
|
|
"clientid" => "select",
|
|
|
|
|
"privatenotes" => "textarea",
|
|
|
|
|
"publicnotes" => "textarea"
|
|
|
|
|
"publicnotes" => "textarea",
|
|
|
|
|
"type" => "select",
|
|
|
|
|
"deleted" => "hidden"
|
|
|
|
|
],
|
|
|
|
|
"labels" => [
|
|
|
|
|
"model" => $Strings->get("Model", false),
|
|
|
|
@ -74,7 +77,8 @@ class Machine implements JsonSerializable {
|
|
|
|
|
"manufacturer" => $Strings->get("Manufacturer", false),
|
|
|
|
|
"clientid" => $Strings->get("Client", false),
|
|
|
|
|
"privatenotes" => $Strings->get("Private Notes", false),
|
|
|
|
|
"publicnotes" => $Strings->get("Public Notes", false)
|
|
|
|
|
"publicnotes" => $Strings->get("Public Notes", false),
|
|
|
|
|
"type" => $Strings->get("Type", false)
|
|
|
|
|
],
|
|
|
|
|
"icons" => []
|
|
|
|
|
]
|
|
|
|
@ -121,6 +125,27 @@ class Machine implements JsonSerializable {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getTypeList(): array {
|
|
|
|
|
global $database;
|
|
|
|
|
$typelist = [];
|
|
|
|
|
foreach ($database->select("machine_types", ["machinetypeid (id)", "typename (name)"]) as $t) {
|
|
|
|
|
$typelist[$t["id"]] = $t["name"];
|
|
|
|
|
}
|
|
|
|
|
return $typelist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getTypeListWithIcons(): array {
|
|
|
|
|
global $database;
|
|
|
|
|
$typelist = [];
|
|
|
|
|
foreach ($database->select("machine_types", ["machinetypeid (id)", "typename (name)", "icon"]) as $t) {
|
|
|
|
|
$typelist[$t["id"]] = [
|
|
|
|
|
"name" => $t["name"],
|
|
|
|
|
"icon" => $t["icon"]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return $typelist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function save() {
|
|
|
|
|
global $database;
|
|
|
|
|
if ($this->exists) {
|
|
|
|
|