Skip to content

Commit

Permalink
#1005 LWPA small CSS inconsistencies
Browse files Browse the repository at this point in the history
#1008 Set network in LWPA from URL
#1011 Wrong message about camera in LPWA
  • Loading branch information
adiganga2002 committed Nov 3, 2022
1 parent 6675510 commit 17b19ef
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 196 deletions.
283 changes: 164 additions & 119 deletions apihub-root/lightweight-pwa/css/main.css

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions apihub-root/lightweight-pwa/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

<body>
<div class="page-container error-page">
<div class="page-header">
<span class="header-title" translate="error_title"></span>
<span class="header-subtitle" translate="error_subtitle"></span>

<div class="page-header modal-header left-aligned-header">
<div class="icon-title-container">
<div class="modal-title header-title" translate="error_title"></div>
<div class="modal-icon"></div>
</div>
<div class="modal-subtitle header-subtitle" translate="error_subtitle"></div>
</div>

<div class="page-content">
<div class="error-text" translate="error_text">
</div>
Expand Down
Binary file added apihub-root/lightweight-pwa/fonts/DMSans-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions apihub-root/lightweight-pwa/images/close-modal-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apihub-root/lightweight-pwa/images/modal-error-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions apihub-root/lightweight-pwa/images/modal-info-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions apihub-root/lightweight-pwa/images/modal-warning-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions apihub-root/lightweight-pwa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<div class="label" translate="fwd_help"></div>
<div class="fwd-icon"></div>
</div>
<div class="more-options-link" ><span translate="app_version"></span> <span id="app_version_number"></span></div>
<div class="more-options-link"><span translate="app_version"></span> <span id="app_version_number"></span>
</div>
</div>
</div>
<div class="welcome-container">
Expand All @@ -47,14 +48,19 @@
</div>
<div id="settings-modal" class="modal-container info-modal">
<div class="modal-body">
<div class="modal-header">
<div class="modal-icon"></div>
<div class="modal-title"></div>
<div class="modal-header left-aligned-header">
<div class="icon-title-container">
<div class="modal-title"></div>
<div class="modal-icon"></div>
</div>
<div class="modal-subtitle"></div>
<div class="close-modal" onclick="mainController.closeModal()"></div>
</div>
<div class="modal-content"></div>
<div class="modal-content">
<div class="generated-content-container"></div>
</div>
</div>
<div class="scan-button" onclick="mainController.goHome()" translate="go_home"></div>
</div>
</body>
<script type="module">
Expand Down
9 changes: 8 additions & 1 deletion apihub-root/lightweight-pwa/js/controllers/MainController.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ function MainController() {
goToPage("scan.html")
}

this.goHome = function () {
goToPage("index.html")
}

this.closeModal = function () {
document.querySelector("#settings-modal").setAttribute('style', 'display:none !important');
}
Expand All @@ -94,7 +98,10 @@ function MainController() {
}

const mainController = new MainController();
let lsEpiDomain = localStorage.setItem("_epiDomain_", environment.epiDomain);
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
let epiDomain = urlParams.get("setdomain") || environment.epiDomain;
let lsEpiDomain = localStorage.setItem("_epiDomain_", epiDomain);
mainController.checkOnboarding();

window.mainController = mainController;
16 changes: 12 additions & 4 deletions apihub-root/lightweight-pwa/js/controllers/ScanController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {convertFromISOtoYYYY_HM, goToPage} from "../utils/utils.js";
import interpretGS1scan from "../utils/interpretGS1scan/interpretGS1scan.js";
import ScanService, {switchFacingMode} from "../services/ScanService.js";
import {getTranslation} from "../translations.js";

function ScanController() {
this.init = async function (facingMode) {
Expand All @@ -20,7 +21,12 @@ function ScanController() {

this.redirectToError = function (err) {
console.log("Error on scanService ", err);
document.querySelector("#scan-error").setAttribute('style', 'display:flex !important');
let modal = document.querySelector("#scan-error")
if (err.scanResult) {
modal.querySelector(".modal-title").innerHTML = getTranslation("scan_parse_error");
modal.querySelector(".modal-content").innerHTML = `<div>${getTranslation("scan_parse_error_message")} ${err.scanResult}</div>`;
}
modal.setAttribute('style', 'display:flex !important');
// goToPage("error.html")
}

Expand All @@ -29,6 +35,7 @@ function ScanController() {
}

this.startScanning = async function () {
let scanResult = null;
this.scanInterval = setInterval(() => {
this.scanService.scan().then(result => {
if (!result) {
Expand All @@ -37,9 +44,11 @@ function ScanController() {
console.log("Scan result:", result);
this.scanService.stop();
clearInterval(this.scanInterval);

scanResult = result.text;
this.processGS1Fields(this.parseGS1Code(result.text));
}).catch(err => {
err.scanResult = scanResult;
this.redirectToError(err);
console.log("Caught", err);
});
}, 100);
Expand All @@ -50,7 +59,7 @@ function ScanController() {
try {
gs1FormatFields = interpretGS1scan.interpretScan(scannedBarcode);
} catch (e) {
this.redirectToError(e);
throw e;
return;
}

Expand Down Expand Up @@ -84,7 +93,6 @@ function ScanController() {
}

this.processGS1Fields = function (gs1Fields) {
let domainName = "epi";
goToPage(`leaflet.html?gtin=${gs1Fields.gtin}&batch=${gs1Fields.batchNumber}&expiry=${gs1Fields.expiry}`)
}

Expand Down
Loading

0 comments on commit 17b19ef

Please # to comment.