Sha256: 0c7b2ef61e93063389b13a4288a5053d8b2cd80e6e61218e3bcb248969176628

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

Deface::Override.new(
  :virtual_path => "spree/admin/users/edit",
  :name => "referral_fieldset",
  :insert_after => "[data-hook='admin_user_api_key']"
) do
<<-CODE.chomp
<fieldset>
  <legend>Referral Information</legend>
  <table>
    <tr>
      <th>Referred by</th>
      <td>
        <% if @user.referred? %>
          <%= link_to(@user.referred_by.email, edit_admin_user_url(@user.referred_by)) %>
        <% elsif @user.affiliate? %>
          <%= link_to(@user.affiliate.name, edit_admin_affiliate_url(@user.affiliate)) %>
        <% else %>
          Organic
        <% end %>
      </td>
    </tr>
      <th>Referral code</th>
      <td><%= @user.referral.code %></td>
    <tr>
    </tr>
      <th>Referred orders</th>
      <td>
        <%= "No referred orders yet." if @user.referral.referred_orders.count == 0 %>
        <ol style="margin-left: 20px;">
          <% @user.referral.referred_orders.each do |order| %>
            <li><%= link_to order.number, edit_admin_order_path(order) %></li>
          <% end %>
        <ol>
      </td>
    <tr>
    <tr>
      <th>Users referred</th>
      <td>
        <%= "No referred users yet." if @user.referred_count == 0 %>
        <ol style="margin-left: 20px;">
          <% @user.referral.referred_users.each do |user| %>
            <li><%= link_to user.email, edit_admin_user_url(user) %></li>
          <% end %>
        </ol>
      </td>
    <tr>
  </tr>
</fieldset>
CODE
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_reffiliate-2.3.1 app/overrides/spree/admin/users/edit.rb