Merge branch 'master' into 3-0-stable-jun-2

This commit is contained in:
Luis Ramos
2020-06-11 19:50:56 +01:00
77 changed files with 539 additions and 372 deletions

View File

@@ -105,6 +105,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
$scope.producerFilter = "0"
$scope.categoryFilter = "0"
$scope.importDateFilter = "0"
$scope.fetchProducts()
$scope.$watch 'sortOptions', (sort) ->
return unless sort && sort.predicate != ""

View File

@@ -37,6 +37,7 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
'q[distributor_id_in][]': $scope['q']['distributor_id_in'],
'q[order_cycle_id_in][]': $scope['q']['order_cycle_id_in'],
'q[s]': $scope.sorting || 'completed_at desc',
shipping_method_id: $scope.shipping_method_id,
per_page: $scope.per_page,
page: page
}

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'Enterprises', (enterprises, ShopsResource, CurrentHub, Taxons, Dereferencer, Matcher, Geo, $rootScope) ->
Darkswarm.factory 'Enterprises', (enterprises, ShopsResource, CurrentHub, Taxons, Dereferencer, Matcher, GmapsGeo, $rootScope) ->
new class Enterprises
enterprises: []
enterprises_by_id: {}
@@ -59,7 +59,7 @@ Darkswarm.factory 'Enterprises', (enterprises, ShopsResource, CurrentHub, Taxons
false
calculateDistance: (query, firstMatching) ->
if query?.length > 0 and Geo.OK
if query?.length > 0 and GmapsGeo.OK
if firstMatching?
@setDistanceFrom firstMatching
else
@@ -68,9 +68,9 @@ Darkswarm.factory 'Enterprises', (enterprises, ShopsResource, CurrentHub, Taxons
@resetDistance()
calculateDistanceGeo: (query) ->
Geo.geocode query, (results, status) =>
GmapsGeo.geocode query, (results, status) =>
$rootScope.$apply =>
if status == Geo.OK
if status == GmapsGeo.OK
#console.log "Geocoded #{query} -> #{results[0].geometry.location}."
@setDistanceFrom results[0].geometry.location
else
@@ -79,7 +79,7 @@ Darkswarm.factory 'Enterprises', (enterprises, ShopsResource, CurrentHub, Taxons
setDistanceFrom: (locatable) ->
for enterprise in @enterprises
enterprise.distance = Geo.distanceBetween enterprise, locatable
enterprise.distance = GmapsGeo.distanceBetween enterprise, locatable
$rootScope.$broadcast 'enterprisesChanged'
resetDistance: ->

View File

@@ -1,5 +1,5 @@
Darkswarm.service "Geo", ->
new class Geo
Darkswarm.service "GmapsGeo", ->
new class GmapsGeo
OK: google?.maps?.GeocoderStatus?.OK
# Usage: