<%= ngettext "Found %{count} file", "Found %{count} files", length(@status.files), count: length(@status.files) %>

<%= link raw(""), to: "#", type: "button", class: "button is-text is-inverted", phx_click: "reload", disabled: @status.state != :idle %>
<%= for %{path: path, date: date, complete: complete} <- @status.files do %> <% {year, month} = with [year, month] <- date, month = month |> to_string() |> String.pad_leading(2, "0") do {year, month} else _ -> {"????", "??"} end %> <% end %>
<%= "#{month}/#{year}" %> <%= Path.absname(path) %> <%= case {@status.state, complete} do %> <% {:running, true} -> %> <% {:running, false} -> %> <%= content_tag :span, nil, class: "is-loading" %> <% {:error, true} -> %> <% {:error, false} -> %> <% {:complete, true } -> %> <% {:complete, false} -> %> <% {:idle, _} -> %> <% end %>
<%= if @status.state == :idle do %> <.form let={f} for={@changeset} phx_change="change" phx_submit="import">
<%= label f, :timezone, gettext("Time zone"), class: "label is-medium " %>
<%= select(f, :timezone, @timezones, disabled: @status.state != :idle) %>
<%= submit gettext("Import"), class: "button is-success is-fullwidth", disabled: !@changeset.valid? or length(@status.files) < 1, phx_disable_with: "Saving...", phx_loading_class: "is-loading" %>
<% end %> <%= if @status.state == :error do %> <%= inspect(@status.message, pretty: true) %> <% end %>