mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Remove changes related to enterprise trials as they dont make sense without business models and account invoices
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
@import "../variables";
|
||||
|
||||
#trial_progress_bar {
|
||||
position: fixed;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
width: 100vw;
|
||||
padding: 8px 10px;
|
||||
font-weight: bold;
|
||||
background-color: $spree-blue;
|
||||
color: white;
|
||||
}
|
||||
@@ -64,10 +64,6 @@ module Admin
|
||||
|
||||
attributes = { sells: params[:sells], visible: true }
|
||||
|
||||
if ['own', 'any'].include? params[:sells]
|
||||
attributes[:shop_trial_start_date] = @enterprise.shop_trial_start_date || Time.zone.now
|
||||
end
|
||||
|
||||
if @enterprise.update_attributes(attributes)
|
||||
flash[:success] = I18n.t(:enterprise_register_success_notice, enterprise: @enterprise.name)
|
||||
redirect_to admin_path
|
||||
|
||||
@@ -78,22 +78,6 @@ module EnterprisesHelper
|
||||
link_to_with_icon 'icon-trash', name, url, options
|
||||
end
|
||||
|
||||
def shop_trial_in_progress?(enterprise)
|
||||
!!enterprise.shop_trial_start_date &&
|
||||
(enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days > Time.zone.now) &&
|
||||
%w(own any).include?(enterprise.sells)
|
||||
end
|
||||
|
||||
def shop_trial_expired?(enterprise)
|
||||
!!enterprise.shop_trial_start_date &&
|
||||
(enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days <= Time.zone.now) &&
|
||||
%w(own any).include?(enterprise.sells)
|
||||
end
|
||||
|
||||
def remaining_trial_days(enterprise)
|
||||
distance_of_time_in_words(Time.zone.now, enterprise.shop_trial_start_date + Spree::Config[:shop_trial_length_days].days)
|
||||
end
|
||||
|
||||
def order_changes_allowed?
|
||||
current_order.andand.distributor.andand.allow_order_changes?
|
||||
end
|
||||
|
||||
@@ -321,10 +321,6 @@ class Enterprise < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def shop_trial_expiry
|
||||
shop_trial_start_date.andand + Spree::Config[:shop_trial_length_days].days
|
||||
end
|
||||
|
||||
def can_invoice?
|
||||
abn.present?
|
||||
end
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
%p.description
|
||||
= t('.producer_hub_description_text')
|
||||
|
||||
-# %p.description
|
||||
-# Test out having your own shopfront with full access to all Shopfront features for 30 days.
|
||||
-# %br
|
||||
-# %br
|
||||
-# At the end of your trial, there is a one-off $200 fee to fully activate your account. Then you will be billed for 2% of your actual transactions, capped at $50 a month (so if you don’t sell anything you don’t pay anything, but you never pay more than $50 a month).
|
||||
|
||||
- else
|
||||
.two.columns.alpha
|
||||
|
||||
@@ -76,14 +70,7 @@
|
||||
.sixteen.columns.alpha
|
||||
%span.error{ ng: { show: "(change_type.sells.$error.required || change_type.sells.$error.pattern) && submitted" } }
|
||||
= t('.choose_option')
|
||||
- if @enterprise.sells == 'unspecified' && @enterprise.shop_trial_start_date.nil?
|
||||
-if free_use?
|
||||
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)" } }
|
||||
- else
|
||||
- trial_length = Spree::Config[:shop_trial_length_days]
|
||||
%input.button.big{ type: 'submit', value: "Start #{trial_length}-Day Shop Trial", ng: { click: "submit(change_type)", show: "sells=='own' || sells=='any'" } }
|
||||
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)", hide: "sells=='own' || sells=='any'" } }
|
||||
- elsif @enterprise.sells == 'unspecified'
|
||||
- if @enterprise.sells == 'unspecified'
|
||||
%input.button.big{ type: 'submit', value: t(:select_continue), ng: { click: "submit(change_type)" } }
|
||||
- else
|
||||
%input.button.big{ type: 'submit', value: t('.change_now'), ng: { click: "submit(change_type)" } }
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
.small-12.medium-10.medium-offset-1.columns.text-center
|
||||
%h2
|
||||
= t :shops_signup_pricing
|
||||
-# %p.text-big
|
||||
-# If there is a time-sensitive offer you can write it here, e.g.
|
||||
-# Sign up before 30th June for an extra month free!
|
||||
%br
|
||||
= ContentConfig.hub_signup_pricing_table_html.html_safe
|
||||
|
||||
|
||||
@@ -89,5 +89,3 @@
|
||||
%a.button.bottom{href: main_app.admin_order_cycles_path}
|
||||
= t "manage_order_cycles"
|
||||
%span.icon-arrow-right
|
||||
|
||||
= render 'spree/admin/shared/trial_progress_bar', enterprise: @enterprise
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
- if enterprise
|
||||
-if shop_trial_in_progress?(enterprise)
|
||||
#trial_progress_bar
|
||||
= "#{t(:shop_trial_expires_in)} #{remaining_trial_days(enterprise)}."
|
||||
-elsif shop_trial_expired?(enterprise)
|
||||
#trial_progress_bar
|
||||
= t(:shop_trial_expired_notice)
|
||||
@@ -202,17 +202,9 @@ en:
|
||||
confirm_resend_order_confirmation: "Are you sure you want to resend the order confirmation email?"
|
||||
must_have_valid_business_number: "%{enterprise_name} must have a valid ABN before invoices can be sent."
|
||||
invoice: "Invoice"
|
||||
percentage_of_sales: "%{percentage} of sales"
|
||||
capped_at_cap: "capped at %{cap}"
|
||||
per_month: "per month"
|
||||
free: "free"
|
||||
free_trial: "free trial"
|
||||
plus_tax: "plus GST"
|
||||
min_bill_turnover_desc: "once turnover exceeds %{mbt_amount}"
|
||||
more: "More"
|
||||
say_no: "No"
|
||||
say_yes: "Yes"
|
||||
then: then
|
||||
ongoing: Ongoing
|
||||
bill_address: Billing Address
|
||||
ship_address: Shipping Address
|
||||
@@ -1767,10 +1759,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
products_distributor_info: When you select a distributor for your order, their address and pickup times will be displayed here.
|
||||
products_distribution_adjustment_label: "Product distribution by %{distributor} for %{product}"
|
||||
|
||||
shop_trial_expires_in: "Your shopfront trial expires in"
|
||||
shop_trial_expired_notice: "Good news! We have decided to extend shopfront trials until further notice."
|
||||
|
||||
|
||||
# keys used in javascript
|
||||
password: Password
|
||||
remember_me: Remember Me
|
||||
@@ -2154,7 +2142,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
live: "live"
|
||||
manage: "Manage"
|
||||
resend: "Resend"
|
||||
trial: Trial
|
||||
add_and_manage_products: "Add & manage products"
|
||||
add_and_manage_order_cycles: "Add & manage order cycles"
|
||||
manage_order_cycles: "Manage order cycles"
|
||||
@@ -2187,7 +2174,6 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
hub_sidebar_at_least: "At least one hub must be selected"
|
||||
hub_sidebar_blue: "blue"
|
||||
hub_sidebar_red: "red"
|
||||
shop_trial_in_progress: "Your shopfront trial expires in %{days}."
|
||||
report_customers_distributor: "Distributor"
|
||||
report_customers_supplier: "Supplier"
|
||||
report_customers_cycle: "Order Cycle"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class DropEnterpriseShopTrialStartDate < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :enterprises, :shop_trial_start_date
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :enterprises, :shop_trial_start_date, :datetime, default: nil
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20190221131741) do
|
||||
ActiveRecord::Schema.define(:version => 20190221214542) do
|
||||
|
||||
create_table "account_invoices", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
@@ -233,7 +233,6 @@ ActiveRecord::Schema.define(:version => 20190221131741) do
|
||||
t.string "linkedin"
|
||||
t.integer "owner_id", :null => false
|
||||
t.string "sells", :default => "none", :null => false
|
||||
t.datetime "shop_trial_start_date"
|
||||
t.boolean "producer_profile_only", :default => false
|
||||
t.string "permalink", :null => false
|
||||
t.boolean "charges_sales_tax", :default => false, :null => false
|
||||
|
||||
@@ -344,90 +344,20 @@ module Admin
|
||||
enterprise.save!
|
||||
end
|
||||
|
||||
context "if the trial has finished" do
|
||||
let(:trial_start) { 30.days.ago.beginning_of_day }
|
||||
|
||||
before do
|
||||
enterprise.update_attribute(:shop_trial_start_date, trial_start)
|
||||
end
|
||||
|
||||
it "is allowed" do
|
||||
Timecop.freeze(Time.zone.local(2015, 4, 16, 14, 0, 0)) do
|
||||
spree_post :register, { id: enterprise, sells: 'own' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.sells).to eq 'own'
|
||||
expect(enterprise.shop_trial_start_date).to eq trial_start
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "if the trial has not finished" do
|
||||
let(:trial_start) { Date.current.to_time }
|
||||
|
||||
before do
|
||||
enterprise.update_attribute(:shop_trial_start_date, trial_start)
|
||||
end
|
||||
|
||||
it "is allowed, but trial start date is not reset" do
|
||||
spree_post :register, { id: enterprise, sells: 'own' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.sells).to eq 'own'
|
||||
expect(enterprise.shop_trial_start_date).to eq trial_start
|
||||
end
|
||||
end
|
||||
|
||||
context "if a trial has not started" do
|
||||
it "is allowed" do
|
||||
spree_post :register, { id: enterprise, sells: 'own' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(flash[:success]).to eq "Congratulations! Registration for #{enterprise.name} is complete!"
|
||||
expect(enterprise.reload.sells).to eq 'own'
|
||||
expect(enterprise.reload.shop_trial_start_date).to be > Time.zone.now-(1.minute)
|
||||
end
|
||||
it "is allowed" do
|
||||
spree_post :register, { id: enterprise, sells: 'own' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(flash[:success]).to eq "Congratulations! Registration for #{enterprise.name} is complete!"
|
||||
expect(enterprise.reload.sells).to eq 'own'
|
||||
end
|
||||
end
|
||||
|
||||
context "setting 'sells' to any" do
|
||||
context "if the trial has finished" do
|
||||
let(:trial_start) { 30.days.ago.beginning_of_day }
|
||||
|
||||
before do
|
||||
enterprise.update_attribute(:shop_trial_start_date, trial_start)
|
||||
end
|
||||
|
||||
it "is allowed" do
|
||||
Timecop.freeze(Time.zone.local(2015, 4, 16, 14, 0, 0)) do
|
||||
spree_post :register, { id: enterprise, sells: 'any' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.sells).to eq 'any'
|
||||
expect(enterprise.shop_trial_start_date).to eq trial_start
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "if the trial has not finished" do
|
||||
let(:trial_start) { Date.current.to_time }
|
||||
|
||||
before do
|
||||
enterprise.update_attribute(:shop_trial_start_date, trial_start)
|
||||
end
|
||||
|
||||
it "is allowed, but trial start date is not reset" do
|
||||
spree_post :register, { id: enterprise, sells: 'any' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(enterprise.reload.sells).to eq 'any'
|
||||
expect(enterprise.shop_trial_start_date).to eq trial_start
|
||||
end
|
||||
end
|
||||
|
||||
context "if a trial has not started" do
|
||||
it "is allowed" do
|
||||
spree_post :register, { id: enterprise, sells: 'any' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(flash[:success]).to eq "Congratulations! Registration for #{enterprise.name} is complete!"
|
||||
expect(enterprise.reload.sells).to eq 'any'
|
||||
expect(enterprise.reload.shop_trial_start_date).to be > Time.zone.now-(1.minute)
|
||||
end
|
||||
it "is allowed" do
|
||||
spree_post :register, { id: enterprise, sells: 'any' }
|
||||
expect(response).to redirect_to spree.admin_path
|
||||
expect(flash[:success]).to eq "Congratulations! Registration for #{enterprise.name} is complete!"
|
||||
expect(enterprise.reload.sells).to eq 'any'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user