Merge master into producer-emails.

This commit is contained in:
Paul Mackay
2015-03-04 19:09:43 +00:00
468 changed files with 11434 additions and 3239 deletions

View File

@@ -3,11 +3,7 @@
= ng_form_for @enterprise_fee_set, :url => main_app.bulk_update_admin_enterprise_fees_path, :html => {'ng-app' => 'enterprise_fees', 'ng-controller' => 'AdminEnterpriseFeesCtrl'} do |enterprise_fee_set_form|
= hidden_field_tag 'enterprise_id', @enterprise.id if @enterprise
- if @enterprise_fee_set.errors.present?
%h2 Errors
%ul
- @enterprise_fee_set.errors.each do |error|
%li= error
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise_fee_set }
%input.search{'ng-model' => 'query', 'placeholder' => 'Search'}

View File

@@ -1,43 +1,16 @@
= f.field_container :name do
= f.label :name
%br/
= f.text_field :name
= render 'spree/shared/error_messages', target: @enterprise
= f.field_container :description do
= f.label :description
%br/
= f.text_field :description
= f.field_container :long_description do
= f.label :long_description
%br/
= f.text_area :long_description
= f.field_container :on_front_page do
= f.label :on_front_page, 'On front page?'
%br/
= f.check_box :on_front_page
= f.field_container :enterprise_ids do
= f.label :enterprise_ids, 'Enterprises'
%br/
= f.collection_select :enterprise_ids, Enterprise.all, :id, :name, {}, {class: "select2 fullwidth", multiple: true}
.row
.alpha.three.columns
= f.label :logo, class: 'with-tip', 'data-powertip' => 'This is the logo'
.with-tip{'data-powertip' => 'This is the logo'}
%a What's this?
.omega.eight.columns
= image_tag @object.logo.url if @object.logo.present?
= f.file_field :logo
.row
.alpha.three.columns
= f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed at the top of the Group profile'
.with-tip{'data-powertip' => 'This image is displayed at the top of the Group profile'}
%a What's this?
.omega.eight.columns
= image_tag @object.promo_image.url if @object.promo_image.present?
= f.file_field :promo_image
= form_for [main_app, :admin, @enterprise_group] do |f|
.row{ ng: {app: 'admin.enterprise_groups', controller: 'enterpriseGroupCtrl'} }
.sixteen.columns.alpha
.four.columns.alpha
= render 'admin/shared/side_menu'
.one.column  
.eleven.columns.omega.fullwidth_inputs
= render 'form_primary_details', f: f
= render 'form_users', f: f
= render 'form_about', f: f
= render 'form_images', f: f
= render 'form_address', f: f
= render 'form_web', f: f
= render "spree/admin/shared/#{action}_resource_links"

View File

@@ -0,0 +1,6 @@
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='About'" } }
%legend About
= f.field_container :long_description do
= f.label :long_description
%br/
= f.text_area :long_description

View File

@@ -0,0 +1,41 @@
= f.fields_for :address do |af|
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Contact'" } }
%legend Contact
.row
.alpha.three.columns
= af.label :phone
.omega.eight.columns
= af.text_field :phone, { placeholder: "eg. 98 7654 3210"}
.row
.alpha.three.columns
= f.label :email
.omega.eight.columns
= f.text_field :email
.row
.three.columns.alpha
= af.label :address1
.eight.columns.omega
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
.row
.alpha.three.columns
= af.label :address2
.eight.columns.omega
= af.text_field :address2
.row
.three.columns.alpha
= af.label :city, 'Suburb'
\/
= af.label :zipcode, 'Postcode'
.four.columns
= af.text_field :city, { placeholder: "eg. Northcote"}
.four.columns.omega
= af.text_field :zipcode, { placeholder: "eg. 3070"}
.row
.three.columns.alpha
= af.label :state_id, 'State'
\/
= af.label :country_id, 'Country'
.four.columns
= af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth"
.four.columns.omega
= af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth"

View File

@@ -0,0 +1,18 @@
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Images'" } }
%legend Images
.row
.alpha.three.columns
= f.label :logo, class: 'with-tip', 'data-powertip' => 'This is the logo'
.with-tip{'data-powertip' => 'This is the logo'}
%a What's this?
.omega.eight.columns
= image_tag @object.logo.url if @object.logo.present?
= f.file_field :logo
.row
.alpha.three.columns
= f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed at the top of the Group profile'
.with-tip{'data-powertip' => 'This image is displayed at the top of the Group profile'}
%a What's this?
.omega.eight.columns
= image_tag @object.promo_image.url if @object.promo_image.present?
= f.file_field :promo_image

View File

@@ -0,0 +1,21 @@
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Primary Details'" } }
%legend Primary Details
= f.field_container :name do
= f.label :name
%br/
= f.text_field :name
= f.field_container :description do
= f.label :description
%br/
= f.text_field :description
= f.field_container :on_front_page do
= f.label :on_front_page, 'On front page?'
%br/
= f.check_box :on_front_page
= f.field_container :enterprise_ids do
= f.label :enterprise_ids, 'Enterprises'
%br/
= f.collection_select :enterprise_ids, @enterprises, :id, :name, {}, {class: "select2 fullwidth", multiple: true}

View File

@@ -0,0 +1,14 @@
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Users'" } }
%legend Users
.row
.three.columns.alpha
=f.label :owner_id, 'Owner'
.with-tip{'data-powertip' => "The primary user responsible for this group."}
%a What's this?
.eight.columns.omega
- if spree_current_user.admin?
= f.hidden_field :owner_id,
class: "select2 fullwidth",
'user-select' => "{id:'#{@enterprise_group.owner.andand.id}', email:'#{@enterprise_group.owner.andand.email}'}"
- else
= @enterprise_group.owner.andand.email

View File

@@ -0,0 +1,27 @@
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Web'" } }
%legend Web Resources
.row
.alpha.three.columns
= f.label :website
.omega.eight.columns
= f.text_field :website, { placeholder: "eg. www.truffles.com"}
.row
.alpha.three.columns
= f.label :facebook, 'Facebook'
.omega.eight.columns
= f.text_field :facebook
.row
.alpha.three.columns
= f.label :instagram, 'Instagram'
.omega.eight.columns
= f.text_field :instagram
.row
.alpha.three.columns
= f.label :linkedin, 'LinkedIn'
.omega.eight.columns
= f.text_field :linkedin
.row
.alpha.three.columns
= f.label :twitter
.omega.eight.columns
= f.text_field :twitter, { placeholder: "eg. @the_prof" }

View File

@@ -1,5 +1,3 @@
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise }
= form_for [main_app, :admin, @enterprise_group] do |f|
= render :partial => 'form', :locals => { :f => f }
= render :partial => 'spree/admin/shared/edit_resource_links'
= render 'admin/enterprise_groups/form', action: 'edit'

View File

@@ -9,6 +9,8 @@
%thead
%tr
%th Name
- if spree_current_user.admin?
%th Owner
%th On front page?
%th Enterprises
%th.actions
@@ -17,14 +19,18 @@
- @enterprise_groups.each do |enterprise_group|
%tr
%td.name= enterprise_group.name
- if spree_current_user.admin?
%td= enterprise_group.owner.andand.email || ""
%td= enterprise_group.on_front_page ? 'Y' : 'N'
%td= enterprise_group.enterprises.map(&:name).join ', '
%td.actions
= link_to '', main_app.edit_admin_enterprise_group_path(enterprise_group), class: 'edit-enterprise-group icon-edit no-text'
= link_to_delete enterprise_group, no_text: true
- if enterprise_group.last?
.blank-action
- else
= link_to_with_icon 'icon-arrow-down', '', main_app.admin_enterprise_group_move_down_path(enterprise_group), class: 'move-down no-text'
= link_to_with_icon 'icon-arrow-up', '', main_app.admin_enterprise_group_move_up_path(enterprise_group), class: 'move-up no-text' unless enterprise_group.first?
- if spree_current_user.admin?
- if enterprise_group.last?
.blank-action
- else
= link_to_with_icon 'icon-arrow-down', '', main_app.admin_enterprise_group_move_down_path(enterprise_group), class: 'move-down no-text'
- if !enterprise_group.first?
= link_to_with_icon 'icon-arrow-up', '', main_app.admin_enterprise_group_move_up_path(enterprise_group), class: 'move-up no-text'

View File

@@ -1,5 +1,3 @@
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise }
= form_for [main_app, :admin, @enterprise_group] do |f|
= render :partial => 'form', :locals => { :f => f }
= render :partial => 'spree/admin/shared/new_resource_links'
= render 'admin/enterprise_groups/form', action: 'new'

View File

@@ -1,30 +1,31 @@
= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit')
%br/
= link_to_delete_enterprise enterprise
%br/
- if can? :destroy, enterprise
= link_to_delete_enterprise enterprise
%br/
- if enterprise.is_primary_producer
= link_to_with_icon 'icon-dashboard', 'Properties', main_app.admin_enterprise_producer_properties_path(enterprise_id: enterprise.id)
= link_to_with_icon 'icon-dashboard', 'Properties', main_app.admin_enterprise_producer_properties_path(enterprise_id: enterprise)
(#{enterprise.producer_properties.count})
%br/
- if enterprise.is_distributor
- if can? :admin, Spree::PaymentMethod
- if can?(:admin, Spree::PaymentMethod) && can?(:manage_payment_methods, enterprise)
= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id)
(#{enterprise.payment_methods.count})
- if enterprise.payment_methods.count == 0
%span.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise has no payment methods", style: "font-size: 16px;color: #DA5354"}
%br/
- if can? :admin, Spree::ShippingMethod
- if can?(:admin, Spree::ShippingMethod) && can?(:manage_shipping_methods, enterprise)
= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id)
(#{enterprise.shipping_methods.count})
- if enterprise.shipping_methods.count == 0
%span.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise has shipping methods", style: "font-size: 16px;color: #DA5354"}
%br/
- if can? :admin, EnterpriseFee
- if can?(:admin, EnterpriseFee) && can?(:manage_enterprise_fees, enterprise)
= link_to_with_icon 'icon-money', 'Enterprise Fees', main_app.admin_enterprise_fees_path(enterprise_id: enterprise.id)
(#{enterprise.enterprise_fees.count})
- if enterprise.enterprise_fees.count == 0

View File

@@ -1,209 +1,48 @@
- content_for :page_actions do
%li= button_link_to "Back to enterprises list", main_app.admin_enterprises_path, icon: 'icon-arrow-left'
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Primary Details'" } }
%legend Primary Details
= render 'admin/enterprises/form/primary_details', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Users'" } }
%legend Users
= render 'admin/enterprises/form/users', f: f
.fullwidth_inputs
%fieldset.eleven.columns.alpha.no-border-bottom
%legend Primary Details
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :name
.eight.columns.omega
= f.text_field :name, { placeholder: "eg. Professor Plum's Biodynamic Truffles" }
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :group_ids, 'Groups'
.with-tip{'data-powertip' => "Select any groups or regions that you are a member of. This will help customers find your enterprise."}
%a What's this?
= f.fields_for :address do |af|
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Address'" } }
%legend Address
= render 'admin/enterprises/form/address', af: af
.eight.columns.omega
= f.collection_select :group_ids, EnterpriseGroup.all, :id, :name, {}, class: "select2 fullwidth", multiple: true, placeholder: "Start typing to search available groups..."
- if spree_current_user.admin?
.row
.three.columns.alpha
=f.label :owner_id, 'Owner'
.with-tip{'data-powertip' => "The primary user responsible for this enterprise."}
%a What's this?
.eight.columns
- owner_email = @enterprise.andand.owner.andand.email || ""
= f.hidden_field :owner_id, class: "select2 fullwidth", 'ofn-user-autocomplete' => true, email: owner_email
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Contact'" } }
%legend Contact
= render 'admin/enterprises/form/contact', f: f
.row
.three.columns.alpha
%label Primary Producer
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food."}
%a What's this?
.five.columns.omega
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
 
= f.label :is_primary_producer, 'Producer'
- if spree_current_user.admin?
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :sells, 'Sells'
.with-tip{'data-powertip' => "None - enterprise does not sell to customers directly.<br />Own - Enterprise sells own products to customers.<br />Any - Enterprise can sell own or other enterprises products.<br />"}
%a What's this?
.two.columns
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "None", value: "none"
.two.columns
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Own", value: "own"
.four.columns.omega
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Any", value: "any"
.row
.three.columns.alpha
%label Visible in search?
.with-tip{'data-powertip' => "Determines whether this enterprise will be visible to customers when searching the site."}
%a What's this?
.two.columns
= f.radio_button :visible, true
&nbsp;
= f.label :visible, "Visible", :value => "true"
.five.columns.omega
= f.radio_button :visible, false
&nbsp;
= f.label :visible, "Not Visible", :value => "false"
- if @enterprise.is_distributor
- # TODO: Angularise this
.row
.three.columns.alpha
%label Link to shop front
.with-tip{'data-powertip' => "A direct link to your shopfront on the Open Food Network."}
%a What's this?
.eight.columns.omega
= main_app.shop_enterprise_url(@enterprise)
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Social'" } }
%legend Social
= render 'admin/enterprises/form/social', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Business Details'" } }
%legend Business Details
= render 'admin/enterprises/form/business_details', f: f
= f.fields_for :address do |af|
%fieldset.eleven.columns.alpha.no-border-bottom
%legend Address
.row
.three.columns.alpha
= af.label :address1
.eight.columns.omega
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
.row
.alpha.three.columns
= af.label :address2
.eight.columns.omega
= af.text_field :address2
.row
.three.columns.alpha
= af.label :city, 'Suburb'
\/
= af.label :zipcode, 'Postcode'
.four.columns
= af.text_field :city, { placeholder: "eg. Northcote"}
.four.columns.omega
= af.text_field :zipcode, { placeholder: "eg. 3070"}
.row
.three.columns.alpha
= af.label :state_id, 'State'
\/
= af.label :country_id, 'Country'
.four.columns
= af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth"
.four.columns.omega
= af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth"
%fieldset.eleven.columns.alpha.no-border-bottom
%legend Contact Details
.row
.alpha.three.columns
= f.label :contact, 'Name'
.omega.eight.columns
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
.row
.alpha.three.columns
= f.label :email
.omega.eight.columns
= f.text_field :email, { placeholder: "eg. gustav@truffles.com"}
.row
.alpha.three.columns
= f.label :phone
.omega.eight.columns
= f.text_field :phone, { placeholder: "eg. 98 7654 3210"}
%fieldset.eleven.columns.alpha.no-border-bottom
%legend Enterprise Details
.row
.alpha.three.columns
= f.label :abn, 'ABN'
.omega.eight.columns
= f.text_field :abn, { placeholder: "eg. 99 123 456 789"}
.row
.alpha.three.columns
= f.label :acn, 'ACN'
.omega.eight.columns
= f.text_field :acn, { placeholder: "eg. 123 456 789"}
.row
.alpha.three.columns
= f.label :website
.omega.eight.columns
= f.text_field :website, { placeholder: "eg. www.truffles.com"}
.row
.alpha.three.columns
= f.label :facebook, 'Facebook'
.omega.eight.columns
= f.text_field :facebook
.row
.alpha.three.columns
= f.label :instagram, 'Instagram'
.omega.eight.columns
= f.text_field :instagram
.row
.alpha.three.columns
= f.label :linkedin, 'LinkedIn'
.omega.eight.columns
= f.text_field :linkedin
.row
.alpha.three.columns
= f.label :twitter
.omega.eight.columns
= f.text_field :twitter, { placeholder: "eg. @the_prof" }
%fieldset.eleven.columns.alpha.no-border-bottom
%legend About Us
.row
.alpha.three.columns
= f.label :description, 'Short Description'
.omega.eight.columns
= f.text_field :description, placeholder: 'Tell us about your enterprise in one or two sentences'
.row
.alpha.three.columns
= f.label :long_description, 'About Us'
.omega.eight.columns
-# textAngular toolbar options, add to the ta-toolbar array below and separate into groups with extra ],[ if needed:
-# ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'quote'],
-# ['bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear'],
-# ['justifyLeft','justifyCenter','justifyRight','indent','outdent'],
-# ['html', 'insertImage', 'insertLink', 'insertVideo']
%text-angular{'ng-model' => 'htmlVariable', 'id' => 'enterprise_long_description', 'name' => 'enterprise[long_description]', 'class' => 'text-angular',
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'}
%fieldset.eleven.columns.alpha.no-border-bottom
%legend IMAGES
.row
.alpha.three.columns
= f.label :logo
%br
100 x 100 pixels
.omega.eight.columns
= image_tag @object.logo(:medium) if @object.logo.present?
= f.file_field :logo
.row
.alpha.three.columns
= f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed in "About Us"'
%br/
%span{ style: 'font-weight:bold' } PLEASE NOTE:
Any promo image uploaded here will be cropped to 1200 x 260.
The promo image is displayed at the top of an enterprise's profile page and pop-ups.
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='About'" } }
%legend About Us
= render 'admin/enterprises/form/about_us', f: f
.omega.eight.columns
= image_tag @object.promo_image(:large) if @object.promo_image.present?
= f.file_field :promo_image
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Images'" } }
%legend Images
= render 'admin/enterprises/form/images', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Shipping Methods'" } }
%legend Shipping Methods
= render 'admin/enterprises/form/shipping_methods', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Payment Methods'" } }
%legend Payment Methods
= render 'admin/enterprises/form/payment_methods', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Enterprise Fees'" } }
%legend Enterprise Fees
= render 'admin/enterprises/form/enterprise_fees', f: f
%fieldset.alpha.no-border-bottom{ ng: { show: "menu.selected.name=='Shop Preferences'" } }
%legend Shop Preferences
= render 'admin/enterprises/form/shop_preferences', f: f

View File

@@ -0,0 +1,5 @@
= admin_inject_enterprise
= admin_inject_taxons
= admin_inject_payment_methods
= admin_inject_shipping_methods
= admin_inject_enterprise_permissions

View File

@@ -0,0 +1,105 @@
.row
.three.columns.alpha
= f.label :name
.nine.columns.omega
= f.text_field :name, { placeholder: "eg. Professor Plum's Biodynamic Truffles", class: "fullwidth" }
- if spree_current_user.admin?
.row{ ng: { app: "admin.users" } }
.three.columns.alpha
=f.label :owner_id, 'Owner'
.with-tip{'data-powertip' => "The primary user responsible for this enterprise."}
%a What's this?
.nine.columns.omega
- owner_email = @enterprise.andand.owner.andand.email || ""
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
.row
.three.columns.alpha
%label Primary Producer?
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food."}
%a What's this?
.five.columns.omega
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
&nbsp;
= f.label :is_primary_producer, 'I am a Producer'
- if spree_current_user.admin?
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :sells, 'Sells'
.with-tip{'data-powertip' => "None - enterprise does not sell to customers directly.<br />Own - Enterprise sells own products to customers.<br />Any - Enterprise can sell own or other enterprises products.<br />"}
%a What's this?
.two.columns
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "None", value: "none"
.two.columns
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Own", value: "own"
.four.columns.omega
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Any", value: "any"
.row
.alpha.three.columns
= f.label :contact, 'Contact Name'
.omega.nine.columns
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
.row
.alpha.three.columns
= f.label :email
.omega.nine.columns
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
.alert-box
%i.icon-info-sign
If we don't recognise this email address we'll send you a confirmation email to make sure it belongs to you. You'll need to use the link in the email we send to fully activate your new enterprise.
%a.close{ href: "" } ×
.row
.alpha.three.columns
= f.label :phone
.omega.nine.columns
= f.text_field :phone, { placeholder: "eg. 98 7654 3210"}
.row
.alpha.three.columns
= f.label :website
.omega.nine.columns
= f.text_field :website, { placeholder: "eg. www.truffles.com"}
= f.fields_for :address do |af|
.row
.three.columns.alpha
= af.label :address1
.nine.columns.omega
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
.row
.alpha.three.columns
= af.label :address2
.nine.columns.omega
= af.text_field :address2
.row
.three.columns.alpha
= af.label :city, 'Suburb'
\/
= af.label :zipcode, 'Postcode'
.four.columns
= af.text_field :city, { placeholder: "eg. Northcote"}
.five.columns.omega
= af.text_field :zipcode, { placeholder: "eg. 3070"}
.row
.three.columns.alpha
= af.label :state_id, 'State'
\/
= af.label :country_id, 'Country'
.four.columns
= af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth"
.five.columns.omega
= af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth"
.row
.twelve.columns.alpha
&nbsp;
.row
.twelve.columns.alpha
= render partial: "spree/admin/shared/new_resource_links"

View File

@@ -1,11 +1,21 @@
= admin_inject_enterprise
= admin_inject_enterprise_long_description
= admin_inject_payment_methods
= admin_inject_shipping_methods
.sixteen.columns.alpha{ ng: { app: 'admin.enterprises', controller: 'enterpriseCtrl' } }
.eleven.columns.alpha
= render 'form', f: f
.one.column &nbsp;
.four.columns.omega
= render 'sidebar', f: f
-# Not all inputs are ng inputs, they don't make the ng-form dirty on change.
-# ng-change is only valid for inputs, not for a form.
-# So we use onchange and have to get the scope to access the ng controller
= form_for [main_app, :admin, @enterprise], html: { name: "enterprise",
"ng-app" => 'admin.enterprises',
"ng-submit" => "navClear()",
"ng-controller" => 'enterpriseCtrl',
'onchange' => 'angular.element(enterprise).scope().enterprise.$setDirty()',
} do |f|
.row
.sixteen.columns.alpha
.four.columns.alpha
= render 'admin/shared/side_menu'
.one.column &nbsp;
.eleven.columns.omega.fullwidth_inputs
= render 'form', f: f
.row
.five.columns.alpha
&nbsp;
.eleven.columns.alpha
= render partial: "spree/admin/shared/#{action}_resource_links"

View File

@@ -1,6 +0,0 @@
- if can? :admin, EnterpriseFee
= render 'sidebar_enterprise_fees', f: f
- if can? :admin, Spree::PaymentMethod
= render 'sidebar_payment_methods', f: f
- if can? :admin, Spree::ShippingMethod
= render 'sidebar_shipping_methods', f: f

View File

@@ -1,20 +0,0 @@
- enterprise_fees_color = @enterprise_fees.count > 0 ? "blue" : "red"
.sidebar_item.four.columns.alpha#enterprise_fees{ ng: { show: 'Enterprise.category != "producer_hub"' } }
.four.columns.alpha.header{ class: "#{enterprise_fees_color}" }
%span.four.columns.alpha.centered Enterprise Fees
.four.columns.alpha.list{ class: "#{enterprise_fees_color}" }
- if @enterprise_fees.count > 0
- @enterprise_fees.each do |enterprise_fee|
%a.four.columns.alpha.list-item{ class: "#{cycle('odd','even')}", href: "#{main_app.admin_enterprise_fees_path}" }
%span.three.columns.alpha
= enterprise_fee.name
%span.one.column.omega
&nbsp;
- else
.four.columns.alpha.list-item.red
%span.three.columns.alpha None Available
%span.one.column.omega
%span.icon-remove-sign
%a.four.columns.alpha.button{ href: "#{main_app.admin_enterprise_fees_path}", class: "#{enterprise_fees_color}" }
CREATE NEW
%span.icon-arrow-right

View File

@@ -1,24 +0,0 @@
.sidebar_item.four.columns.alpha#payment_methods{ ng: { show: 'Enterprise.sells != "none"' } }
.four.columns.alpha.header{ ng: { class: "paymentMethodsColor()" } }
%span.four.columns.alpha.centered Payment Methods
.four.columns.alpha.list{ ng: { class: "paymentMethodsColor()" } }
- if @payment_methods.count > 0
-# = hidden_field_tag "enterprise[payment_method_ids][]", []
- @payment_methods.each do |payment_method|
%span.four.columns.alpha.list-item{ class: "#{cycle('odd','even')}", ng: { controller: 'paymentMethodCtrl', init: "findPaymentMethodByID(#{payment_method.id})" } }
%span.four.columns
%span.three.columns.alpha
%label
= f.check_box :payment_method_ids, { multiple: true, 'ng-model' => 'PaymentMethod.selected' }, payment_method.id, nil
= payment_method.name
%a.one.columns.omega{ href: "#{edit_admin_payment_method_path(payment_method)}" }
%span.icon-arrow-right
- else
.four.columns.alpha.list-item
%span.three.columns.alpha None Available
%span.one.column.omega
%span.icon-remove-sign
%a.four.columns.alpha.button{ href: "#{new_admin_payment_method_path}", ng: { class: "paymentMethodsColor()" } }
CREATE NEW
%span.icon-arrow-right

View File

@@ -1,23 +0,0 @@
.sidebar_item.four.columns.alpha#shipping_methods{ ng: { show: 'Enterprise.sells != "none"' } }
.four.columns.alpha.header{ ng: { class: "shippingMethodsColor()" } }
%span.four.columns.alpha.centered Shipping Methods
.four.columns.alpha.list{ ng: { class: "shippingMethodsColor()" } }
- if @shipping_methods.count > 0
- @shipping_methods.each do |shipping_method|
%span.four.columns.alpha.list-item{ class: "#{cycle('odd','even')}", ng: { controller: 'shippingMethodCtrl', init: "findShippingMethodByID(#{shipping_method.id})" } }
%span.four.columns
%span.three.columns.alpha
%label
= f.check_box :shipping_method_ids, { :multiple => true, 'ng-model' => 'ShippingMethod.selected' }, shipping_method.id, nil
= shipping_method.name
%a.one.columns.omega{ href: "#{edit_admin_shipping_method_path(shipping_method)}" }
%span.one.column.alpha.icon-arrow-right
- else
.four.columns.alpha.list-item
%span.three.columns.alpha None Available
%span.one.column.omega
%span.icon-remove-sign
%a.four.columns.alpha.button{ href: "#{new_admin_shipping_method_path}", ng: { class: "shippingMethodsColor()" } }
CREATE NEW
%span.icon-arrow-right

View File

@@ -4,7 +4,9 @@
Editing:
= @enterprise.name
= form_for [main_app, :admin, @enterprise] do |f|
= render 'ng_form', f: f
.twelve.columns.alpha
= render partial: 'spree/admin/shared/edit_resource_links'
- content_for :page_actions do
%li= button_link_to "Back to enterprises list", main_app.admin_enterprises_path, icon: 'icon-arrow-left'
= render 'admin/enterprises/form_data'
= render 'admin/enterprises/ng_form', action: 'edit'

View File

@@ -0,0 +1,17 @@
.row
.alpha.three.columns
= f.label :description, 'Short Description'
.omega.eight.columns
= f.text_field :description, maxlength: 255, placeholder: 'Tell us about your enterprise in one or two sentences'
.row
.alpha.three.columns
= f.label :long_description, 'About Us'
.omega.eight.columns
-# textAngular toolbar options, add to the ta-toolbar array below and separate into groups with extra ],[ if needed:
-# ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre', 'quote'],
-# ['bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear'],
-# ['justifyLeft','justifyCenter','justifyRight','indent','outdent'],
-# ['html', 'insertImage', 'insertLink', 'insertVideo']
%text-angular{'ng-model' => 'Enterprise.long_description', 'id' => 'enterprise_long_description', 'name' => 'enterprise[long_description]', 'class' => 'text-angular',
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'}

View File

@@ -0,0 +1,36 @@
-# redo denoting required fields in the whole project
.row
Required fields are denoted with an asterisk (
%span.required *
)
.row
.three.columns.alpha
= af.label :address1
%span.required *
.eight.columns.omega
= af.text_field :address1, { placeholder: "eg. 123 High Street"}
.row
.alpha.three.columns
= af.label :address2
.eight.columns.omega
= af.text_field :address2
.row
.three.columns.alpha
= af.label :city, 'Suburb'
\/
= af.label :zipcode, 'Postcode'
%span.required *
.four.columns
= af.text_field :city, { placeholder: "eg. Northcote"}
.four.columns.omega
= af.text_field :zipcode, { placeholder: "eg. 3070"}
.row
.three.columns.alpha
= af.label :state_id, 'State'
\/
= af.label :country_id, 'Country'
%span.required *
.four.columns
= af.collection_select :state_id, af.object.country.states, :id, :name, {}, :class => "select2 fullwidth"
.four.columns.omega
= af.collection_select :country_id, available_countries, :id, :name, {}, :class => "select2 fullwidth"

View File

@@ -0,0 +1,10 @@
.row
.alpha.three.columns
= f.label :abn, 'ABN'
.omega.eight.columns
= f.text_field :abn, { placeholder: "eg. 99 123 456 789"}
.row
.alpha.three.columns
= f.label :acn, 'ACN'
.omega.eight.columns
= f.text_field :acn, { placeholder: "eg. 123 456 789"}

View File

@@ -0,0 +1,33 @@
-if @enterprise.unconfirmed_email
.alert-box
Email change is pending.
We've sent a confirmation email to
%strong= "#{@enterprise.unconfirmed_email}."
= link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: @enterprise.unconfirmed_email } ), method: :post)
%a.close{ href: "#" } ×
.row
.alpha.three.columns
= f.label :contact, 'Name'
.omega.eight.columns
= f.text_field :contact, { placeholder: "eg. Gustav Plum"}
.row
.alpha.three.columns
= f.label :email
%span.required *
.omega.eight.columns
= f.text_field :email, { placeholder: "eg. gustav@truffles.com", "ng-model" => "Enterprise.email" }
.row{ ng: { hide: "pristineEmail == null || pristineEmail == Enterprise.email"} }
.alpha.three.columns
&nbsp;
.omega.eight.columns
Note: A new email address may need to be confirmed prior to use
.row
.alpha.three.columns
= f.label :phone
.omega.eight.columns
= f.text_field :phone, { placeholder: "eg. 98 7654 3210"}
.row
.alpha.three.columns
= f.label :website
.omega.eight.columns
= f.text_field :website, { placeholder: "eg. www.truffles.com"}

View File

@@ -0,0 +1,30 @@
- if @enterprise_fees.count > 0
%table
%thead
%tr
%th Name
%th Fee Type
-# %th Calculator
-# %th Calculator Values
%tbody
- @enterprise_fees.each do |enterprise_fee|
%tr
%td= enterprise_fee.name
%td= enterprise_fee.fee_type
-# %td= enterprise_fee.calculator.preferred_flat_percent
-# %td= enterprise_fee.fee_type
%br
%div
%a.button{ href: "#{main_app.admin_enterprise_fees_path}"}
Manage Enterprise Fees
%i.icon-arrow-right
- else
%p.text-center
You don't have any enterprise fees yet.
%br
.text-center
%a.button{ href: "#{main_app.admin_enterprise_fees_path}"}
Create One Now
%i.icon-arrow-right

View File

@@ -0,0 +1,19 @@
.row
.alpha.three.columns
= f.label :logo
%br
100 x 100 pixels
.omega.eight.columns
= image_tag @object.logo(:medium) if @object.logo.present?
= f.file_field :logo
.row
.alpha.three.columns
= f.label :promo_image, class: 'with-tip', 'data-powertip' => 'This image is displayed in "About Us"'
%br/
%span{ style: 'font-weight:bold' } PLEASE NOTE:
Any promo image uploaded here will be cropped to 1200 x 260.
The promo image is displayed at the top of an enterprise's profile page and pop-ups.
.omega.eight.columns
= image_tag @object.promo_image(:large) if @object.promo_image.present?
= f.file_field :promo_image

View File

@@ -0,0 +1,33 @@
- if @payment_methods.count > 0
%table
%thead
%tr
%th Name
%th Applies?
%th
%tbody
- @payment_methods.each do |payment_method|
%tr{ ng: { controller: 'paymentMethodCtrl', init: "findPaymentMethodByID(#{payment_method.id})" } }
%td= payment_method.name
%td= f.check_box :payment_method_ids, { multiple: true, 'ng-model' => 'PaymentMethod.selected' }, payment_method.id, nil
%td= link_to "Edit", edit_admin_payment_method_path(payment_method)
%br
.row
.six.columns.alpha
%a.button{ href: "#{admin_payment_methods_path}"}
Manage Payment Methods
%i.icon-arrow-right
.five.columns.omega.text-right
%a.button{ href: "#{new_admin_payment_method_path}"}
Create New Payment Method
%i.icon-plus
- else
%p.text-center
You don't have any payment methods yet.
%br
.text-center
%a.button{ href: "#{new_admin_payment_method_path}"}
Create One Now
%i.icon-arrow-right

View File

@@ -0,0 +1,79 @@
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :name
%span.required *
.eight.columns.omega
= f.text_field :name, { placeholder: "eg. Professor Plum's Biodynamic Truffles" }
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :group_ids, 'Groups'
.with-tip{'data-powertip' => "Select any groups or regions that you are a member of. This will help customers find your enterprise."}
%a What's this?
.eight.columns.omega
= f.collection_select :group_ids, EnterpriseGroup.all, :id, :name, {}, class: "select2 fullwidth", multiple: true, placeholder: "Start typing to search available groups..."
.row
.three.columns.alpha
%label Primary Producer
.with-tip{'data-powertip' => "Select 'Producer' if you are a primary producer of food."}
%a What's this?
.five.columns.omega
= f.check_box :is_primary_producer, 'ng-model' => 'Enterprise.is_primary_producer'
&nbsp;
= f.label :is_primary_producer, 'Producer'
- if spree_current_user.admin?
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label :sells, 'Sells'
.with-tip{'data-powertip' => "None - enterprise does not sell to customers directly.<br />Own - Enterprise sells own products to customers.<br />Any - Enterprise can sell own or other enterprises products.<br />"}
%a What's this?
.two.columns
= f.radio_button :sells, "none", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "None", value: "none"
.two.columns
= f.radio_button :sells, "own", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Own", value: "own"
.four.columns.omega
= f.radio_button :sells, "any", 'ng-model' => 'Enterprise.sells'
&nbsp;
= f.label :sells, "Any", value: "any"
.row
.three.columns.alpha
%label Visible in search?
.with-tip{'data-powertip' => "Determines whether this enterprise will be visible to customers when searching the site."}
%a What's this?
.two.columns
= f.radio_button :visible, true
&nbsp;
= f.label :visible, "Visible", :value => "true"
.five.columns.omega
= f.radio_button :visible, false
&nbsp;
= f.label :visible, "Not Visible", :value => "false"
.permalink{ ng: { controller: "permalinkCtrl" } }
.row{ ng: { show: "Enterprise.sells == 'own' || Enterprise.sells == 'any'" } }
.three.columns.alpha
= f.label :permalink, 'Permalink (no spaces)'
.with-tip{'data-powertip' => "This permalink is used to create the url to your shop: #{spree.root_url}your-shop-name/shop"}
%a What's this?
.six.columns
= f.text_field :permalink, { 'ng-model' => "Enterprise.permalink", placeholder: "eg. your-shop-name", 'ng-model-options' => "{ updateOn: 'default blur', debounce: {'default': 300, 'blur': 0} }" }
.two.columns.omega
%img.spinner{ src: "/assets/loading.gif", width: "30px", ng: { show: "checking" } }
%span{ ng: { class: 'availability.toLowerCase()', hide: "checking" } }
{{ availability }}
%i{ ng: { class: "{'icon-ok-sign': availability == 'Available', 'icon-remove-sign': availability == 'Unavailable'}" } }
.row{ ng: { show: "Enterprise.sells == 'own' || Enterprise.sells == 'any'" } }
.three.columns.alpha
%label Link to shop front
.with-tip{'data-powertip' => "A direct link to your shopfront on the Open Food Network."}
%a What's this?
.eight.columns.omega
= surround spree.root_url, "/shop" do
{{Enterprise.permalink}}

View File

@@ -0,0 +1,33 @@
- if @shipping_methods.count > 0
%table
%thead
%tr
%th Name
%th Applies?
%th
%tbody
- @shipping_methods.each do |shipping_method|
%tr{ ng: { controller: 'shippingMethodCtrl', init: "findShippingMethodByID(#{shipping_method.id})" } }
%td= shipping_method.name
%td= f.check_box :shipping_method_ids, { :multiple => true, 'ng-model' => 'ShippingMethod.selected' }, shipping_method.id, nil
%td= link_to "Edit", edit_admin_shipping_method_path(shipping_method)
%br
.row
.six.columns.alpha
%a.button{ href: "#{admin_shipping_methods_path}"}
Manage Shipping Methods
%i.icon-arrow-right
.five.columns.omega.text-right
%a.button{ href: "#{new_admin_shipping_method_path}"}
Create New Shipping Method
%i.icon-plus
- else
%p.text-center
You don't have any shipping methods yet.
%br
.text-center
%a.button{ href: "#{new_admin_shipping_method_path}"}
Create One Now
%i.icon-arrow-right

View File

@@ -0,0 +1,24 @@
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label "enterprise_preferred_shopfront_message", t(:shopfront_message)
.eight.columns.omega
%text-angular{'ng-model' => 'Enterprise.preferred_shopfront_message', 'id' => 'enterprise_preferred_shopfront_message', 'name' => 'enterprise[preferred_shopfront_message]', 'class' => 'text-angular',
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
'placeholder' => 'An optional explanation for customers detailing how your shopfront works, to be displayed above the product list on your shop page.'}
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label "enterprise_preferred_shopfront_closed_message", t(:shopfront_closed_message)
.eight.columns.omega
%text-angular{'ng-model' => 'Enterprise.preferred_shopfront_closed_message', 'id' => 'enterprise_preferred_shopfront_closed_message', 'name' => 'enterprise[preferred_shopfront_closed_message]', 'class' => 'text-angular',
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
'placeholder' => 'A message which provides a more detailed explanation about why your shop is closed and/or when customers can expect it to open again. This is displayed on your shop only when you have no active order cycles (ie. shop is closed).'}
.row
.alpha.eleven.columns
.three.columns.alpha
= f.label "enterprise_preferred_shopfront_taxon_order", t(:shopfront_category_ordering)
%br
(top to bottom)
.eight.columns.omega
%textarea.fullwidth{ id: 'enterprise_preferred_shopfront_taxon_order', name: 'enterprise[preferred_shopfront_taxon_order]', rows: 6, 'ng-model' => 'Enterprise.preferred_shopfront_taxon_order', 'ofn-taxon-autocomplete' => '', 'multiple-selection' => 'true', placeholder: 'Category' }

View File

@@ -0,0 +1,20 @@
.row
.alpha.three.columns
= f.label :facebook, 'Facebook'
.omega.eight.columns
= f.text_field :facebook
.row
.alpha.three.columns
= f.label :instagram, 'Instagram'
.omega.eight.columns
= f.text_field :instagram
.row
.alpha.three.columns
= f.label :linkedin, 'LinkedIn'
.omega.eight.columns
= f.text_field :linkedin
.row
.alpha.three.columns
= f.label :twitter
.omega.eight.columns
= f.text_field :twitter, { placeholder: "eg. @the_prof" }

View File

@@ -0,0 +1,42 @@
- owner_email = @enterprise.andand.owner.andand.email || ""
- full_permissions = (spree_current_user.admin? || spree_current_user == @enterprise.andand.owner)
.row
.three.columns.alpha
=f.label :owner_id, 'Owner'
- if full_permissions
%span.required *
.with-tip{'data-powertip' => "The primary user responsible for this enterprise."}
%a What's this?
.eight.columns.omega
- if full_permissions
= f.hidden_field :owner_id, class: "select2 fullwidth", 'user-select' => 'Enterprise.owner'
- else
= owner_email
.row
.three.columns.alpha
=f.label :user_ids, 'Managers'
- if full_permissions
%span.required *
.with-tip{'data-powertip' => "The other users with permission to manage this enterprise."}
%a What's this?
.eight.columns.omega
- if full_permissions
%table
%tr
%td
- # Ignore this input in the submit
= hidden_field_tag :ignored, :new_manager, class: "select2 fullwidth", 'user-select' => 'newManager', 'ng-model' => 'newManager'
%td.actions
%a{ 'ng-click' => 'addManager(newManager)', :class => "icon-plus no-text" }
%tr.animate-repeat{ ng: { repeat: 'manager in Enterprise.users' }}
%td
= hidden_field_tag "enterprise[user_ids][]", nil, multiple: true, 'ng-value' => 'manager.id'
{{ manager.email }}
%td.actions
%a{ 'ng-click' => 'removeManager(manager)', :class => "icon-trash no-text" }
- else
- @enterprise.users.each do |manager|
= manager.email
%br

View File

@@ -8,7 +8,9 @@
= render 'admin/shared/enterprises_sub_menu'
= form_for @enterprise_set, :url => main_app.bulk_update_admin_enterprises_path do |f|
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise_set }
= form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path do |f|
%table#listing_enterprises.index
%colgroup
%col{style: "width: 25%;"}/

View File

@@ -3,7 +3,13 @@
- content_for :page_title do
New Enterprise
= form_for [main_app, :admin, @enterprise] do |f|
= render partial: 'ng_form', :locals => { f: f }
.twelve.columns.alpha
= render partial: 'spree/admin/shared/new_resource_links'
- content_for :page_actions do
%li= button_link_to "Back to enterprises list", main_app.admin_enterprises_path, icon: 'icon-arrow-left'
-# Form
= form_for [main_app, :admin, @enterprise], html: { "nav-check" => '', "nav-callback" => '' } do |f|
.row
.twelve.columns.fullwidth_inputs
= render 'new_form', f: f

View File

@@ -8,7 +8,7 @@
.exchange-product-details
.supplier {{ product.supplier_name }}
%label
= check_box_tag 'order_cycle_outgoing_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-hide' => 'product.variants', 'ng-disabled' => 'product.variants.length > 0', 'ng-model' => 'exchange.variants[product.master_id]', 'id' => 'order_cycle_outgoing_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}'
= check_box_tag 'order_cycle_outgoing_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-hide' => 'product.variants.length > 0', 'ng-disabled' => 'product.variants.length > 0', 'ng-model' => 'exchange.variants[product.master_id]', 'id' => 'order_cycle_outgoing_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}'
%img{'ng-src' => '{{ product.image_url }}'}
{{ product.name }}
.exchange-product-variant{'ng-repeat' => 'variant in product.variants | filter:variantSuppliedToOrderCycle'}

View File

@@ -9,13 +9,13 @@
.exchange-product-details
%label
= check_box_tag 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-hide' => 'product.variants', 'ng-disabled' => 'product.variants.length > 0', 'ng-model' => 'exchange.variants[product.master_id]', 'ofn-sync-distributions' => '{{ product.master_id }}', 'id' => 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}'
= check_box_tag 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-hide' => 'product.variants.length > 0', 'ng-disabled' => 'product.variants.length > 0', 'ng-model' => 'exchange.variants[product.master_id]', 'ofn-sync-distributions' => '{{ product.master_id }}', 'id' => 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}'
%img{'ng-src' => '{{ product.image_url }}'}
{{ product.name }}
-# When the master variant is in the order cycle but the product has variants, we want to
-# be able to remove the master variant, since it serves no purpose. Display a checkbox to do so.
.exchange-product-variant{'ng-show' => 'exchange.variants[product.master_id] && product.variants'}
.exchange-product-variant{'ng-show' => 'exchange.variants[product.master_id] && product.variants.length > 0'}
%label
= check_box_tag 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}', 1, 1, 'ng-model' => 'exchange.variants[product.master_id]', 'ofn-sync-distributions' => '{{ product.master_id }}', 'id' => 'order_cycle_incoming_exchange_{{ $parent.$index }}_variants_{{ product.master_id }}'
Obsolete master

View File

@@ -1,14 +1,4 @@
= f.label :name
= f.text_field :name, 'ng-model' => 'order_cycle.name', 'required' => true
%br/
.date-field
= f.label :orders_open_at, 'Orders open'
= f.text_field :orders_open_at, 'datetimepicker' => 'order_cycle.orders_open_at', 'ng-model' => 'order_cycle.orders_open_at'
.date-field
= f.label :orders_close_at, 'Orders close'
= f.text_field :orders_close_at, 'datetimepicker' => 'order_cycle.orders_close_at', 'ng-model' => 'order_cycle.orders_close_at'
%br/
= render 'name_and_timing_form', f: f
%h2 Incoming
@@ -32,7 +22,7 @@
%h2 Coordinator
= f.label :coordinator_id, 'Coordinator'
= f.collection_select :coordinator_id, coordinating_enterprises, :id, :name, {include_blank: true}, {'ng-model' => 'order_cycle.coordinator_id', 'ofn-on-change' => 'order_cycle.coordinator_fees = []', 'required' => true}
= f.collection_select :coordinator_id, order_cycle_coordinating_enterprises, :id, :name, {include_blank: true}, {'ng-model' => 'order_cycle.coordinator_id', 'ofn-on-change' => 'order_cycle.coordinator_fees = []', 'required' => true}
= render 'coordinator_fees', f: f
@@ -51,7 +41,7 @@
%tr.products{'ng-show' => 'exchange.showProducts'}
= render 'exchange_distributed_products_form'
= select_tag :new_distributor_id, options_from_collection_for_select(order_cycle_hub_enterprises, :id, :name), {'ng-model' => 'new_distributor_id'}
= select_tag :new_distributor_id, options_for_select(order_cycle_hub_enterprises), {'ng-model' => 'new_distributor_id'}
= f.submit 'Add distributor', 'ng-click' => 'addDistributor($event)'
.actions

View File

@@ -0,0 +1,15 @@
.row
.alpha.two.columns
= f.label :name
.fourteen.columns.omega
= f.text_field :name, 'ng-model' => 'order_cycle.name', 'required' => true
.row
.alpha.two.columns
= f.label :orders_open_at, 'Orders open'
.six.columns
= f.text_field :orders_open_at, 'datetimepicker' => 'order_cycle.orders_open_at', 'ng-model' => 'order_cycle.orders_open_at'
.two.columns
= f.label :orders_close_at, 'Orders close'
.six.columns.omega
= f.text_field :orders_close_at, 'datetimepicker' => 'order_cycle.orders_close_at', 'ng-model' => 'order_cycle.orders_close_at'

View File

@@ -4,15 +4,17 @@
%td= link_to order_cycle.name, main_app.edit_admin_order_cycle_path(order_cycle)
%td= order_cycle_form.text_field :orders_open_at, :class => 'datetimepicker', :value => order_cycle.orders_open_at
%td= order_cycle_form.text_field :orders_close_at, :class => 'datetimepicker', :value => order_cycle.orders_close_at
%td.suppliers
- order_cycle.suppliers.managed_by(spree_current_user).each do |s|
= s.name
%br/
%td= order_cycle.coordinator.name
%td.distributors
- order_cycle.distributors.managed_by(spree_current_user).each do |d|
= d.name
%br/
- unless order_cycles_simple_view
%td.suppliers
- order_cycle.suppliers.merge(OpenFoodNetwork::Permissions.new(spree_current_user).order_cycle_enterprises).each do |s|
= s.name
%br/
%td= order_cycle.coordinator.name
%td.distributors
- order_cycle.distributors.merge(OpenFoodNetwork::Permissions.new(spree_current_user).order_cycle_enterprises).each do |d|
= d.name
%br/
%td.products
- variant_images = capture do

View File

@@ -0,0 +1,29 @@
= render 'name_and_timing_form', f: f
.row
.alpha.two.columns
= label_tag 'Ready for'
.six.columns
= text_field_tag 'order_cycle_outgoing_exchange_0_pickup_time', '', 'id' => 'order_cycle_outgoing_exchange_0_pickup_time', 'placeholder' => 'Date / time', 'ng-model' => 'outgoing_exchange.pickup_time', 'size' => 30
.two.columns
= label_tag 'Customer instructions'
.six.columns.omega
= text_field_tag 'order_cycle_outgoing_exchange_0_pickup_instructions', '', 'id' => 'order_cycle_outgoing_exchange_0_pickup_instructions', 'placeholder' => 'Pick-up or delivery notes', 'ng-model' => 'outgoing_exchange.pickup_instructions', 'size' => 30
= label_tag 'Products'
%table.exchanges
%tbody{ng: {repeat: "exchange in order_cycle.incoming_exchanges"}}
%tr.products
= render 'exchange_supplied_products_form'
%br/
= label_tag 'Fees'
= render 'coordinator_fees', f: f
.actions
= f.submit @order_cycle.new_record? ? 'Create' : 'Update', 'ng-disabled' => '!loaded()'
%span{'ng-show' => 'loaded()'}
or
= link_to 'Cancel', main_app.admin_order_cycles_path
%span{'ng-hide' => 'loaded()'} Loading...

View File

@@ -4,5 +4,10 @@
%li
= button_to "Notify producers", main_app.notifications_admin_order_cycle_path, :id => 'admin_notify_producers'
= form_for [main_app, :admin, @order_cycle], :url => '', :html => {:class => 'ng order_cycle', 'ng-app' => 'order_cycle', 'ng-controller' => 'AdminEditOrderCycleCtrl', 'ng-submit' => 'submit()'} do |f|
= render 'form', :f => f
- ng_controller = order_cycles_simple_view ? 'AdminSimpleEditOrderCycleCtrl' : 'AdminEditOrderCycleCtrl'
= form_for [main_app, :admin, @order_cycle], :url => '', :html => {:class => 'ng order_cycle', 'ng-app' => 'admin.order_cycles', 'ng-controller' => ng_controller, 'ng-submit' => 'submit($event)'} do |f|
- if order_cycles_simple_view
= render 'simple_form', f: f
- else
= render 'form', f: f

View File

@@ -5,17 +5,16 @@
%li#new_order_cycle_link
= button_link_to "New Order Cycle", main_app.new_admin_order_cycle_path, :icon => 'icon-plus', :id => 'admin_new_order_cycle_link'
= form_for @order_cycle_set, :url => main_app.bulk_update_admin_order_cycles_path do |f|
%table.index#listing_order_cycles
%colgroup
%col
%col{'style' => 'width: 20%;'}
%col{'style' => 'width: 20%;'}
%col
%col
%col
- unless order_cycles_simple_view
%col
%col
%col
%col
%col
%col
@@ -25,9 +24,10 @@
%th Name
%th Open
%th Close
%th Suppliers
%th Coordinator
%th Distributors
- unless order_cycles_simple_view
%th Suppliers
%th Coordinator
%th Distributors
%th Products
%th.actions
%th.actions

View File

@@ -1,4 +1,9 @@
%h1 New Order Cycle
= form_for [main_app, :admin, @order_cycle], :url => '', :html => {:class => 'ng order_cycle', 'ng-app' => 'order_cycle', 'ng-controller' => 'AdminCreateOrderCycleCtrl', 'ng-submit' => 'submit()'} do |f|
= render 'form', :f => f
- ng_controller = order_cycles_simple_view ? 'AdminSimpleCreateOrderCycleCtrl' : 'AdminCreateOrderCycleCtrl'
= form_for [main_app, :admin, @order_cycle], :url => '', :html => {:class => 'ng order_cycle', 'ng-app' => 'admin.order_cycles', 'ng-controller' => ng_controller, 'ng-submit' => 'submit($event)'} do |f|
- if order_cycles_simple_view
= render 'simple_form', f: f
- else
= render 'form', f: f

View File

@@ -0,0 +1,8 @@
.side_menu{ ng: { controller: 'sideMenuCtrl' } }
%a.menu_item{ href: "", id: "{{ item.name.toLowerCase().replace(' ', '_') }}",
ng: { repeat: '(index,item) in menu.items | filter:{visible:true}',
click: 'select(index)',
show: 'showItem(item) !== false',
class: '{ selected: item.selected }' } }
%i{ class: "{{item.icon_class}}" }
%span {{ item.name }}

View File

@@ -0,0 +1,4 @@
.row
%input.four.columns.alpha{type: 'button', value: 'Save Changes', 'ng-click' => 'update()'}
.twelve.columns.omega
= render 'spree/admin/shared/status_message'

View File

@@ -0,0 +1,5 @@
= admin_inject_spree_api_key
= admin_inject_hubs
= admin_inject_hub_permissions
= admin_inject_producers
= admin_inject_variant_overrides

View File

@@ -0,0 +1,4 @@
- content_for :page_title do
Override Product Details
= render :partial => 'spree/admin/shared/product_sub_menu'

View File

@@ -0,0 +1,7 @@
.row
.two.columns.alpha
Hub
.four.columns
%select.select2.fullwidth#hub_id{ 'ng-model' => 'hub_id', name: 'hub_id', 'ng-options' => 'hub.id as hub.name for hub in hubs' }
.ten.columns.omega
%input{ type: 'button', value: 'Go', 'ng-click' => 'selectHub()' }

View File

@@ -0,0 +1,10 @@
%table.index.bulk{ng: {show: 'hub'}}
%thead
%tr
%th Producer
%th Product
%th Price
%th On hand
%tbody{ng: {repeat: 'product in products | hubPermissions:hubPermissions:hub.id'}}
= render 'admin/variant_overrides/products_product'
= render 'admin/variant_overrides/products_variants'

View File

@@ -0,0 +1,5 @@
%tr.product.even
%td {{ producers[product.producer_id].name }}
%td {{ product.name }}
%td
%td

View File

@@ -0,0 +1,10 @@
%tr.variant{ng: {repeat: 'variant in product.variants'}}
%td
%td
{{ variant.display_name }}
.variant-override-unit {{ variant.unit_to_display }}
%td
%input{name: 'variant-overrides-{{ variant.id }}-price', type: 'text', ng: {model: 'variantOverrides[hub.id][variant.id].price'}, placeholder: '{{ variant.price }}', 'ofn-track-variant-override' => 'price'}
%td
%input{name: 'variant-overrides-{{ variant.id }}-count-on-hand', type: 'text', ng: {model: 'variantOverrides[hub.id][variant.id].count_on_hand'}, placeholder: '{{ variant.on_hand }}', 'ofn-track-variant-override' => 'price'}

View File

@@ -0,0 +1,11 @@
= render 'admin/variant_overrides/header'
= render 'admin/variant_overrides/data'
%div{ ng: { app: 'ofn.admin', controller: 'AdminVariantOverridesCtrl', init: 'initialise()' } }
= render 'admin/variant_overrides/hub_choice'
%div{ng: {show: 'hub'}}
%h2 {{ hub.name }}
= render 'admin/variant_overrides/actions'
= render 'admin/variant_overrides/products'