mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 20:01:07 +03:30
1 line
11 KiB
JavaScript
Vendored
1 line
11 KiB
JavaScript
Vendored
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{"6tPj":function(t,e,a){"use strict";var s=a("7oej");a.n(s).a},"7oej":function(t,e,a){var s=a("P8Hk");"string"==typeof s&&(s=[[t.i,s,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};a("aET+")(s,r);s.locals&&(t.exports=s.locals)},P8Hk:function(t,e,a){(t.exports=a("JPst")(!1)).push([t.i,"\n.WM-Border-Gray[data-v-6c9c7db4] {\r\n border-color: #aaa !important;\n}\n.WM-Color-LightGrey[data-v-6c9c7db4] {\r\n background-color: #f5f5f5;\n}\n.v-btn--top.v-btn--absolute.v-btn--small[data-v-6c9c7db4] {\r\n top: -25px !important;\n}\n.v-btn--bottom.v-btn--absolute.v-btn--small[data-v-6c9c7db4] {\r\n bottom: -24px !important;\n}\r\n",""])},Zgy5:function(t,e,a){"use strict";a.r(e);var s=a("o0o1"),r=a.n(s),o=a("Y8XJ"),i=a("85lN");function n(t,e,a,s,r,o,i){try{var n=t[o](i),l=n.value}catch(t){return void a(t)}n.done?e(l):Promise.resolve(l).then(s,r)}function l(t){return function(){var e=this,a=arguments;return new Promise(function(s,r){var o=t.apply(e,a);function i(t){n(o,s,r,i,l,"next",t)}function l(t){n(o,s,r,i,l,"throw",t)}i(void 0)})}}var c={data:function(){return{form:{name:"",unique_code:"",info:[{id:0,name:"",type:"",size:""}]},type:[{state:"Text",abbr:"Text"},{state:"Checkbox",abbr:"Checkbox"},{state:"Select",abbr:"Select"},{state:"Form",abbr:"Form"}],size:[{state:"not Selected",abbr:""},{state:"2 as 12",abbr:"md2 xs12"},{state:"3 as 12",abbr:"md3 xs12"},{state:"4 as 12",abbr:"md4 xs12"},{state:"6 as 12",abbr:"md6 xs12"},{state:"8 as 12",abbr:"md8 xs12"},{state:"10 as 12",abbr:"md10 xs12"},{state:"10 as 12",abbr:"md12 xs12"}],rules:{required:function(t){return!!t||"Required."}}}},created:function(){this.$route.params.testType&&this.load(this.$route.params.testType)},methods:{changeType:function(t,e){this.form.info[t].options="Select"==e||"Checkbox"==e?[{id:0,title:""}]:[],"Form"==e&&(this.form.info[t].children=[{id:0,name:"",type:"",size:""}])},removeSelectbox:function(t,e){var a=this.form;this.form=[],a.info[t].options.splice(e,1),this.form=a},addSelectbox:function(t){var e=this.form;this.form=[],e.info[t].options.push({id:0,title:""}),this.form=e},addInput:function(){this.form.info.push({id:0,name:"",type:"",size:""})},changeTypeForm:function(t,e,a){if("Select"==e||"Checkbox"==e){var s=this.form;this.form="",s.info[t].children[a].options=[{id:0,title:""}],this.form=s}else{var r=this.form;this.form="",r.info[t].children[a].options=[],this.form=r}},removeSelectboxForm:function(t,e,a){var s=this.form;this.form=[],s.info[t].children[a].options.splice(e,1),this.form=s},addSelectboxForm:function(t,e){var a=this.form;this.form=[],a.info[t].children[e].options.push({id:0,title:""}),this.form=a},duplicateForm:function(t){var e=this.form;this.form=[],e.info[t].children.push({id:0,name:"",type:"",size:""}),this.form=e},removeForm:function(t,e){var a=this.form;this.form=[],a.info[t].children.splice(e,1),this.form=a},removeInput:function(t){var e=this.form;this.form=[],e.info.splice(t,1),this.form=e},registerForm:function(){var t=l(r.a.mark(function t(){var e;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.$refs.form.validate()){t.next=12;break}if(e=null,!this.$route.params.testType){t.next=8;break}return t.next=5,o.a.put(i.a.updateTestType(this.$route.params.testType),this.form);case 5:e=t.sent,t.next=11;break;case 8:return t.next=10,o.a.post(i.a.storeTestType,this.form);case 10:e=t.sent;case 11:e&&200==e.status&&this.$router.push({name:"Dashboard"});case 12:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),load:function(){var t=l(r.a.mark(function t(e){var a;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.a.get(i.a.editTestType(e));case 2:200==(a=t.sent).status&&(this.form=a.data.data);case 4:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()}},m=(a("6tPj"),a("KHd+")),u=Object(m.a)(c,function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("v-form",{ref:"form"},[a("v-container",{attrs:{"grid-list-xs":""}},[a("material-card",{attrs:{color:"black",title:"Add a New Test"}},[a("v-layout",{staticClass:"ma-2",attrs:{row:"",wrap:""}},[a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2",attrs:{name:"name",label:"Name",color:"black",rules:[t.rules.required]},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),t._v(" "),a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2",attrs:{rules:[t.rules.required],name:"uniquecode",label:"Unique Code",color:"black"},model:{value:t.form.unique_code,callback:function(e){t.$set(t.form,"unique_code",e)},expression:"form.unique_code"}})],1)],1),t._v(" "),t._l(t.form.info,function(e,s){return a("v-layout",{key:s,staticClass:"pb-4 ma-2 WM-Border WM-Border-Gray WM-BG-White WM-Relative",attrs:{row:"",wrap:""}},[a("v-layout",{staticClass:"ma-2",attrs:{row:"",wrap:""}},[a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2",attrs:{name:"inputname",label:"Input Name",color:"black",rules:[t.rules.required]},model:{value:e.name,callback:function(a){t.$set(e,"name",a)},expression:"info.name"}})],1),t._v(" "),a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-select",t._b({staticClass:"pa-2",attrs:{items:t.type,"item-text":"state","item-value":"abbr",label:"Type","single-line":"",color:"black"},on:{change:function(a){return t.changeType(s,e.type)}},model:{value:e.type,callback:function(a){t.$set(e,"type",a)},expression:"info.type"}},"v-select",0!==e.id?{disabled:!0}:{disabled:!1},!1))],1),t._v(" "),a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},["Form"!==e.type?a("v-select",{staticClass:"pa-2",attrs:{items:t.size,"item-text":"state","item-value":"abbr",label:"Size","single-line":"",color:"black"},model:{value:e.size,callback:function(a){t.$set(e,"size",a)},expression:"info.size"}}):t._e()],1)],1),t._v(" "),"Select"===e.type||"Checkbox"===e.type?a("v-layout",{staticClass:"ma-3 pa-3 WM-Border WM-Border-Black WM-Relative WM-Width-Full",attrs:{row:"",wrap:""}},[e.options.length>0?a("v-layout",{staticClass:"WM-Relative WM-Width-Full",attrs:{row:"",wrap:""}},t._l(e.options,function(e,r){return a("v-flex",{key:r,staticClass:"pb-4 ma-2 WM-Border WM-Border-Gray WM-BG-White WM-Width-Full WM-Relative",attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2 Input",attrs:{rules:[t.rules.required],name:"title",label:"Title",color:"black"},model:{value:e.title,callback:function(a){t.$set(e,"title",a)},expression:"selectbox.title"}}),t._v(" "),r>=1?a("v-btn",{attrs:{absolute:"",small:"",right:"",bottom:"",color:"pink"},on:{click:function(e){return t.removeSelectbox(s,r)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-times")]),t._v("REMOVE\n ")],1):t._e()],1)}),1):t._e(),t._v(" "),a("v-btn",{staticClass:"mb-2",attrs:{absolute:"",right:"",bottom:"",small:"",color:"black"},on:{click:function(e){return t.addSelectbox(s)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-plus")]),t._v(" "),a("span",{staticClass:"white--text"},[t._v("Add")])],1)],1):t._e(),t._v(" "),"Form"===e.type?a("v-layout",{staticClass:"pa-3 my-4 mx-3 WM-Border WM-Border-Black WM-Relative",attrs:{row:"",wrap:""}},[t._l(e.children,function(e,r){return a("v-layout",{key:r,staticClass:"pa-3 my-4 mx-3 WM-Border WM-Border-Gray WM-Color-LightGrey WM-Width-Full WM-Relative Form",attrs:{row:"",wrap:""}},[a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2",attrs:{rules:[t.rules.required],name:"name",label:"Input Name",color:"black"},model:{value:e.name,callback:function(a){t.$set(e,"name",a)},expression:"children.name"}})],1),t._v(" "),a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},[a("v-select",t._b({staticClass:"pa-2",attrs:{items:t.type,"item-text":"state","item-value":"abbr",label:"Type","single-line":"",color:"black"},on:{change:function(a){return t.changeTypeForm(s,e.type,r)}},model:{value:e.type,callback:function(a){t.$set(e,"type",a)},expression:"children.type"}},"v-select",0!==e.id?{disabled:!0}:{disabled:!1},!1))],1),t._v(" "),a("v-flex",{attrs:{xs12:"",md3:"",sm3:""}},["Form"!==e.type?a("v-select",{staticClass:"pa-2",attrs:{items:t.size,"item-text":"state","item-value":"abbr",label:"Size","single-line":"",color:"black"},model:{value:e.size,callback:function(a){t.$set(e,"size",a)},expression:"children.size"}}):t._e()],1),t._v(" "),"Select"===e.type||"Checkbox"===e.type?a("v-layout",{staticClass:"pa-3 mb-3 WM-Border WM-Border-Black WM-Relative WM-Width-Full",attrs:{row:"",wrap:""}},[e.options.length>0?a("v-layout",{staticClass:"WM-Relative WM-Width-Full",attrs:{row:"",wrap:""}},t._l(e.options,function(e,o){return a("v-flex",{key:o,staticClass:"pb-4 ma-2 WM-Border WM-Border-Gray WM-BG-White WM-Width-Full WM-Relative",attrs:{xs12:"",md3:"",sm3:""}},[a("v-text-field",{staticClass:"pa-2 Input",attrs:{name:"title",label:"Title",color:"black",rules:[t.rules.required]},model:{value:e.title,callback:function(a){t.$set(e,"title",a)},expression:"selectbox.title"}}),t._v(" "),o>=1?a("v-btn",{attrs:{absolute:"",small:"",right:"",bottom:"",color:"pink"},on:{click:function(e){return t.removeSelectboxForm(s,o,r)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-times")]),t._v("REMOVE\n ")],1):t._e()],1)}),1):t._e(),t._v(" "),a("v-btn",{attrs:{absolute:"",right:"",bottom:"",small:"",color:"black"},on:{click:function(e){return t.addSelectboxForm(s,r)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-plus")]),t._v(" "),a("span",{staticClass:"white--text"},[t._v("Add")])],1)],1):t._e(),t._v(" "),a("v-btn",{attrs:{absolute:"",small:"",right:"",top:"",color:"pink"},on:{click:function(e){return t.removeForm(s,r)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-times")]),t._v("REMOVE\n ")],1)],1)}),t._v(" "),a("v-btn",{attrs:{absolute:"",small:"",right:"",bottom:"",color:"cyan"},on:{click:function(e){return t.duplicateForm(s)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-plus")]),t._v("ADD\n ")],1)],2):t._e(),t._v(" "),s>0?a("v-btn",{attrs:{absolute:"",small:"",right:"",top:"",color:"pink"},on:{click:function(e){return t.removeInput(s)}}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-times")]),t._v("REMOVE\n ")],1):t._e(),t._v(" "),t.form.info.length-1==s?a("v-layout",{staticClass:"mt-4",attrs:{row:"",wrap:"","align-center":"","justify-center":""}},[a("v-btn",{staticClass:"mb-2",attrs:{absolute:"",right:"",bottom:"",small:"",color:"pink"},on:{click:t.addInput}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-plus")]),t._v(" "),a("span",{staticClass:"white--text"},[t._v("Add")])],1)],1):t._e()],1)}),t._v(" "),a("v-layout",{staticClass:"mt-4",attrs:{row:"",wrap:"","align-center":"","justify-center":""}},[a("v-btn",{staticClass:"WM-CyanBlueGradient-BG",staticStyle:{padding:"10px 60px"},on:{click:t.registerForm}},[a("v-icon",{staticClass:"white--text mr-2 caption"},[t._v("fas fa-check")]),t._v(" "),a("span",{staticClass:"white--text"},[t._v("Generate Form")])],1),t._v(" "),a("router-link",{attrs:{to:"/dashboard"}},[a("v-btn",{staticClass:"WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5"},[a("v-icon",{staticClass:"black--text mr-2 caption"},[t._v("fas fa-chevron-left")]),t._v(" "),a("span",{staticClass:"black--text"},[t._v("Back")])],1)],1)],1)],2)],1)],1)},[],!1,null,"6c9c7db4",null);e.default=u.exports}}]); |