From 888be36ca03186bb2346a2a1a6e0b274782835a1 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Tue, 10 Sep 2024 13:29:16 -0400 Subject: [PATCH] MVP --- mccs-it/thermal/app.js | 4 +-- mccs-it/thermal/modules/Thermal.js | 2 +- mccs-it/thermal/public/index.html | 41 ++++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/mccs-it/thermal/app.js b/mccs-it/thermal/app.js index d4a467d..e0d5cba 100644 --- a/mccs-it/thermal/app.js +++ b/mccs-it/thermal/app.js @@ -11,13 +11,13 @@ app.use(express.static('public')); app.use(express.json()); // Test print function -app.post('/test-print', async (req, res) => { +app.post('/print', async (req, res) => { try { const { username, studentId } = req.body; if (!username || !studentId) { return res.status(400).json({ message: 'Username and Student ID are required.' }); } - await Thermal.generateFile(username, studentId, req, res); + await Thermal.printCredentials(username, studentId, req, res); } catch (error) { console.error('Print Error:', error); res.status(500).json({ message: 'Print Error', error: error.message }); diff --git a/mccs-it/thermal/modules/Thermal.js b/mccs-it/thermal/modules/Thermal.js index c3c701a..528c36d 100644 --- a/mccs-it/thermal/modules/Thermal.js +++ b/mccs-it/thermal/modules/Thermal.js @@ -4,7 +4,7 @@ const { spawn } = require('child_process'); const path = require('path'); module.exports = { - generateFile(username, studentId, req, res) { + printCredentials(username, studentId, req, res) { // Create the output text const infoArray = [ 'Username:', diff --git a/mccs-it/thermal/public/index.html b/mccs-it/thermal/public/index.html index 82f2452..ba6892a 100644 --- a/mccs-it/thermal/public/index.html +++ b/mccs-it/thermal/public/index.html @@ -3,19 +3,38 @@ - Thermal Printer Test + Credential Printer + - -

Thermal Printer Test

-
- -

+ +
+

ITS Credential Printer

+

+ Provide the username and student ID in the fields below, then click the Print button. + A pre-formatted receipt will print with the information from the thermal printer. +

+ + +
+ + +
- -

+
+ + +
- - +
+ +
+ +