Add API to get machine form fields without looking up machine
This commit is contained in:
parent
35714f96b9
commit
a28062ae8a
@ -23,7 +23,7 @@ if (!empty($VARS["id"])) {
|
|||||||
$user = getRequestUser();
|
$user = getRequestUser();
|
||||||
|
|
||||||
|
|
||||||
if ($VARS["action"] != "lookup") {
|
if ($VARS["action"] != "lookup" && $VARS["action"] != "getmachineformfields") {
|
||||||
|
|
||||||
if (!$user->hasPermission("MACHINEMANAGER_EDIT")) {
|
if (!$user->hasPermission("MACHINEMANAGER_EDIT")) {
|
||||||
http_response_code(403);
|
http_response_code(403);
|
||||||
|
@ -60,6 +60,10 @@ $APIS = [
|
|||||||
"publicnotes (optional)" => "string"
|
"publicnotes (optional)" => "string"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"getmachineformfields" => [
|
||||||
|
"load" => "machine.php",
|
||||||
|
"vars" => []
|
||||||
|
],
|
||||||
"getclient" => [
|
"getclient" => [
|
||||||
"load" => "client.php",
|
"load" => "client.php",
|
||||||
"vars" => [
|
"vars" => [
|
||||||
|
@ -148,7 +148,59 @@ class Machine implements JsonSerializable {
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return [];
|
return [
|
||||||
|
"status" => "OK",
|
||||||
|
"id" => "",
|
||||||
|
"icon" => "",
|
||||||
|
"type" => [
|
||||||
|
"id" => "",
|
||||||
|
"label" => ""
|
||||||
|
],
|
||||||
|
"clientinfo" => [],
|
||||||
|
"info" => [],
|
||||||
|
"events" => [],
|
||||||
|
"components" => [],
|
||||||
|
"formdata" => [
|
||||||
|
"options" => [
|
||||||
|
"clientid" => ["" => ""] + Clients::getAllAsIDNameArray(),
|
||||||
|
"type" => Machine::getTypeList()
|
||||||
|
],
|
||||||
|
"inputtypes" => [
|
||||||
|
"model" => "text",
|
||||||
|
"condition" => "number",
|
||||||
|
"price" => "number",
|
||||||
|
"os" => "text",
|
||||||
|
"serial" => "text",
|
||||||
|
"manufacturer" => "text",
|
||||||
|
"clientid" => "select",
|
||||||
|
"privatenotes" => "textarea",
|
||||||
|
"publicnotes" => "textarea",
|
||||||
|
"type" => "select"
|
||||||
|
],
|
||||||
|
"labels" => [
|
||||||
|
"model" => $Strings->get("Model", false),
|
||||||
|
"condition" => $Strings->get("Condition", false),
|
||||||
|
"price" => $Strings->get("Price", false),
|
||||||
|
"os" => $Strings->get("OS/Software", false),
|
||||||
|
"serial" => $Strings->get("Serial", false),
|
||||||
|
"manufacturer" => $Strings->get("Manufacturer", false),
|
||||||
|
"clientid" => $Strings->get("Client", false),
|
||||||
|
"privatenotes" => $Strings->get("Private Notes", false),
|
||||||
|
"publicnotes" => $Strings->get("Public Notes", false),
|
||||||
|
"type" => $Strings->get("Type", false)
|
||||||
|
],
|
||||||
|
"icons" => [
|
||||||
|
"model" => "fas fa-hashtag",
|
||||||
|
"condition" => "fas fa-star-half-alt",
|
||||||
|
"price" => "fas fa-money-bill-wave",
|
||||||
|
"os" => "fas fa-hdd",
|
||||||
|
"serial" => "fas fa-barcode",
|
||||||
|
"manufacturer" => "fas fa-industry",
|
||||||
|
"privatenotes" => "fas fa-comment-dots",
|
||||||
|
"publicnotes" => "far fa-comment-dots"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toHTMLListGroup(bool $public = true): string {
|
public function toHTMLListGroup(bool $public = true): string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user