Sha256: 0d17781217bbdbf1f0292505d87e7c267c66cd4deb07cb747239c667fdec024f

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 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 data-hook="admin_user_referral_table">
  <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) %> (<%= order.state %>)</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.4.1 app/overrides/spree/admin/users/edit.rb