|
|
|
@ -1,8 +1,9 @@
|
|
|
|
<% align = field.dig('preferences', 'align') %>
|
|
|
|
<% align = field.dig('preferences', 'align') %>
|
|
|
|
|
|
|
|
<% valign = field.dig('preferences', 'valign') %>
|
|
|
|
<% color = field.dig('preferences', 'color') %>
|
|
|
|
<% color = field.dig('preferences', 'color') %>
|
|
|
|
<% font = field.dig('preferences', 'font') %>
|
|
|
|
<% font = field.dig('preferences', 'font') %>
|
|
|
|
<% font_type = field.dig('preferences', 'font_type') %>
|
|
|
|
<% font_type = field.dig('preferences', 'font_type') %>
|
|
|
|
<field-value dir="auto" class="flex absolute text-[1.6vw] lg:text-base <%= 'font-mono' if font == 'Courier' %> <%= 'font-serif' if font == 'Times' %> <%= 'font-bold' if font_type == 'bold' || font_type == 'bold_italic' %> <%= 'italic' if font_type == 'italic' || font_type == 'bold_italic' %> <%= align == 'right' ? 'justify-end' : (align == 'center' ? 'justify-center' : '') %>" style="<%= "color: #{color}; " if color.present? %>width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: clamp(4pt, 1.6vw, #{field['preferences']['font_size'].to_i * 1.23}pt); line-height: `clamp(6pt, 2.0vw, #{(field['preferences']['font_size'].to_i * 1.23) + 3}pt)`" if field.dig('preferences', 'font_size') %>">
|
|
|
|
<field-value dir="auto" class="flex absolute text-[1.6vw] lg:text-base <%= 'font-mono' if font == 'Courier' %> <%= 'font-serif' if font == 'Times' %> <%= 'font-bold' if font_type == 'bold' || font_type == 'bold_italic' %> <%= 'italic' if font_type == 'italic' || font_type == 'bold_italic' %> <%= align == 'right' ? 'text-right' : (align == 'center' ? 'text-center' : '') %>" style="<%= "color: #{color}; " if color.present? %>width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: clamp(4pt, 1.6vw, #{field['preferences']['font_size'].to_i * 1.23}pt); line-height: `clamp(6pt, 2.0vw, #{(field['preferences']['font_size'].to_i * 1.23) + 3}pt)`" if field.dig('preferences', 'font_size') %>">
|
|
|
|
<% if field['type'] == 'signature' %>
|
|
|
|
<% if field['type'] == 'signature' %>
|
|
|
|
<div class="flex flex-col justify-between h-full overflow-hidden">
|
|
|
|
<div class="flex flex-col justify-between h-full overflow-hidden">
|
|
|
|
<div class="flex-grow flex overflow-hidden" style="min-height: 50%">
|
|
|
|
<div class="flex-grow flex overflow-hidden" style="min-height: 50%">
|
|
|
|
@ -61,17 +62,19 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% elsif field['type'] == 'date' %>
|
|
|
|
<% elsif field['type'] == 'date' %>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<div class="flex items-center px-0.5">
|
|
|
|
<div class="flex w-full px-0.5 <%= valign == 'top' ? 'items-start' : (valign == 'bottom' ? 'items-end' : 'items-center') %>">
|
|
|
|
<% value = Time.current.in_time_zone(local_assigns[:timezone]).to_date.to_s if value == '{{date}}' %>
|
|
|
|
<% 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 class="w-full"><%= TimeUtils.format_date_string(value, field.dig('preferences', 'format'), local_assigns[:locale]) %></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% elsif field['type'] == 'number' %>
|
|
|
|
<% elsif field['type'] == 'number' %>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<div class="flex items-center px-0.5 whitespace-nowrap">
|
|
|
|
<div class="flex w-full px-0.5 whitespace-nowrap <%= valign == 'top' ? 'items-start' : (valign == 'bottom' ? 'items-end' : 'items-center') %>">
|
|
|
|
<%= NumberUtils.format_number(value, field.dig('preferences', 'format')) %>
|
|
|
|
<div class="w-full"><%= NumberUtils.format_number(value, field.dig('preferences', 'format')) %></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<% else %>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<autosize-field></autosize-field>
|
|
|
|
<div class="flex items-center px-0.5 whitespace-pre-wrap"><%= Array.wrap(value).join(', ') %></div>
|
|
|
|
<div class="flex w-full px-0.5 whitespace-pre-wrap <%= valign == 'top' ? 'items-start' : (valign == 'bottom' ? 'items-end' : 'items-center') %>">
|
|
|
|
|
|
|
|
<div class="w-full"><%= Array.wrap(value).join(', ') %></div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</field-value>
|
|
|
|
</field-value>
|
|
|
|
|