<%# /templates/receipts/index.html.ep %> % layout 'default'; % title icon('receipts') . ' Receipts'; <% my $get_store_icon = sub { my $name = shift; return undef unless $name; my $slug = lc($name); $slug =~ s/[^a-z0-9]/-/g; $slug =~ s/-+/-/g; for my $ext (qw(png jpg jpeg gif svg)) { my $path = "public/images/shops/$slug.$ext"; return "/images/shops/$slug.$ext" if -e $path; } return undef; }; %> % content_for 'head' => begin % end

<%= icon('receipts') %> Receipt Ledger

<% if (my $msg = flash('message')) { %> <% } %> <% if (my $error = flash('error')) { %> <% } %>
Weekly Spend $<%= sprintf("%.2f", $summary->{week_total} // 0) %>
% for my $s (@{$breakdown->{week}}) { <% my $icon = $get_store_icon->($s->{store_name}); %>
% if ($icon) { % } <%= $s->{store_name} %> $<%= sprintf("%.2f", $s->{total}) %>
% }
Monthly Spend $<%= sprintf("%.2f", $summary->{month_total} // 0) %>
% for my $s (@{$breakdown->{month}}) { <% my $icon = $get_store_icon->($s->{store_name}); %>
% if ($icon) { % } <%= $s->{store_name} %> $<%= sprintf("%.2f", $s->{total}) %>
% }
Yearly Spend $<%= sprintf("%.2f", $summary->{year_total} // 0) %>
% for my $s (@{$breakdown->{year}}) { <% my $icon = $get_store_icon->($s->{store_name}); %>
% if ($icon) { % } <%= $s->{store_name} %> $<%= sprintf("%.2f", $s->{total}) %>
% }
% if (@$receipts) { % for my $r (@$receipts) { % } % } else { % }
Preview Filename Store Date Total Uploaded By Actions
% if ($r->{mime_type} =~ /^image/) {
% } else { <%= icon('receipts') %> % }
<%= $r->{original_filename} %>
<% if (my $icon = $get_store_icon->($r->{store_name})) { %> <% } %> <%= $r->{store_name} || 'Unknown' %>
% if ($r->{description}) {
<%= $r->{description} %> % }
<%= $r->{formatted_date} || '-' %> $<%= sprintf("%.2f", $r->{total_amount} // 0) %> <%= $r->{uploaded_by} %>
<%= icon('view') %> % if ($r->{uploaded_by} eq session('user') || is_admin) {
% }
📭 No receipts found. Upload one to get started.