mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-26 05:55:15 +00:00
Add feature to remove line items from open order cycle
- Add JS controller to send delete requests. - Add resource controller to destroy items. - Add authorisation check to abilities. - Update fees after removing line item.
This commit is contained in:
committed by
Rob Harrington
parent
4112c3cc75
commit
4835ef067f
@@ -0,0 +1,10 @@
|
||||
Darkswarm.controller "EditOrderCtrl", ($scope, $resource, Cart) ->
|
||||
|
||||
$scope.deleteLineItem = (id) ->
|
||||
params = {id: id}
|
||||
success = (response) ->
|
||||
$(".line-item-" + id).remove()
|
||||
fail = (error) ->
|
||||
console.log error
|
||||
|
||||
$resource("/line_items/:id").delete(params, success, fail)
|
||||
@@ -102,7 +102,6 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
|
||||
for line_item in items
|
||||
line_item.variant.line_item = line_item
|
||||
Variants.extend line_item.variant
|
||||
line_item.variant.extended_name = @extendedVariantName(line_item.variant)
|
||||
items
|
||||
|
||||
total_item_count: =>
|
||||
|
||||
Reference in New Issue
Block a user