Deface::Override.new( :virtual_path => "spree/admin/users/edit", :name => "referral_fieldset", :insert_after => "[data-hook='admin_user_api_key']" ) do <<-CODE.chomp
Referral Information CODE end
Referred by <% 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 %>
Referral code <%= @user.referral.code %>
Referred orders <%= "No referred orders yet." if @user.referral.referred_orders.count == 0 %>
    <% @user.referral.referred_orders.each do |order| %>
  1. <%= link_to order.number, edit_admin_order_path(order) %>
  2. <% end %>
Users referred <%= "No referred users yet." if @user.referred_count == 0 %>
    <% @user.referral.referred_users.each do |user| %>
  1. <%= link_to user.email, edit_admin_user_url(user) %>
  2. <% end %>