Add selectable checkboxes

This commit is contained in:
Matt-Yorkley
2018-10-05 22:00:27 +01:00
parent 4f5bb96484
commit f263ef7dc0
3 changed files with 13 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor,
{id: 50, name: t('js.admin.orders.index.per_page', results: 50)},
{id: 100, name: t('js.admin.orders.index.per_page', results: 100)}
]
$scope.selected = {}
$scope.select_all = false
$scope.initialise = ->
$scope.per_page = 15
@@ -36,6 +38,11 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, RequestMonitor,
page: page
})
$scope.toggleAll = ->
$scope.select_all = !$scope.select_all
$scope.orders.forEach (order) ->
$scope.selected[order.id] = $scope.select_all
$scope.$watch 'sortOptions', (sort) ->
if sort && sort.predicate != ""
$scope.sorting = sort.predicate + ' desc' if sort.reverse

View File

@@ -24,6 +24,9 @@
%col{style: "width: 10%"}
%thead
%tr
%th
= t('.select_all')
%input{type: 'checkbox', 'ng-click' => 'toggleAll()'}
%th
= t(:products_distributor)
%th
@@ -39,6 +42,8 @@
%th.actions
%tbody
%tr{ng: {repeat: 'order in orders track by $index', class: {even: "'even'", odd: "'odd'"}}, 'ng-class' => "'state-{{order.state}}'"}
%td.align-center
%input{type: 'checkbox', 'ng-model' => 'selected[order.id]'}
%td.align-center
{{order.distributor_name}}
%td.align-center

View File

@@ -2695,6 +2695,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
no_orders_found: "No Orders Found"
results_found: "%{number} Results found."
viewing: "Viewing %{start} to %{end}."
select_all: "Select All"
invoice:
issued_on: Issued on
tax_invoice: TAX INVOICE