From 34119cb22102f522a82db7a4799a9115f9f37d98 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 30 Apr 2022 04:38:50 +0000 Subject: [PATCH] Display billed amount on Trotec usage tablet --- webclient/src/Usage.js | 86 +++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 31 deletions(-) diff --git a/webclient/src/Usage.js b/webclient/src/Usage.js index 5792c0f..69401da 100644 --- a/webclient/src/Usage.js +++ b/webclient/src/Usage.js @@ -60,37 +60,7 @@ export function Usage(props) { } {showUsage ? - <> -

- {usage.first_name} -

- -
10800 ? '#cc0000' : '' }}> -
Session Time
- -

- {parseInt(usage.session_time / 60)} mins -

-
- -
Job #{usage.last_use_id} Time
- -

- {parseInt(usage.last_use_time / 60)} mins -

- -
Today Total
- -

- {parseInt(usage.today_total / 60)} mins -

- -
Month Total
- -

- {parseInt(usage.month_total / 60)} mins -

- + : <>
{title} Usage
@@ -103,3 +73,57 @@ export function Usage(props) { ); }; + +export function TrotecUsage(props) { + const { usage } = props; + + const today_total = parseInt(usage.today_total / 60); + const month_total = parseInt(usage.month_total / 60); + const free_time = 360; + + return ( + <> +

+ {usage.first_name} +

+ +
10800 ? '#cc0000' : '' }}> +
Session Time
+ +

+ {parseInt(usage.session_time / 60)} mins +

+
+ +
Laser-firing Time Today
+ +

+ {today_total} mins +

+ +
Laser-firing Time Month
+ +

+ {month_total} mins +

+ + {month_total <= free_time ? + <> +
Free Time Remaining
+ +

+ {free_time - month_total} mins +

+ + : + <> +
Current Month Bill
+ +

+ ${((month_total - free_time) * 0.5).toFixed(2)} +

+ + } + + ); +}