(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c0148db6"],{c579:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("b-row",[r("b-col",[r("b-card",{staticClass:"shadow"},[[r("div",{staticClass:"card-header bg-white border-0"},[r("b-row",{staticClass:"align-items-center"},[r("b-col",[r("h3",{staticClass:"mb-0"},[e._v("Edit Question")])])],1)],1)],r("b-card-body",[r("question-detail-form",{attrs:{question:e.question,isSubmitting:e.isSubmitting,isError:e.isError,isSuccess:e.isSuccess},on:{"question-submitted":e.onSubmitted,"question-cancelled":e.onCancelled,"question-deleted":e.onDeleted}})],1)],2)],1)],1)],1)},o=[],s=(r("96cf"),r("1da1")),i=r("d4ec"),c=r("bee2"),a=r("262e"),u=r("2caf"),l=r("9ab4"),d=r("60a3"),b=r("4bb5"),f=r("ebfa"),m=r("bd5e"),p=Object(b["a"])("question"),v=function(e){Object(a["a"])(r,e);var t=Object(u["a"])(r);function r(){var e;return Object(i["a"])(this,r),e=t.apply(this,arguments),e._id=0,e}return Object(c["a"])(r,[{key:"stateChanged",value:function(e){e===m["a"].SUCCESS&&this.$router.go(-1)}},{key:"created",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.setQuestionState(null),this.id=+this.$route.params.id,e.next=4,this.getQuestion(this.id);case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onSubmitted",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancelled",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.$router.go(-1);case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onDeleted",value:function(){var e=Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()},{key:"id",get:function(){return this._id},set:function(e){this._id=e}},{key:"message",get:function(){var e;return null===(e=this.question)||void 0===e?void 0:e.message}},{key:"isSubmitting",get:function(){return this.questionState&&this.questionState===m["a"].SAVING}},{key:"isError",get:function(){return this.questionState&&this.questionState===m["a"].ERROR}},{key:"isSuccess",get:function(){return this.questionState&&this.questionState===m["a"].SUCCESS}}]),r}(d["e"]);Object(l["__decorate"])([p.State],v.prototype,"question",void 0),Object(l["__decorate"])([p.State],v.prototype,"questionState",void 0),Object(l["__decorate"])([Object(d["f"])("questionState")],v.prototype,"stateChanged",null),Object(l["__decorate"])([p.Action],v.prototype,"getQuestion",void 0),Object(l["__decorate"])([p.Mutation],v.prototype,"setQuestionState",void 0),v=Object(l["__decorate"])([Object(d["a"])({components:{QuestionDetailForm:f["a"]}})],v);var w=v,h=w,_=r("2877"),g=Object(_["a"])(h,n,o,!1,null,null,null);t["default"]=g.exports},ebfa:function(e,t,r){"use strict";var n=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 n=t.handleSubmit;return[r("b-form",{on:{submit:function(t){return t.preventDefault(),n(e.onSubmit)}}},[r("h6",{staticClass:"heading-small text-muted mb-4"},[e._v("Question Information")]),r("div",{staticClass:"pl-lg-4"},[r("b-row",[r("b-col",[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)})],1)],1)],1),r("hr",{staticClass:"my-4"}),r("h6",{staticClass:"heading-small text-muted mb-4"},[e._v("Answers")]),r("div",{staticClass:"pl-lg-4"},[r("b-row",[r("b-col",{attrs:{xl:"12"}},[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)})],1),r("b-col",{attrs:{xl:"12"}},[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:"Incorrect Answers","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",[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",[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)})],1)],1)],1),r("div",{staticClass:"pl-lg-4 text-center"},[r("b-button",{attrs:{type:"submit",variant:"primary",disabled:e.isSubmitting}},[e._v("Submit")]),r("b-button",{attrs:{type:"button",variant:"danger",disabled:e.isSubmitting},on:{click:e.onDelete}},[e._v("Delete")]),r("b-button",{attrs:{type:"button",variant:"secondary",disabled:e.isSubmitting},on:{click:e.onCancel}},[e._v("Cancel")])],1)]),r("div",{staticClass:"pt-2"},[r("b-alert",{attrs:{variant:"danger",show:e.isError,dismissible:""},on:{dismissed:e.alertDismissed}},[e._v("Something went wrong")]),r("b-alert",{attrs:{variant:"success",show:e.isSuccess,dismissible:""},on:{dismissed:e.alertDismissed}},[e._v("Thank you for your submission")])],1)]}}])})},o=[],s=r("d4ec"),i=r("bee2"),c=r("262e"),a=r("2caf"),u=r("9ab4"),l=r("60a3"),d=function(e){Object(c["a"])(r,e);var t=Object(a["a"])(r);function r(){var e,n;return Object(s["a"])(this,r),n=t.apply(this,arguments),n.form={id:null!==(e=n.id)&&void 0!==e?e:0,message:n.message,correctAnswer:n.correctAnswer,incorrectAnswer1:n.incorrectAnswer1,incorrectAnswer2:n.incorrectAnswer2,incorrectAnswer3:n.incorrectAnswer3},n}return Object(i["a"])(r,[{key:"questionChanged",value:function(e){e&&(this.form.message=e.message,this.form.id=e.id,this.form.correctAnswer=e.answers[0].message,this.form.incorrectAnswer1=e.answers[1].message,this.form.incorrectAnswer2=e.answers[2].message,this.form.incorrectAnswer3=e.answers[3].message)}},{key:"getValidationState",value:function(e){var t=e.dirty,r=e.validated,n=e.valid,o=void 0===n?null:n;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(){return{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:"onDelete",value:function(){}},{key:"onCancel",value:function(){}},{key:"alertDismissed",value:function(){}}]),r}(l["e"]);Object(u["__decorate"])([Object(l["c"])()],d.prototype,"id",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"message",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"correctAnswer",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"incorrectAnswer1",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"incorrectAnswer2",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"incorrectAnswer3",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"question",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"isSubmitting",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"isSuccess",void 0),Object(u["__decorate"])([Object(l["c"])()],d.prototype,"isError",void 0),Object(u["__decorate"])([Object(l["f"])("question")],d.prototype,"questionChanged",null),Object(u["__decorate"])([Object(l["d"])()],d.prototype,"observer",void 0),Object(u["__decorate"])([Object(l["b"])("question-submitted")],d.prototype,"onSubmit",null),Object(u["__decorate"])([Object(l["b"])("question-deleted")],d.prototype,"onDelete",null),Object(u["__decorate"])([Object(l["b"])("question-cancelled")],d.prototype,"onCancel",null),Object(u["__decorate"])([Object(l["b"])()],d.prototype,"alertDismissed",null),d=Object(u["__decorate"])([l["a"]],d);var b=d,f=b,m=r("2877"),p=Object(m["a"])(f,n,o,!1,null,null,null);t["a"]=p.exports}}]); //# sourceMappingURL=chunk-c0148db6.0242e057.js.map