Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for QR codes #146

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.5.0 (unreleased)
------------------

- #146 Support for QR codes
- #145 Dynamic PDF group key lookup
- #143 Fix user defined range operators are omitted in results report
- #142 Display custom comment for out of range results
Expand Down
10 changes: 9 additions & 1 deletion src/senaite/impress/analysisrequest/templates/info.pt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<col style="width: 40%;">
<!-- Lab Address -->
<col style="width: 40%">
<!-- Accreditation Logo -->
<!-- Accreditation Logo and QR -->
<col style="width: 20%">
</colgroup>
<tr>
Expand Down Expand Up @@ -93,6 +93,14 @@
tal:condition="not:accreditation_logo"
tal:attributes="src python:view.get_resource_url('AccreditationBodyLogo.png', prefix='bika.lims.images' )"/>
</div>
<div class="text-right">
<!-- QR Code -->
<div class="qrcode"
data-size="80"
data-color="#3a3"
tal:attributes="data-text model/absolute_url">
</div>
</div>
</td>
</tr>
</table>
Expand Down

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions webpack/app/api.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ class PublishAPI
barcode_hri = '<div class=\'barcode-hri\'>' + id + '</div>'
$(this).append barcode_hri


render_qrcodes: ->
###
* Render QR codes
###
$('.qrcode').each ->
text = $(this).attr('data-text')
console.debug "Render QR Code #{text}"
size = $(this).attr('data-size')
color = $(this).attr('data-color')

$(this).qrcode
'size': size
'color': color
'text': text
'render': 'image'


render_ranges: ->
###
* Render ranges (graphs)
Expand Down
3 changes: 3 additions & 0 deletions webpack/app/senaite.impress.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class PublishController extends React.Component
# render the barcodes
@api.render_barcodes()

# render the qr codes
@api.render_qrcodes()

# render range graphs
@api.render_ranges()

Expand Down