diff --git a/src/app/components/article-service/article.service.js b/src/app/components/article-service/article.service.js index 9100d57..d5da579 100644 --- a/src/app/components/article-service/article.service.js +++ b/src/app/components/article-service/article.service.js @@ -27,7 +27,8 @@ getEvents: getEvents, subscribeToEvent: subscribeToEvent, searchTopics: searchTopics, - searchProposals: searchProposals + searchProposals: searchProposals, + sendContactForm: sendContactForm }; return service; @@ -211,6 +212,13 @@ return UtilService.post(url, encodedParams); } + function sendContactForm (community_id, data){ + var url = service.apiCommunities + community_id + '/contact' + var encodedParams = angular.element.param(data); + + return UtilService.post(url, encodedParams); + } + function searchTopics (params, cbSuccess, cbError) { // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Topic&query=cisternas var url = '/api/v1/search/article'; diff --git a/src/app/components/dialoga-service/dialoga.service.js b/src/app/components/dialoga-service/dialoga.service.js index 6449b3a..44b6c13 100644 --- a/src/app/components/dialoga-service/dialoga.service.js +++ b/src/app/components/dialoga-service/dialoga.service.js @@ -25,6 +25,7 @@ extendedService.getQuestions = getQuestions; extendedService.searchPrograms = searchPrograms; extendedService.searchProposals = searchProposals; + extendedService.sendContactForm = sendContactForm; extendedService.filterProposalsByCategorySlug = filterProposalsByCategorySlug; extendedService.filterProposalsByProgramId = filterProposalsByProgramId; @@ -232,6 +233,10 @@ ArticleService.searchProposals(params, cbSuccess, cbError); } + function sendContactForm (data) { + return ArticleService.sendContactForm(API.communityId, data); + } + function filterProposalsByCategorySlug (input, categorySlug) { if(!angular.isArray(input)){ diff --git a/src/app/pages/duvidas/duvidas.controller.js b/src/app/pages/duvidas/duvidas.controller.js index 9f39434..055fe31 100644 --- a/src/app/pages/duvidas/duvidas.controller.js +++ b/src/app/pages/duvidas/duvidas.controller.js @@ -15,28 +15,59 @@ vm.$log = $log; vm.init(); + vm.loadData(); } DuvidasPageController.prototype.init = function () { var vm = this; - vm.questions = null; - + vm.questions = [{ + question: 'O que é o Dialoga Brasil?', + answer: 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven`t heard of them accusamus labore sustainable VHS.' + },{ + question: 'O que ... ?', + answer: 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven`t heard of them accusamus labore sustainable VHS.' + } + ]; vm.loading = true; vm.error = false; - - vm.loadData(); }; - DuvidasPageController.prototype.loadData = function () { var vm = this; - vm.DialogaService.getQuestions(function(questions){ - vm.questions = questions; - }, function (error) { - vm.error = error; - vm.$log.error(error); + // vm.DialogaService.getQuestions(function(questions){ + // vm.questions = questions; + // }, function (error) { + // vm.error = error; + // vm.$log.error(error); + // }); + }; + + DuvidasPageController.prototype.submitContactForm = function ($event, contactForm) { + var vm = this; + + vm.$log.debug('submitContactForm contactForm', contactForm); + vm.sendingContactForm = true; + + var data = { + name: contactForm.inputName.$modelValue, + email: contactForm.inputEmail.$modelValue, + subject: contactForm.inputSubject.$modelValue, + message: contactForm.inputMessage.$modelValue + }; + + vm.DialogaService.sendContactForm(data) + .then(function(response){ + vm.$log.debug('sendContactForm success', response); + + }, function(response){ + vm.$log.debug('sendContactForm error', response); + + }) + .finally(function(response){ + vm.$log.debug('sendContactForm finally', response); + vm.sendingContactForm = false; }); }; })(); diff --git a/src/app/pages/duvidas/duvidas.html b/src/app/pages/duvidas/duvidas.html index 39a2180..8dfd09f 100644 --- a/src/app/pages/duvidas/duvidas.html +++ b/src/app/pages/duvidas/duvidas.html @@ -1,4 +1,4 @@ -