diff --git a/src/assets/ITThermal.js b/src/assets/ITThermal.js index d53b0a3..9b72837 100644 --- a/src/assets/ITThermal.js +++ b/src/assets/ITThermal.js @@ -1,7 +1,8 @@ /* ITS Thermal Receipt Printer * Developed by Skylar Grant for MCCS ITS */ -const version = "1.2.9"; +const version = "1.3.0"; +const inDevEnv = false; // Set to true for development environment, false for production // ############################################################# // Variables // ############################################################# @@ -73,6 +74,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-499 for procedure details.', fontInfo: standard }, + steps: [ + 'Remove all peripherals from the device', + 'Remove; label; and retain any storage media', + 'Remove any asset tags from the device', + 'Change asset status to Disposed in ME/SD', + 'Place device in eWaste bin', + 'If bin is full, contact Region Manager to schedule pick-up' + ] } } @@ -83,6 +132,25 @@ function setVersionNumber() { document.getElementById('versionNumber').innerText = version; } +function setDevBanner() { + if (inDevEnv) { + const body = document.body; + const banner = document.createElement('div'); + banner.innerText = 'DEVELOPMENT BUILD'; + banner.style.position = 'fixed'; + banner.style.top = '0'; + banner.style.left = '0'; + // banner.style.width = '100%'; + banner.style.backgroundColor = 'red'; + banner.style.color = 'white'; + banner.style.textAlign = 'center'; + banner.style.fontSize = '24px'; + banner.style.fontWeight = 'bold'; + banner.style.zIndex = '1000'; + body.appendChild(banner); + } +} + function tempPasswordHandler() { // Grab the form values const username = document.getElementById('tempPwUsername').value; @@ -135,6 +203,45 @@ 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); +} + +function quickPrintContactHandler() { + /** @type Array */ + const lineArray = new Array(); + lineArray.push(new LineItem('', standard, false)); + const bUrl = generateFile(lineArray, true, true); + displayPdf(bUrl); +} + +function quickPrintPasswordReqHandler() { + /** @type Array */ + const lineArray = prepPasswordReqs(); + const bUrl = generateFile(lineArray, true, true); + displayPdf(bUrl); +} + /** * * @param {String} password @@ -204,6 +311,81 @@ 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 */ + 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 */ + 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 */ + 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; +} + +function prepPasswordReqs() { + const s = strings.tempPassword; + const lineArray = []; + + for (const reqLine of s.pwRequirements) { + lineArray.push(new LineItem(reqLine.text, reqLine.fontInfo, false)); + } + return lineArray; +}; + /** * * @param {Array} lineArray @@ -225,9 +407,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 +521,6 @@ document.getElementById('genPassword').addEventListener('click', () => { alert(`An error occurred while generating the PDF: ${error.message}`); } }); - document.getElementById('deviceTrackerBtn').addEventListener('click', () => { try { deviceTrackerHandler(); @@ -345,12 +528,48 @@ 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}`); + } +}); +document.getElementById('quickPrintContactBtn').addEventListener('click', () => { + try { + quickPrintContactHandler(); + } catch (error) { + alert(`An error occurred while generating the PDF: ${error.message}`); + } +}); +document.getElementById('quickPrintPasswordReqBtn').addEventListener('click', () => { + try { + quickPrintPasswordReqHandler(); + } catch (error) { + alert(`An error occurred while generating the PDF: ${error.message}`); + } +}); // ############################################################# // Function Calls // ############################################################# try { setVersionNumber(); + setDevBanner(); } catch (error) { console.error(`An error occurred during initialization: ${error.message}`); } \ No newline at end of file diff --git a/src/index.html b/src/index.html index d31a3c5..b359b72 100644 --- a/src/index.html +++ b/src/index.html @@ -82,6 +82,29 @@ + + +
+ +

Quick Prints

+ +
+ + + + +
+
@@ -153,6 +176,48 @@ + + +
+ +

Asset Management

+ +

Please provide feedback on these checklists to Skylar Grant.

+ +
+ + +
+ +
+ +
+ + +
+ +
+ + +
+ +
+