|
|
|
|
@ -74,12 +74,14 @@
|
|
|
|
|
<% schema = Submissions.filtered_conditions_schema(@submission, values:) %>
|
|
|
|
|
<% schema.each do |item| %>
|
|
|
|
|
<% document = @submission.schema_documents.find { |a| item['attachment_uuid'] == a.uuid } %>
|
|
|
|
|
<a href="#<%= "page-#{document.uuid}-0" %>" onclick="[event.preventDefault(), window[event.target.closest('a').href.split('#')[1]].scrollIntoView({ behavior: 'smooth', block: 'start' })]" class="block cursor-pointer">
|
|
|
|
|
<img src="<%= Docuseal::URL_CACHE.fetch([document.id, document.uuid, 0].join(':'), expires_in: 10.minutes) { document.preview_images.first.url } %>" width="<%= document.preview_images.first.metadata['width'] %>" height="<%= document.preview_images.first.metadata['height'] %>" class="rounded border" loading="lazy">
|
|
|
|
|
<div class="pb-2 pt-1.5 text-center" dir="auto">
|
|
|
|
|
<%= item['name'].presence || document.filename.base %>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<% if document.preview_images.first %>
|
|
|
|
|
<a href="#<%= "page-#{document.uuid}-0" %>" onclick="[event.preventDefault(), window[event.target.closest('a').href.split('#')[1]].scrollIntoView({ behavior: 'smooth', block: 'start' })]" class="block cursor-pointer">
|
|
|
|
|
<img src="<%= Docuseal::URL_CACHE.fetch([document.id, document.uuid, 0].join(':'), expires_in: 10.minutes) { document.preview_images.first.url } %>" width="<%= document.preview_images.first.metadata['width'] %>" height="<%= document.preview_images.first.metadata['height'] %>" class="rounded border" loading="lazy">
|
|
|
|
|
<div class="pb-2 pt-1.5 text-center" dir="auto">
|
|
|
|
|
<%= item['name'].presence || document.filename.base %>
|
|
|
|
|
</div>
|
|
|
|
|
</a>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="document_view" class="w-full overflow-y-auto overflow-x-hidden mt-0.5 pt-0.5">
|
|
|
|
|
@ -92,7 +94,7 @@
|
|
|
|
|
<% document = @submission.schema_documents.find { |e| e.uuid == item['attachment_uuid'] } %>
|
|
|
|
|
<% document_annots_index = document.metadata.dig('pdf', 'annotations')&.group_by { |e| e['page'] } || {} %>
|
|
|
|
|
<% preview_images_index = document.preview_images.loaded? ? document.preview_images.index_by { |e| e.filename.base.to_i } : {} %>
|
|
|
|
|
<% lazyload_metadata = document.preview_images.first.metadata %>
|
|
|
|
|
<% lazyload_metadata = document.preview_images.first&.metadata || {} %>
|
|
|
|
|
<% (document.metadata.dig('pdf', 'number_of_pages') || (document.preview_images.loaded? ? preview_images_index.size : document.preview_images.size)).times do |index| %>
|
|
|
|
|
<% page = preview_images_index[index] || page_blob_struct.new(metadata: lazyload_metadata, url: preview_document_page_path(document.signed_uuid, "#{index}.jpg")) %>
|
|
|
|
|
<div id="<%= "page-#{document.uuid}-#{index}" %>" class="relative">
|
|
|
|
|
|