Compare commits
3 Commits
c6d8be790e
...
983724bf08
| Author | SHA1 | Date | |
|---|---|---|---|
| 983724bf08 | |||
| f244957c6e | |||
| 32063e3cb2 |
@ -1,7 +1,7 @@
|
||||
/* ITS Thermal Receipt Printer
|
||||
* Developed by Skylar Grant for MCCS ITS
|
||||
*/
|
||||
const version = "1.2.9";
|
||||
const version = "1.2.10 dev";
|
||||
// #############################################################
|
||||
// Variables
|
||||
// #############################################################
|
||||
@ -73,6 +73,54 @@ const strings = {
|
||||
user: {text: 'User:', fontInfo: standard},
|
||||
serviceType: {text: 'Service Type:', fontInfo: standard},
|
||||
notes: {text: 'Notes:', fontInfo: standard}
|
||||
},
|
||||
imagingClistStaff: {
|
||||
title: { text: '(Re)Imaging Checklist', fontInfo: standardBold },
|
||||
subtitle: { text: 'Staff', fontInfo: standardBold },
|
||||
sol: { text: 'See SOL-411 for procedure details.', fontInfo: standard },
|
||||
steps: [
|
||||
'Physically clean device',
|
||||
'Create software inventory & identify image/software needs',
|
||||
'Verify OneDrive setup & migrate user data',
|
||||
'Attach software inventory to ticket & confirm with user',
|
||||
'Remove old drive, label with hostname/date, retain; install new drive',
|
||||
'PXE boot; enter image code; name machine per SOL-279',
|
||||
'Request removal of old hostname',
|
||||
'Wait & verify post-deploy status in OS Deployer',
|
||||
'Verify post-deployment finished',
|
||||
'Verify device assignment in ME/SD Asset module',
|
||||
'Record machine SN/ST',
|
||||
'Confirm data, printers, drives, LAN login, and wireless access with user',
|
||||
'Transfer ticket to Region Manager for stock request',
|
||||
]
|
||||
},
|
||||
imagingClistLabs: {
|
||||
title: { text: '(Re)Imaging Checklist', fontInfo: standardBold },
|
||||
subtitle: { text: 'Labs', fontInfo: standardBold },
|
||||
sol: { text: 'See SOL-411 for procedure details.', fontInfo: standard },
|
||||
steps: [
|
||||
'Physically clean device',
|
||||
'Verify Lab Image',
|
||||
'PXE boot; enter image code; name machine per SOL-279',
|
||||
'Request removal of old hostname',
|
||||
'Verify post-deployment finished',
|
||||
'Run EC inventory scan',
|
||||
'Verify device assignment in ME/SD Asset module',
|
||||
'Record machine SN/ST',
|
||||
'Confirm data, printers connectivity',
|
||||
]
|
||||
},
|
||||
ewasteClist: {
|
||||
title: { text: 'eWaste Checklist', fontInfo: standardBold },
|
||||
sol: { text: 'See SOL-??? for procedure details.', fontInfo: standard },
|
||||
steps: [
|
||||
'Verify all peripherals are removed from the device',
|
||||
'Remove; label; and retain any storage media',
|
||||
'Remove any asset tags from the device',
|
||||
'Mark asset Disposed in ME/SD if applicable',
|
||||
'Place device in eWaste bin',
|
||||
'If bin is full, contact Region Manager to schedule pick-up'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,6 +183,30 @@ function deviceTrackerHandler() {
|
||||
displayPdf(bUrl);
|
||||
}
|
||||
|
||||
function imagingClistStaffHandler() {
|
||||
// Grab the User or Host Name value
|
||||
const imagingHostname = document.getElementById('imagingClistName').value;
|
||||
const lineArray = prepImagingClistStaff(imagingHostname);
|
||||
const bUrl = generateFile(lineArray, false, false);
|
||||
displayPdf(bUrl);
|
||||
}
|
||||
|
||||
function imagingClistLabsHandler() {
|
||||
// Grab the User or Host Name value
|
||||
const imagingHostname = document.getElementById('imagingClistName').value;
|
||||
const lineArray = prepImagingClistLabs(imagingHostname);
|
||||
const bUrl = generateFile(lineArray, false, false);
|
||||
displayPdf(bUrl);
|
||||
}
|
||||
|
||||
function ewasteClistHandler() {
|
||||
// Grab the User or Host Name value
|
||||
const imagingHostname = document.getElementById('imagingClistName').value;
|
||||
const lineArray = prepEwasteClist(imagingHostname);
|
||||
const bUrl = generateFile(lineArray, false, false);
|
||||
displayPdf(bUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} password
|
||||
@ -204,6 +276,71 @@ function prepDeviceTracker(dtTicketNumber, dtUser, dtService, dtNotes) {
|
||||
return lineArray;
|
||||
};
|
||||
|
||||
function prepImagingClistStaff(hostname) {
|
||||
const s = strings.imagingClistStaff;
|
||||
const now = new Date();
|
||||
const formattedDate = `Date: ${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${now.getFullYear()}`;
|
||||
/** @type Array<LineItem> */
|
||||
const lineArray = new Array();
|
||||
lineArray.push(new LineItem(s.title.text, s.title.fontInfo, false));
|
||||
lineArray.push(new LineItem(s.subtitle.text, s.subtitle.fontInfo, false));
|
||||
lineArray.push(new LineItem(s.sol.text, s.sol.fontInfo, false));
|
||||
lineArray.push(new LineItem(formattedDate, standard, false));
|
||||
|
||||
lineArray.push(new LineItem(`User/Hostname:`, standard, false));
|
||||
lineArray.push(new LineItem(hostname, standardBold, true));
|
||||
|
||||
for (let i = 0; i < s.steps.length; i++) {
|
||||
const text = s.steps[i];
|
||||
const newText = `____ ${text}`;
|
||||
lineArray.push(new LineItem(newText, standard, false));
|
||||
}
|
||||
return lineArray;
|
||||
}
|
||||
|
||||
function prepImagingClistLabs(hostname) {
|
||||
const s = strings.imagingClistLabs;
|
||||
const now = new Date();
|
||||
const formattedDate = `Date: ${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${now.getFullYear()}`;
|
||||
/** @type Array<LineItem> */
|
||||
const lineArray = new Array()
|
||||
lineArray.push(new LineItem(s.title.text, s.title.fontInfo, false));
|
||||
lineArray.push(new LineItem(s.subtitle.text, s.subtitle.fontInfo, false));
|
||||
lineArray.push(new LineItem(s.sol.text, s.sol.fontInfo, false));
|
||||
lineArray.push(new LineItem(formattedDate, standard, false));
|
||||
|
||||
lineArray.push(new LineItem(`User/Hostname:`, standard, false));
|
||||
lineArray.push(new LineItem(hostname, standardBold, true));
|
||||
|
||||
for (let i = 0; i < s.steps.length; i++) {
|
||||
const text = s.steps[i];
|
||||
const newText = `____ ${text}`;
|
||||
lineArray.push(new LineItem(newText, standard, false));
|
||||
}
|
||||
return lineArray;
|
||||
}
|
||||
|
||||
function prepEwasteClist(hostname) {
|
||||
const s = strings.ewasteClist;
|
||||
const now = new Date();
|
||||
const formattedDate = `Date: ${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${now.getFullYear()}`;
|
||||
/** @type Array<LineItem> */
|
||||
const lineArray = new Array()
|
||||
lineArray.push(new LineItem(s.title.text, s.title.fontInfo, false));
|
||||
lineArray.push(new LineItem(s.sol.text, s.sol.fontInfo, false));
|
||||
lineArray.push(new LineItem(formattedDate, standard, false));
|
||||
|
||||
lineArray.push(new LineItem(`User/Hostname:`, standard, false));
|
||||
lineArray.push(new LineItem(hostname, standardBold, true));
|
||||
|
||||
for (let i = 0; i < s.steps.length; i++) {
|
||||
const text = s.steps[i];
|
||||
const newText = `____ ${text}`;
|
||||
lineArray.push(new LineItem(newText, standard, false));
|
||||
}
|
||||
return lineArray;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Array<LineItem>} lineArray
|
||||
@ -225,9 +362,11 @@ function generateFile(lineArray, header, footer) {
|
||||
// Print the header if needed
|
||||
if (header) {
|
||||
doc.addImage(headerImageUri, headerImageType, 0, 0, logoWidthMm, logoHeightMm);
|
||||
currentPos += logoHeightMm + ( verticalSpacing * 2);
|
||||
} else {
|
||||
currentPos =+ verticalSpacing;
|
||||
}
|
||||
|
||||
currentPos += logoHeightMm + ( verticalSpacing * 2);
|
||||
|
||||
for (const row of lineArray) {
|
||||
doc.setFont(row.fontInfo.name, row.fontInfo.style);
|
||||
@ -337,7 +476,6 @@ document.getElementById('genPassword').addEventListener('click', () => {
|
||||
alert(`An error occurred while generating the PDF: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('deviceTrackerBtn').addEventListener('click', () => {
|
||||
try {
|
||||
deviceTrackerHandler();
|
||||
@ -345,6 +483,28 @@ document.getElementById('deviceTrackerBtn').addEventListener('click', () => {
|
||||
alert(`An error occurred while generating the PDF: ${error.message}`);
|
||||
}
|
||||
});
|
||||
document.getElementById('imagingClistStaffBtn').addEventListener('click', () => {
|
||||
try {
|
||||
imagingClistStaffHandler();
|
||||
} catch (error) {
|
||||
alert(`An error occurred while generating the PDF: ${error.message}`);
|
||||
}
|
||||
});
|
||||
document.getElementById('imagingClistLabsBtn').addEventListener('click', () => {
|
||||
try {
|
||||
imagingClistLabsHandler();
|
||||
} catch (error) {
|
||||
alert(`An error occurred while generating the PDF: ${error.message}`);
|
||||
}
|
||||
});
|
||||
document.getElementById('ewasteClistBtn').addEventListener('click', () => {
|
||||
try {
|
||||
ewasteClistHandler();
|
||||
} catch (error) {
|
||||
alert(`An error occurred while generating the PDF: ${error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// #############################################################
|
||||
// Function Calls
|
||||
|
||||
@ -153,6 +153,46 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Imaging Checklists -->
|
||||
<div class="bg-white dark:bg-gray-800 p-5 rounded-lg shadow-lg">
|
||||
<!-- Title -->
|
||||
<h1 class="dark:text-gray-300 text-2xl font-bold text-center mb-4">Asset Management</h1>
|
||||
<!-- Hostname or Username Field -->
|
||||
<div class="mb-4">
|
||||
<label for="imagingClistName" class="dark:text-gray-300 block text-md font-medium text-gray-700">Hostname or Username:</label>
|
||||
<input type="text" id="imagingClistName" name="imagingClistName" class="dark:border-gray-700 dark:bg-gray-700 dark:text-white mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
||||
</div>
|
||||
<!-- Imaging Checklist Staff Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit"
|
||||
id="imagingClistStaffBtn"
|
||||
style="background-color: #4b7839;"
|
||||
class="dark:bg-indigo-600 dark:hover:bg-indigo-700 w-full text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-opacity-50 mt-4">
|
||||
Staff Imaging Checklist
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Imaging Checklist Labs Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit"
|
||||
id="imagingClistLabsBtn"
|
||||
style="background-color: #4b7839;"
|
||||
class="dark:bg-indigo-600 dark:hover:bg-indigo-700 w-full text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-opacity-50 mt-4">
|
||||
Labs Imaging Checklist
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- eWaste Checklist Button -->
|
||||
<div class="text-center">
|
||||
<button type="submit"
|
||||
id="ewasteClistBtn"
|
||||
style="background-color: #4b7839;"
|
||||
class="dark:bg-indigo-600 dark:hover:bg-indigo-700 w-full text-white py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-opacity-50 mt-4">
|
||||
eWaste Checklist
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- (Hidden) PDF Viewer -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user