2021-12-01 18:16:45 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title><%= t("protocols.print.title") %></title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
2023-02-06 18:34:59 +08:00
|
|
|
<%= javascript_include_tag 'jquery_bundle' %>
|
2021-12-03 20:44:18 +08:00
|
|
|
<%= javascript_include_tag 'application' %>
|
|
|
|
<%= javascript_include_tag "handsontable.full" %>
|
|
|
|
<%= render 'shared/formulas_libraries' %>
|
2021-12-06 17:40:08 +08:00
|
|
|
<%= stylesheet_link_tag 'layouts/print_protocol', media: 'print, screen' %>
|
2021-12-01 18:16:45 +08:00
|
|
|
<body>
|
|
|
|
<%= yield %>
|
|
|
|
<script>
|
2021-12-03 20:44:18 +08:00
|
|
|
$("[data-role='hot-table']").each(function() {
|
|
|
|
var $container = $(this).find("[data-role='step-hot-table']");
|
|
|
|
var contents = $(this).find('.hot-contents');
|
2023-02-14 18:15:42 +08:00
|
|
|
var metadata = $(this).find('.hot-metadata');
|
2021-12-03 20:44:18 +08:00
|
|
|
|
|
|
|
$container.handsontable({
|
|
|
|
startRows: <%= Constants::HANDSONTABLE_INIT_ROWS_CNT %>,
|
|
|
|
startCols: <%= Constants::HANDSONTABLE_INIT_COLS_CNT %>,
|
|
|
|
rowHeaders: true,
|
|
|
|
colHeaders: true,
|
|
|
|
fillHandle: false,
|
|
|
|
formulas: true,
|
2023-02-14 18:15:42 +08:00
|
|
|
data: JSON.parse(contents.attr('value')).data,
|
|
|
|
cell: JSON.parse(metadata.val() || '{}').cells || [],
|
2021-12-03 20:44:18 +08:00
|
|
|
readOnly: true
|
|
|
|
});
|
|
|
|
var hot = $container.handsontable('getInstance');
|
|
|
|
|
2023-02-14 18:15:42 +08:00
|
|
|
setTimeout(() => {
|
|
|
|
hot.render()
|
|
|
|
}, 500)
|
2021-12-03 20:44:18 +08:00
|
|
|
});
|
|
|
|
|
2021-12-01 18:16:45 +08:00
|
|
|
window.print();
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|