From dd8648512d84427168d845934598041862e4e6e7 Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 2 Jun 2015 13:34:07 -0400 Subject: [PATCH 1/2] clean up * indentation * unused back method * and make sure search params are cleared on navigation --- app/scripts/order/controller/edit.js | 9 +++------ app/scripts/order/controller/list.js | 2 +- app/themes/views/order/edit.html | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/scripts/order/controller/edit.js b/app/scripts/order/controller/edit.js index bf477d51..8b2b8503 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,19 @@ 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'); 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 2a31df82..ef809ea5 100644 --- a/app/themes/views/order/edit.html +++ b/app/themes/views/order/edit.html @@ -153,7 +153,7 @@



From 34b536de892b07da3b1daf78326dd2e30347cdad Mon Sep 17 00:00:00 2001 From: Adam Knox Date: Tue, 2 Jun 2015 13:34:46 -0400 Subject: [PATCH 2/2] [#95989020] add support for displaying and saving notes --- app/scripts/order/controller/edit.js | 6 ++++++ app/themes/views/order/edit.html | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app/scripts/order/controller/edit.js b/app/scripts/order/controller/edit.js index 8b2b8503..81ce4747 100644 --- a/app/scripts/order/controller/edit.js +++ b/app/scripts/order/controller/edit.js @@ -96,6 +96,12 @@ function ($scope, $routeParams, $location, $q, $orderApiService, $dashboardUtils // 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]; diff --git a/app/themes/views/order/edit.html b/app/themes/views/order/edit.html index ef809ea5..b33f7d7c 100644 --- a/app/themes/views/order/edit.html +++ b/app/themes/views/order/edit.html @@ -151,6 +151,13 @@

+ +

Notes

+
    +
  • {{ note }}
  • +
+ +