Standardize ASP filenames: remove underscores
Renamed 45 ASP files to follow lowercase concatenated naming convention: - Direct handlers: save_machine_direct.asp -> savemachinedirect.asp - USB files: checkin_usb.asp -> checkinusb.asp - API files: api_usb.asp -> apiusb.asp - Map files: network_map.asp -> networkmap.asp - Printer files: printer_lookup.asp -> printerlookup.asp Also: - Updated 84+ internal references across all ASP and JS files - Deleted 6 test/duplicate files (editmacine.asp, test_*.asp) - Updated production migration guide with filename changes - Added rename scripts for Linux (bash) and Windows (PowerShell)
This commit is contained in:
288
checkinusb.asp
Normal file
288
checkinusb.asp
Normal file
@@ -0,0 +1,288 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--#include file="./includes/header.asp"-->
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
</head>
|
||||
|
||||
<%
|
||||
theme = Request.Cookies("theme")
|
||||
IF theme = "" THEN
|
||||
theme="bg-theme1"
|
||||
END IF
|
||||
|
||||
' Check if serial was passed in URL (from displayusb.asp)
|
||||
Dim prefilledSerial
|
||||
prefilledSerial = Trim(Request.QueryString("serial"))
|
||||
%>
|
||||
<body class="bg-theme <%Response.Write(theme)%>">
|
||||
|
||||
<!-- 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>
|
||||
<!-- end loader -->
|
||||
<!-- Start wrapper-->
|
||||
<div id="wrapper">
|
||||
<!--#include file="./includes/leftsidebar.asp"-->
|
||||
<!--Start topbar header-->
|
||||
<!--#include file="./includes/topbarheader.asp"-->
|
||||
<!--End topbar header-->
|
||||
<div class="clearfix"></div>
|
||||
<div class="content-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row mt-3">
|
||||
<div class="col-lg-8 offset-lg-2">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;">
|
||||
<h5 class="card-title" style="margin:0;">
|
||||
<i class="zmdi zmdi-arrow-left"></i> USB Check-in
|
||||
</h5>
|
||||
<a href="./displayusb.asp" class="btn btn-sm btn-secondary">
|
||||
<i class="zmdi zmdi-arrow-left"></i> Back to USB Devices
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<%
|
||||
' Check for error messages
|
||||
Dim errorType, errorMsg
|
||||
errorType = Request.QueryString("error")
|
||||
errorMsg = Request.QueryString("msg")
|
||||
|
||||
If errorType <> "" Then
|
||||
Response.Write("<div class='alert alert-danger alert-dismissible fade show' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><strong>Error!</strong> " & Server.HTMLEncode(errorMsg) & "</div>")
|
||||
End If
|
||||
%>
|
||||
|
||||
<!-- Step 1: Scan USB -->
|
||||
<div id="step1">
|
||||
<div class="alert alert-info">
|
||||
<i class="zmdi zmdi-info"></i> <strong>Step 1:</strong> Scan or enter the USB serial number to check in
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="serialnumber">USB Serial Number</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control form-control-lg"
|
||||
id="serialnumber"
|
||||
placeholder="Scan barcode or type serial number..."
|
||||
autocomplete="off"
|
||||
autofocus
|
||||
value="<%=Server.HTMLEncode(prefilledSerial)%>"
|
||||
style="font-size: 24px; text-align: center; padding: 20px; font-family: monospace; letter-spacing: 2px;">
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<button type="button" id="lookupBtn" class="btn btn-primary btn-lg">
|
||||
<i class="zmdi zmdi-search"></i> Look Up USB
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 2: USB Details and Check-in Form -->
|
||||
<div id="step2" style="display:none;">
|
||||
<div class="alert alert-warning">
|
||||
<i class="zmdi zmdi-alert-triangle"></i> <strong>USB Found!</strong> Please confirm the USB has been wiped before check-in.
|
||||
</div>
|
||||
|
||||
<div class="card bg-light mb-3">
|
||||
<div class="card-body">
|
||||
<h6 class="card-subtitle mb-2 text-muted">Checkout Details</h6>
|
||||
<table class="table table-sm mb-0">
|
||||
<tr><th style="width:150px;">Serial Number:</th><td id="usbSerial" class="font-weight-bold"></td></tr>
|
||||
<tr><th>Name:</th><td id="usbName"></td></tr>
|
||||
<tr><th>Business Unit:</th><td id="usbBU"></td></tr>
|
||||
<tr><th>Checked Out By:</th><td id="usbSSO" class="font-weight-bold text-primary"></td></tr>
|
||||
<tr><th>Checkout Time:</th><td id="usbCheckoutTime"></td></tr>
|
||||
<tr><th>Duration:</th><td id="usbDuration"></td></tr>
|
||||
<tr><th>Reason:</th><td id="usbReason"></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="checkinForm" method="post" action="./savecheckinusb.asp">
|
||||
<input type="hidden" id="checkoutid" name="checkoutid" value="">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="alert alert-danger" style="padding:15px;">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="waswiped" name="waswiped" value="1" required>
|
||||
<label class="custom-control-label" for="waswiped" style="font-size:16px; font-weight:bold;">
|
||||
<i class="zmdi zmdi-shield-check"></i> I confirm this USB has been WIPED/FORMATTED before returning
|
||||
</label>
|
||||
</div>
|
||||
<small class="text-dark mt-2 d-block">This is required for security. USB devices must be wiped before being returned to the locker.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notes">Check-in Notes (optional)</label>
|
||||
<textarea
|
||||
class="form-control"
|
||||
id="notes"
|
||||
name="notes"
|
||||
rows="2"
|
||||
placeholder="Any notes about the USB or its use..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="text-center" style="margin-top:20px;">
|
||||
<button type="button" id="backBtn" class="btn btn-secondary btn-lg">
|
||||
<i class="zmdi zmdi-arrow-left"></i> Back
|
||||
</button>
|
||||
<button type="submit" class="btn btn-success btn-lg" id="submitBtn" disabled>
|
||||
<i class="zmdi zmdi-check"></i> Complete Check-in
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Loading indicator -->
|
||||
<div id="loadingArea" style="display:none; text-align:center; padding:40px;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
<p class="mt-3 text-muted">Looking up USB device...</p>
|
||||
</div>
|
||||
|
||||
<!-- Error state -->
|
||||
<div id="errorArea" style="display:none;">
|
||||
<div class="alert alert-danger" id="errorMessage"></div>
|
||||
<div class="text-center">
|
||||
<button type="button" id="retryBtn" class="btn btn-primary">
|
||||
<i class="zmdi zmdi-refresh"></i> Try Again
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container"><div class="text-center"></div></div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="assets/js/jquery.min.js"></script>
|
||||
<script src="assets/js/popper.min.js"></script>
|
||||
<script src="assets/js/bootstrap.min.js"></script>
|
||||
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
|
||||
<script src="assets/js/sidebar-menu.js"></script>
|
||||
<script src="assets/js/app-script.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Auto-focus on serial input
|
||||
$('#serialnumber').focus();
|
||||
|
||||
// If prefilled serial, auto-lookup
|
||||
var prefilled = $('#serialnumber').val().trim();
|
||||
if (prefilled.length >= 3) {
|
||||
setTimeout(function() {
|
||||
lookupUSB(prefilled);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// Lookup button click
|
||||
$('#lookupBtn').on('click', function() {
|
||||
var serial = $('#serialnumber').val().trim();
|
||||
if (serial.length < 3) {
|
||||
alert('Please enter at least 3 characters');
|
||||
$('#serialnumber').focus();
|
||||
return;
|
||||
}
|
||||
lookupUSB(serial);
|
||||
});
|
||||
|
||||
// Enter key in serial field
|
||||
$('#serialnumber').on('keypress', function(e) {
|
||||
if (e.which === 13) {
|
||||
e.preventDefault();
|
||||
$('#lookupBtn').click();
|
||||
}
|
||||
});
|
||||
|
||||
// Back button
|
||||
$('#backBtn').on('click', function() {
|
||||
$('#step2').hide();
|
||||
$('#step1').show();
|
||||
$('#serialnumber').focus();
|
||||
});
|
||||
|
||||
// Retry button
|
||||
$('#retryBtn').on('click', function() {
|
||||
$('#errorArea').hide();
|
||||
$('#step1').show();
|
||||
$('#serialnumber').val('').focus();
|
||||
});
|
||||
|
||||
// Enable/disable submit based on checkbox
|
||||
$('#waswiped').on('change', function() {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// Form validation
|
||||
$('#checkinForm').on('submit', function(e) {
|
||||
if (!$('#waswiped').is(':checked')) {
|
||||
e.preventDefault();
|
||||
alert('You must confirm the USB has been wiped before check-in.');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
function lookupUSB(serial) {
|
||||
$('#step1').hide();
|
||||
$('#loadingArea').show();
|
||||
|
||||
$.ajax({
|
||||
url: './apiusb.asp',
|
||||
method: 'GET',
|
||||
data: { action: 'checkin_lookup', serial: serial },
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$('#loadingArea').hide();
|
||||
|
||||
if (data.success) {
|
||||
// Found checked-out USB - show check-in form
|
||||
$('#usbSerial').text(data.serialnumber);
|
||||
$('#usbName').text(data.alias || '-');
|
||||
$('#usbBU').text(data.businessunit || '-');
|
||||
$('#usbSSO').text(data.sso);
|
||||
$('#usbCheckoutTime').text(data.checkout_time || '-');
|
||||
$('#usbDuration').text(data.duration || '-');
|
||||
$('#usbReason').text(data.checkout_reason || '-');
|
||||
$('#checkoutid').val(data.checkoutid);
|
||||
|
||||
// Reset checkbox and button
|
||||
$('#waswiped').prop('checked', false);
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
|
||||
$('#step2').show();
|
||||
} else {
|
||||
var errorHtml = '<strong>' + (data.error || 'Error looking up USB') + '</strong>';
|
||||
if (data.error && data.error.indexOf('not currently checked out') >= 0) {
|
||||
errorHtml += '<br><br>To checkout this USB, use <a href="./checkoutusb.asp?serial=' + encodeURIComponent(serial) + '">Checkout</a>.';
|
||||
}
|
||||
$('#errorMessage').html(errorHtml);
|
||||
$('#errorArea').show();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('#loadingArea').hide();
|
||||
$('#errorMessage').html('<strong>Error connecting to server. Please try again.</strong>');
|
||||
$('#errorArea').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user