Add Internal ID label, make more label fields customizable

master
Skylar Ittner 4 years ago
parent 9c96652c6a
commit 15d5834f78

@ -20,23 +20,12 @@ if (!Machine::exists($machineid)) {
exit();
}
$labeltype = "machineid";
if (!empty($VARS["labeltype"])) {
switch ($VARS["labeltype"]) {
case "doortag":
$labeltype = "doortag";
break;
case "machineidanonymous":
$labeltype = "machineidanonymous";
break;
case "pickupslip":
$labeltype = "pickupslip";
break;
case "machineid":
default:
$labeltype = "machineid";
}
$labeltype = array_keys($SETTINGS["labels"]["templates"])[0];
if (!empty($VARS["labeltype"]) && array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) {
$labeltype = $VARS["labeltype"];
}
$machine = new Machine($machineid);
$pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid";
@ -44,18 +33,15 @@ $pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid";
<div class="d-flex">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "machineid" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>">ID Label</a>
</li>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "pickupslip" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=pickupslip">Pickup Slip</a>
</li>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "doortag" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=doortag">Door Tag</a>
</li>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "machineidanonymous" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=machineidanonymous">ID Label (No "Property Of")</a>
</li>
<?php
foreach ($SETTINGS["labels"]["templates"] as $id => $display) {
?>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == $id ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=<?php echo $id; ?>"><?php echo $display; ?></a>
</li>
<?php
}
?>
</ul>
<div class="ml-auto">
<a href="./app.php?page=viewmachine&id=<?php echo $machine->getID(); ?>" class="btn btn-info btn-sm"><i class="fas fa-eye"></i> <?php $Strings->get("Go to machine"); ?></a>

@ -24,26 +24,16 @@ if (!Machine::exists($machineid)) {
exit("No such machine.");
}
$labeltype = "machineid";
switch ($VARS["labeltype"]) {
case "doortag":
$labeltype = "doortag";
break;
case "machineidanonymous":
$labeltype = "machineidanonymous";
break;
case "pickupslip":
$labeltype = "pickupslip";
break;
case "machineid":
default:
$labeltype = "machineid";
$labeltype = array_keys($SETTINGS["labels"]["templates"])[0];
if (array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) {
$labeltype = $VARS["labeltype"];
}
$machine = new Machine($machineid);
$mergedata = [
"id" => $machine->getID(),
"link" => str_replace("{{id}}", $machine->getID(), $SETTINGS["branding"]["trackinglink"]),
"price" => number_format($machine->getPrice(), 2),
"devicetype" => $machine->getTypeLabel(),
"devicetype_lowercase" => strtolower($machine->getTypeLabel()),
@ -61,9 +51,13 @@ $mergedata = [
"clientbillingaddress" => "",
"clientshippingaddress" => "",
"clientpublicnotes" => "",
"clientprivatenotes" => "",
"clientprivatenotes" => ""
];
foreach ($SETTINGS["labels"]["fields"] as $id => $val) {
$mergedata[$id] = str_replace("{{id}}", $machine->getID(), $val);
}
/**
* https://stackoverflow.com/a/14167216
*/

Binary file not shown.

Binary file not shown.

@ -37,10 +37,30 @@ $SETTINGS = [
// Name of the app.
"site_title" => "MachineManager",
"branding" => [
"machineidnumber" => "Netsyms device ID number, machine ID number",
"shortmachineid" => "Device ID Number",
// Title of public tracking page
"publictitle" => "Device Lookup",
"trackinglink" => "https://qr.ntsm.io/?t=mid&q={{id}}"
// Shown in public tracking page
"machineidnumber" => "Netsyms device ID number, machine ID number",
// Shown in public tracking page
"shortmachineid" => "Device/Machine ID Number",
"labels" => [
// Shown above machine ID barcodes on labels (key ${idnumbertitle})
"idnumbertitle" => "Netsyms Device ID #",
// Rendered to QR codes on labels (key ${link})
"link" => "https://qr.ntsm.io/?t=mid&q={{id}}",
// Rendered on labels (key ${linktitle_lg})
"linktitle_lg" => "Scan QR code or visit ntsm.io/pci for device\ninfo and tracking",
// Rendered on labels (key ${linktitle_sm})
"linktitle_sm" => "Scan QR code or visit ntsm.io/pci for device info and tracking",
// Rendered on labels (key ${linktitle_xl})
"linktitle_xl" => "You can check the status of your device by scanning the QR code, or by going to ntsm.io/pci and entering the Netsyms Device ID.",
// Rendered on labels (key ${companyname})
"companyname" => "Netsyms Technologies",
// Rendered on labels (key ${companyphone})
"companyphone" => "(406) 404-7177",
// Rendered on labels (key ${companywebsite})
"companywebsite" => "netsyms.com"
]
],
// Settings for connecting to the AccountHub server.
"accounthub" => [

Loading…
Cancel
Save