nbg and auto fill GEL exchange rate
All checks were successful
Build and Deploy to Production / build (push) Successful in 47s
Build and Deploy to Production / deploy (push) Successful in 27s

This commit is contained in:
Sergei Poljanski 2026-06-08 19:29:25 +03:00
commit 7dbeb0dd49
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
7 changed files with 161 additions and 5 deletions

View file

@ -48,8 +48,10 @@
</select>
</div>
<div class="field">
<label for="gel_rate">GEL rate</label>
<label for="gel_rate">GEL rate (GEL per 1 <span id="gel-rate-ccy">unit</span>)</label>
<input type="text" id="gel_rate" name="gel_rate" value="<%= @form_values[:gel_rate] %>" placeholder="2.9500" inputmode="decimal" required />
<button type="button" id="fetch-gel-rate" class="link-button">↻ Fetch official (NBG)</button>
<span id="gel-rate-status" class="optional"></span>
</div>
</div>

View file

@ -16,7 +16,7 @@
<% if @invoice.ltc? %>
<dt>LTC</dt>
<dd class="mono">
<% if (amt = @invoice.ltc_amount_due) %><%= amt.to_s('F').sub(/\.?0+$/, '') %> LTC<% if @invoice.ltc_rate %> @ <%= '%.2f' % @invoice.ltc_rate %> <%= @invoice.currency %><% end %><br /><% end %>
<% if (amt = @invoice.ltc_amount_due) %><%= amt.to_s('F').sub(/\.?0+$/, '') %> LTC<% if @invoice.ltc_rate %> @ <%= @invoice.ltc_rate.to_s('F').sub(/(\.\d*?)0+$/, '\1').sub(/\.$/, '') %> <%= @invoice.currency %><% end %><br /><% end %>
<span style="word-break:break-all;"><%= @invoice.ltc_address %></span>
</dd>
<% end %>

View file

@ -9,6 +9,12 @@
<dt>Issued</dt><dd class="mono"><%= @invoice.issued_on.strftime('%Y-%m-%d') %></dd>
<dt>Due</dt><dd class="mono"><%= @invoice.due_on.strftime('%Y-%m-%d') %></dd>
<dt>Total</dt><dd class="mono"><%= @invoice.currency %> <%= '%.2f' % @invoice.total %></dd>
<% unless @invoice.currency == 'GEL' %>
<dt>In GEL</dt><dd class="mono">GEL <%= '%.2f' % @invoice.total_gel %> <span class="optional">@ <%= fmt_rate(@invoice.gel_rate) %></span></dd>
<% end %>
<% if @invoice.ltc? && (ltc = @invoice.ltc_amount_due) %>
<dt>In LTC</dt><dd class="mono"><%= fmt_ltc(ltc) %> LTC<% if @invoice.ltc_rate %> <span class="optional">@ <%= fmt_rate(@invoice.ltc_rate) %> <%= @invoice.currency %></span><% end %></dd>
<% end %>
<dt>Status</dt><dd><span class="badge badge-<%= @invoice.status %>"><%= @invoice.status %></span></dd>
</dl>
</section>