(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c05f5"],{4201:function(e,t,r){"use strict";r.r(t);var s=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("b-row",{staticClass:"mt-2"},[r("b-col",{staticClass:"ml-auto mr-auto",attrs:{md:"10"}},[r("b-card",{staticClass:"card-submit",attrs:{title:"Submit Your Question","sub-title":"Use the form below to submit your question. Remember, the first answer is the correct one."}},[r("b-card-body",[r("question-form",{attrs:{question:e.question,submissionState:e.submissionState,isSaving:e.isSaving},on:{"message-submitted":e.onSubmitted,"alert-dismissed":e.onAlertDismissed}})],1)],1)],1)],1)},o=[],n=r("d4ec"),i=r("bee2"),c=r("262e"),a=r("2caf"),l=r("9ab4"),u=r("60a3"),d=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("validation-observer",{ref:"observer",scopedSlots:e._u([{key:"default",fn:function(t){var s=t.handleSubmit;return[r("b-form",{staticClass:"text-left",on:{submit:function(t){return t.preventDefault(),s(e.onSubmit)}}},[r("validation-provider",{attrs:{name:"Question",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[r("b-form-group",{attrs:{label:"Question","label-for":"question"}},[r("b-form-input",{attrs:{id:"question",type:"text",placeholder:"Question",state:e.getValidationState(t)},model:{value:e.form.message,callback:function(t){e.$set(e.form,"message",t)},expression:"form.message"}}),r("b-form-invalid-feedback",{attrs:{id:"question-feedback"}},[e._v(e._s(t.errors[0]))])],1)]}}],null,!0)}),r("validation-provider",{attrs:{name:"Correct Answer",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[r("b-form-group",{attrs:{label:"Correct Answer","label-for":"correctAnswer"}},[r("b-form-input",{attrs:{id:"correctAnswer",type:"text",placeholder:"Correct Answer",state:e.getValidationState(t)},model:{value:e.form.correctAnswer,callback:function(t){e.$set(e.form,"correctAnswer",t)},expression:"form.correctAnswer"}}),r("b-form-invalid-feedback",{attrs:{id:"correctAnswer-feedback"}},[e._v(e._s(t.errors[0]))])],1)]}}],null,!0)}),r("validation-provider",{attrs:{name:"First Incorrect Answer",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[r("b-form-group",{attrs:{label:"First Incorrect Answer","label-for":"incorrectAnswer1"}},[r("b-form-input",{attrs:{id:"incorrectAnswer1",type:"text",placeholder:"First Incorrect Answer",state:e.getValidationState(t)},model:{value:e.form.incorrectAnswer1,callback:function(t){e.$set(e.form,"incorrectAnswer1",t)},expression:"form.incorrectAnswer1"}}),r("b-form-invalid-feedback",{attrs:{id:"incorrectAnswer1-feedback"}},[e._v(e._s(t.errors[0]))])],1)]}}],null,!0)}),r("validation-provider",{attrs:{name:"Second Incorrect Answer",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[r("b-form-group",{attrs:{label:"Second Incorrect Answer","label-for":"incorrectAnswer2"}},[r("b-form-input",{attrs:{id:"incorrectAnswer2",type:"text",placeholder:"Second Incorrect Answer",state:e.getValidationState(t)},model:{value:e.form.incorrectAnswer2,callback:function(t){e.$set(e.form,"incorrectAnswer2",t)},expression:"form.incorrectAnswer2"}}),r("b-form-invalid-feedback",{attrs:{id:"incorrectAnswer2-feedback"}},[e._v(e._s(t.errors[0]))])],1)]}}],null,!0)}),r("validation-provider",{attrs:{name:"Third Incorrect Answer",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[r("b-form-group",{attrs:{label:"Third Incorrect Answer","label-for":"incorrectAnswer3"}},[r("b-form-input",{attrs:{id:"incorrectAnswer3",type:"text",placeholder:"Third Incorrect Answer",state:e.getValidationState(t)},model:{value:e.form.incorrectAnswer3,callback:function(t){e.$set(e.form,"incorrectAnswer3",t)},expression:"form.incorrectAnswer3"}}),r("b-form-invalid-feedback",{attrs:{id:"incorrectAnswer3-feedback"}},[e._v(e._s(t.errors[0]))])],1)]}}],null,!0)}),r("b-button",{attrs:{type:"submit",variant:"primary",disabled:e.isSaving}},[e._v("Submit")])],1),r("div",{staticClass:"pt-2"},[r("b-alert",{attrs:{variant:"danger",show:e.hasError,dismissible:""},on:{dismissed:e.alertDismissed}},[e._v("Something went wrong")]),r("b-alert",{attrs:{variant:"success",show:e.hasSuccess,dismissible:""},on:{dismissed:e.alertDismissed}},[e._v("Thank you for your submission")])],1)]}}])})},b=[],m=function(e){Object(c["a"])(r,e);var t=Object(a["a"])(r);function r(){var e,s;return Object(n["a"])(this,r),s=t.apply(this,arguments),s.form={id:null!==(e=s.id)&&void 0!==e?e:0,message:s.message,correctAnswer:s.correctAnswer,incorrectAnswer1:s.incorrectAnswer1,incorrectAnswer2:s.incorrectAnswer2,incorrectAnswer3:s.incorrectAnswer3},s}return Object(i["a"])(r,[{key:"stateChanged",value:function(e){"Success"===e&&this.resetForm()}},{key:"getValidationState",value:function(e){var t=e.dirty,r=e.validated,s=e.valid,o=void 0===s?null:s;return t||r?o:null}},{key:"resetForm",value:function(){var e=this;this.form={id:0,message:null,correctAnswer:null,incorrectAnswer1:null,incorrectAnswer2:null,incorrectAnswer3:null},this.$nextTick((function(){e.observer.reset()}))}},{key:"onSubmit",value:function(){this.form.message&&this.form.correctAnswer&&this.form.incorrectAnswer1&&this.form.incorrectAnswer2&&this.form.incorrectAnswer3&&this.messageSubmitted({id:this.form.id,message:this.form.message,answers:[{message:this.form.correctAnswer},{message:this.form.incorrectAnswer1},{message:this.form.incorrectAnswer2},{message:this.form.incorrectAnswer3}]})}},{key:"messageSubmitted",value:function(e){}},{key:"alertDismissed",value:function(){}},{key:"hasError",get:function(){return"Error"===this.submissionState}},{key:"hasSuccess",get:function(){return"Success"===this.submissionState}}]),r}(u["e"]);Object(l["__decorate"])([Object(u["c"])()],m.prototype,"id",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"message",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"correctAnswer",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"incorrectAnswer1",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"incorrectAnswer2",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"incorrectAnswer3",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"submissionState",void 0),Object(l["__decorate"])([Object(u["c"])()],m.prototype,"isSaving",void 0),Object(l["__decorate"])([Object(u["f"])("submissionState")],m.prototype,"stateChanged",null),Object(l["__decorate"])([Object(u["d"])()],m.prototype,"observer",void 0),Object(l["__decorate"])([Object(u["b"])()],m.prototype,"messageSubmitted",null),Object(l["__decorate"])([Object(u["b"])()],m.prototype,"alertDismissed",null),m=Object(l["__decorate"])([u["a"]],m);var f=m,p=f,v=r("2877"),w=Object(v["a"])(p,d,b,!1,null,null,null),A=w.exports,_=r("4bb5"),h=Object(_["a"])("submission"),S=function(e){Object(c["a"])(r,e);var t=Object(a["a"])(r);function r(){var e;return Object(n["a"])(this,r),e=t.apply(this,arguments),e.question={id:0,message:"",answers:[]},e}return Object(i["a"])(r,[{key:"onAlertDismissed",value:function(){this.setSubmissionState(null)}}]),r}(u["e"]);Object(l["__decorate"])([h.State],S.prototype,"submissionState",void 0),Object(l["__decorate"])([h.State],S.prototype,"isSaving",void 0),Object(l["__decorate"])([h.Mutation],S.prototype,"setSubmissionState",void 0),Object(l["__decorate"])([h.Action("saveSubmission")],S.prototype,"onSubmitted",void 0),S=Object(l["__decorate"])([Object(u["a"])({components:{QuestionForm:A}})],S);var y=S,g=y,j=Object(v["a"])(g,s,o,!1,null,null,null);t["default"]=j.exports}}]); //# sourceMappingURL=chunk-2d0c05f5.ee7dd31b.js.map