diff --git a/app/scripts/order/controller/edit.js b/app/scripts/order/controller/edit.js index bf477d51..81ce4747 100644 --- a/app/scripts/order/controller/edit.js +++ b/app/scripts/order/controller/edit.js @@ -82,10 +82,6 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils ); } - $scope.back = function () { - $location.path("/orders"); - }; - /** * Event handler to save the order data. * Creates new order if ID in current order is empty OR updates current order if ID is set @@ -96,18 +92,25 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils delete $scope.order["updated_at"]; if (orderId !== null && JSON.stringify(oldString) !== JSON.stringify($scope.order)) { $orderApiService.update({"orderID": orderId}, $scope.order).$promise.then(function (response) { + + // Success if (response.error === null) { $scope.message = $dashboardUtilsService.getMessage(null , 'success', 'Order was updated successfully'); + + // Update the notes list with whatever is on the server. + // we get the whole order back, so we could set the entire thing + $scope.order.note = ''; + $scope.order.notes = response.result.notes || []; + for (var field in response.result) { if (response.result.hasOwnProperty(field) && "updated_at" !== field) { oldString[field] = response.result[field]; - } } } else { $scope.message = $dashboardUtilsService.getMessage(response); } - $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); + $('[ng-click="save()"]').removeClass('disabled').children('i').remove(); $('[ng-click="save()"]').siblings('.btn').removeClass('disabled'); }); diff --git a/app/scripts/order/controller/list.js b/app/scripts/order/controller/list.js index 9e09aa3b..5bb69117 100644 --- a/app/scripts/order/controller/list.js +++ b/app/scripts/order/controller/list.js @@ -76,7 +76,7 @@ function ($rootScope, $scope, $location, $routeParams, $q, DashboardListService, * @param id */ $scope.select = function (id) { - $location.path("/order/" + id); + $location.path("/order/" + id).search(''); }; /** diff --git a/app/themes/views/order/edit.html b/app/themes/views/order/edit.html index 8ccaadce..728d8b8e 100644 --- a/app/themes/views/order/edit.html +++ b/app/themes/views/order/edit.html @@ -154,9 +154,16 @@