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

Display accession image #5266

Merged
merged 4 commits into from
Jan 9, 2025
Merged
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
47 changes: 47 additions & 0 deletions mason/stock/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,46 @@ function jqueryStuff() {


</div>
<%perl>
if ($type_name eq 'accession') {
</%perl>
<div class="col-sm-6">
<div style="position: relative;">
<button class="btn btn-default btn-small" id="toggle_qr_code" style="position: absolute; right: 10px; top: 10px; z-index: 10;">Show QR Code</button>
</div>
</div>

<div id ="qr_code_display" style="display: none; text-align: center; margin-top: 40px;">
<div style="text-align: center;">
<& /util/barcode.mas, identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode" &>
</div>
</div>

<div class="col-sm-6">
<br /><br />
<div style="display: flex; justify-content: center; align-items; height: 100%; margin-top: 20px;">
<%perl>
use SGN::Image;
my $image_id = $stockref->{image_ids}->[0]->[0];
my $image = SGN::Image->new($schema->storage->dbh, $image_id, $c);
my $image_url = $image->get_image_url('small');
</%perl>

<img src="<% $image_url %>" alt="No accession image to display" class="img-responsive" style="max-width: 100%; height: auto;" />
</div>
<br /><br />
</div>
<%perl>
} else {
</%perl>
<div class="col-sm-6">
<br /><br />
<& /util/barcode.mas, identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode" &>
<br /><br />
</div>
<%perl>
}
</%perl>
</div>

<div class="row">
Expand Down Expand Up @@ -450,6 +485,18 @@ function jqueryStuff() {
}
});

jQuery('#toggle_qr_code').click(function() {
var qrCodeDisplay = jQuery('#qr_code_display');
var buttonText = jQuery(this).text();

qrCodeDisplay.toggle();
if (qrCodeDisplay.is(':visible')) {
jQuery(this).text('Hide QR Code');
} else {
jQuery(this).text('Show QR Code');
}
});


});

Expand Down
Loading