mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Adding js infrastructure to dynamically fetch available payment and shipping methods for accounts distributor
This commit is contained in:
@@ -0,0 +1 @@
|
||||
angular.module("admin.accounts_and_billing_settings", [])
|
||||
@@ -0,0 +1,14 @@
|
||||
angular.module("admin.accounts_and_billing_settings").directive "methodSettingsFor", ->
|
||||
template: "<div ng-include='include_html'></div>"
|
||||
restrict: 'A'
|
||||
scope: {
|
||||
enterprise_id: '=methodSettingsFor'
|
||||
}
|
||||
link: (scope, element, attrs) ->
|
||||
scope.include_html = ""
|
||||
|
||||
scope.$watch "enterprise_id", (newVal, oldVal)->
|
||||
if !newVal? || newVal == ""
|
||||
scope.include_html = ""
|
||||
else
|
||||
scope.include_html = "/admin/accounts_and_billing_settings/show_methods?enterprise_id=#{newVal};"
|
||||
@@ -0,0 +1,11 @@
|
||||
angular.module("admin.accounts_and_billing_settings").directive "watchValueAs", ->
|
||||
restrict: 'A'
|
||||
scope: {
|
||||
value: "=watchValueAs"
|
||||
}
|
||||
link: (scope, element, attrs) ->
|
||||
scope.value = element.val()
|
||||
|
||||
element.on "change blur load", ->
|
||||
scope.$apply ->
|
||||
scope.value = element.val()
|
||||
@@ -22,6 +22,7 @@
|
||||
//= require angular-rails-templates
|
||||
//= require_tree ../templates/admin
|
||||
//= require ./admin
|
||||
//= require ./accounts_and_billing_settings/accounts_and_billing_settings
|
||||
//= require ./customers/customers
|
||||
//= require ./dropdown/dropdown
|
||||
//= require ./enterprises/enterprises
|
||||
|
||||
Reference in New Issue
Block a user