diff --git a/app/assets/javascripts/admin/standing_orders/controllers/details_controller.js.coffee b/app/assets/javascripts/admin/standing_orders/controllers/details_controller.js.coffee index 7ac5e11946..ce9f673e41 100644 --- a/app/assets/javascripts/admin/standing_orders/controllers/details_controller.js.coffee +++ b/app/assets/javascripts/admin/standing_orders/controllers/details_controller.js.coffee @@ -7,4 +7,4 @@ angular.module("admin.standingOrders").controller "DetailsController", ($scope, StatusMessage.clear() $scope.setView('products') else - StatusMessage.display 'failure', 'Oops! There seems to be a problem...' + StatusMessage.display 'failure', t('admin.standing_orders.details.invalid_error') diff --git a/app/assets/javascripts/admin/standing_orders/controllers/standing_order_controller.js.coffee b/app/assets/javascripts/admin/standing_orders/controllers/standing_order_controller.js.coffee index aa5195a301..1dd08c83ec 100644 --- a/app/assets/javascripts/admin/standing_orders/controllers/standing_order_controller.js.coffee +++ b/app/assets/javascripts/admin/standing_orders/controllers/standing_order_controller.js.coffee @@ -8,7 +8,6 @@ angular.module("admin.standingOrders").controller "StandingOrderController", ($s $scope.newItem = { variant_id: 0, quantity: 1 } $scope.distributor_id = $scope.standingOrder.shop_id # variant selector requires distributor_id $scope.view = if $scope.standingOrder.id? then 'review' else 'details' - $scope.stepTitles = { details: '1. Basic Details', products: '2. Add Products', review: '3. Review & Finalise' } $scope.save = -> $scope.standing_order_form.$setPristine() @@ -16,6 +15,8 @@ angular.module("admin.standingOrders").controller "StandingOrderController", ($s $scope.setView = (view) -> $scope.view = view + $scope.stepTitleFor = (step) -> t("admin.standing_orders.steps.#{step}") + $scope.addStandingLineItem = -> StandingOrder.buildItem($scope.newItem) diff --git a/app/views/admin/standing_orders/_details.html.haml b/app/views/admin/standing_orders/_details.html.haml index 2ed44e2ba7..9a2caaa692 100644 --- a/app/views/admin/standing_orders/_details.html.haml +++ b/app/views/admin/standing_orders/_details.html.haml @@ -2,38 +2,38 @@ %legend{ align: 'center'}= t("admin.standing_orders.form.details") .row .seven.columns.alpha.field - %label{ for: 'customer_id'} Customer - %input.ofn-select2.fullwidth#customer_id{ name: 'customer_id', type: 'number', data: 'customers', text: 'email', required: true, ng: { model: 'standingOrder.customer_id' } } + %label{ for: 'customer_id'}= t('admin.customer') + %input.ofn-select2.fullwidth#customer_id{ name: 'customer_id', type: 'number', data: 'customers', text: 'email', required: true, placeholder: t('admin.choose'), ng: { model: 'standingOrder.customer_id' } } .error{ ng: { show: 'submitted && standing_order_details_form.customer_id.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.customer', show: 'standing_order_details_form.customer_id.$pristine' } } {{ error }} .two.columns   .seven.columns.omega.field - %label{ for: 'schedule_id'} Schedule - %input.ofn-select2.fullwidth#schedule_id{ name: 'schedule_id', type: 'number', data: 'schedules', required: true, ng: { model: 'standingOrder.schedule_id' } } + %label{ for: 'schedule_id'}= t('admin.schedule') + %input.ofn-select2.fullwidth#schedule_id{ name: 'schedule_id', type: 'number', data: 'schedules', required: true, placeholder: t('admin.choose'), ng: { model: 'standingOrder.schedule_id' } } .error{ ng: { show: 'submitted && standing_order_details_form.schedule_id.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.schedule', show: 'standing_order_details_form.schedule_id.$pristine'} } {{ error }} .row .seven.columns.alpha.field - %label{ for: 'payment_method_id'} Payment Method - %input.ofn-select2.fullwidth#payment_method_id{ name: 'payment_method_id', type: 'number', data: 'paymentMethods', required: true, ng: { model: 'standingOrder.payment_method_id' } } + %label{ for: 'payment_method_id'}= t('admin.payment_method') + %input.ofn-select2.fullwidth#payment_method_id{ name: 'payment_method_id', type: 'number', data: 'paymentMethods', required: true, placeholder: t('admin.choose'), ng: { model: 'standingOrder.payment_method_id' } } .error{ ng: { show: 'submitted && standing_order_details_form.payment_method_id.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.payment_method', show: 'standing_order_details_form.payment_method_id.$pristine' } } {{ error }} .two.columns   .seven.columns.omega.field - %label{ for: 'shipping_method_id'} Shipping Method - %input.ofn-select2.fullwidth#shipping_method_id{ name: 'shipping_method_id', type: 'number', data: 'shippingMethods', required: true, ng: { model: 'standingOrder.shipping_method_id' } } + %label{ for: 'shipping_method_id'}= t('admin.shipping_method') + %input.ofn-select2.fullwidth#shipping_method_id{ name: 'shipping_method_id', type: 'number', data: 'shippingMethods', required: true, placeholder: t('admin.choose'), ng: { model: 'standingOrder.shipping_method_id' } } .error{ ng: { show: 'submitted && standing_order_details_form.shipping_method_id.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.shipping_method', show: 'standing_order_details_form.shipping_method_id.$pristine' } } {{ error }} .row .seven.columns.alpha.field - %label{ for: 'begins_at'} Begins At + %label{ for: 'begins_at'}= t('admin.begins_at') %input.fullwidth#begins_at{ name: 'begins_at', type: 'text', placeholder: 'Select A Date', datepicker: 'standingOrder.begins_at', required: true, ng: { model: 'standingOrder.begins_at' } } .error{ ng: { show: 'submitted && standing_order_details_form.begins_at.$error.required' } }= t(:error_required) .error{ ng: { repeat: 'error in errors.begins_at', show: 'standing_order_details_form.begins_at.$pristine' } } {{ error }} .two.columns   .seven.columns.omega.field - %label{ for: 'ends_at'} Begins At + %label{ for: 'ends_at'}= t('admin.ends_at') %input.fullwidth#ends_at{ name: 'ends_at', type: 'text', placeholder: 'Optional', datepicker: 'standingOrder.begins_at', ng: { model: 'standingOrder.ends_at' } } .error{ ng: { repeat: 'error in errors.ends_at', show: 'standing_order_details_form.ends_at.$pristine' } } {{ error }} diff --git a/app/views/admin/standing_orders/_form.html.haml b/app/views/admin/standing_orders/_form.html.haml index c474d1d2eb..6381388a52 100644 --- a/app/views/admin/standing_orders/_form.html.haml +++ b/app/views/admin/standing_orders/_form.html.haml @@ -1,18 +1,17 @@ %form.margin-bottom-50{ name: 'standing_order_form', novalidate: true, ng: { submit: 'save()' } } %save-bar{ dirty: "standing_order_form.$dirty", persist: 'true', ng: { show: "view == 'review'" } } - %input.red{ type: "submit", value: "Save" } + %input.red{ type: "submit", value: t('admin.standing_orders.create') } .details{ ng: { show: "['details','review'].indexOf(view) >= 0" } } %ng-form{ name: 'standing_order_details_form', ng: { controller: 'DetailsController' } } %save-bar{ dirty: "standing_order_details_form.$dirty", persist: 'true', ng: { hide: "view == 'review'" } } - %input{ type: "button", value: 'Back', ng: { click: "back()" } } - %input.red{ type: "button", value: 'Next', ng: { click: 'next()' } } + %input.red{ type: "button", value: t(:next), ng: { click: 'next()' } } = render 'details' .products{ ng: { show: "['products','review'].indexOf(view) >= 0" } } %ng-form{ name: 'standing_order_products_form', ng: { controller: 'ProductsController' } } %save-bar{ dirty: "standing_order_products_form.$dirty", persist: 'true', ng: { hide: "view == 'review'" } } - %input{ type: "button", value: 'Back', ng: { click: "back()" } } - %input.red{ type: "button", value: 'Next', ng: { click: 'next()' } } + %input{ type: "button", value: t(:back), ng: { click: "back()" } } + %input.red{ type: "button", value: t(:next), ng: { click: 'next()' } } = render 'autocomplete' = render 'products' diff --git a/app/views/admin/standing_orders/_wizard_progress.html.haml b/app/views/admin/standing_orders/_wizard_progress.html.haml index 14d6913c4f..aa5c5b2e99 100644 --- a/app/views/admin/standing_orders/_wizard_progress.html.haml +++ b/app/views/admin/standing_orders/_wizard_progress.html.haml @@ -1,3 +1,3 @@ %ul.wizard-progress %li{ ng: { repeat: "step in ['details','products','review']", class: '{current: view==step}' } } - {{ stepTitles[step] }} + {{ stepTitleFor(step) }} diff --git a/app/views/admin/standing_orders/new.html.haml b/app/views/admin/standing_orders/new.html.haml index 5f3b5ec88d..da3ee1da0b 100644 --- a/app/views/admin/standing_orders/new.html.haml +++ b/app/views/admin/standing_orders/new.html.haml @@ -1,7 +1,7 @@ -# = render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise } - content_for :page_title do - New Standing Order + =t('admin.standing_orders.new') -# - content_for :page_actions do -# %li= button_link_to "Back to standing orders list", main_app.admin_standing_orders_path, icon: 'icon-arrow-left' diff --git a/config/locales/en.yml b/config/locales/en.yml index 3a5db33ae5..a03c624683 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -188,18 +188,24 @@ en: create_and_add_another: "Create and Add Another" admin: # Common properties / models + begins_at: Begins At + customer: Customer date: Date email: Email + ends_at: Ends At name: Name on_hand: On Hand on_demand: On Demand on_demand?: On Demand? order_cycle: Order Cycle + payment_method: Payment Method phone: Phone price: Price producer: Producer product: Product quantity: Quantity + schedule: Schedule + shipping_method: Shipping Method shop: Shop sku: SKU tags: Tags @@ -221,6 +227,7 @@ en: clear: Clear show_more: Show more show_n_more: Show %{num} more + choose: "Choose..." columns: Columns actions: Actions @@ -783,8 +790,15 @@ en: name: Packing Reports standing_orders: + new: New Standing Order + create: Create Standing Order + steps: + details: 1. Basic Details + products: 2. Add Products + review: 3. Review & Save details: - details: 'Details' + details: Details + invalid_error: Oops! Please fill in all of the required fields... stripe_connect_settings: edit: diff --git a/spec/features/admin/standing_orders_spec.rb b/spec/features/admin/standing_orders_spec.rb index 029c2e09cb..abf1f33b76 100644 --- a/spec/features/admin/standing_orders_spec.rb +++ b/spec/features/admin/standing_orders_spec.rb @@ -30,7 +30,7 @@ feature 'Standing Orders' do # No date filled out, so error returned click_button('Next') expect(page).to have_content 'can\'t be blank' - expect(page).to have_content 'Oops! There seems to be a problem...' + expect(page).to have_content 'Oops! Please fill in all of the required fields...' fill_in 'begins_at', with: Date.today.strftime('%F') click_button('Next') @@ -52,7 +52,7 @@ feature 'Standing Orders' do click_button('Next') expect{ - click_button('Save') + click_button('Create Standing Order') expect(page).to have_content 'Saved' }.to change(StandingOrder, :count).by(1)