- content_for :head
  = vite_javascript_tag 'cocoon'

= form_with(model: warehouse_order) do |form|
  - if warehouse_order.errors.any?
    = render layout: 'shared/banner', locals: {color: 'alert'} do
      b hey, slight issue:
      ul
        - warehouse_order.errors.each do |error|
          li= error.full_message
  div
    = form.label :user_facing_title, "short title (shown to recipient):"
    = form.text_field :user_facing_title, class: 'form-control'

  div
    = form.label :recipient_email, "recipient email:"
    = form.email_field :recipient_email, class: 'form-control'

  b address:
  = render 'addresses/nested_form', form: form
  .py-3
    = form.label :internal_notes, "internal notes:"
    .display-block
      = form.text_area :internal_notes, class: 'form-control'
    
    = form.label :notify_on_dispatch, 'send the recipient a "sent to warehouse" email? '
    = form.check_box :notify_on_dispatch, class: 'form-control'
    br
    small
      | (they'll get an email when it ships regardless)
  h4 contents:
  #line_items
    = form.fields_for :line_items do |line_item|
      = render 'line_item_fields', f: line_item

    .links
      = link_to_add_association 'add item', form, :line_items
  = render 'shared/tag_picker', form: form, field_name: :tags
  .pt-3
    = form.submit "save", class: 'form-control'
