diff --git a/app/scripts/controllers.js b/app/scripts/controllers.js index 59bc741..290460f 100644 --- a/app/scripts/controllers.js +++ b/app/scripts/controllers.js @@ -59,7 +59,7 @@ angular.module('confusionApp') }]) - .controller('FeedbackController', ['$scope', function ($scope) { + .controller('FeedbackController', ['$scope', 'feedbackFactory', function ($scope, feedbackFactory) { $scope.sendFeedback = function () { console.log($scope.feedback); @@ -69,6 +69,8 @@ angular.module('confusionApp') console.log('incorrect'); } else { + feedbackFactory.getFeedback().save($scope.feedback); + $scope.invalidChannelSelection = false; $scope.feedback = {mychannel: "", firstName: "", lastName: "", agree: false, email: ""}; $scope.feedback.mychannel = ""; @@ -133,11 +135,13 @@ angular.module('confusionApp') } ); - $scope.promotion = menuFactory.getPromotion(0); - $scope.leader = corporateFactory.getLeader(0); + $scope.promotion = menuFactory.getPromotions().get({id: 0}); + + $scope.leader = corporateFactory.getLeaders().get({id: 0}); + }]) .controller('AboutController', ['$scope', 'corporateFactory', function ($scope, corporateFactory) { - $scope.leaders = corporateFactory.getLeaders(); + $scope.leaders = corporateFactory.getLeaders().query(); }]) ; diff --git a/app/scripts/services.js b/app/scripts/services.js index d74db59..d9589c7 100644 --- a/app/scripts/services.js +++ b/app/scripts/services.js @@ -10,70 +10,30 @@ angular.module('confusionApp') return $resource(baseURL + "dishes/:id", null, {'update': {method: 'PUT'}}); }; - var promotions = [ - { - _id: 0, - name: 'Weekend Grand Buffet', - image: 'images/buffet.png', - label: 'New', - price: '19.99', - description: 'Featuring mouthwatering combinations with a choice of five different salads, six enticing appetizers, six main entrees and five choicest desserts. Free flowing bubbly and soft drinks. All for just $19.99 per person ', - } - - ]; - - this.getPromotion = function (index) { - return promotions[index]; + this.getPromotions = function () { + return $resource(baseURL + "promotions/:id", null); }; }]) - .factory('corporateFactory', function () { + .factory('corporateFactory', ['$resource', 'baseURL', function ($resource, baseURL) { var corpfac = {}; - var leadership = [ - { - name: "Peter Pan", - image: 'images/alberto.png', - designation: "Chief Epicurious Officer", - abbr: "CEO", - description: "Our CEO, Peter, credits his hardworking East Asian immigrant parents who undertook the arduous journey to the shores of America with the intention of giving their children the best future. His mother's wizardy in the kitchen whipping up the tastiest dishes with whatever is available inexpensively at the supermarket, was his first inspiration to create the fusion cuisines for which The Frying Pan became well known. He brings his zeal for fusion cuisines to this restaurant, pioneering cross-cultural culinary connections." - }, - { - name: "Dhanasekaran Witherspoon", - image: 'images/alberto.png', - designation: "Chief Food Officer", - abbr: "CFO", - description: "Our CFO, Danny, as he is affectionately referred to by his colleagues, comes from a long established family tradition in farming and produce. His experiences growing up on a farm in the Australian outback gave him great appreciation for varieties of food sources. As he puts it in his own words, Everything that runs, wins, and everything that stays, pays!" - }, - { - name: "Agumbe Tang", - image: 'images/alberto.png', - designation: "Chief Taste Officer", - abbr: "CTO", - description: "Blessed with the most discerning gustatory sense, Agumbe, our CFO, personally ensures that every dish that we serve meets his exacting tastes. Our chefs dread the tongue lashing that ensues if their dish does not meet his exacting standards. He lives by his motto, You click only if you survive my lick." - }, - { - name: "Alberto Somayya", - image: 'images/alberto.png', - designation: "Executive Chef", - abbr: "EC", - description: "Award winning three-star Michelin chef with wide International experience having worked closely with whos-who in the culinary world, he specializes in creating mouthwatering Indo-Italian fusion experiences. He says, Put together the cuisines from the two craziest cultures, and you get a winning hit! Amma Mia!" - } - - ]; - corpfac.getLeaders = function () { - return leadership; - }; - - corpfac.getLeader = function (index) { - return leadership[index]; + return $resource(baseURL + "leadership/:id", null); }; return corpfac; - }) + }]) + + .service('feedbackFactory', ['$resource', 'baseURL', function ($resource, baseURL) { + + this.getFeedback = function () { + return $resource(baseURL + "feedback/:id", null, {'update': {method: 'PUT'}}); + }; + + }]) ; \ No newline at end of file diff --git a/json-server/db.json b/json-server/db.json index 7a6780b..71c126a 100644 --- a/json-server/db.json +++ b/json-server/db.json @@ -209,5 +209,19 @@ "description": "Award winning three-star Michelin chef with wide International experience having worked closely with whos-who in the culinary world, he specializes in creating mouthwatering Indo-Italian fusion experiences. He says, Put together the cuisines from the two craziest cultures, and you get a winning hit! Amma Mia!" } ], - "feedback": [] -} + "feedback": [ + { + "mychannel": "Email", + "firstName": "1", + "lastName": "1", + "agree": true, + "email": "1@1", + "tel": { + "areaCode": "1", + "number": "1" + }, + "comments": "1", + "id": 1 + } + ] +} \ No newline at end of file