From cf6a013ee8867710d1f95e3e7da9b7c821f5cf9c Mon Sep 17 00:00:00 2001 From: Christian Torres Date: Tue, 23 Jul 2019 23:54:44 -0600 Subject: [PATCH] Validating selection and sending vote to backend. --- app/Http/Controllers/VoteController.php | 3 +- .../js/components/OptionItemComponent.vue | 21 ++-- .../js/components/SurveyInstanceComponent.vue | 98 +++++++++++++++---- 3 files changed, 94 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/VoteController.php b/app/Http/Controllers/VoteController.php index 8e36538..66d8b87 100644 --- a/app/Http/Controllers/VoteController.php +++ b/app/Http/Controllers/VoteController.php @@ -33,6 +33,7 @@ public function create(Request $request) */ public function store(Request $request) { - // + $options = $request['options']; + print_r($options); } } diff --git a/resources/js/components/OptionItemComponent.vue b/resources/js/components/OptionItemComponent.vue index 0fb08ce..a13f0bb 100644 --- a/resources/js/components/OptionItemComponent.vue +++ b/resources/js/components/OptionItemComponent.vue @@ -1,14 +1,14 @@ @@ -18,6 +18,15 @@ export default { props: { option: Object, number: Number, + selected: { + type: Boolean, + default: false, + } + }, + methods: { + handleClick() { + this.$emit('change', { option: this.option, selected: !this.selected }); + } }, mounted() { } diff --git a/resources/js/components/SurveyInstanceComponent.vue b/resources/js/components/SurveyInstanceComponent.vue index d63ac08..4d46eca 100644 --- a/resources/js/components/SurveyInstanceComponent.vue +++ b/resources/js/components/SurveyInstanceComponent.vue @@ -1,30 +1,53 @@