.block
  .block__header
    span.block__header__title Available Items and Prices

    = if current?(@user, @conn.assigns.current_user) do
      = link "Add an item", to: ~p"/profiles/#{@user}/commission/items/new"

  .block__content

    = if not Enum.any?(@commission.items) do
      = if current?(@user, @conn.assigns.current_user) do
        p You have not added any items to your commissions sheet yet.
        p
          ' Your listing will not appear in search results until you
          = link "list at least one item", to: ~p"/profiles/#{@user}/commission/items/new"
          ' .
      - else
        p This artist has not added any items yet. Please check back later.

    table.table
      thead
        tr
          th Example
          th Description
          th Base Price
          th Add-Ons
          = if can?(@conn, :edit, @commission) do
            th Options
      tbody
        = for {description, add_ons, item} <- @items do
          tr
            td
              = if item.example_image do
                = render PhilomenaWeb.ImageView, "_image_container.html", image: item.example_image, size: :thumb_small, conn: @conn
              - else
                | (No example)

            td
              strong
                = item.item_type

              br
              br

              = description
            td
              | $
              = Decimal.round(item.base_price, 2)

            td
              = add_ons

            = if can?(@conn, :edit, @commission) do
              td
                = link "Edit item", to: ~p"/profiles/#{@user}/commission/items/#{item}/edit"
                br
                br
                = link "Delete item", to: ~p"/profiles/#{@user}/commission/items/#{item}", data: [confirm: "Are you really, really sure?", method: "delete"]
