Renaming standing order files

This commit is contained in:
Rob Harrington
2018-02-02 16:10:10 +11:00
parent b258c032cc
commit a9b5fd69d8
57 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
# Used to display a message before redirecting to a link
angular.module("admin.standingOrders").directive "confirmOrderEdit", (ConfirmDialog, $window) ->
restrict: "A"
link: (scope, element, attrs) ->
element.bind "click", (event) ->
unless scope.proxyOrder.order_id?
event.preventDefault()
ConfirmDialog.open('error', t('admin.standing_orders.orders.confirm_edit'), {confirm: t('yes_i_am_sure')}).then ->
$window.open(attrs.href)

View File

@@ -0,0 +1,28 @@
angular.module("admin.standingOrders").directive 'newStandingOrderDialog', ($compile, $window, $templateCache, DialogDefaults, shops) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
scope.submitted = false
scope.shops = shops
scope.shop_id = null
scope.newStandingOrder = ->
scope.new_standing_order_form.$setPristine()
scope.submitted = true
if scope.shop_id?
$window.location.href = "/admin/standing_orders/new?standing_order[shop_id]=#{scope.shop_id}"
return
# Compile modal template
template = $compile($templateCache.get('admin/new_standing_order_dialog.html'))(scope)
# Set Dialog options
template.dialog(DialogDefaults)
# Link opening of dialog to click event on element
element.bind 'click', (e) ->
if shops.length == 1
scope.shop_id = shops[0].id
scope.newStandingOrder()
else
template.dialog('open')