Rearranging elements on the order cycle form a little bit

This commit is contained in:
Rob Harrington
2015-04-08 14:31:18 +10:00
parent 32cc17745a
commit f6e635466b
3 changed files with 15 additions and 23 deletions

View File

@@ -1,5 +1,7 @@
= render 'name_and_timing_form', f: f
-if Enterprise.managed_by(spree_current_user).include? @order_cycle.coordinator
= render 'coordinator_fees', f: f
%h2 Incoming
%table.exchanges
@@ -20,15 +22,6 @@
= f.submit 'Add supplier', 'ng-click' => 'addSupplier($event)'
%h2 Coordinator
-if Enterprise.managed_by(spree_current_user).include? @order_cycle.coordinator
= f.label :coordinator_id, 'Coordinator'
= f.select :coordinator_id, permitted_coordinating_enterprise_options_for(@order_cycle), { include_blank: true }, {'ng-model' => 'order_cycle.coordinator_id', 'ofn-on-change' => 'order_cycle.coordinator_fees = []', 'required' => true}
= render 'coordinator_fees', f: f
- else
= @order_cycle.coordinator.name
%h2 Outgoing
%table.exchanges
%thead

View File

@@ -2,20 +2,24 @@
.row
.alpha.two.columns
= f.label :name
.fourteen.columns.omega
.six.columns.omega
- if as_coordinator
= f.text_field :name, 'ng-model' => 'order_cycle.name', 'required' => true
- else
{{ order_cycle.name }}
.row
.alpha.two.columns
.two.columns
= f.label :orders_open_at, 'Orders open'
.six.columns
.omega.six.columns
- if as_coordinator
= f.text_field :orders_open_at, 'datetimepicker' => 'order_cycle.orders_open_at', 'ng-model' => 'order_cycle.orders_open_at'
- else
{{ order_cycle.orders_open_at }}
.row
.alpha.two.columns
= f.label :coordinator
.six.columns.omega
= @order_cycle.coordinator.name
.two.columns
= f.label :orders_close_at, 'Orders close'
.six.columns.omega

View File

@@ -90,7 +90,6 @@ feature %q{
fill_in 'order_cycle_name', with: 'Plums & Avos'
fill_in 'order_cycle_orders_open_at', with: '2040-11-06 06:00:00'
fill_in 'order_cycle_orders_close_at', with: '2040-11-13 17:00:00'
select 'My coordinator', from: 'order_cycle_coordinator_id'
# And I add a coordinator fee
click_button 'Add coordinator fee'
@@ -170,8 +169,7 @@ feature %q{
page.find('#order_cycle_name').value.should == oc.name
page.find('#order_cycle_orders_open_at').value.should == oc.orders_open_at.to_s
page.find('#order_cycle_orders_close_at').value.should == oc.orders_close_at.to_s
page.find('#order_cycle_coordinator_id').value.to_i.should == oc.coordinator_id
page.should have_selector "select[name='order_cycle_coordinator_fee_0_id']"
page.should have_content "COORDINATOR #{oc.coordinator.name}"
# And I should see the suppliers
page.should have_selector 'td.supplier_name', :text => oc.suppliers.first.name
@@ -524,13 +522,11 @@ feature %q{
page.should have_content oc_user_coordinating.name
page.should_not have_content oc_for_other_user.name
# The order cycle should show enterprises that I manage
# The order cycle should show all enterprises in the order cycle
page.should have_selector 'td.suppliers', text: supplier_managed.name
page.should have_selector 'td.distributors', text: distributor_managed.name
# The order cycle should not show enterprises that I don't manage
page.should_not have_selector 'td.suppliers', text: supplier_unmanaged.name
page.should_not have_selector 'td.distributors', text: distributor_unmanaged.name
page.should have_selector 'td.suppliers', text: supplier_unmanaged.name
page.should have_selector 'td.distributors', text: distributor_unmanaged.name
end
scenario "creating a new order cycle" do
@@ -551,7 +547,6 @@ feature %q{
select_incoming_variant supplier_managed, 0, product_managed.master
select_incoming_variant supplier_permitted, 1, product_permitted.master
select 'Managed distributor', from: 'order_cycle_coordinator_id'
click_button 'Add coordinator fee'
select 'Managed distributor fee', from: 'order_cycle_coordinator_fee_0_id'