mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
4.0 KiB
74 lines
4.0 KiB
<% align = field.dig('preferences', 'align') %>
|
|
<field-value dir="auto" class="flex absolute text-[1.6vw] lg:text-base <%= align == 'right' ? 'justify-end' : (align == 'center' ? 'justify-center' : '') %>" style="width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: #{field['preferences']['font_size']}pt" if field.dig('preferences', 'font_size') %>">
|
|
<% if field['type'] == 'signature' %>
|
|
<div class="flex flex-col justify-between h-full overflow-hidden">
|
|
<div class="flex-grow flex overflow-hidden" style="min-height: 50%">
|
|
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>">
|
|
</div>
|
|
<% if local_assigns[:with_signature_id] && attachment = attachments_index[value] %>
|
|
<div class="w-full mt-1 text-[1vw] lg:text-[0.55rem] lg:leading-[0.65rem]">
|
|
<div class="truncate uppercase">
|
|
ID: <%= attachment.uuid %>
|
|
</div>
|
|
<div>
|
|
<%= t('reason') %>: <%= submitter.values[field.dig('preferences', 'reason_field_uuid')].presence || t('digitally_signed_by') %> <%= submitter.name %>
|
|
<% if submitter.email %>
|
|
<<%= submitter.email %>>
|
|
<% end %>
|
|
</div>
|
|
<div>
|
|
<%= l(attachment.created_at.in_time_zone(local_assigns[:timezone]), format: :long, locale: local_assigns[:locale]) %> <%= TimeUtils.timezone_abbr(local_assigns[:timezone], attachment.created_at) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% elsif field['type'].in?(['image', 'initials', 'stamp']) %>
|
|
<img class="object-contain mx-auto" src="<%= attachments_index[value].url %>" loading="lazy">
|
|
<% elsif field['type'].in?(['file', 'payment']) %>
|
|
<autosize-field></autosize-field>
|
|
<div class="px-0.5 flex flex-col justify-center">
|
|
<% Array.wrap(value).each do |val| %>
|
|
<a target="_blank" href="<%= attachments_index[val].url %>">
|
|
<%= svg_icon('paperclip', class: 'inline w-[1.6vw] h-[1.6vw] lg:w-4 lg:h-4') %>
|
|
<%= attachments_index[val].filename %>
|
|
</a>
|
|
<% end %>
|
|
</div>
|
|
<% elsif field['type'] == 'checkbox' %>
|
|
<div class="w-full flex items-center justify-center">
|
|
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
|
|
</div>
|
|
<% elsif field['type'].in?(%w[multiple radio]) && area['option_uuid'] %>
|
|
<% option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] } %>
|
|
<% option_name = option['value'].presence || "Option #{field['options'].index(option) + 1}" %>
|
|
<% if option && Array.wrap(value).include?(option_name) %>
|
|
<div class="w-full flex items-center justify-center">
|
|
<%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %>
|
|
</div>
|
|
<% end %>
|
|
<% elsif field['type'] == 'cells' && area['cell_w'].to_f > 0.0 %>
|
|
<% cell_width = area['cell_w'] / area['w'] * 100 %>
|
|
<div class="w-full flex items-center">
|
|
<% (0..(area['w'] / area['cell_w']).ceil).each do |index| %>
|
|
<% if value[index] %>
|
|
<div class="text-center flex-none" style="width: <%= cell_width %>%;"><%= value[index] %></div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<% elsif field['type'] == 'date' %>
|
|
<autosize-field></autosize-field>
|
|
<div class="flex items-center px-0.5">
|
|
<% value = Time.current.in_time_zone(local_assigns[:timezone]).to_date.to_s if value == '{{date}}' %>
|
|
<%= TimeUtils.format_date_string(value, field.dig('preferences', 'format'), local_assigns[:locale]) %>
|
|
</div>
|
|
<% elsif field['type'] == 'number' %>
|
|
<autosize-field></autosize-field>
|
|
<div class="flex items-center px-0.5 whitespace-nowrap">
|
|
<%= NumberUtils.format_number(value, field.dig('preferences', 'format')) %>
|
|
</div>
|
|
<% else %>
|
|
<autosize-field></autosize-field>
|
|
<div class="flex items-center px-0.5 whitespace-pre-wrap"><%= Array.wrap(value).join(', ') %></div>
|
|
<% end %>
|
|
</field-value>
|