<% admin_breadcrumb link_to plural_resource_name(SolidusPromotions::Promotion), solidus_promotions.admin_promotions_path %>
<% admin_breadcrumb link_to(@promotion.name, solidus_promotions.edit_admin_promotion_path(@promotion)) %>
<% admin_breadcrumb plural_resource_name(SolidusPromotions::PromotionCode) %>

<% content_for :page_actions do %>
  <li>
    <%= link_to t('solidus_promotions.view_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id), class: 'btn btn-primary' %>

    <%= link_to t('solidus_promotions.download_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %>
  </li>
<% end %>

<%= form_for [:admin, @promotion, @promotion_code], method: :post do |f| %>
  <fieldset class="no-border-top">
    <%= render partial: 'spree/shared/error_messages', locals: { target: @promotion_code } %>

    <div class="row">
      <div class="col-4">
        <%= f.field_container :value do %>
          <%= f.label :value, class: 'required' %>
          <%= f.text_field :value, class: 'fullwidth', required: true %>
        <% end %>
      </div>
    </div>

    <div class="form-buttons filter-actions actions" data-hook="buttons">
      <%= f.submit t('spree.actions.create'), class: 'btn btn-primary' %>
      <%= link_to t('spree.actions.cancel'), solidus_promotions.admin_promotion_promotion_codes_url(@promotion), class: 'button' %>
    </div>
  </fieldset>
<% end %>
