(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c0430a92"],{"0138":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("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 Submission")])])],1)],1)],r("b-card-body",[r("question-detail-form",{attrs:{question:e.submission,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)},n=[],o=(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"),m=r("ebfa"),f=r("bd5e"),p=Object(b["a"])("submission"),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===f["a"].SUCCESS&&this.$router.go(-1)}},{key:"created",value:function(){var e=Object(o["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.setSubmissionState(null),this.id=+this.$route.params.id,e.next=4,this.getSubmission(this.id);case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"onCancelled",value:function(){var e=Object(o["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(o["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.archiveSubmission(this.id);case 2:case"end":return e.stop()}}),e,this)})));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.submission)||void 0===e?void 0:e.message}},{key:"isSubmitting",get:function(){return this.submissionState&&this.submissionState===f["a"].SAVING}},{key:"isError",get:function(){return this.submissionState&&this.submissionState===f["a"].ERROR}},{key:"isSuccess",get:function(){return this.submissionState&&this.submissionState===f["a"].SUCCESS}}]),r}(d["e"]);Object(l["__decorate"])([p.State],v.prototype,"submission",void 0),Object(l["__decorate"])([p.State],v.prototype,"submissionState",void 0),Object(l["__decorate"])([Object(d["f"])("submissionState")],v.prototype,"stateChanged",null),Object(l["__decorate"])([p.Action],v.prototype,"getSubmission",void 0),Object(l["__decorate"])([p.Mutation],v.prototype,"setSubmissionState",void 0),Object(l["__decorate"])([p.Action("moveSubmission")],v.prototype,"onSubmitted",void 0),Object(l["__decorate"])([p.Action],v.prototype,"archiveSubmission",void 0),v=Object(l["__decorate"])([Object(d["a"])({components:{QuestionDetailForm:m["a"]}})],v);var w=v,_=w,h=r("2877"),g=Object(h["a"])(_,s,n,!1,null,null,null);t["default"]=g.exports},ebfa:function(e,t,r){"use strict";var s=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",{on:{submit:function(t){return t.preventDefault(),s(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)]}}])})},n=[],o=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,s;return Object(o["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:"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,s=e.valid,n=void 0===s?null:s;return t||r?n: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,m=b,f=r("2877"),p=Object(f["a"])(m,s,n,!1,null,null,null);t["a"]=p.exports}}]); //# sourceMappingURL=chunk-c0430a92.bb909efc.js.map