mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
19 lines
458 B
CoffeeScript
19 lines
458 B
CoffeeScript
angular.module("Darkswarm").factory 'Customers', (Customer) ->
|
|
new class Customers
|
|
all: []
|
|
byID: {}
|
|
|
|
index: (params={}) ->
|
|
return @all if @all.length
|
|
Customer.index params, (data) => @load(data)
|
|
@all
|
|
|
|
load: (customers) ->
|
|
for customer in customers
|
|
@all.push customer
|
|
@byID[customer.id] = customer
|
|
|
|
clearAllAllowCharges: () ->
|
|
for customer in @index()
|
|
customer.allow_charges = false
|