From a86037362557ace9f89dfeafaf209c1d177ae062 Mon Sep 17 00:00:00 2001 From: Teja Manthena Date: Fri, 15 Dec 2023 17:16:10 +0100 Subject: [PATCH 1/2] Make Trays from Blob Capabilities available in Print Now/ezeep.js --- .../ezp-printer-selection.tsx | 35 +++++++++++++++++-- src/data/locales/de.json | 5 ++- src/data/locales/en.json | 5 ++- src/shared/types.d.ts | 10 ++++++ 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/components/ezp-printer-selection/ezp-printer-selection.tsx b/src/components/ezp-printer-selection/ezp-printer-selection.tsx index 52f42ea..8ccc849 100644 --- a/src/components/ezp-printer-selection/ezp-printer-selection.tsx +++ b/src/components/ezp-printer-selection/ezp-printer-selection.tsx @@ -84,6 +84,7 @@ export class EzpPrinterSelection { Resolutions: [], DuplexSupported: false, Color: false, + Trays: [] } // needs to be initialised with empty strings @@ -97,7 +98,9 @@ export class EzpPrinterSelection { copies: '', resolution: 0, paperlength : 0, - paperwidth : 0 + paperwidth : 0, + defaultSource: '', + trayname: '' } @State() paperid: number | string @@ -215,6 +218,10 @@ export class EzpPrinterSelection { this.printProcessing = true // we have to initialse this obj with empty strings to display the select component // but don't want to send any attributes with empty strings to the API + if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) { + delete this.selectedProperties.trayname + delete this.selectedProperties.defaultSource + } let cleanPrintProperties = removeEmptyStrings(this.selectedProperties) cleanPrintProperties = managePaperDimensions(cleanPrintProperties) // put it in store for further use @@ -310,7 +317,7 @@ export class EzpPrinterSelection { } else { this.selectedPrinter = { id: '', location: '', name: '', is_queue: false } localStorage.removeItem('printer') - localStorage.removeItem('properties') + localStorage.removeItem('properties') } } else { this.selectedPrinter = { id: '', location: '', name: '', is_queue: false } @@ -376,6 +383,16 @@ export class EzpPrinterSelection { this.selectedProperties.paperwidth = eventDetails.value // console.log(this.selectedProperties) break + case 'tray': + if(this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) { + delete this.selectedProperties.trayname + delete this.selectedProperties.defaultSource + } + if(this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) { + this.selectedProperties.trayname = eventDetails.title + this.selectedProperties.defaultSource = eventDetails.id + } + break case 'duplex': if (eventDetails.title === 'None') { this.selectedProperties.duplex = false @@ -781,6 +798,20 @@ export class EzpPrinterSelection { preSelected={this.selectedPrinter.id ? this.selectedProperties.resolution : null} disabled={!(this.selectedPrinterConfig.Resolutions.length > 0)} /> + {this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null ? ( + = 1 && this.selectedPrinterConfig.Trays.map((trays) => ({ + title: trays.Name, + id: trays.Index, + meta: '', + type: 'tray', + }))} + /> ) : null} diff --git a/src/data/locales/de.json b/src/data/locales/de.json index 3eaaf14..c57fd0d 100644 --- a/src/data/locales/de.json +++ b/src/data/locales/de.json @@ -42,7 +42,10 @@ "duplex_short": "auf der kurzen Seite umdrehen", "pull_print_success": "Bereit zum Auslösen.", "width":"Breite", - "length":"Länge" + "length":"Länge", + "trays": "Trays", + "select_trays": "Wähle Trays", + "page_ranges": "Page Ranges" }, "button_actions": { "login": "Anmelden", diff --git a/src/data/locales/en.json b/src/data/locales/en.json index 80cf3d4..ca154b1 100644 --- a/src/data/locales/en.json +++ b/src/data/locales/en.json @@ -42,7 +42,10 @@ "no_printers": "No printers found.", "copies": "Copies", "width":"Width", - "length":"Length" + "length":"Length", + "trays": "Trays", + "select_trays": "Select Trays", + "page_ranges": "Page Ranges" }, "button_actions": { "login": "Sign In", diff --git a/src/shared/types.d.ts b/src/shared/types.d.ts index 6174f25..c9c89be 100644 --- a/src/shared/types.d.ts +++ b/src/shared/types.d.ts @@ -64,6 +64,8 @@ export interface PrinterProperties { resolution?: string | number paperlength? : string | number paperwidth? : string | number + defaultSource?: number | string + trayname?: string } export interface Printer { @@ -79,6 +81,13 @@ export interface PaperFormat { XRes: number YRes: number } + +export interface Trays { + Default : boolean + Index: number + Name: string +} + export interface PrinterConfig { Collate?: boolean Color?: boolean @@ -95,6 +104,7 @@ export interface PrinterConfig { PaperFormats?: Array Resolutions?: Array TPUID?: number + Trays?: Array } export interface User { From c041cc9e2095b5336bb0286e986bcec03e79b98f Mon Sep 17 00:00:00 2001 From: Teja Manthena Date: Fri, 15 Dec 2023 19:15:55 +0100 Subject: [PATCH 2/2] Added icons for trays and page ranges --- src/components/ezp-icon/assets/glyph-paper_range.svg | 1 + src/components/ezp-icon/assets/glyph-trays.svg | 1 + .../ezp-printer-selection/ezp-printer-selection.tsx | 4 ++-- src/shared/types.d.ts | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/components/ezp-icon/assets/glyph-paper_range.svg create mode 100644 src/components/ezp-icon/assets/glyph-trays.svg diff --git a/src/components/ezp-icon/assets/glyph-paper_range.svg b/src/components/ezp-icon/assets/glyph-paper_range.svg new file mode 100644 index 0000000..9b3d08c --- /dev/null +++ b/src/components/ezp-icon/assets/glyph-paper_range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/ezp-icon/assets/glyph-trays.svg b/src/components/ezp-icon/assets/glyph-trays.svg new file mode 100644 index 0000000..2112d96 --- /dev/null +++ b/src/components/ezp-icon/assets/glyph-trays.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/ezp-printer-selection/ezp-printer-selection.tsx b/src/components/ezp-printer-selection/ezp-printer-selection.tsx index 6e6dcdd..f1056ab 100644 --- a/src/components/ezp-printer-selection/ezp-printer-selection.tsx +++ b/src/components/ezp-printer-selection/ezp-printer-selection.tsx @@ -812,7 +812,7 @@ export class EzpPrinterSelection { {this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null ? ( ) : null}