diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb
index 7dc689e0..acb95259 100644
--- a/app/controllers/submissions_controller.rb
+++ b/app/controllers/submissions_controller.rb
@@ -12,6 +12,14 @@ class SubmissionsController < ApplicationController
authorize!(:create, Submission)
end
+ FIELD_ICONS = {
+ 'text' => 'text_size', 'signature' => 'writing_sign', 'date' => 'calendar_event',
+ 'number' => 'square_number_1', 'image' => 'photo', 'initials' => 'letter_case_upper',
+ 'file' => 'paperclip', 'select' => 'select', 'checkbox' => 'checkbox', 'radio' => 'circle_dot',
+ 'stamp' => 'rubber_stamp', 'cells' => 'columns_3', 'multiple' => 'checks', 'phone' => 'phone_check',
+ 'payment' => 'credit_card', 'verification' => 'id'
+ }.freeze
+
def show
@submission = Submissions.preload_with_pages(@submission)
diff --git a/app/views/icons/_calendar_event.html.erb b/app/views/icons/_calendar_event.html.erb
new file mode 100644
index 00000000..30985cd0
--- /dev/null
+++ b/app/views/icons/_calendar_event.html.erb
@@ -0,0 +1,7 @@
+
diff --git a/app/views/icons/_checkbox.html.erb b/app/views/icons/_checkbox.html.erb
new file mode 100644
index 00000000..4ba1aabd
--- /dev/null
+++ b/app/views/icons/_checkbox.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_checks.html.erb b/app/views/icons/_checks.html.erb
new file mode 100644
index 00000000..6785cfb8
--- /dev/null
+++ b/app/views/icons/_checks.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_columns_3.html.erb b/app/views/icons/_columns_3.html.erb
new file mode 100644
index 00000000..145a8e98
--- /dev/null
+++ b/app/views/icons/_columns_3.html.erb
@@ -0,0 +1,3 @@
+
diff --git a/app/views/icons/_credit_card.html.erb b/app/views/icons/_credit_card.html.erb
new file mode 100644
index 00000000..7715a538
--- /dev/null
+++ b/app/views/icons/_credit_card.html.erb
@@ -0,0 +1,6 @@
+
diff --git a/app/views/icons/_id.html.erb b/app/views/icons/_id.html.erb
new file mode 100644
index 00000000..fdabfdec
--- /dev/null
+++ b/app/views/icons/_id.html.erb
@@ -0,0 +1,7 @@
+
diff --git a/app/views/icons/_letter_case_upper.html.erb b/app/views/icons/_letter_case_upper.html.erb
new file mode 100644
index 00000000..ae1e879f
--- /dev/null
+++ b/app/views/icons/_letter_case_upper.html.erb
@@ -0,0 +1,6 @@
+
diff --git a/app/views/icons/_photo.html.erb b/app/views/icons/_photo.html.erb
new file mode 100644
index 00000000..ba5e8805
--- /dev/null
+++ b/app/views/icons/_photo.html.erb
@@ -0,0 +1,6 @@
+
diff --git a/app/views/icons/_rubber_stamp.html.erb b/app/views/icons/_rubber_stamp.html.erb
new file mode 100644
index 00000000..e55d052e
--- /dev/null
+++ b/app/views/icons/_rubber_stamp.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_select.html.erb b/app/views/icons/_select.html.erb
new file mode 100644
index 00000000..36fce4f4
--- /dev/null
+++ b/app/views/icons/_select.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_square_number_1.html.erb b/app/views/icons/_square_number_1.html.erb
new file mode 100644
index 00000000..b9dea773
--- /dev/null
+++ b/app/views/icons/_square_number_1.html.erb
@@ -0,0 +1,4 @@
+
diff --git a/app/views/icons/_text_size.html.erb b/app/views/icons/_text_size.html.erb
new file mode 100644
index 00000000..22b69e42
--- /dev/null
+++ b/app/views/icons/_text_size.html.erb
@@ -0,0 +1,8 @@
+
diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb
index 5ecd9ad9..80ff697f 100644
--- a/app/views/submissions/show.html.erb
+++ b/app/views/submissions/show.html.erb
@@ -93,8 +93,10 @@
<% fields_index = Templates.build_field_areas_index(@submission.template_fields || @submission.template.fields) %>
<% submitters_index = @submission.submitters.index_by(&:uuid) %>
+ <% submitters_order_index = nil %>
<% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %>
<% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %>
+ <% bg_classes = %w[bg-red-100 bg-sky-100 bg-emerald-100 bg-yellow-100 bg-purple-100 bg-pink-100 bg-cyan-100 bg-orange-100 bg-lime-100 bg-indigo-100] %>
<% schema.each do |item| %>
<% document = @submission.schema_documents.find { |e| e.uuid == item['attachment_uuid'] } %>
<% document_annots_index = document.metadata.dig('pdf', 'annotations')&.group_by { |e| e['page'] } || {} %>
@@ -111,19 +113,29 @@
<% fields_index.dig(document.uuid, index)&.each do |(area, field)| %>
<% value = values[field['uuid']].presence || (field['default_value'] != '{{date}}' && field['readonly'] == true && field['conditions'].blank? && field['default_value'].present? ? Submitters::SubmitValues.template_default_value_for_submitter(field['default_value'], @submission.submitters.find { |e| e.uuid == field['submitter_uuid'] }, with_time: false) : nil) %>
<% value ||= field['default_value'] if field['type'] == 'heading' %>
- <% next if value.blank? %>
<% submitter = submitters_index[field['submitter_uuid']] %>
- <% if (mask = field.dig('preferences', 'mask').presence) && signed_in? && can?(:read, @submission) %>
-
-
- <%= render 'submissions/value', font_scale:, area:, field:, attachments_index:, value:, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id: %>
-
-
- <%= render 'submissions/value', font_scale:, area:, field:, attachments_index:, value: Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', '), locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id: %>
+ <% if value.present? %>
+ <% if (mask = field.dig('preferences', 'mask').presence) && signed_in? && can?(:read, @submission) %>
+
+
+ <%= render 'submissions/value', font_scale:, area:, field:, attachments_index:, value:, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id: %>
+
+
+ <%= render 'submissions/value', font_scale:, area:, field:, attachments_index:, value: Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', '), locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id: %>
+
-
- <% else %>
- <%= render 'submissions/value', page_width: width, page_height: height, font_scale:, area:, field:, attachments_index:, value: mask.present? ? Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', ') : value, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id:, with_submitter_timezone:, with_signature_id_reason: %>
+ <% else %>
+ <%= render 'submissions/value', page_width: width, page_height: height, font_scale:, area:, field:, attachments_index:, value: mask.present? ? Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', ') : value, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id:, with_submitter_timezone:, with_signature_id_reason: %>
+ <% end %>
+ <% elsif field['readonly'] != true && submitter && !submitter.completed_at? %>
+ <% submitters_order_index ||= (@submission.template_submitters || @submission.template.submitters).each_with_index.to_h { |s, i| [s['uuid'], i] } %>
+ <% submitter_index = submitters_order_index[submitter.uuid] %>
+ <% bg_class = bg_classes[submitter_index % bg_classes.size] %>
+
+
+ <%= svg_icon(SubmissionsController::FIELD_ICONS[field['type']], class: 'max-h-10 w-full h-full stroke-2 opacity-50') %>
+
+
<% end %>
<% end %>