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(); exit();
} }
$labeltype = "machineid"; $labeltype = array_keys($SETTINGS["labels"]["templates"])[0];
if (!empty($VARS["labeltype"])) {
switch ($VARS["labeltype"]) { if (!empty($VARS["labeltype"]) && array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) {
case "doortag": $labeltype = $VARS["labeltype"];
$labeltype = "doortag";
break;
case "machineidanonymous":
$labeltype = "machineidanonymous";
break;
case "pickupslip":
$labeltype = "pickupslip";
break;
case "machineid":
default:
$labeltype = "machineid";
}
} }
$machine = new Machine($machineid); $machine = new Machine($machineid);
$pdfurl = "./print/print.php?labeltype=$labeltype&id=$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"> <div class="d-flex">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="nav-item"> <?php
<a class="nav-link<?php echo ($labeltype == "machineid" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>">ID Label</a> foreach ($SETTINGS["labels"]["templates"] as $id => $display) {
</li> ?>
<li class="nav-item"> <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> <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> </li>
<li class="nav-item"> <?php
<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>
</ul> </ul>
<div class="ml-auto"> <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> <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."); exit("No such machine.");
} }
$labeltype = "machineid"; $labeltype = array_keys($SETTINGS["labels"]["templates"])[0];
switch ($VARS["labeltype"]) {
case "doortag": if (array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) {
$labeltype = "doortag"; $labeltype = $VARS["labeltype"];
break;
case "machineidanonymous":
$labeltype = "machineidanonymous";
break;
case "pickupslip":
$labeltype = "pickupslip";
break;
case "machineid":
default:
$labeltype = "machineid";
} }
$machine = new Machine($machineid); $machine = new Machine($machineid);
$mergedata = [ $mergedata = [
"id" => $machine->getID(), "id" => $machine->getID(),
"link" => str_replace("{{id}}", $machine->getID(), $SETTINGS["branding"]["trackinglink"]),
"price" => number_format($machine->getPrice(), 2), "price" => number_format($machine->getPrice(), 2),
"devicetype" => $machine->getTypeLabel(), "devicetype" => $machine->getTypeLabel(),
"devicetype_lowercase" => strtolower($machine->getTypeLabel()), "devicetype_lowercase" => strtolower($machine->getTypeLabel()),
@ -61,9 +51,13 @@ $mergedata = [
"clientbillingaddress" => "", "clientbillingaddress" => "",
"clientshippingaddress" => "", "clientshippingaddress" => "",
"clientpublicnotes" => "", "clientpublicnotes" => "",
"clientprivatenotes" => "", "clientprivatenotes" => ""
]; ];
foreach ($SETTINGS["labels"]["fields"] as $id => $val) {
$mergedata[$id] = str_replace("{{id}}", $machine->getID(), $val);
}
/** /**
* https://stackoverflow.com/a/14167216 * https://stackoverflow.com/a/14167216
*/ */

Binary file not shown.

Binary file not shown.

@ -37,10 +37,30 @@ $SETTINGS = [
// Name of the app. // Name of the app.
"site_title" => "MachineManager", "site_title" => "MachineManager",
"branding" => [ "branding" => [
"machineidnumber" => "Netsyms device ID number, machine ID number", // Title of public tracking page
"shortmachineid" => "Device ID Number",
"publictitle" => "Device Lookup", "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. // Settings for connecting to the AccountHub server.
"accounthub" => [ "accounthub" => [

Loading…
Cancel
Save