![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/dist/_nuxt/ |
(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{721:function(e,t,n){"use strict";var l={name:"PageHeader",props:{title:{required:!0}}},r=n(88),component=Object(r.a)(l,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"row"},[n("div",{staticClass:"col-md-6"},[n("div",{staticClass:"border-bottom mb-3"},[n("h3",[e._v(e._s(e.title))])])]),e._v(" "),n("div",{staticClass:"col-md-6"},[e._t("default")],2)])}),[],!1,null,"0f95d94e",null);t.a=component.exports},794:function(e,t,n){"use strict";n.r(t);n(12),n(15);var l=n(721),r={name:"BooleanType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}}},o=n(88),c=Object(o.a)(r,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"custom-control custom-checkbox pt-4"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.timesheetSetting.value,expression:"timesheetSetting.value"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"checkbox_"+e.timesheetSetting.code},domProps:{checked:Array.isArray(e.timesheetSetting.value)?e._i(e.timesheetSetting.value,null)>-1:e.timesheetSetting.value},on:{change:function(t){var n=e.timesheetSetting.value,l=t.target,r=!!l.checked;if(Array.isArray(n)){var o=e._i(n,null);l.checked?o<0&&e.$set(e.timesheetSetting,"value",n.concat([null])):o>-1&&e.$set(e.timesheetSetting,"value",n.slice(0,o).concat(n.slice(o+1)))}else e.$set(e.timesheetSetting,"value",r)}}}),e._v(" "),n("label",{staticClass:"custom-control-label",attrs:{for:"checkbox_"+e.timesheetSetting.code}},[e._v("\n "+e._s(e.timesheetSetting.label)+"\n ")])])])}),[],!1,null,null,null).exports,m={name:"DateType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}}},d=Object(o.a)(m,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("label",{staticClass:"required-field"},[e._v(e._s(e.timesheetSetting.label))]),e._v(" "),n("b-form-datepicker",{attrs:{id:"date_"+e.timesheetSetting.id},model:{value:e.timesheetSetting.value,callback:function(t){e.$set(e.timesheetSetting,"value",t)},expression:"timesheetSetting.value"}})],1)}),[],!1,null,null,null).exports,h={name:"FileType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{filePath:null,uploadReady:!1}},mounted:function(){this.uploadReady=!1,null!==this.timesheetSetting.value&&(this.filePath=this.timesheetSetting.value,this.timesheetSetting.value=null),this.uploadReady=!0}},v=Object(o.a)(h,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"pt-4"},[n("label",{staticClass:"required-field"},[e._v(e._s(e.timesheetSetting.label))]),e._v(" "),e.filePath?n("div",[n("a",{attrs:{href:e.filePath,target:"_blank"}},[e._v("Show File")])]):e._e(),e._v(" "),e.uploadReady?n("div",[n("b-form-file",{attrs:{accept:".jpg, .jpeg, .png, .txt, .csv, .pdf",placeholder:"Upload File..."},model:{value:e.timesheetSetting.value,callback:function(t){e.$set(e.timesheetSetting,"value",t)},expression:"timesheetSetting.value"}}),e._v(" "),e.filePath?n("span",{staticClass:"text-muted small"},[e._v("Note: when a new file is uploaded, the existing file is automatically deleted")]):e._e()],1):e._e()])])}),[],!1,null,null,null).exports,f={name:"NumberType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}}},S=Object(o.a)(f,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"form-group"},[n("corals-input",{attrs:{form:e.form,type:e.timesheetSetting.type.toLowerCase(),field:"timesheetSettings."+e.index+".value",label:e.timesheetSetting.label,required:""},model:{value:e.timesheetSetting.value,callback:function(t){e.$set(e.timesheetSetting,"value",t)},expression:"timesheetSetting.value"}}),e._v(" "),e.timesheetSetting.properties&&e.timesheetSetting.properties.help_text?n("span",{staticClass:"text-muted small"},[e._v("Note: "+e._s(e.timesheetSetting.properties.help_text))]):e._e()],1)}),[],!1,null,null,null).exports,_={name:"SelectType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}},methods:{getOptionObject:function(){return{key:"",value:""}},removeOption:function(e){var t=[];this.timesheetSetting.value.forEach((function(n,l){l!=e&&t.push(n)})),this.timesheetSetting.value=t},addOption:function(){this.timesheetSetting.value.push(this.getOptionObject())}},computed:{}},x=Object(o.a)(_,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("label",{staticClass:"required-field"},[e._v(e._s(e.timesheetSetting.label))]),e._v(" "),n("table",{staticClass:"table table-striped table-responsive values-table",attrs:{width:"100%"}},[e._m(0),e._v(" "),n("tbody",e._l(e.timesheetSetting.value,(function(t,l){return n("tr",{attrs:{id:"tr_"+l,"data-index":""+l}},[n("td",[n("div",{staticClass:"form-group"},[n("corals-input",{attrs:{form:e.form,size:"sm",type:"text",field:"timesheetSetting.value."+l+".key",label:!1},model:{value:t.key,callback:function(n){e.$set(t,"key",n)},expression:"optionValue.key"}})],1)]),e._v(" "),n("td",[n("div",{staticClass:"form-group"},[n("corals-input",{attrs:{form:e.form,size:"sm",type:"text",field:"timesheetSetting.value."+l+".value",label:!1},model:{value:t.value,callback:function(n){e.$set(t,"value",n)},expression:"optionValue.value"}})],1)]),e._v(" "),n("td",[n("button",{staticClass:"btn btn-danger btn-sm",staticStyle:{margin:"0"},attrs:{"data-index":""+l},on:{click:function(t){return t.preventDefault(),e.removeOption(l)}}},[n("fa",{attrs:{icon:"times"}})],1)])])})),0)]),e._v(" "),n("button",{staticClass:"btn btn-success btn-sm",on:{click:function(t){return t.preventDefault(),e.addOption.apply(null,arguments)}}},[n("fa",{attrs:{icon:"plus"}})],1)])}),[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("thead",[n("tr",[n("th",{attrs:{width:"50%"}},[e._v("Key")]),e._v(" "),n("th",{attrs:{width:"50%"}},[e._v("Value")]),e._v(" "),n("th")])])}],!1,null,null,null),y=x.exports,C={name:"TextareaType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}}},T=Object(o.a)(C,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("corals-textarea",{attrs:{form:e.form,field:"timesheetSettings."+e.index+".value",label:e.timesheetSetting.label,rows:"4",placeholder:"Value...",required:""},model:{value:e.timesheetSetting.value,callback:function(t){e.$set(e.timesheetSetting,"value",t)},expression:"timesheetSetting.value"}})],1)}),[],!1,null,null,null).exports,$={name:"TextType",props:{form:{required:!0},timesheetSetting:{required:!0},index:{required:!0}},data:function(){return{}},methods:{}},k=Object(o.a)($,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("corals-input",{attrs:{form:e.form,type:e.timesheetSetting.type.toLowerCase(),field:"timesheetSettings."+e.index+".value",label:e.timesheetSetting.label,required:""},model:{value:e.timesheetSetting.value,callback:function(t){e.$set(e.timesheetSetting,"value",t)},expression:"timesheetSetting.value"}})],1)}),[],!1,null,null,null).exports,w={name:"settings",components:{PageHeader:l.a,BooleanType:c,DateType:d,FileType:v,NumberType:S,SelectType:y,TextareaType:T,TextType:k},middleware:"Authorization",data:function(){return{showTimesheetSettings:!1,form:this.$form({timesheetSettings:[]}),formFile:this.$form({file:null})}},methods:{getData:function(){var e=this;this.showTimesheetSettings=!1,this.$axios.get("timesheet/settings").then((function(t){var n=t.data;e.form.timesheetSettings=n.data,e.showTimesheetSettings=!0}))},updateSettings:function(){var e=this;this.form.timesheetSettings.forEach((function(t){"FILE"===t.type&&null!==t.value&&(e.formFile.file=t.value,e.formFile.post("timesheet/settings/".concat(t.id,"/upload-file")))})),this.$axios.post("timesheet/settings/update",{timesheetSettings:this.form.timesheetSettings}).then((function(t){var n=t.data;e.getData(),e.$store.dispatch("GET_AND_SET_SETTINGS",{$axios:e.$axios,force:!0}),e.$toast.success(n.data.message)}))}},computed:{getTimesheetSettings:function(){return this.form.timesheetSettings}},mounted:function(){this.getData()}},O=Object(o.a)(w,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("page-header",{attrs:{title:"Settings"}}),e._v(" "),e.form.isReady&&e.showTimesheetSettings?n("div",[n("div",{staticClass:"row"},e._l(e.getTimesheetSettings,(function(t,l){return n("div",{key:"timesheet_setting_"+l,staticClass:"mr-5 mb-2",staticStyle:{width:"25%"}},[n(""+t.type[0].toUpperCase()+t.type.slice(1).toLowerCase()+"Type",{tag:"component",attrs:{form:e.form,timesheetSetting:t,index:l}})],1)})),0),e._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-md-10"}),e._v(" "),n("div",{staticClass:"col-md-2"},[n("button",{staticClass:"btn btn-md btn-success",on:{click:function(t){return t.preventDefault(),e.updateSettings.apply(null,arguments)}}},[n("fa",{attrs:{icon:"edit"}}),e._v("\n Update\n ")],1)])])]):e._e()],1)}),[],!1,null,null,null);t.default=O.exports}}]);