Skip to content

Commit

Permalink
pass through GHS_codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbocarsly committed Sep 25, 2024
1 parent eec5aec commit 655a6ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webapp/src/gateway_fetch_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { GATEWAY_URL } from "@/resources.js";

import { fetch_post } from "@/server_fetch_utils.js";

export function printQRCode(item_id, name, url, hcodes) {
return fetch_post(`${GATEWAY_URL}/print-label/`, {
export function printQRCode(item_id, name, url, hcodes, isDryrun) {
return fetch_post(`${GATEWAY_URL}/print-label`, {
item_id: item_id,
name: name,
url: url,
hcodes: hcodes,
dryrun: isDryrun,
});
}
11 changes: 11 additions & 0 deletions webapp/src/views/EditPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<a class="nav-item nav-link" :href="itemApiUrl" target="_blank">
<font-awesome-icon icon="code" fixed-width /> View JSON
</a>
<a class="nav-item nav-link" @click="printLabel">Print label</a>
</div>
<div class="navbar-nav ml-auto">
<span v-if="itemDataLoaded && !savedStatus" class="navbar-text unsaved-warning">
Expand Down Expand Up @@ -102,6 +103,7 @@ import {
updateBlockFromServer,
getBlocksInfos,
} from "@/server_fetch_utils";
import { printQRCode } from "@/gateway_fetch_utils.js";
import FormattedItemName from "@/components/FormattedItemName";

import setupUppy from "@/file_upload.js";
Expand Down Expand Up @@ -299,6 +301,15 @@ export default {
});
this.setLastModified();
},
printLabel() {
printQRCode(
this.item_data.item_id,
this.item_data.name,
"https://demo.datalab-io.org",
this.item_data.GHS_codes,
false,
);
},
leavePageWarningListener(event) {
event.preventDefault;
return (event.returnValue =
Expand Down

0 comments on commit 655a6ec

Please sign in to comment.