Standardize share toast notifications and fix PC scanning/editing

Share Toast Notifications:
- Unified toast style across all pages (purple gradient, top-right position)
- Updated displayapplication.asp, displaytopic.asp, displayudc.asp
- Updated printerlinksgenerator.asp (replaced alert with toast)
- Same text: "Link Copied!" / "This link will show the search term..."

PC Scanning/Editing Fixes:
- savedevicedirect.asp: Use machinetypeid=33 to detect PCs (not pctypeid)
- savedevicedirect.asp: Use new Dell TBD model (ID 110) for new PCs
- editpc.asp: Model dropdown includes current model even if vendor ispc=0
- editpc.asp: Fixed vendor query to use ispc=1 instead of ismachine=1

Database changes (manual):
- Set ispc=1 for Dell, Dell Inc., DellInc., HP vendors
- Created Dell TBD model (ID 110) as default PC model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-17 15:31:59 -05:00
parent a4096ace94
commit b858d069c5
6 changed files with 180 additions and 80 deletions

View File

@@ -105,9 +105,54 @@
.lightbox-close:hover { .lightbox-close:hover {
opacity: 1; opacity: 1;
} }
/* Share toast notification */
#shareToast {
position: fixed;
top: 80px;
right: 20px;
z-index: 9999;
min-width: 300px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
display: none;
}
@keyframes toastSlideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes toastSlideOut {
from {
transform: translateX(0);
opacity: 1;
}
to {
transform: translateX(100%);
opacity: 0;
}
}
</style> </style>
<body class="bg-theme <%Response.Write(theme)%>"> <body class="bg-theme <%Response.Write(theme)%>">
<!-- Share toast notification -->
<div id="shareToast">
<div style="display: flex; align-items: center;">
<i class="zmdi zmdi-check-circle" style="font-size: 24px; margin-right: 12px;"></i>
<div>
<strong style="display: block; margin-bottom: 5px;">Link Copied!</strong>
<span style="font-size: 13px; opacity: 0.9;">This link will show the search term and highlight the result</span>
</div>
</div>
</div>
<!-- start loader --> <!-- start loader -->
<div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner" ><div class="loader"></div></div></div></div> <div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner" ><div class="loader"></div></div></div></div>
<!-- end loader --> <!-- end loader -->
@@ -633,17 +678,21 @@
document.execCommand('copy'); document.execCommand('copy');
document.body.removeChild(temp); document.body.removeChild(temp);
// Show feedback // Show toast notification
var btn = event.currentTarget; showToast();
var originalHTML = btn.innerHTML; }
btn.innerHTML = '<i class="zmdi zmdi-check"></i>';
btn.classList.remove('btn-outline-secondary'); function showToast() {
btn.classList.add('btn-success'); var toast = document.getElementById('shareToast');
toast.style.display = 'block';
toast.style.animation = 'toastSlideIn 0.3s ease-out';
setTimeout(function() { setTimeout(function() {
btn.innerHTML = originalHTML; toast.style.animation = 'toastSlideOut 0.3s ease-out';
btn.classList.remove('btn-success'); setTimeout(function() {
btn.classList.add('btn-outline-secondary'); toast.style.display = 'none';
}, 1500); }, 300);
}, 2500);
} }
$(document).ready(function() { $(document).ready(function() {

View File

@@ -158,79 +158,66 @@
<script src="assets/js/app-script.js"></script> <script src="assets/js/app-script.js"></script>
<style> <style>
.toast-notification { /* Share toast notification */
#shareToast {
position: fixed; position: fixed;
top: 20px; top: 80px;
right: 20px; right: 20px;
z-index: 9999;
min-width: 300px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white; color: white;
padding: 15px 25px; padding: 15px 20px;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 4px 15px rgba(0,0,0,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.3);
z-index: 10000;
display: none; display: none;
animation: slideIn 0.3s ease-out;
} }
@keyframes toastSlideIn {
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; }
from { to { transform: translateX(0); opacity: 1; }
transform: translateX(400px); }
opacity: 0; @keyframes toastSlideOut {
} from { transform: translateX(0); opacity: 1; }
to { to { transform: translateX(100%); opacity: 0; }
transform: translateX(0);
opacity: 1;
}
} }
</style> </style>
<!-- Share toast notification -->
<div id="shareToast">
<div style="display: flex; align-items: center;">
<i class="zmdi zmdi-check-circle" style="font-size: 24px; margin-right: 12px;"></i>
<div>
<strong style="display: block; margin-bottom: 5px;">Link Copied!</strong>
<span style="font-size: 13px; opacity: 0.9;">This link will show the search term and highlight the result</span>
</div>
</div>
</div>
<script> <script>
function shareApplication() { function shareApplication() {
var shareUrl = window.location.href; var shareUrl = window.location.href;
if (navigator.clipboard && navigator.clipboard.writeText) { var temp = document.createElement('textarea');
navigator.clipboard.writeText(shareUrl).then(function() { temp.value = shareUrl;
showToast(); temp.style.position = 'fixed';
}).catch(function(err) { temp.style.left = '-9999px';
console.error('Failed to copy: ', err); document.body.appendChild(temp);
}); temp.select();
} else { document.execCommand('copy');
// Fallback for older browsers document.body.removeChild(temp);
copyToClipboardFallback(shareUrl);
}
}
function copyToClipboardFallback(text) { showToast();
var textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position = "fixed";
textArea.style.top = "-9999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
showToast();
} catch (err) {
console.error('Fallback: Could not copy text: ', err);
}
document.body.removeChild(textArea);
} }
function showToast() { function showToast() {
var toast = document.createElement('div'); var toast = document.getElementById('shareToast');
toast.className = 'toast-notification';
toast.innerHTML = '<i class="zmdi zmdi-check-circle" style="margin-right:10px;"></i> Link copied to clipboard!';
document.body.appendChild(toast);
toast.style.display = 'block'; toast.style.display = 'block';
toast.style.animation = 'toastSlideIn 0.3s ease-out';
setTimeout(function() { setTimeout(function() {
toast.style.animation = 'slideIn 0.3s ease-out reverse'; toast.style.animation = 'toastSlideOut 0.3s ease-out';
setTimeout(function() { setTimeout(function() {
document.body.removeChild(toast); toast.style.display = 'none';
}, 300); }, 300);
}, 2500); }, 2500);
} }

View File

@@ -97,8 +97,43 @@ Dim theme, strSQL, rs, objConn
periodLabel = "Custom Range" periodLabel = "Custom Range"
End If End If
%> %>
<style>
/* Share toast notification */
#shareToast {
position: fixed;
top: 80px;
right: 20px;
z-index: 9999;
min-width: 300px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
display: none;
}
@keyframes toastSlideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
from { transform: translateX(0); opacity: 1; }
to { transform: translateX(100%); opacity: 0; }
}
</style>
<body class="bg-theme <%=Server.HTMLEncode(theme)%>"> <body class="bg-theme <%=Server.HTMLEncode(theme)%>">
<!-- Share toast notification -->
<div id="shareToast">
<div style="display: flex; align-items: center;">
<i class="zmdi zmdi-check-circle" style="font-size: 24px; margin-right: 12px;"></i>
<div>
<strong style="display: block; margin-bottom: 5px;">Link Copied!</strong>
<span style="font-size: 13px; opacity: 0.9;">This link will show the search term and highlight the result</span>
</div>
</div>
</div>
<!-- start loader --> <!-- start loader -->
<div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner"><div class="loader"></div></div></div></div> <div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner"><div class="loader"></div></div></div></div>
@@ -2546,10 +2581,21 @@ function copyFilterLink(btn) {
document.execCommand('copy'); document.execCommand('copy');
document.body.removeChild(temp); document.body.removeChild(temp);
// Brief feedback // Show toast notification
var original = btn.innerHTML; showToast();
btn.innerHTML = 'Copied!'; }
setTimeout(function() { btn.innerHTML = original; }, 1000);
function showToast() {
var toast = document.getElementById('shareToast');
toast.style.display = 'block';
toast.style.animation = 'toastSlideIn 0.3s ease-out';
setTimeout(function() {
toast.style.animation = 'toastSlideOut 0.3s ease-out';
setTimeout(function() {
toast.style.display = 'none';
}, 300);
}, 2500);
} }
// Dashboard Charts // Dashboard Charts

View File

@@ -276,9 +276,10 @@ Set rsMachineStatus = Nothing
<option value="">-- Select Model --</option> <option value="">-- Select Model --</option>
<% <%
Dim rsModels Dim rsModels
strSQL = "SELECT models.*, vendors.vendor FROM models " &_ ' Include all PC vendor models PLUS the currently selected model (in case it's from a non-PC vendor)
strSQL = "SELECT models.modelnumberid, models.modelnumber, vendors.vendor FROM models " &_
"INNER JOIN vendors ON models.vendorid = vendors.vendorid " &_ "INNER JOIN vendors ON models.vendorid = vendors.vendorid " &_
"WHERE vendors.ispc = 1 AND models.isactive = 1 " &_ "WHERE (vendors.ispc = 1 AND models.isactive = 1) OR models.modelnumberid = " & CLng(modelid) & " " &_
"ORDER BY vendors.vendor ASC, models.modelnumber ASC" "ORDER BY vendors.vendor ASC, models.modelnumber ASC"
Set rsModels = objconn.Execute(strSQL) Set rsModels = objconn.Execute(strSQL)
While Not rsModels.EOF While Not rsModels.EOF
@@ -317,7 +318,7 @@ Set rsMachineStatus = Nothing
<option value="">-- Select Vendor --</option> <option value="">-- Select Vendor --</option>
<% <%
Dim rsVendors Dim rsVendors
strSQL = "SELECT * FROM vendors WHERE ismachine = 1 AND isactive = 1 ORDER BY vendor ASC" strSQL = "SELECT * FROM vendors WHERE ispc = 1 AND isactive = 1 ORDER BY vendor ASC"
Set rsVendors = objconn.Execute(strSQL) Set rsVendors = objconn.Execute(strSQL)
While Not rsVendors.EOF While Not rsVendors.EOF
Response.Write("<option value='" & rsVendors("vendorid") & "'>" & Server.HTMLEncode(rsVendors("vendor")) & "</option>") Response.Write("<option value='" & rsVendors("vendorid") & "'>" & Server.HTMLEncode(rsVendors("vendor")) & "</option>")

View File

@@ -24,9 +24,13 @@ Response.Write(" .link-input { width: 100%; padding: 5px; font-family: 'C
Response.Write(" .filter-box { background: white; padding: 15px; margin-bottom: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }") Response.Write(" .filter-box { background: white; padding: 15px; margin-bottom: 20px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }")
Response.Write(" .filter-box input { padding: 8px; width: 300px; border: 1px solid #ddd; border-radius: 3px; }") Response.Write(" .filter-box input { padding: 8px; width: 300px; border: 1px solid #ddd; border-radius: 3px; }")
Response.Write(" .info-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin-bottom: 20px; }") Response.Write(" .info-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin-bottom: 20px; }")
Response.Write(" #shareToast { position: fixed; top: 80px; right: 20px; z-index: 9999; min-width: 300px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px 20px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); display: none; }")
Response.Write(" @keyframes toastSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }")
Response.Write(" @keyframes toastSlideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }")
Response.Write(" </style>") Response.Write(" </style>")
Response.Write("</head>") Response.Write("</head>")
Response.Write("<body>") Response.Write("<body>")
Response.Write(" <div id='shareToast'><div style='display: flex; align-items: center;'><span style='font-size: 24px; margin-right: 12px;'>&#10003;</span><div><strong style='display: block; margin-bottom: 5px;'>Link Copied!</strong><span style='font-size: 13px; opacity: 0.9;'>This link will show the search term and highlight the result</span></div></div></div>")
Response.Write(" <h1>Printer Installation Link Generator</h1>") Response.Write(" <h1>Printer Installation Link Generator</h1>")
Response.Write(" <div class='info-box'>") Response.Write(" <div class='info-box'>")
@@ -126,11 +130,24 @@ Response.Write(" </table>")
Response.Write(" <script>") Response.Write(" <script>")
Response.Write(" function copyToClipboard(text) {") Response.Write(" function copyToClipboard(text) {")
Response.Write(" navigator.clipboard.writeText(text).then(function() {") Response.Write(" var temp = document.createElement('textarea');")
Response.Write(" alert('Copied to clipboard!');") Response.Write(" temp.value = text;")
Response.Write(" }, function(err) {") Response.Write(" temp.style.position = 'fixed';")
Response.Write(" console.error('Could not copy text: ', err);") Response.Write(" temp.style.left = '-9999px';")
Response.Write(" });") Response.Write(" document.body.appendChild(temp);")
Response.Write(" temp.select();")
Response.Write(" document.execCommand('copy');")
Response.Write(" document.body.removeChild(temp);")
Response.Write(" showToast();")
Response.Write(" }")
Response.Write(" function showToast() {")
Response.Write(" var toast = document.getElementById('shareToast');")
Response.Write(" toast.style.display = 'block';")
Response.Write(" toast.style.animation = 'toastSlideIn 0.3s ease-out';")
Response.Write(" setTimeout(function() {")
Response.Write(" toast.style.animation = 'toastSlideOut 0.3s ease-out';")
Response.Write(" setTimeout(function() { toast.style.display = 'none'; }, 300);")
Response.Write(" }, 2500);")
Response.Write(" }") Response.Write(" }")
Response.Write(" ") Response.Write(" ")
Response.Write(" function filterTable() {") Response.Write(" function filterTable() {")

View File

@@ -22,8 +22,8 @@
' Check if serial number already exists - PHASE 2: Use machines table ' Check if serial number already exists - PHASE 2: Use machines table
' Check ALL machines regardless of type to prevent duplicates ' Check ALL machines regardless of type to prevent duplicates
Dim checkSQL, rsCheck, cmdCheck, existingMachineID, existingPCTypeID Dim checkSQL, rsCheck, cmdCheck, existingMachineID, existingMachineTypeID
checkSQL = "SELECT machineid, pctypeid FROM machines WHERE serialnumber = ? AND isactive = 1" checkSQL = "SELECT machineid, machinetypeid FROM machines WHERE serialnumber = ? AND isactive = 1"
Set cmdCheck = Server.CreateObject("ADODB.Command") Set cmdCheck = Server.CreateObject("ADODB.Command")
cmdCheck.ActiveConnection = objConn cmdCheck.ActiveConnection = objConn
cmdCheck.CommandText = checkSQL cmdCheck.CommandText = checkSQL
@@ -35,14 +35,14 @@
If Not rsCheck.EOF Then If Not rsCheck.EOF Then
' Serial number already exists - redirect to appropriate edit page ' Serial number already exists - redirect to appropriate edit page
existingMachineID = rsCheck("machineid") existingMachineID = rsCheck("machineid")
existingPCTypeID = rsCheck("pctypeid") existingMachineTypeID = rsCheck("machinetypeid")
rsCheck.Close rsCheck.Close
Set rsCheck = Nothing Set rsCheck = Nothing
Set cmdCheck = Nothing Set cmdCheck = Nothing
objConn.Close objConn.Close
' Redirect to PC edit page if it's a PC (pctypeid IS NOT NULL), otherwise to machine edit page ' Redirect to PC edit page if it's a PC (machinetypeid 33), otherwise to machine edit page
If Not IsNull(existingPCTypeID) Then If existingMachineTypeID = 33 Then
Response.Redirect("./editpc.asp?machineid=" & existingMachineID & "&scanned=1") Response.Redirect("./editpc.asp?machineid=" & existingMachineID & "&scanned=1")
Else Else
Response.Redirect("./editmachine.asp?machineid=" & existingMachineID & "&scanned=1") Response.Redirect("./editmachine.asp?machineid=" & existingMachineID & "&scanned=1")
@@ -57,13 +57,13 @@
' Insert new PC with minimal required fields - PHASE 2: Use machines table ' Insert new PC with minimal required fields - PHASE 2: Use machines table
' machinetypeid = 33 (PC), pctypeid = 1 (Standard) ' machinetypeid = 33 (PC), pctypeid = 1 (Standard)
' machinestatusid = 2 (Inventory) ' machinestatusid = 2 (Inventory)
' modelnumberid = 1 (default model) ' modelnumberid = 110 (Dell TBD - default PC model)
' maptop = 1519, mapleft = 1896 (default map location) ' maptop = 1519, mapleft = 1896 (default map location)
' hostname = serialnumber (default) ' hostname = serialnumber (default)
' isactive = 1 ' isactive = 1
Dim insertSQL, cmdInsert Dim insertSQL, cmdInsert
insertSQL = "INSERT INTO machines (serialnumber, hostname, machinetypeid, pctypeid, machinestatusid, modelnumberid, maptop, mapleft, isactive, lastupdated) " & _ insertSQL = "INSERT INTO machines (serialnumber, hostname, machinetypeid, pctypeid, machinestatusid, modelnumberid, maptop, mapleft, isactive, lastupdated) " & _
"VALUES (?, ?, 33, 1, 2, 1, 1519, 1896, 1, NOW())" "VALUES (?, ?, 33, 1, 2, 110, 1519, 1896, 1, NOW())"
Set cmdInsert = Server.CreateObject("ADODB.Command") Set cmdInsert = Server.CreateObject("ADODB.Command")
cmdInsert.ActiveConnection = objConn cmdInsert.ActiveConnection = objConn
cmdInsert.CommandText = insertSQL cmdInsert.CommandText = insertSQL