|
|
@@ -18,8 +18,10 @@ $(function() {
|
|
|
const $hideInactiveTestersSwitch = $("#hide-inactive-testers");
|
|
|
$hideInactiveTestersSwitch.on("change", () => loadAllAddresses());
|
|
|
|
|
|
+ const $customerRows = $("a[data-customer-id]");
|
|
|
+
|
|
|
// On customer select
|
|
|
- $("a[data-customer-id]").on("click", function() {
|
|
|
+ $customerRows.on("click", function() {
|
|
|
let customerId = $(this).data("customer-id");
|
|
|
|
|
|
let key = "customer-" + customerId;
|
|
|
@@ -93,6 +95,46 @@ $(function() {
|
|
|
|
|
|
});
|
|
|
|
|
|
+ const filter = $("input[name=filter]:checked").val();
|
|
|
+ if(filter) {
|
|
|
+ $customerRows.each((index, element) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ $(element).trigger("click");
|
|
|
+ }, index * 250);
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const $toggleAllCustomers = $("#toggle-all-customers");
|
|
|
+ $toggleAllCustomers.on("click", event => {
|
|
|
+ event.preventDefault();
|
|
|
+
|
|
|
+ const $firstRow = $customerRows.eq(0);
|
|
|
+ const selected = $firstRow.data("selected");
|
|
|
+ if(!selected) {
|
|
|
+ let loadCount = 0;
|
|
|
+ $customerRows.each((index, element) => {
|
|
|
+ const $row = $(element);
|
|
|
+ const selected = $row.data("selected");
|
|
|
+ if(!selected) {
|
|
|
+ setTimeout(() => {
|
|
|
+ $row.trigger("click");
|
|
|
+ }, loadCount * 250);
|
|
|
+ loadCount++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $customerRows.each((index, element) => {
|
|
|
+ const $row = $(element);
|
|
|
+ const selected = $row.data("selected");
|
|
|
+ if(selected) {
|
|
|
+ $row.trigger("click");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
|
|
|
function loadCustomerLocations(customerId) {
|
|
|
@@ -117,6 +159,7 @@ function loadCustomerLocations(customerId) {
|
|
|
customer_id: customerId,
|
|
|
min_date: minDate,
|
|
|
max_date: maxDate,
|
|
|
+ filter: $("input[name=filter]:checked").val(),
|
|
|
submit: $("#submit").val()
|
|
|
}, function(response) {
|
|
|
if(!response.success) return false;
|