diff --git a/app/views/spree/admin/orders/index.html.haml b/app/views/spree/admin/orders/index.html.haml index 1ca1753f19..e834c9b88e 100644 --- a/app/views/spree/admin/orders/index.html.haml +++ b/app/views/spree/admin/orders/index.html.haml @@ -36,6 +36,9 @@ %div.menu_item %span.name{'ng-controller' => 'bulkCancelCtrl', 'ng-click' => 'cancelSelectedOrders()' } = t('.cancel_orders') + %div.menu_item + %span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" } + = t('.resend_confirmation') = render partial: 'per_page_controls', locals: { position: "right" } @@ -63,7 +66,7 @@ %tbody %tr{ng: {repeat: 'order in orders track by order.id', class: {even: "'even'", odd: "'odd'"}}, 'ng-class' => "{'state-{{order.state}}': true, 'row-loading': rowStatus[order.id] == 'loading'}"} %td.align-center - %input{type: 'checkbox', 'ng-model' => 'checkboxes[order.id]', 'ng-change' => 'toggleSelection(order.id)'} + %input{type: 'checkbox', 'ng-model' => 'checkboxes[order.id]', 'ng-change' => 'toggleSelection(order.id)', value: '{{order.id}}', name: 'order_ids[]'} %td.align-center {{order.distributor_name}} %td.align-center @@ -118,3 +121,7 @@ = t('.no_orders_found') = render 'spree/admin/shared/custom-confirm' + += render ConfirmModalComponent.new(id: "resend_confirmation", confirm_actions: "click->resend-confirmation-email#confirm", controllers: "resend-confirmation-email") do + .margin-bottom-30 + = t('.resend_confirmation_confirm_html') diff --git a/app/webpacker/controllers/resend_confirmation_email_controller.js b/app/webpacker/controllers/resend_confirmation_email_controller.js new file mode 100644 index 0000000000..d375e6a0cf --- /dev/null +++ b/app/webpacker/controllers/resend_confirmation_email_controller.js @@ -0,0 +1,18 @@ +import ApplicationController from "./application_controller"; + +export default class extends ApplicationController { + connect() { + super.connect(); + } + + confirm() { + const order_ids = []; + document + .querySelectorAll("#listing_orders input[name='order_ids[]']:checked") + .forEach((checkbox) => { + order_ids.push(checkbox.value); + }); + + this.stimulate("ResendConfirmationEmailReflex#confirm", order_ids); + } +} diff --git a/config/locales/en.yml b/config/locales/en.yml index ba026c13ae..adf05e112e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3912,6 +3912,8 @@ See the %{link} to find out more about %{sitename}'s features and to start using viewing: "Viewing %{start} to %{end}." print_invoices: "Print Invoices" cancel_orders: "Cancel Orders" + resend_confirmation: "Resend Confirmation" + resend_confirmation_confirm_html: "This will resend the confirmation email to the customer.
Are you sure you want to proceed?" selected: zero: "No order selected" one: "1 order selected"