![]() 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([[17,5,9,10],{292:function(t,e,r){"use strict";r.r(e);r(33),r(47),r(44),r(18),r(116);var o={name:"CoralsTextarea",props:{form:{type:Object,required:!0},label:{type:[String,Boolean],default:"",required:!1},field:{type:String,required:!0},required:{type:Boolean,default:!1}},computed:{hasValueAttr:function(){return void 0!==this.$attrs.value},labelValue:function(){if(!1===this.label)return"";if(this.label)return this.label;var label=this.field.replace("_"," ");return label.charAt(0).toUpperCase()+label.slice(1)},idValue:function(){return this.$attrs.id?this.$attrs.id:this.field},fieldDescription:function(){return this.$attrs.description||""}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("b-form-group",{attrs:{"invalid-feedback":t.form.error(t.field),label:t.labelValue,"label-for":t.idValue,"label-class":t.required?"required-field":"",description:t.fieldDescription,state:t.form.state(t.field)}},[t.hasValueAttr?r("b-form-textarea",t._b({attrs:{id:t.idValue,state:t.form.state(t.field)},on:{input:function(e){return t.$emit("input",e)}}},"b-form-textarea",t.$attrs,!1)):r("b-form-textarea",t._b({attrs:{id:t.idValue,state:t.form.state(t.field)},on:{input:function(e){return t.$emit("input",e)}},model:{value:t.form[t.field],callback:function(e){t.$set(t.form,t.field,"string"==typeof e?e.trim():e)},expression:"form[field]"}},"b-form-textarea",t.$attrs,!1))],1)}),[],!1,null,"26d350b3",null);e.default=component.exports},294:function(t,e,r){"use strict";r.r(e);r(192),r(237),r(19),r(33),r(420),r(14),r(12);var o={name:"CoralsReportsDateForm",props:{form:{required:!0},rowClass:{required:!1,type:String}},data:function(){return{periodOptions:{currentWeek:"Current Week",currentMonth:"Current Month",previousMonth:"Previous Month",currentYear:"Current Year",previousYear:"Previous Year",custom:"Custom"}}},mounted:function(){var t=this.$route.query.period;t&&Object.keys(this.periodOptions).includes(t)&&(this.form.period=t),this.datePeriod()},methods:{checkDatePattern:function(t){return t&&t.match(/^\d{4}-\d{2}-\d{2}$/)?t:null},datePeriod:function(){var t=new Date;switch(t=new Date(t.getFullYear(),t.getMonth(),3),this.form.period){case"previousWeek":this.form.from_date=this.getFormattedDate("week",!0,!0),this.form.to_date=this.getFormattedDate("week",!1,!0);break;case"currentWeek":this.form.from_date=this.getFormattedDate("week"),this.form.to_date=this.getFormattedDate("week",!1);break;case"previousMonth":this.form.from_date=this.getFormattedDate("month",!0,!0),this.form.to_date=this.getFormattedDate("month",!1,!0);break;case"currentYear":this.form.from_date=this.getFormattedDate("year"),this.form.to_date=this.getFormattedDate("year",!1);break;case"previousYear":this.form.from_date=this.getFormattedDate("year",!0,!0),this.form.to_date=this.getFormattedDate("year",!1,!0);break;case"custom":this.form.from_date=this.checkDatePattern(this.$route.query.from_date),this.form.to_date=this.checkDatePattern(this.$route.query.to_date);break;default:this.form.from_date=this.getFormattedDate("month"),this.form.to_date=this.getFormattedDate("month",!1)}if("custom"!==this.form.period){var e={};delete(e=Object.assign(JSON.parse(JSON.stringify(this.$route.query)),{period:this.form.period})).from_date,delete e.to_date,this.$router.push({query:e}),this.filter()}else this.changePeriodToCustom()},changePeriodToCustom:function(){this.form.period="custom";var t;t=Object.assign(JSON.parse(JSON.stringify(this.$route.query)),{period:this.form.period,from_date:this.form.from_date,to_date:this.form.to_date}),this.$router.push({query:t}),t.from_date&&t.to_date&&this.filter()},getFormattedDate:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.$moment();return r&&(o=o.subtract(1,t)),(o=e?o.startOf(t):o.endOf(t)).format("YYYY-MM-DD")},filter:function(){this.$emit("filter")}}},n=o,l=r(88),component=Object(l.a)(n,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-3"},[r("corals-select",{attrs:{form:t.form,field:"period",options:t.periodOptions},on:{input:t.datePeriod}})],1),t._v(" "),r("div",{staticClass:"col-md-3"},[r("corals-datepicker",{attrs:{form:t.form,field:"from_date",max:this.form.to_date,label:"From Date"},on:{input:t.changePeriodToCustom}})],1),t._v(" "),r("div",{staticClass:"col-md-3"},[r("corals-datepicker",{attrs:{form:t.form,field:"to_date",min:this.form.from_date,label:"End Date"},on:{input:t.changePeriodToCustom}})],1),t._v(" "),t._t("custom-actions",(function(){return[r("div",{staticClass:"col-md-2",staticStyle:{"margin-top":"35px"}},[r("a",{staticClass:"btn btn-success btn-sm",on:{click:function(e){return e.preventDefault(),t.filter.apply(null,arguments)}}},[r("fa",{attrs:{icon:"search"}})],1)])]}))],2)}),[],!1,null,null,null);e.default=component.exports},298:function(t,e,r){"use strict";r.r(e);r(33),r(47),r(44),r(18),r(116);var o={name:"CoralsCheckboxes",props:{list:{required:!0},listLabelKey:{required:!1,default:"label"},listValueKey:{required:!1,default:"id"},form:{type:Object,required:!0},label:{type:[String,Boolean],default:"",required:!1},field:{type:String,required:!0},required:{type:Boolean,default:!1}},computed:{labelValue:function(){if(!1===this.label)return"";if(this.label)return this.label;var label=this.field.replace("_"," ");return label.charAt(0).toUpperCase()+label.slice(1)},idValue:function(){return this.$attrs.id?this.$attrs.id:this.field},fieldDescription:function(){return this.$attrs.description||""}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("b-form-group",{attrs:{"invalid-feedback":t.form.error(t.field),label:t.labelValue,"label-for":t.idValue,"label-class":t.required?"required-field":"",description:t.fieldDescription,state:t.form.state(t.field)}},[r("b-form-checkbox-group",t._b({attrs:{id:t.idValue},model:{value:t.form[t.field],callback:function(e){t.$set(t.form,t.field,e)},expression:"form[field]"}},"b-form-checkbox-group",t.$attrs,!1),t._l(t.list,(function(e){return r("b-form-checkbox",{key:t.field+"_"+e[t.listValueKey],attrs:{value:e[t.listValueKey]}},[t._v("\n "+t._s(e[t.listLabelKey])+"\n ")])})),1)],1)}),[],!1,null,"23ec1748",null);e.default=component.exports},719:function(t,e,r){"use strict";var o={name:"COverlay",props:{show:{default:!1,type:Boolean}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement;return(t._self._c||e)("b-overlay",{attrs:{show:t.show,rounded:"sm","spinner-variant":"primary",variant:"transparent",blur:"1px"}},[t._t("default")],2)}),[],!1,null,"5a577948",null);e.a=component.exports},720:function(t,e,r){var content=r(725);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(95).default)("7c8b2224",content,!0,{sourceMap:!1})},721:function(t,e,r){"use strict";var o={name:"PageHeader",props:{title:{required:!0}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("div",{staticClass:"border-bottom mb-3"},[r("h3",[t._v(t._s(t.title))])])]),t._v(" "),r("div",{staticClass:"col-md-6"},[t._t("default")],2)])}),[],!1,null,"0f95d94e",null);e.a=component.exports},722:function(t,e,r){"use strict";r(33),r(47),r(41),r(19),r(18),r(14),r(12),r(20),r(15),r(21);var o=r(2);r(39);function n(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(object);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,r)}return e}function l(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?n(Object(source),!0).forEach((function(e){Object(o.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):n(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var c={data:function(){var t=this;return{formModalId:"",deleteRecordId:null,editRecordId:null,cloneRecordId:null,showRecordId:null,listFilters:null,filterBy:[],defaultOptions:{hideCreate:!1,headings:{},columnsDropdown:!1,initialPage:1,perPageValues:[],perPage:25,debounce:1e3,filterByColumn:!0,responseAdapter:function(t){var data=t.data;return{data:data.data,count:data.meta.pagination.total}},requestAdapter:function(data){return t.$router.replace({query:l(l({},t.$route.query),{},{page:data.page})}).catch((function(){})),data.query=Object.assign(data.query,t.filterBy),data},sortIcon:{base:"ts-ico",up:"ts-up",down:"ts-down",is:"ts-sort"},sortable:[],filterable:[],customColumns:[],requestKeys:{query:"query",limit:"limit",orderBy:"orderBy",ascending:"ascending",page:"page",byColumn:"byColumn"},initFilters:{},templates:{},listColumns:{}},listTableRefs:"listTable"}},beforeMount:function(){var t=this.$route.query;this.defaultOptions.initialPage=t.page?parseInt(t.page):1},mounted:function(){this.formModalId="".concat(this.resourceURL,"Table")},computed:{deleteURL:function(){return this.deleteHref||this.resourceURL},editURL:function(){return this.editHref||this.resourceURL},cloneURL:function(){return this.cloneHref||this.resourceURL}},methods:{onSubmit:function(){var t=this;this.editRecordId?this.form.put("".concat(this.editURL,"/").concat(this.editRecordId)).then((function(e){t.handleFormHidden(),t.$emit("formUpdated",e.data)})):this.form.post("".concat(this.resourceURL)).then((function(e){t.handleFormHidden(),t.$emit("formStored",e.data)}))},tableOptions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this.defaultOptions;return Object.assign(e,t)},showDeleteModal:function(t,e){var r=this;this.deleteRecordId=t,this.$swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#d7d7d7",confirmButtonText:"Yes, delete it!"}).then((function(t){t.value&&r.doDeleteRecord()}))},doDeleteRecord:function(){var t=this;this.$axios.delete("".concat(this.deleteURL,"/").concat(this.deleteRecordId)).then((function(e){t.refresh(),e.data.message&&t.$toast.success(e.data.message)})).catch((function(e){var r=e.message;e.response&&e.response.data&&e.response.data.message&&(r=e.response.data.message),t.$toast.error(r)}))},refresh:function(){this.$refs[this.listTableRefs].refresh()},showFormModal:function(){this.$bvModal.show(this.formModalId)},handleFormHidden:function(){this.editRecordId=null,this.$bvModal.hide(this.formModalId),this.refresh()},handleShowHidden:function(){this.showRecordId=null},cloneRecord:function(t,e){var r=this;this.$axios.get("".concat(this.cloneURL,"/").concat(t,"?edit=1")).then((function(o){var n=o.data;r.cloneRecordId=t,r.form.cloneReplace(n.data,e),r.showFormModal()})).catch((function(t){r.$toast.error(t.message)}))},editRecord:function(t){var e=this;this.$axios.get("".concat(this.editURL,"/").concat(t,"?edit=1")).then((function(r){var o=r.data;e.editRecordId=t,e.form.replace(o.data),e.showFormModal()})).catch((function(t){e.$toast.error(t.message)}))},replace:function(data,object){for(var t in data)object[t]=data[t];return object},showRecord:function(t){this.showRecordId=t}}},d=c,m=r(723),f=r(719),v=r(293),_=r.n(v),h={mixins:[d],components:{COverlay:f.a,PageSection:m.a},inject:{handleBulkAction:{default:[]}},props:{columns:{required:!0},bulkActionOptions:{required:!1,default:function(){return[]}},resourceURL:{required:!0},deleteHref:{required:!1},editHref:{required:!1},cloneHref:{required:!1},cloneAttr:{required:!1},options:{required:!0},form:{required:!1},formSize:{required:!1,default:""},labels:{required:!0},rowColumns:{required:!1,default:"col-md-12"},nameClickable:{required:!1},compact:{required:!1},onDataLoaded:{required:!1,default:function(){return function(){}}}},name:"CrudIndex",data:function(){return{selectedIds:[]}},beforeMount:function(){this.$eventBus.$on("setSelectedIds",this.setSelectedIds)},methods:{setSelectedIds:function(t){this.selectedIds=t},onModalShow:function(){this.editRecordId||this.cloneRecordId||(this.form.replace(this.form.originalData),this.editRecordId=null,this.cloneRecordId=null,this.form.errors.purge())},onModalHidden:function(){this.form.replace(this.form.originalData),this.editRecordId=null,this.cloneRecordId=null,this.form.errors.purge(),this.$emit("edit-form-closed")},getTableData:function(){var table=this.$refs[this.listTableRefs];return _.a.get(table,"data")},selectAll:function(t){var data=this.getTableData();this.selectedIds=t?data.map((function(t){return t.id})):[],this.$refs.checkbox_header__table.checked=t}},computed:{modalTitle:function(){return(this.editRecordId?"Update ":this.cloneRecordId?"Clone ":"Create ")+this.labels.singularTitle}},watch:{selectedIds:function(t){this.$refs.checkbox_header__table.checked=this.getTableData().length===_.a.uniq(t).length}},beforeDestroy:function(){}},y=(r(724),r(88)),component=Object(y.a)(h,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"crud-index"},[r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-4"},[r("PageSection",{attrs:{title:t.labels.title}})],1),t._v(" "),r("div",{staticClass:"col-md-8 text-right"},[t.bulkActionOptions.length?r("b-dropdown",{staticClass:"m-2",attrs:{id:"dropdown-left",text:"Actions",variant:"primary",size:"sm"}},[t._l(t.bulkActionOptions,(function(e){return[r("b-dropdown-item",{staticStyle:{"text-transform":"capitalize"},attrs:{href:"#"},on:{click:function(r){return r.preventDefault(),t.handleBulkAction(e,t.selectedIds)}}},[t._v("\n "+t._s(e)+"\n ")])]}))],2):t._e(),t._v(" "),t._t("extraButtons"),t._v(" "),t.options.hideCreate?t._e():r("b-button",{attrs:{variant:"primary",size:"sm",type:"button"},on:{click:function(e){return e.preventDefault(),t.showFormModal.apply(null,arguments)}}},[r("fa",{attrs:{icon:"plus"}}),t._v("\n Create\n ")],1),t._v(" "),r("b-button",{attrs:{variant:"warning",size:"sm",type:"button"},on:{click:function(e){return e.preventDefault(),t.refresh.apply(null,arguments)}}},[r("fa",{attrs:{icon:"redo"}})],1)],2)]),t._v(" "),r("div",{staticClass:"row mt-3"},[r("div",{class:t.rowColumns},[r("v-server-table",{ref:"listTable",attrs:{columns:t.columns,url:t.resourceURL,options:t.tableOptions(t.options)},on:{loaded:t.onDataLoaded},scopedSlots:t._u([{key:"checkbox",fn:function(e){return t.$isAdmin()&&t.bulkActionOptions.length?r("div",{staticClass:"text-center"},[r("b-form-checkbox",{key:e.row.id+"__checkbox_record",attrs:{value:e.row.id},model:{value:t.selectedIds,callback:function(e){t.selectedIds=e},expression:"selectedIds"}})],1):t._e()}},t._l(t.options.customColumns,(function(e){return{key:e,fn:function(r){return[t._t(e,null,{object:r})]}}})),{key:"actions",fn:function(e){return r("div",{},[e.row.edit&&Object.keys(e.row.edit).length?r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:"Edit"},on:{click:function(r){return r.preventDefault(),t.editRecord(e.row.id)}}},[r("fa",{attrs:{icon:"edit"}})],1):t._e(),t._v(" "),e.row.delete&&Object.keys(e.row.delete).length?r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],staticClass:"text-danger",attrs:{title:"Delete"},on:{click:function(r){return r.preventDefault(),t.showDeleteModal(e.row.id,e.index)}}},[r("fa",{attrs:{icon:"trash"}})],1):t._e(),t._v(" "),e.row.clone&&Object.keys(e.row.clone).length?r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],staticClass:"text-warning",attrs:{title:"Clone"},on:{click:function(r){return r.preventDefault(),t.cloneRecord(e.row.id,t.cloneAttr)}}},[r("fa",{attrs:{icon:"clone"}})],1):t._e(),t._v(" "),t._t("extra-actions",null,{object:e.row})],2)}}],null,!0)},[r("div",{staticClass:"text-center",attrs:{slot:"h__checkbox"},slot:"h__checkbox"},[t.$isAdmin()&&t.bulkActionOptions.length?r("div",{staticClass:"custom-control custom-checkbox"},[r("input",{key:"checkbox_header__table",ref:"checkbox_header__table",staticClass:"custom-control-input",attrs:{type:"checkbox","true-value":1,"false-value":0,id:"checkbox_header__table"},on:{change:function(e){return t.selectAll(e.target.checked)}}}),t._v(" "),r("label",{staticClass:"custom-control-label",attrs:{for:"checkbox_header__table"}})]):t._e()])])],1)]),t._v(" "),r("b-modal",{attrs:{"hide-footer":"",size:t.formSize,"content-class":"shadow",title:t.modalTitle,"no-close-on-backdrop":"",id:t.formModalId},on:{hidden:t.onModalHidden,show:t.onModalShow}},[t.form?r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12"},[r("c-overlay",{attrs:{show:!t.form.isReady}},[r("form",{on:{submit:function(e){return e.preventDefault(),t.onSubmit()}}},[t._t("default",null,{form:t.form}),t._v(" "),r("div",{staticClass:"text-right"},[r("button",{staticClass:"btn btn-sm btn-primary",attrs:{type:"submit",disabled:!t.form.isReady}},[t._v("\n "+t._s(t.modalTitle)+"\n ")]),t._v(" "),r("button",{staticClass:"btn btn-sm btn-secondary",attrs:{disabled:!t.form.isReady},on:{click:function(e){return e.preventDefault(),t.$bvModal.hide(t.formModalId)}}},[t._v("Close\n ")])])],2)])],1)]):t._e()])],1)}),[],!1,null,null,null);e.a=component.exports},723:function(t,e,r){"use strict";var o={name:"PageSection",props:{title:{required:!0}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12"},[r("div",{staticClass:"border-bottom mb-3"},[r("h4",[t._v(t._s(t.title))]),t._v(" "),t._t("default")],2)])])}),[],!1,null,"019ca8fe",null);e.a=component.exports},724:function(t,e,r){"use strict";r(720)},725:function(t,e,r){var o=r(94)(!1);o.push([t.i,".form-modal-header{padding:0!important}",""]),t.exports=o},726:function(t,e,r){"use strict";var o=r(55);r(53);e.a={methods:{yesNoOptions:function(){return[{id:!1,text:"No"},{id:!0,text:"Yes"}]},objectAsQueryString:function(t){var p,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=[];for(p in t)if(t.hasOwnProperty(p)){var n=e?e+"["+p+"]":p,l=t[p];r.push(null!==l&&"object"===Object(o.a)(l)?this.objectAsQueryString(l,n):encodeURIComponent(n)+"="+encodeURIComponent(l))}return r.join("&")}}}},728:function(t,e,r){"use strict";var o={name:"BaseReportTable",components:{},props:{title:{required:!0},data:{required:!0},form:{required:!0}},methods:{getRowClass:function(t,e){return"header"===e?"bg-secondary text-white":"footer"===e?"bg-info text-white":void 0}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("h6",[t._v(t._s(t.title))]),t._v(" "),t.data?r("div",{staticClass:"table-responsive"},[r("table",{staticClass:"table table-striped table-condensed"},t._l(t.data,(function(e,o){return r("tr",{key:o,class:t.getRowClass(e,o)},["no_data"===o?[r("td",{staticClass:"text-center",attrs:{colspan:Object.keys(t.data.header).length}},[t._v("\n No Data Found\n ")])]:t._e(),t._v(" "),t._l(e,(function(e,o){return["nav_to"===e.code?r("td",[r("nuxt-link",{attrs:{to:e.attr.route+"?period="+t.form.period+(t.form.client_name?"&client="+t.form.client_name:"")+(t.form.project_name?"&project="+t.form.project_name:"")}},[t._v("\n "+t._s(e.attr.label)+"\n ")])],1):r("td",[t._v("\n "+t._s(e)+"\n ")])]}))],2)})),0)]):r("b-skeleton-table",{attrs:{rows:4,columns:4,"table-props":{bordered:!0,striped:!0}}})],1)}),[],!1,null,null,null);e.a=component.exports},731:function(t,e,r){"use strict";var o=r(62),n=(r(136),r(12),r(97),r(96),r(101),r(419),r(19),{name:"EntriesHoursLineChart",components:{LineChart:r(732).a},props:{model:{required:!0,type:String},params:{required:!1},from_date:{required:!0},to_date:{required:!0}},fetch:function(){var t=this;return Object(o.a)(regeneratorRuntime.mark((function e(){var r,o,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="timesheet/charts/".concat(t.model,"/get-charts-data"),o=[],n="",t.from_date&&(n="from_date=".concat(t.from_date)),t.to_date&&(t.from_date&&(n+="&"),n+="to_date=".concat(t.to_date)),t.params&&((t.from_date||t.to_date)&&(n+="&"),n+=new URLSearchParams(t.params).toString()),o.push(n),r+="?".concat(o),e.next=10,t.$axios.post(r).then((function(e){var r=e.data;t.lineChartData=r.data}));case 10:case"end":return e.stop()}}),e)})))()},data:function(){return{lineChartData:{},lineChartOptions:{scales:{yAxes:[{ticks:{beginAtZero:!0}}]}}}},computed:{chartDataReady:function(){return this.lineChartData&&Object.keys(this.lineChartData).length}}}),l=r(88),component=Object(l.a)(n,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[t.chartDataReady?r("div",{staticClass:"entries-line-chart"},[r("label",[t._v("Evaluation: "+t._s(t.lineChartData.evaluation_percentage))]),t._v(" "),r("line-chart",{attrs:{lineChartData:t.lineChartData,lineChartOptions:t.lineChartOptions}})],1):r("div",[r("b-skeleton-img",{attrs:{height:"370px"}})],1)])}),[],!1,null,"61d06f71",null);e.a=component.exports},732:function(t,e,r){"use strict";var o={name:"LineChart",extends:r(734).a,props:["lineChartData","lineChartOptions"],mounted:function(){this.renderChart(this.lineChartData,this.lineChartOptions)}},n=r(88),component=Object(n.a)(o,undefined,undefined,!1,null,null,null);e.a=component.exports},733:function(t,e,r){var content=r(739);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(95).default)("8a92a63a",content,!0,{sourceMap:!1})},736:function(t,e,r){"use strict";var o={name:"ActivitiesReport",components:{BaseReportTable:r(728).a},props:{form:{required:!0},url:{required:!0}},data:function(){return{billable_activities_for_client_report:null,non_billable_activities_for_client_report:null}},mounted:function(){this.getActivitiesDataForReport()},methods:{getActivitiesDataForReport:function(){var t=this,e=this.url;this.form.post(e).then((function(e){var r=e.data;t.billable_activities_for_client_report=r.data.billable_activities,t.non_billable_activities_for_client_report=r.data.non_billable_activities}))}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Billable Per Activity",data:t.billable_activities_for_client_report,form:t.form}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Non Billable Per Activity",data:t.non_billable_activities_for_client_report,form:t.form}})],1)])}),[],!1,null,null,null);e.a=component.exports},738:function(t,e,r){"use strict";r(733)},739:function(t,e,r){var o=r(94)(!1);o.push([t.i,"[data-v-74f6eee8] .vue__time-picker input.display-time{width:100%;border:1px solid #ced4da;height:calc(1.5em + .75rem + 2px);padding:.375rem .75rem;font-size:1rem;line-height:1.5}",""]),t.exports=o},742:function(t,e,r){"use strict";var o=r(2),n=(r(12),r(14),r(15),r(745)),l=r.n(n),c=(r(746),r(292)),d=r(293),m={name:"EntryFields",components:{CoralsTextarea:c.default,VueTimepicker:l.a},props:{form:{required:!0},fullCrud:{required:!1,default:!0}},mounted:function(){this.originalTags=Object(o.a)({},this.form.project_id,this.form.tags),this.loadProjectRelatedFormData(this.form.project_id),this.loadProjectTags(),this.timePicker={HH:"".concat(Object(d.padStart)(this.form.hours||0,2,0)),mm:"".concat(Object(d.padStart)(this.form.minutes||0,2,0))},(this.form.evaluation_hours||this.form.evaluation_minutes)&&(this.evaluationTimePicker={HH:"".concat(Object(d.padStart)(this.form.evaluation_hours||0,2,0)),mm:"".concat(Object(d.padStart)(this.form.evaluation_minutes||0,2,0))})},data:function(){return{active_options:1,activities:[],users:[],projectTagOptions:[],originalTags:[],timePicker:{},evaluationTimePicker:{},timeValidation:""}},methods:{loadProjectRelatedFormData:function(t){var e=this;if(!t)return this.activities=[],this.users=[],void(this.timePicker={});this.form.isReady=!1;var r="timesheet/entries/get-form-data?project_id=".concat(t);this.$axios.get(r).then((function(t){var r=t.data;e.activities=r.data.activities,e.users=r.data.users})).finally((function(){e.form.isReady=!0}))},getActivitiesOrProjectsOptions:function(t){var e=[],r=[],o=[];return this.active_options?(o=t.filter((function(object){return(1===object.is_active||"active"===object.status)&&!0!==object.group})),r=t.filter((function(t){return!0===t.group&&"active"===t.status}))):(o=t.filter((function(object){return!0!==object.group})),r=t.filter((function(t){return!0===t.group}))),r.forEach((function(t){t.is_group_empty=!0,e.push(t),o.filter((function(r){t.code===r.group&&(t.is_group_empty=!1,e.push(r))}))})),e},loadProjectTags:function(){var t=this;if(this.projectTagOptions=[],this.form.tags=[],!this.form.project_id)return[];var e="timesheet/projects/entries/".concat(this.form.project_id,"/get-project-labels");this.$axios.get(e).then((function(e){var r=e.data;t.originalTags.hasOwnProperty(t.form.project_id)&&(t.form.tags=t.originalTags[t.form.project_id]),t.projectTagOptions=r.data}))},TimeValueInput:function(data){this.form.minutes=data.mm,this.form.hours=data.HH},EvaluationTimeValueInput:function(data){this.form.evaluation_minutes=data.mm,this.form.evaluation_hours=data.HH}},watch:{"form.project_id":function(){this.loadProjectTags()},"form.isReady":function(t){if(t){for(var e="",r=0,o=["hours","minutes","evaluation_hours","evaluation_minutes"];r<o.length;r++){var n=o[r];this.form.errors.has(n)&&(e+=this.form.errors.get(n)+"<br/>")}this.timeValidation=e}else this.timeValidation=""}},computed:{getTimeError:function(){return this.timeValidation},getProjectOptions:function(){return this.getActivitiesOrProjectsOptions(this.form.getFormData("projects"))},getActivitiesOptions:function(){return this.getActivitiesOrProjectsOptions(this.activities)},getUsersOptions:function(){return this.active_options?this.users.filter((function(t){return"active"===t.status})):this.users},evaluationEnabled:function(){return this.$store.getters.settings("evaluation_enabled")},isMultipleEntries:function(){return this.form.multiple_entries&&this.fullCrud}}},f=(r(738),r(88)),component=Object(f.a)(m,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[this.form.id?t._e():r("div",{directives:[{name:"is-admin",rawName:"v-is-admin"}]},[r("div",{staticClass:"custom-control custom-checkbox mb-2"},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.active_options,expression:"active_options"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"active_options"},domProps:{checked:Array.isArray(t.active_options)?t._i(t.active_options,null)>-1:t.active_options},on:{change:function(e){var r=t.active_options,o=e.target,n=!!o.checked;if(Array.isArray(r)){var l=t._i(r,null);o.checked?l<0&&(t.active_options=r.concat([null])):l>-1&&(t.active_options=r.slice(0,l).concat(r.slice(l+1)))}else t.active_options=n}}}),t._v(" "),t._m(0)])]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{form:t.form,required:"",label:"Project",field:"project_id",options:t.getProjectOptions},on:{input:function(e){return t.loadProjectRelatedFormData(t.form.project_id)}}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{form:t.form,required:"",label:"Activity",field:"activity_id",options:t.getActivitiesOptions}})],1)]),t._v(" "),t.isMultipleEntries?r("div",{staticClass:"row"},[this.form.all_member_users?t._e():r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{form:t.form,field:"user_id",label:"Users",multiple:!0,options:t.getUsersOptions,required:""}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-checkbox",{attrs:{field:"all_member_users",label:"All active full time members",form:t.form,"with-space":""}})],1)]):r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[t.fullCrud?r("corals-select",{attrs:{form:t.form,label:"User",field:"user_id",options:t.getUsersOptions,required:""}}):t._e()],1),t._v(" "),r("div",{staticClass:"col-md-6"},[t.fullCrud?r("corals-datepicker",{attrs:{form:t.form,required:"",field:"spent_at",label:"Spent at"}}):t._e()],1)]),t._v(" "),t.isMultipleEntries?r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-datepicker",{attrs:{form:t.form,max:t.form.spent_to,required:"",field:"spent_from",label:"Spent From"}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-datepicker",{attrs:{form:t.form,min:t.form.spent_from,required:"",field:"spent_to",label:"Spent to"}})],1)]):t._e(),t._v(" "),r("div",{staticClass:"row d-block d-md-none"},[r("div",{staticClass:"col-12"},[r("corals-textarea",{attrs:{field:"description",rows:"2",required:"",form:t.form}}),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-6"},[r("div",{staticClass:"form-group"},[r("vue-timepicker",{staticClass:"d-block",attrs:{"input-class":"form-control","hour-label":"Hours","minute-label":"Minutes",format:"HH:mm","minute-interval":5,"advanced-keyboard":"","manual-input":"","drop-direction":"auto","close-on-complete":"",placeholder:"HH:MM"},on:{input:t.TimeValueInput},model:{value:t.timePicker,callback:function(e){t.timePicker=e},expression:"timePicker"}})],1)]),t._v(" "),t.fullCrud&&t.evaluationEnabled?r("div",{staticClass:"col-6"},[r("div",{staticClass:"form-group"},[r("vue-timepicker",{staticClass:"d-block",attrs:{"input-class":"form-control","hour-label":"Hours","minute-label":"Minutes",format:"HH:mm","minute-interval":5,"advanced-keyboard":"","manual-input":"","drop-direction":"auto","close-on-complete":"",placeholder:"HH:MM"},on:{input:t.EvaluationTimeValueInput},model:{value:t.evaluationTimePicker,callback:function(e){t.evaluationTimePicker=e},expression:"evaluationTimePicker"}}),t._v(" "),r("small",{staticClass:"text-muted"},[t._v("Evaluation Time")])],1)]):t._e()]),t._v(" "),t.getTimeError.length?r("div",{staticClass:"d-block invalid-feedback",domProps:{innerHTML:t._s(t.getTimeError)}}):t._e()],1)]),t._v(" "),r("div",{staticClass:"sm-gutters d-none d-md-flex"},[r("div",{staticClass:"col-9"},[r("corals-textarea",{attrs:{field:"description",rows:"4",required:"",form:t.form}}),t._v(" "),t.getTimeError.length?r("div",{staticClass:"d-block invalid-feedback",domProps:{innerHTML:t._s(t.getTimeError)}}):t._e()],1),t._v(" "),r("div",{staticClass:"col-3"},[r("div",{staticClass:"form-group"},[r("label",{staticClass:"d-block"},[t._v(" ")]),t._v(" "),r("vue-timepicker",{staticClass:"d-block",attrs:{"input-class":"form-control","hour-label":"Hours","minute-label":"Minutes",format:"HH:mm","minute-interval":5,"advanced-keyboard":"","manual-input":"","drop-direction":"auto","close-on-complete":"",placeholder:"HH:MM"},on:{input:t.TimeValueInput},model:{value:t.timePicker,callback:function(e){t.timePicker=e},expression:"timePicker"}})],1),t._v(" "),t.fullCrud&&t.evaluationEnabled?r("div",{staticClass:"form-group"},[r("vue-timepicker",{staticClass:"d-block",attrs:{"input-class":"form-control","hour-label":"Hours","minute-label":"Minutes",format:"HH:mm","minute-interval":5,"advanced-keyboard":"","manual-input":"","drop-direction":"auto","close-on-complete":"",placeholder:"HH:MM"},on:{input:t.EvaluationTimeValueInput},model:{value:t.evaluationTimePicker,callback:function(e){t.evaluationTimePicker=e},expression:"evaluationTimePicker"}}),t._v(" "),r("small",{staticClass:"text-muted"},[t._v("Evaluation Time")])],1):r("div",[r("div",{staticClass:"text-center"},[r("fa",{staticClass:"text-success",attrs:{icon:["far","clock"],size:"3x"}})],1)])])]),t._v(" "),r("transition",{attrs:{name:"fade"}},[Object.keys(t.projectTagOptions).length?r("corals-select",{attrs:{form:t.form,field:"tags",label:"Labels",multiple:!0,options:t.projectTagOptions}}):t._e()],1),t._v(" "),t.fullCrud&&!t.isMultipleEntries&&t.evaluationEnabled?r("div",{staticClass:"row"},[r("div",{staticClass:"col-6"},[r("corals-checkbox",{attrs:{field:"has_reviewed",form:t.form}})],1)]):t._e(),t._v(" "),t.fullCrud&&!t.form.id?r("div",{staticClass:"row"},[r("div",{staticClass:"col-6"},[r("corals-checkbox",{attrs:{field:"multiple_entries",form:t.form}})],1)]):t._e()],1)}),[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("label",{staticClass:"custom-control-label",attrs:{for:"active_options"}},[r("small",[t._v("Show Active Options")])])}],!1,null,"74f6eee8",null);e.a=component.exports},743:function(t,e,r){"use strict";var o={name:"ProjectsReport",components:{BaseReportTable:r(728).a},props:{form:{required:!0},url:{required:!0}},data:function(){return{billable_projects_report:null,non_billable_projects_report:null}},mounted:function(){this.getActivitiesDataForReport()},methods:{getActivitiesDataForReport:function(){var t=this,e=this.url;this.form.post(e).then((function(e){var r=e.data;t.billable_projects_report=r.data.billable_projects_report,t.non_billable_projects_report=r.data.non_billable_projects_report}))}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Billable Activities Per Project",data:t.billable_projects_report,form:t.form}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Non Billable Activities Per Project",data:t.non_billable_projects_report,form:t.form}})],1)])}),[],!1,null,null,null);e.a=component.exports},750:function(t,e,r){"use strict";var o={name:"UsersReport",components:{BaseReportTable:r(728).a},props:{form:{required:!0},url:{required:!0}},data:function(){return{billable_users_report:null,non_billable_users_report:null}},mounted:function(){this.getActivitiesDataForReport()},methods:{getActivitiesDataForReport:function(){var t=this,e=this.url;this.form.post(e).then((function(e){var r=e.data;t.billable_users_report=r.data.billable_users_report,t.non_billable_users_report=r.data.non_billable_users_report}))}}},n=r(88),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Billable Activities Per User",data:t.billable_users_report,form:t.form}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("BaseReportTable",{attrs:{title:"Non Billable Activities Per User",data:t.non_billable_users_report,form:t.form}})],1)])}),[],!1,null,null,null);e.a=component.exports},751:function(t,e,r){"use strict";var o=r(30),n=r(161).findIndex,l=r(162),c="findIndex",d=!0;c in[]&&Array(1).findIndex((function(){d=!1})),o({target:"Array",proto:!0,forced:d},{findIndex:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),l(c)},752:function(t,e,r){var content=r(766);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(95).default)("7802c4da",content,!0,{sourceMap:!1})},753:function(t,e,r){var content=r(768);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(95).default)("49a1683b",content,!0,{sourceMap:!1})},754:function(t,e,r){var content=r(771);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(95).default)("4e91244c",content,!0,{sourceMap:!1})},765:function(t,e,r){"use strict";r(752)},766:function(t,e,r){var o=r(94)(!1);o.push([t.i,"[data-v-6d9a1486] .min-h-400{min-height:400px}",""]),t.exports=o},767:function(t,e,r){"use strict";r(753)},768:function(t,e,r){var o=r(94)(!1);o.push([t.i,".totals-table[data-v-8e75f894]{margin-bottom:0}.totals-table td[data-v-8e75f894],.totals-table tr[data-v-8e75f894]{background-color:unset!important;padding:2px}.clear-item-btn[data-v-8e75f894]{position:absolute;top:0;right:5px}#invoice-items .form-group[data-v-8e75f894]{margin-bottom:.5rem}#invoice-items[data-v-8e75f894] label{margin-bottom:.25rem}",""]),t.exports=o},770:function(t,e,r){"use strict";r(754)},771:function(t,e,r){var o=r(94)(!1);o.push([t.i,".card-overflow[data-v-db996d8c]{overflow-x:visible!important;overflow-y:visible!important}",""]),t.exports=o},796:function(t,e,r){"use strict";r.r(e);var o=r(55),n=r(62),l=(r(54),r(751),r(44),r(33),r(47),r(136),r(721)),c=r(722),d=(r(238),r(12),r(14),r(41),r(72),r(39),r(726)),m=r(298),f={name:"ProjectTypes",components:{},props:{form:{required:!0}},data:function(){return{budgetOptions:{project_hours:"Project Hours",project_fees:"Project fees",no_budget:"No budget"},billByOptions:{project_billable_rate:"Project billable rate",person_billable_rate:"Person billable rate",activity_billable_rate:"Activity billable rate"}}}},v=r(88),_=Object(v.a)(f,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("b-tab",{scopedSlots:t._u([{key:"title",fn:function(){return[r("h5",[t._v("Time & Materials")]),t._v(" "),r("small",[t._v("Bill by the hour, with billable rates")])]},proxy:!0}])},[t._v(" "),"time_and_materials"===t.form.type?[r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12 pb-2"},[r("label",{staticClass:"mb-0 required-field",attrs:{id:"bill_by"}},[t._v("Billable rates")]),t._v(" "),r("small",{staticClass:"text-muted d-block"},[t._v("We need billable rates to track your project's billable amount")])])]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{label:!1,"aria-labelledby":"bill_by",form:t.form,field:"bill_by",options:t.billByOptions}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},["project_billable_rate"===t.form.bill_by?r("corals-input",{attrs:{label:!1,form:t.form,type:"number",field:"hourly_rate",placeholder:"Billable Rate",step:"0.01"}}):r("div",{staticClass:"text-info"},["person_billable_rate"===t.form.bill_by?r("small",[t._v("\n You can set your rates in "),r("b",[t._v("Users")]),t._v(" Tab\n ")]):t._e(),t._v(" "),"activity_billable_rate"===t.form.bill_by?r("small",[t._v("\n You can set your rates in "),r("b",[t._v("Activities")]),t._v(" Tab\n ")]):t._e()])],1)]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12 pb-2"},[r("label",{staticClass:"mb-0",attrs:{id:"budget_time_and_materials"}},[t._v("Budget")]),t._v(" "),r("small",{staticClass:"text-muted d-block"},[t._v("Set a budget to track project progress")])])]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{label:!1,"aria-labelledby":"budget_time_and_materials",form:t.form,field:"budget_by",options:t.budgetOptions}})],1),t._v(" "),"no_budget"!==t.form.budget_by?r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{label:!1,"aria-labelledby":"budget_non_billable",form:t.form,type:"number",field:"budget",placeholder:"Budget",step:"0.01"}})],1):t._e()]),t._v(" "),"no_budget"!==t.form.budget_by?r("div",[r("corals-checkbox",{attrs:{field:"reset_budget_each_month",label:"Budget resets every month",form:t.form}}),t._v(" "),r("corals-checkbox",{attrs:{field:"send_email_on_exceed_limit",label:"Send email alerts if project exceeds percentage of budget",form:t.form}})],1):t._e(),t._v(" "),t.form.send_email_on_exceed_limit&&"no_budget"!==t.form.budget_by?r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{form:t.form,type:"number",label:"Percentage Of Budget",field:"budget_alert_limit",step:"0.01",required:""}})],1)]):t._e()]:t._e()],2),t._v(" "),r("b-tab",{scopedSlots:t._u([{key:"title",fn:function(){return[r("h5",[t._v("Fixed Fee")]),t._v(" "),r("small",[t._v("Bill a set price, regardless of time tracked")])]},proxy:!0}])},[t._v(" "),"fixed_fee"===t.form.type?[r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12 pb-2"},[r("label",{staticClass:"mb-0 required-field",attrs:{id:"bill_by"}},[t._v("Billable rates")]),t._v(" "),r("small",{staticClass:"text-muted d-block"},[t._v("We need billable rates to track your project's billable amount")])])]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{label:!1,"aria-labelledby":"bill_by",form:t.form,field:"bill_by",options:t.billByOptions}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},["project_billable_rate"===t.form.bill_by?r("corals-input",{attrs:{label:!1,form:t.form,type:"number",field:"hourly_rate",placeholder:"Billable Rate",step:"0.01"}}):r("div",{staticClass:"text-info"},["person_billable_rate"===t.form.bill_by?r("small",[t._v("\n You can set your rates in "),r("b",[t._v("Users")]),t._v(" Tab\n ")]):t._e(),t._v(" "),"activity_billable_rate"===t.form.bill_by?r("small",[t._v("\n You can set your rates in "),r("b",[t._v("Activities")]),t._v(" Tab\n ")]):t._e()])],1)]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{form:t.form,placeholder:"Fee",type:"number",field:"fee",step:"0.01",required:""}})],1)]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12 pb-2"},[r("label",{staticClass:"mb-0",attrs:{id:"budget_fixed_fee"}},[t._v("Budget")]),t._v(" "),r("small",{staticClass:"text-muted d-block"},[t._v("Set a budget to track project progress")])])]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{label:!1,"aria-labelledby":"budget_fixed_fee",form:t.form,field:"budget_by",options:t.budgetOptions}})],1),t._v(" "),"no_budget"!==t.form.budget_by?r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{label:!1,"aria-labelledby":"budget_non_billable",form:t.form,type:"number",field:"budget",placeholder:"Budget",step:"0.01"}})],1):t._e()]),t._v(" "),"no_budget"!==t.form.budget_by?r("div",[r("corals-checkbox",{attrs:{field:"reset_budget_each_month",label:"Budget resets every month",form:t.form}}),t._v(" "),r("corals-checkbox",{attrs:{field:"send_email_on_exceed_limit",label:"Send email alerts if project exceeds percentage of budget",form:t.form}})],1):t._e(),t._v(" "),t.form.send_email_on_exceed_limit&&"no_budget"!==t.form.budget_by?r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{form:t.form,type:"number",label:"Percentage Of Budget",field:"budget_alert_limit",step:"0.01",required:""}})],1)]):t._e()]:t._e()],2),t._v(" "),r("b-tab",{scopedSlots:t._u([{key:"title",fn:function(){return[r("h5",[t._v("Non-Billable")]),t._v(" "),r("small",[t._v("Not billed to a client")])]},proxy:!0}])},[t._v(" "),"non_billable"===t.form.type?[r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12 pb-2"},[r("label",{staticClass:"mb-0",attrs:{id:"budget_non_billable"}},[t._v("Budget")]),r("br"),t._v(" "),r("small",{staticClass:"text-muted"},[t._v("Set a budget to track project progress")])])]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{label:!1,"aria-labelledby":"budget_non_billable",form:t.form,field:"budget_by",options:t.budgetOptions}})],1),t._v(" "),"no_budget"!==t.form.budget_by?r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{label:!1,"aria-labelledby":"budget_non_billable",form:t.form,type:"number",field:"budget",placeholder:"Budget",step:"0.01"}})],1):t._e()]),t._v(" "),"no_budget"!==t.form.budget_by?r("div",[r("corals-checkbox",{attrs:{field:"reset_budget_each_month",label:"Budget resets every month",form:t.form}}),t._v(" "),r("corals-checkbox",{attrs:{field:"send_email_on_exceed_limit",label:"Send email alerts if project exceeds percentage of budget",form:t.form}})],1):t._e(),t._v(" "),t.form.send_email_on_exceed_limit&&"no_budget"!==t.form.budget_by?r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{form:t.form,type:"number",label:"Percentage Of Budget",field:"budget_alert_limit",step:"0.01",required:""}})],1)]):t._e()]:t._e()],2)],1)}),[],!1,null,"2e219594",null).exports,h={name:"ClientsProjectIndex",components:{CoralsCheckboxes:m.default,CrudIndex:c.a,ProjectTypes:_},mixins:[d.a],props:{client:{required:!0}},data:function(){var t=this;return{project_types:["time_and_materials","fixed_fee","non_billable"],currentTabIndex:0,labelTextFieldErrorMessage:"",labelTextField:"",dontShowLabelFieldError:null,labels:{title:"Projects",singularTitle:"Project"},columns:["name","hourly_rate","budget","project_type_as_label","budget_by_as_label","assignable","taxable","status","actions"],options:{listColumns:{taxable:this.yesNoOptions(),assignable:this.yesNoOptions(),status:[]},initFilters:{status:"active"},sortable:["name"],filterable:["name","taxable","assignable","status"],customColumns:["name","taxable","assignable","status"],hideCreate:this.$cant("create","project"),headings:{budget_by_as_label:"Budget By",project_type_as_label:"Type"}},form:this.$form({name:"",description:"",budget:"",hourly_rate:"",assignable:0,taxable:0,status:"active",bill_cycle:"",bill_cycle_starts_at:"",currency:"usd",start_date:"",fee:"",type:"time_and_materials",budget_by:"",bill_by:"",send_email_on_exceed_limit:0,reset_budget_each_month:0,budget_alert_limit:"",user_rates:[],activity_rates:[],labels:[],integration_id:""},{fetchFormDataURL:"/timesheet/clientProjects/get-form-data",loadFormDataCallBack:function(){t.options.listColumns.status=t.getOptions(t.form.formData.status_options)}}),billCycleOptions:{daily:"Daily",weekly:"Weekly",biweekly:"Biweekly",monthly:"Monthly"},weekDaysOptions:{0:"Sunday",1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday"}}},methods:{getActivityHourlyRate:function(t,e){var r=this.form.activity_rates.find((function(e){return e.activity_id===t})),o=e.find((function(e){return e.id===t}));return r?r.activity_rate:null!==o.hourly_rate?o.hourly_rate:void 0},activityChecked:function(t){return!!this.form.activity_rates.find((function(e){return e.activity_id===t}))},setProjectActivityRateCheckbox:function(t,e,r){r?this.form.activity_rates.push({activity_id:e,activity_rate:t}):this.form.activity_rates=this.form.activity_rates.filter((function(t){return t.activity_id!==e}))},setProjectActivityRate:function(t,e){var r=this.form.activity_rates.find((function(t){return t.activity_id===e}));r&&r&&(r.activity_rate=t)},userChecked:function(t){return!!this.form.user_rates.find((function(e){return e.user_id===t}))},getUserHourlyRate:function(t,e){var r=this.form.user_rates.find((function(e){return e.user_id===t})),o=e.find((function(e){return e.id===t}));return r?r.user_rate:null!==o.hourly_rate?o.hourly_rate:void 0},setProjectUserRateCheckbox:function(t,e,r){r?this.form.user_rates.push({user_id:e,user_rate:t}):this.form.user_rates=this.form.user_rates.filter((function(t){return t.user_id!==e}))},setProjectUserRate:function(t,e){var r=this.form.user_rates.find((function(t){return t.user_id===e}));r&&r&&(r.user_rate=t)},getOptions:function(t){var e=[];return e.push({id:"",text:"All"}),t.map((function(t){var r,label=t.label.split(",");e.push({id:null!==(r=t.id)&&void 0!==r?r:t.value,text:label[0]})})),e},removeLabel:function(label){var t=this;this.$swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#d7d7d7",confirmButtonText:"Yes, delete it!"}).then((function(e){e.value&&(t.form.labels=t.form.labels.filter((function(t){return t.name!=label.name})))}))},pushLabelToProjectLabels:function(){if(this.dontShowLabelFieldError=!0,!this.labelTextField||!this.labelTextField.length)return this.dontShowLabelFieldError=!1,this.labelTextFieldErrorMessage="The label shouldn't be empty",void this.$toast.error(this.labelTextFieldErrorMessage);this.form.labels.push({name:this.labelTextField,status:"active",id:null}),this.labelTextField="",this.dontShowLabelFieldError=null,this.labelTextFieldErrorMessage=""},generateInvoice:function(t){var e=this;this.$axios.post("".concat(this.projectsResource,"/").concat(t.id,"/generate-invoice")).then((function(t){e.$toast.success(t.data.message),e.$refs.projectsTable.refresh()})).catch((function(t){e.$toast.error(t.message)}))}},watch:{"form.type":function(){var t=this;null!==this.form.type&&(this.currentTabIndex=this.project_types.findIndex((function(e){return e===t.form.type})))},currentTabIndex:function(){return-1!==this.currentTabIndex&&(this.form.type=this.project_types[this.currentTabIndex]),""}},computed:{projectsResource:function(){return"/timesheet/clients/"+this.client.id+"/projects"}}},y=(r(765),Object(v.a)(h,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("crud-index",{ref:"projectsTable",attrs:{columns:t.columns,resourceURL:t.projectsResource,options:t.options,form:t.form,labels:t.labels,"form-size":"lg"},scopedSlots:t._u([{key:"name",fn:function(e){var object=e.object;return[r("nuxt-link",{attrs:{to:"/clients/"+object.row.client_id+"/projects/"+object.row.id}},[t._v("\n "+t._s(object.row.name)+"\n ")])]}},{key:"status",fn:function(e){var object=e.object;return[r("span",{domProps:{innerHTML:t._s(object.row.status_as_labels)}})]}},{key:"assignable",fn:function(e){return[e.object.row.assignable?r("fa",{staticClass:"text-success",attrs:{icon:"check"}}):r("span",[t._v("-")])]}},{key:"taxable",fn:function(e){return[e.object.row.taxable?r("fa",{staticClass:"text-success",attrs:{icon:"check"}}):r("span",[t._v("-")])]}},{key:"extra-actions",fn:function(e){var object=e.object;return[object.generateInvoice?r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],staticClass:"text-danger",attrs:{title:"Generate Invoice"},on:{click:function(e){return e.preventDefault(),t.generateInvoice(object)}}},[r("fa",{attrs:{icon:"file-invoice"}})],1):t._e()]}},{key:"default",fn:function(e){var form=e.form;return[r("b-tabs",{attrs:{"content-class":"mt-3"}},[r("b-tab",{attrs:{title:"Details",active:""}},[r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-6"},[r("corals-input",{attrs:{form:form,field:"name",required:""}}),t._v(" "),r("corals-input",{attrs:{form:form,label:"Integration Key",field:"integration_id"}}),t._v(" "),r("corals-checkbox",{attrs:{field:"assignable",form:form}}),t._v(" "),r("corals-checkbox",{attrs:{field:"taxable",form:form}}),t._v(" "),r("corals-radio",{attrs:{form:form,field:"status",label:"Status",list:form.getFormData("status_options"),required:""}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-datepicker",{attrs:{form:form,field:"start_date",label:"Start Date"}}),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{form:form,field:"bill_cycle",options:t.billCycleOptions,description:"Will overrides the client settings"}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},["monthly"===form.bill_cycle||"biweekly"===form.bill_cycle?r("corals-input",{attrs:{type:"number",form:form,label:"Start of Cycle",description:"Day of month",field:"bill_cycle_starts_at",min:"1"}}):form.bill_cycle&&"weekly"===form.bill_cycle?r("corals-select",{attrs:{form:form,field:"bill_cycle_starts_at",label:"Start of Cycle",options:t.weekDaysOptions}}):t._e()],1)]),t._v(" "),r("corals-textarea",{attrs:{form:form,field:"description"}})],1)])]),t._v(" "),r("b-tab",{attrs:{title:"Labels"}},[r("div",{staticClass:"row mb-2"},[r("div",{staticClass:"col-md-10"},[r("b-form-group",{attrs:{label:"Label","label-for":"label_text_value",state:t.dontShowLabelFieldError,"invalid-feedback":t.labelTextFieldErrorMessage}},[r("b-form-input",{attrs:{state:t.dontShowLabelFieldError,type:"text",id:"label_text_value"},model:{value:t.labelTextField,callback:function(e){t.labelTextField="string"==typeof e?e.trim():e},expression:"labelTextField"}})],1)],1),t._v(" "),r("div",{staticClass:"col-md-1 ",staticStyle:{"margin-top":"33px"}},[r("a",{staticClass:"btn btn-success btn-sm",on:{click:function(e){return e.preventDefault(),t.pushLabelToProjectLabels.apply(null,arguments)}}},[r("fa",{attrs:{icon:"plus"}})],1)])]),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-12"},[r("table",{staticClass:"table"},[r("thead",[r("tr",[r("th",[t._v("Label")]),t._v(" "),r("th",[t._v("Is active?")]),t._v(" "),t._e()])]),t._v(" "),r("tbody",t._l(form.labels,(function(label){return r("tr",[r("td",{domProps:{innerHTML:t._s(label.name)}}),t._v(" "),r("td",[label?r("b-form-checkbox",{attrs:{value:"active","unchecked-value":"inactive"},model:{value:label.status,callback:function(e){t.$set(label,"status",e)},expression:"label.status"}}):t._e()],1),t._v(" "),t._e()])})),0)])])])]),t._v(" "),form.assignable?r("b-tab",{attrs:{title:"Users"}},[form.error("user_rates")?r("p",{staticClass:"text-danger"},[t._v("\n "+t._s(form.error("user_rates"))+"\n ")]):t._e(),t._v(" "),r("table",{staticClass:"table table-striped table-condensed"},[r("thead",[r("tr",[r("th",[t._v("User")]),t._v(" "),r("th",[t._v("Rate")])])]),t._v(" "),r("tbody",t._l(form.getFormData("users"),(function(e){return r("tr",[r("td",{staticClass:"align-middle"},[r("div",{staticClass:"custom-control custom-checkbox"},[r("input",{staticClass:"custom-control-input",attrs:{type:"checkbox",id:"user_"+e.id},domProps:{value:e.id,checked:t.userChecked(e.id)},on:{change:function(r){return t.setProjectUserRateCheckbox(e.hourly_rate,e.id,r.target.checked)}}}),t._v(" "),r("label",{staticClass:"custom-control-label",attrs:{for:"user_"+e.id}},[t._v("\n "+t._s(e.label)+"\n ")])])]),t._v(" "),r("td",[r("input",{staticClass:"form-control w-75",attrs:{id:"user_rate_"+e.id,type:"number"},domProps:{value:t.getUserHourlyRate(e.id,form.getFormData("users"))},on:{input:function(r){return t.setProjectUserRate(r.target.value,e.id)}}})])])})),0)])]):t._e(),t._v(" "),r("b-tab",{attrs:{title:"Activities"}},[form.error("activity_rates")?r("p",{staticClass:"text-danger"},[t._v("\n "+t._s(form.error("activity_rates"))+"\n ")]):t._e(),t._v(" "),r("table",{staticClass:"table table-striped table-condensed"},[r("thead",[r("tr",[r("th",[t._v("Title")]),t._v(" "),r("th",[t._v("Rate")])])]),t._v(" "),r("tbody",[r("tr",{staticClass:"table-secondary text-white"},[r("td",{staticClass:"p-2",attrs:{colspan:"2"}},[r("strong",[t._v("Billable Activities")])])]),t._v(" "),t._l(form.getFormData("billable_activities"),(function(e){return r("tr",[r("td",{staticClass:"align-middle"},[r("div",{staticClass:"custom-control custom-checkbox"},[r("input",{staticClass:"custom-control-input",attrs:{type:"checkbox",id:"activity_"+e.id},domProps:{value:e.id,checked:t.activityChecked(e.id)},on:{change:function(r){return t.setProjectActivityRateCheckbox(e.hourly_rate,e.id,r.target.checked)}}}),t._v(" "),r("label",{staticClass:"custom-control-label",attrs:{for:"activity_"+e.id}},[t._v("\n "+t._s(e.title)+"\n ")])])]),t._v(" "),r("td",{staticClass:"w-50"},[r("input",{staticClass:"form-control w-50",attrs:{id:"activity_rate_"+e.id,type:"number"},domProps:{value:t.getActivityHourlyRate(e.id,form.getFormData("billable_activities"))},on:{input:function(r){return t.setProjectActivityRate(r.target.value,e.id)}}})])])}))],2),t._v(" "),r("tbody",[r("tr",{staticClass:"table-secondary text-white"},[r("td",{staticClass:"p-2",attrs:{colspan:"2"}},[r("strong",[t._v("Non Billable Activities")])])]),t._v(" "),t._l(form.getFormData("non_billable_activities"),(function(e){return r("tr",[r("td",{staticClass:"align-middle"},[r("div",{staticClass:"custom-control custom-checkbox"},[r("input",{staticClass:"custom-control-input",attrs:{type:"checkbox",id:"activity_"+e.id},domProps:{value:e.id,checked:t.activityChecked(e.id)},on:{change:function(r){return t.setProjectActivityRateCheckbox(e.hourly_rate,e.id,r.target.checked)}}}),t._v(" "),r("label",{staticClass:"custom-control-label",attrs:{for:"activity_"+e.id}},[t._v("\n "+t._s(e.title)+"\n ")])])]),t._v(" "),r("td",{staticClass:"w-50"},[r("input",{staticClass:"form-control w-50",attrs:{id:"activity_rate_"+e.id,type:"number"},domProps:{value:t.getActivityHourlyRate(e.id,form.getFormData("non_billable_activities"))},on:{input:function(r){return t.setProjectActivityRate(r.target.value,e.id)}}})])])}))],2)])]),t._v(" "),r("b-tab",{attrs:{title:"Project Type"}},[r("b-tabs",{attrs:{pills:"",vertical:"","content-class":"min-h-400"},model:{value:t.currentTabIndex,callback:function(e){t.currentTabIndex=e},expression:"currentTabIndex"}},[r("project-types",{attrs:{form:form}})],1)],1)],1)]}}])})}),[],!1,null,"6d9a1486",null)),C=y.exports,x=(r(15),{name:"ClientsInvoicesIndex",components:{CrudIndex:c.a},provide:function(){return{handleBulkAction:this.handleBulkAction}},props:{client:{required:!0}},data:function(){var t=this;return{form:this.$form({notes:"",status:"pending",project_id:"",invoice_date:new Date,due_date:new Date,items:[this.getItemObject()]},{fetchFormDataURL:"timesheet/invoices/get-form-data?client_id=".concat(this.client.id),model:"invoice",loadFormDataCallBack:function(){t.options.listColumns.status=t.getOptions(t.form.formData.status_options)}}),labels:{title:"Invoices",singularTitle:"Invoice"},options:{hideCreate:this.$notAdmin(),listColumns:{status:[]},customColumns:["code","status","total","notes"],filterable:["code","status","notes","invoice_date"],headings:{total:"Summary",total_hours:"Hours",project_name:"Project"}}}},methods:{getOptions:function(t){var e=[];return e.push({id:"",text:"All"}),t.map((function(t){var r,label=t.label.split(",");e.push({id:null!==(r=t.id)&&void 0!==r?r:t.value,text:label[0]})})),e},handleBulkAction:function(t,e){var r=this;this.$bvModal.msgBoxConfirm("Are you sure?",{size:"md",buttonSize:"sm",okVariant:"danger",footerClass:"p-2",hideHeaderClose:!1,centered:!0}).then((function(o){!0===o&&r.$axios.post("timesheet/invoices/bulk-action",{selection:e,action:t}).then((function(t){var e=t.data.data.level,o=t.data.data.message;"success"===e?r.$toast.success(o):r.$toast.error(o),r.$eventBus.$emit("setSelectedIds",[]),r.$refs.invoicesTable.refresh()})).catch((function(t){r.$toast.error(t.response.data.message)}))})).catch((function(t){}))},getItemObject:function(){return{title:"",type:"item",rate:"",quantity:1,notes:""}},addItem:function(){this.form.items.push(this.getItemObject())},removeItem:function(t){var e=[];this.form.items.forEach((function(r,o){o!=t&&e.push(r)})),this.form.items=e}},computed:{deleteHref:function(){return"timesheet/invoices"},editHref:function(){return"timesheet/invoices"},columns:function(){var t=[];return this.$isAdmin()&&this.bulkActionOptions.length&&t.push("checkbox"),t.push("code","project_name","total","total_hours","invoice_date","notes","status","actions"),this.$notAdmin()&&t.pop(),t},invoicesResource:function(){return"/timesheet/invoices/by-client/".concat(this.client.id)},bulkActionOptions:function(){return this.$notAdmin()?[]:["delete","pending","paid","void"]}}}),k=(r(767),Object(v.a)(x,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("crud-index",{ref:"invoicesTable",attrs:{columns:t.columns,deleteHref:t.deleteHref,editHref:t.editHref,"bulk-action-options":t.bulkActionOptions,resourceURL:t.invoicesResource,options:t.options,labels:t.labels,form:t.form,"form-size":"lg"},scopedSlots:t._u([{key:"code",fn:function(e){var object=e.object;return[r("nuxt-link",{attrs:{to:"/invoices/"+object.row.id}},[t._v("\n "+t._s(object.row.code)+"\n ")])]}},{key:"status",fn:function(e){var object=e.object;return[r("span",{domProps:{innerHTML:t._s(object.row.status)}})]}},{key:"total",fn:function(e){var object=e.object;return[r("table",{staticClass:"table totals-table table-borderless"},[parseFloat(object.row.total)!==parseFloat(object.row.subtotal)?r("tr",[r("td",[t._v("Subtotal")]),t._v(" "),r("td",{staticClass:"text-right"},[t._v(t._s(object.row.subtotal))])]):t._e(),t._v(" "),parseFloat(object.row.tax_total)?r("tr",[r("td",[t._v("Taxes")]),t._v(" "),r("td",{staticClass:"text-right"},[t._v(t._s(object.row.tax_total))])]):t._e(),t._v(" "),parseFloat(object.row.discount_total)?r("tr",[r("td",[t._v("Discount")]),t._v(" "),r("td",{staticClass:"text-right"},[t._v(t._s(object.row.discount_total))])]):t._e(),t._v(" "),r("tr",[r("td",[r("b",[t._v("Total")])]),t._v(" "),r("td",{staticClass:"text-right"},[r("b",[t._v(t._s(object.row.total))])])])])]}},{key:"notes",fn:function(e){var object=e.object;return[object.row.notes?r("fa",{directives:[{name:"b-popover",rawName:"v-b-popover.click.blur",value:object.row.notes,expression:"object.row.notes",modifiers:{click:!0,blur:!0}}],staticClass:"text-primary cursor-pointer",attrs:{icon:"sticky-note"}}):r("span",[t._v(t._s(object.row.notes))])]}},{key:"default",fn:function(e){var form=e.form;return[r("div",[r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-radio",{attrs:{form:form,field:"status",label:"Status",list:form.getFormData("status_options"),required:""}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-select",{attrs:{form:form,label:"Project",field:"project_id",options:form.getFormData("client_projects_options")}})],1)]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-6"},[r("corals-datepicker",{attrs:{form:form,field:"invoice_date",label:"Invoice Date"}})],1),t._v(" "),r("div",{staticClass:"col-md-6"},[r("corals-datepicker",{attrs:{form:form,field:"due_date",label:"Due Date"}})],1)]),t._v(" "),r("corals-textarea",{attrs:{form:form,field:"notes",placeholder:"Place invoice notes here..."}})],1),t._v(" "),r("hr"),t._v(" "),r("div",{attrs:{id:"invoice-items"}},[t._l(form.items,(function(e,o){return r("div",{key:"item_"+o,staticClass:"p-1 position-relative",style:o%2!=0?{"background-color":"rgba(0, 0, 0, 0.05)"}:""},[r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-8"},[r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-7"},[r("corals-input",{attrs:{form:form,size:"sm",type:"text",field:"items."+o+".title",label:"Title",required:""},model:{value:e.title,callback:function(r){t.$set(e,"title",r)},expression:"item.title"}})],1),t._v(" "),r("div",{staticClass:"col-md-5"},[r("label",{staticClass:"required-field"},[t._v("Type")]),t._v(" "),r("b-form-select",{attrs:{size:"sm",options:form.getFormData("type_options"),"text-field":"label","value-field":"id",required:""},model:{value:e.type,callback:function(r){t.$set(e,"type",r)},expression:"item.type"}})],1)]),t._v(" "),r("div",{staticClass:"row sm-gutters"},[r("div",{staticClass:"col-md-4"},[r("corals-input",{attrs:{form:form,size:"sm",type:"number",field:"items."+o+".quantity",label:"Quantity",step:"0.01",required:""},model:{value:e.quantity,callback:function(r){t.$set(e,"quantity",r)},expression:"item.quantity"}})],1),t._v(" "),r("div",{staticClass:"col-md-4"},[r("corals-input",{attrs:{form:form,size:"sm",type:"number",field:"items."+o+".rate",label:"Rate",step:"0.01",required:""},model:{value:e.rate,callback:function(r){t.$set(e,"rate",r)},expression:"item.rate"}})],1),t._v(" "),r("div",{staticClass:"col-md-4"},[r("label",{staticClass:"d-block"},[t._v("Amount")]),t._v(" "),r("div",{},[r("b-form-input",{attrs:{size:"sm",value:Math.round(e.quantity*e.rate*100)/100,readonly:""}})],1)])])]),t._v(" "),r("div",{staticClass:"col-md-4"},[r("corals-textarea",{attrs:{form:form,size:"sm",field:"items."+o+".notes",label:"Notes",rows:"4",placeholder:"Item Notes..."},model:{value:e.notes,callback:function(r){t.$set(e,"notes",r)},expression:"item.notes"}})],1)]),t._v(" "),r("a",{staticClass:"text-danger clear-item-btn",attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.removeItem(o)}}},[r("fa",{attrs:{icon:"times"}})],1)])})),t._v(" "),r("button",{staticClass:"btn btn-sm btn-success mt-1",on:{click:function(e){return e.preventDefault(),t.addItem.apply(null,arguments)}}},[r("fa",{attrs:{icon:"plus"}}),t._v("\n Add Item\n ")],1)],2)]}}])})}),[],!1,null,"8e75f894",null)),w=k.exports,j=(r(299),r(101),r(192),r(237),r(18),r(116),r(719)),T={name:"ClientsBillableEntriesIndex",components:{EntryFields:r(742).a,COverlay:j.a},props:{client:{required:!0}},fetch:function(){var t=this;return Object(n.a)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.fetchProjects();case 2:t.projects=e.sent;case 3:case"end":return e.stop()}}),e)})))()},data:function(){return{showGenerateClientInvoiceBtn:!1,formModalId:"entry-cycle-modal",projects:[],ready:!1,selectedEntry:null,includeThePrev:1,search:"",form:this.$form({activity_id:"",user_id:"",project_id:"",spent_at:new Date,hours:"",minutes:"",description:"",evaluation_minutes:"",evaluation_hours:"",has_reviewed:0},{fetchFormDataURL:"timesheet/entries/get-form-data",model:"entry"})}},methods:{onModalShow:function(){this.selectedEntry||(this.form.replace(this.form.originalData),this.selectedEntry=null,this.form.errors.purge())},modelHidden:function(){this.form.replace(this.form.originalData),this.selectedEntry=null,this.form.errors.purge()},submitEditEntryForm:function(){var t=this;this.form.put("timesheet/entries/".concat(this.selectedEntry.id)).then(function(){var e=Object(n.a)(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.$bvModal.hide(t.formModalId),e.next=3,t.fetchProjects();case 3:t.projects=e.sent;case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},showEditEntryModal:function(t){var e=this;this.selectedEntry=t,this.$axios.get("timesheet/entries/".concat(t.id,"?edit=1")).then((function(t){var r=t.data;e.form.replace(r.data),e.$bvModal.show(e.formModalId)})).catch((function(t){e.$toast.error(t.message)}))},deleteEntry:function(t){var e=this;this.$swal.fire({title:"Are you sure?",text:"You won't be able to revert this!",icon:"warning",showCancelButton:!0,confirmButtonColor:"#d33",cancelButtonColor:"#d7d7d7",confirmButtonText:"Yes, delete it!"}).then((function(r){r.value&&e.doDeleteEntry(t)}))},doDeleteEntry:function(t){var e=this;this.$axios.delete("timesheet/entries/".concat(t.id)).then(function(){var t=Object(n.a)(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.fetchProjects();case 2:e.projects=t.sent;case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){var r=t.message;t.response&&t.response.data&&t.response.data.message&&(r=t.response.data.message),e.$toast.error(r)}))},generateInvoicePerCycle:function(t,e){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pending";this.$notAdmin()||this.$swal.fire({title:"Are you sure?",text:"You are going to generate invoice for this cycle.",icon:"warning",showCancelButton:!0,confirmButtonColor:"#007bff",cancelButtonColor:"#d7d7d7",confirmButtonText:"Generate"}).then((function(l){l.value&&r.$axios.post("timesheet/entries/generate-invoice-per-cycle/".concat(e.id,"/").concat(r.client.id,"?status=").concat(o),{cycle_start:t.start,cycle_end:t.end,include_previous_entries:r.includeThePrev}).then(function(){var t=Object(n.a)(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.$toast.success(e.data.message),t.next=3,r.fetchProjects();case 3:r.projects=t.sent;case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){console.error(t)}))}))},generateVoidInvoicePerCycle:function(t,e){this.$notAdmin()||this.generateInvoicePerCycle(t,e,"void")},generatePaidInvoicePerCycle:function(t,e){this.$notAdmin()||this.generateInvoicePerCycle(t,e,"paid")},fetchProjects:function(){var t=this;return Object(n.a)(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.ready=!1,t.showGenerateClientInvoiceBtn=!1,e.next=4,t.$axios.get("timesheet/entries/entries-per-billing-cycle/".concat(t.client.id)).then((function(e){var data=e.data;return t.ready=!0,data.data}));case 4:return(r=e.sent).forEach((function(e){for(var r in e.cycles)!1===e.cycles[r].is_current&&(t.showGenerateClientInvoiceBtn=!0)})),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})))()},userCount:function(t,e){var r=0;return t.forEach((function(t){return t.user===e&&r++})),r},totalUserTime:function(t,e){var r=0,o=0;return t.forEach((function(t){t.user===e&&(r+=t.evaluation_hours,o+=t.evaluation_minutes)})),o>=60&&(r+=Math.floor(o/60),o%=60),o<10&&(o="0"+o),r<10&&(r="0"+r),r+":"+o},totalEvaluationTime:function(t){for(var e=[],r=0,o=0,i=0;i<t.length;i++)for(var n=0;n<t[i].length;n++)r+=t[i][n].evaluation_hours,o+=t[i][n].evaluation_minutes;return o>=60&&(r+=Math.floor(o/60),o%=60),o<10&&(o="0"+o),r<10&&(r="0"+r),e.total_evaluation_hours=r,e.total_evaluation_minutes=o,e},generateInvoice:function(){var t=this;this.$axios.post("timesheet/clients/".concat(this.client.id,"/generate-invoice")).then(function(){var e=Object(n.a)(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.$toast.success(r.data.message),e.next=3,t.fetchProjects();case 3:t.projects=e.sent;case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){t.$toast.error(e.message)}))}},computed:{getProjects:function(){var t=this;if(!this.search.length)return this.projects;var e=[];return this.projects.forEach((function(r){var o={},n=0,l=[];for(var c in r.cycles){for(var d=[],m={},f=0;f<r.cycles[c].entries.length;f++){var v;(v=r.cycles[c].entries[f].filter((function(e){return e.user.toLowerCase().includes(t.search.toLowerCase())||e.description.toLowerCase().includes(t.search.toLowerCase())||e.spent_at.includes(t.search)}))).length>0&&d.push(v)}if(d.length>0){var _=t.totalEvaluationTime(d);m={code:r.cycles[c].code,end:r.cycles[c].end,start:r.cycles[c].start,is_current:r.cycles[c].is_current,entries:d,total_evaluation_hours:_.total_evaluation_hours,total_evaluation_minutes:_.total_evaluation_minutes,total_evaluation_time:_.total_evaluation_hours+":"+_.total_evaluation_minutes}}else m=[];0!==m.length&&(n=1,o[r.cycles[c].code]=m)}1===n&&(l={budget:r.budget,currency:r.currency,cycles:o,hourly_rate:r.hourly_rate,id:r.id,name:r.name},e.push(l))})),e},isReady:function(){return this.ready}}},P=T,R=(r(770),Object(v.a)(P,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[t.isReady?[t.getProjects.length&&t.$isAdmin()?r("div",{staticClass:"mb-4"},[r("b-form-checkbox",{staticClass:"d-inline-block",attrs:{id:"include_prev",name:"include_prev",value:1,"unchecked-value":0},model:{value:t.includeThePrev,callback:function(e){t.includeThePrev=e},expression:"includeThePrev"}},[t._v("\n On Generate Invoice include not billed entries from previous cycles\n ")])],1):t._e(),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-8"},[r("div",{staticClass:"form-group form-row"},[r("div",{staticClass:"col-md-6"},[r("b-form-input",{staticClass:"form-control",attrs:{placeholder:"Type to filter...",debounce:"500"},model:{value:t.search,callback:function(e){t.search="string"==typeof e?e.trim():e},expression:"search"}})],1),t._v(" "),r("div",{staticClass:"col-md-2"},[r("b-button",{attrs:{disabled:!t.search},on:{click:function(e){t.search=""}}},[t._v("Clear")])],1)])]),t._v(" "),t.showGenerateClientInvoiceBtn?r("div",{staticClass:"col-md-4 text-right"},[t.$isAdmin()?r("b-button",{attrs:{variant:"primary"},on:{click:function(e){return e.preventDefault(),t.generateInvoice.apply(null,arguments)}}},[r("fa",{attrs:{icon:"plus"}}),t._v("\n Generate Invoice\n ")],1):t._e()],1):t._e()]),t._v(" "),t._l(t.getProjects,(function(e,o){return[r("h4",[t._v(t._s(e.name))]),t._v(" "),r("div",{staticClass:"accordion",attrs:{role:"tablist"}},[t._l(e.cycles,(function(n,code){return[r("b-card",{staticClass:"card-overflow mb-1",attrs:{"no-body":""}},[r("b-card-header",{staticClass:"p-1",attrs:{"header-tag":"header",role:"tab"}},[r("b-button",{directives:[{name:"b-toggle",rawName:"v-b-toggle",value:"accordion-"+o+code,expression:"'accordion-'+index+code"}],staticClass:"d-flex justify-content-between",attrs:{block:"",variant:n.is_current?"secondary":"success"}},[r("div",{staticClass:"align-self-center"},[t._v(t._s(n.start)+" - "+t._s(n.end))]),t._v(" "),n.has_unreviewed_entries?r("div",{staticClass:"alert alert-warning p-1 m-0"},[t._v("\n Some of entries are pending review!\n ")]):t._e(),t._v(" "),r("div",[r("b",{staticClass:"mx-3"},[t._v("\n Total: "+t._s(n.total_evaluation_time)+"\n ")]),t._v(" "),r("div",{directives:[{name:"isAdmin",rawName:"v-isAdmin"}],staticClass:"dropdown d-inline-block"},[r("b-dropdown",{attrs:{id:"dropdown",dropleft:"","no-caret":"",variant:"warning","toggle-class":"p-1",size:"sm"},scopedSlots:t._u([{key:"button-content",fn:function(){return[r("fa",{attrs:{icon:"ellipsis-v"}})]},proxy:!0}],null,!0)},[t._v(" "),r("a",{staticClass:"btn btn-sm dropdown-item",attrs:{href:"#"},on:{click:function(r){return r.stopPropagation(),t.generateInvoicePerCycle(n,e)}}},[r("fa",{attrs:{icon:"file-invoice"}}),t._v("\n Generate Pending Invoice\n ")],1),t._v(" "),r("a",{staticClass:"btn btn-sm dropdown-item",attrs:{href:"#"},on:{click:function(r){return r.stopPropagation(),t.generateVoidInvoicePerCycle(n,e)}}},[r("fa",{attrs:{icon:"file-invoice"}}),t._v("\n Generate Void Invoice\n ")],1),t._v(" "),r("a",{staticClass:"btn btn-sm dropdown-item",attrs:{href:"#"},on:{click:function(r){return r.stopPropagation(),t.generatePaidInvoicePerCycle(n,e)}}},[r("fa",{attrs:{icon:"file-invoice"}}),t._v("\n Generate Paid Invoice\n ")],1)])],1)])])],1),t._v(" "),r("b-collapse",{attrs:{id:"accordion-"+o+code,accordion:"cycle-accordion-"+o+code,role:"tabpanel"}},[r("b-card-body",[r("div",{staticClass:"table-responsive"},[r("table",{staticClass:"VueTables__table table"},[r("thead",[r("tr",[r("th",{staticClass:"cw-120"},[t._v("Date")]),t._v(" "),r("th",{staticClass:"cw-200"},[t._v("Resource")]),t._v(" "),r("th",[t._v("Description")]),t._v(" "),r("th",{staticClass:"cw-120"},[t._v("Time")]),t._v(" "),r("th",{directives:[{name:"isAdmin",rawName:"v-isAdmin"}]},[t._v("Actions")])])]),t._v(" "),r("tbody",[t._l(n.entries,(function(e,o){return[t._l(e,(function(n,l){return[r("tr",{class:o%2?"odd-row":"even-row"},[0===l?r("td",{attrs:{rowspan:e.length}},[t._v("\n "+t._s(n.spent_at)+"\n "),r("br"),t._v(" "),r("small",[t._v(t._s(n.spent_at_day.name))])]):t._e(),t._v(" "),0===l||e[l-1].user!==e[l].user?r("td",{attrs:{rowspan:t.userCount(e,n.user)}},[r("div",[t._v(t._s(n.user))]),t._v(" "),r("div",{staticClass:"font-weight-bold mt-1"},[t._v("\n "+t._s(t.totalUserTime(e,n.user))+"\n ")])]):t._e(),t._v(" "),r("td",[r("div",{domProps:{innerHTML:t._s(t.$getTextWithLinks(n.description))}}),t._v(" "),r("div",[t._l(n.labels,(function(label){return[r("span",{staticClass:"badge badge-warning mr-1"},[t._v(t._s(label.name))])]}))],2)]),t._v(" "),r("th",[t._v("\n "+t._s(n.evaluation_time)+"\n "),n.has_reviewed?r("fa",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip",value:"Has Reviewed",expression:"'Has Reviewed'"}],staticClass:"text-success",attrs:{icon:"check-circle"}}):t._e()],1),t._v(" "),r("th",{directives:[{name:"isAdmin",rawName:"v-isAdmin"}]},[r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:"Edit"},on:{click:function(e){return e.preventDefault(),t.showEditEntryModal(n)}}},[r("fa",{attrs:{icon:"edit"}})],1),t._v(" "),r("b-link",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],staticClass:"text-danger",attrs:{title:"Delete"},on:{click:function(e){return e.preventDefault(),t.deleteEntry(n)}}},[r("fa",{attrs:{icon:"trash"}})],1)],1)])]}))]}))],2)])])])],1)],1)]})),t._v(" "),Object.keys(e.cycles).length?t._e():r("h4",{staticClass:"text-center text-muted"},[t._v("No data available")])],2),t._v(" "),r("hr")]})),t._v(" "),t.getProjects.length?t._e():r("h4",{staticClass:"text-center text-muted"},[t._v("No data available")])]:[t._m(0)],t._v(" "),r("b-modal",{attrs:{"hide-footer":"","content-class":"shadow",title:"Edit Entry","no-close-on-backdrop":"",id:t.formModalId,size:"lg"},on:{hidden:t.modelHidden,show:t.onModalShow}},[r("c-overlay",{attrs:{show:!t.form.isReady}},[r("form",{on:{submit:function(e){return e.preventDefault(),t.submitEditEntryForm.apply(null,arguments)}}},[r("entry-fields",{attrs:{form:t.form}}),t._v(" "),r("div",{staticClass:"text-right"},[r("button",{staticClass:"btn btn-sm btn-primary",attrs:{type:"submit",disabled:!t.form.isReady}},[t._v("\n Update Entry\n ")]),t._v(" "),r("button",{staticClass:"btn btn-sm btn-secondary",attrs:{disabled:!t.form.isReady},on:{click:function(e){return e.preventDefault(),t.$bvModal.hide(t.formModalId)}}},[t._v("Close\n ")])])],1)])],1)],2)}),[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"loader"},[r("h4",{staticClass:"text-center text-muted"},[t._v("\n Loading\n "),r("span",{staticClass:"dot"},[t._v(".")]),t._v(" "),r("span",{staticClass:"dot"},[t._v(".")]),t._v(" "),r("span",{staticClass:"dot"},[t._v(".")])])])}],!1,null,"db996d8c",null)),O=R.exports,I=r(731),D=r(743),$=r(736),A=r(750),E=r(294),B={name:"clientShow",asyncData:function(t){return Object(n.a)(regeneratorRuntime.mark((function e(){var r,o,n,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,o=t.$axios,n=t.redirect,e.next=3,o.get("/timesheet/clients/".concat(r.clientid)).then((function(t){return t.data.data})).catch((function(t){return n("/")}));case 3:return l=e.sent,e.abrupt("return",{client:l});case 5:case"end":return e.stop()}}),e)})))()},components:{EntriesHoursLineChart:I.a,ClientsInvoicesIndex:w,ClientsProjectsIndex:C,ClientsBillableEntriesIndex:O,PageHeader:l.a,CRUDIndex:c.a,ActivitiesReport:$.a,UsersReport:A.a,ProjectsReport:D.a,CoralsReportsDateForm:E.default},data:function(){return{form:this.$form({period:"currentMonth",from_date:"",to_date:"",client_id:this.$route.params.clientid,client_name:""},{resetOnSuccess:!1}),currentTabIndex:0,currentSubTabsIndex:0,showClientReport:!1}},methods:{isReady:function(t){return!!t&&(this.form.client_name=t.name,!0)},filter:function(){var t=this;this.showClientReport=!1,this.$nextTick((function(){t.showClientReport=!0}))},isTabVisible:function(t){return-1!==this.tabs.findIndex((function(e){return e===t}))},setActiveIndex:function(t){this.currentTabIndex=t}},computed:{chartDataParameters:function(){var t=this.form.from_date,e=this.form.to_date;return null!==t&&"object"==Object(o.a)(t)&&(t=this.form.from_date.toLocaleDateString()),null!==e&&"object"==Object(o.a)(e)&&(e=this.form.to_date.toLocaleDateString()),{client_id:this.$route.params.clientid,from_date:t,to_date:e,is_limited:this.form.is_limited?1:0}},tabs:function(){var t=["dashboard-tab","projects-tab","billable-entries-tab","invoices-tab"];this.$isAdmin()||(t=t.slice(2,4));var e=this.$route.query.tab;return e&&(this.currentTabIndex=t.findIndex((function(t){return t.replace("-tab","")===e}))),t},breadcrumbLinks:function(){return[{text:"Clients",to:"/clients"},{text:this.client.name,active:!0}]}}},F=Object(v.a)(B,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return t.isReady(t.client)?r("div",[r("PageHeader",{attrs:{title:t.client.name}}),t._v(" "),r("b-breadcrumb",{attrs:{items:t.breadcrumbLinks}}),t._v(" "),r("div",{directives:[{name:"is-admin",rawName:"v-is-admin"}],staticClass:"table-responsive"},[r("table",{staticClass:"table border-bottom"},[t._m(0),t._v(" "),r("tbody",[r("tr",[r("td",[t._v(t._s(t.client.name))]),t._v(" "),r("td",[t._v(t._s(t.client.user.full_name))]),t._v(" "),r("td",[t._v(t._s(t.client.number_of_projects))]),t._v(" "),r("td",[t._v(t._s(t.client.bill_cycle))]),t._v(" "),r("td",[t._v(t._s(t.client.bill_cycle_starts_at))]),t._v(" "),r("td",[r("span",{domProps:{innerHTML:t._s(t.client.status_as_labels)}})])])])])]),t._v(" "),r("b-tabs",{attrs:{"content-class":"mt-3"},on:{"activate-tab":t.setActiveIndex}},[t.isTabVisible("dashboard-tab")?r("b-tab",{attrs:{title:"Dashboard"}},[r("CoralsReportsDateForm",{attrs:{form:t.form},on:{filter:t.filter}}),t._v(" "),r("b-tabs",{staticClass:"mt-3",attrs:{"content-class":"mt-3"},model:{value:t.currentSubTabsIndex,callback:function(e){t.currentSubTabsIndex=e},expression:"currentSubTabsIndex"}},[r("b-tab",{attrs:{title:"Projects",active:""}},[t.showClientReport?r("projects-report",{attrs:{url:"timesheet/clients/get-projects-report",form:t.form}}):t._e()],1),t._v(" "),r("b-tab",{attrs:{title:"Activities",lazy:""}},[t.showClientReport?r("activities-report",{attrs:{url:"timesheet/clients/get-activities-report",form:t.form}}):t._e()],1),t._v(" "),r("b-tab",{attrs:{title:"Users",lazy:""}},[t.showClientReport?r("users-report",{attrs:{url:"timesheet/clients/get-users-report",form:t.form}}):t._e()],1)],1),t._v(" "),r("hr"),t._v(" "),r("div",{staticClass:"row"},[r("div",{staticClass:"col-md-3"},[t.showClientReport?r("EntriesHoursLineChart",{attrs:{model:"client",params:t.chartDataParameters}}):t._e()],1)])],1):t._e(),t._v(" "),t.isTabVisible("projects-tab")?r("b-tab",{attrs:{title:"Projects",active:"projects-tab"===t.tabs[t.currentTabIndex]}},["projects-tab"===t.tabs[t.currentTabIndex]?r("clients-projects-index",{attrs:{client:t.client}}):t._e()],1):t._e(),t._v(" "),t.isTabVisible("billable-entries-tab")?r("b-tab",{attrs:{title:"Billable Entries",active:"billable-entries-tab"===t.tabs[t.currentTabIndex]}},["billable-entries-tab"===t.tabs[t.currentTabIndex]?r("clients-billable-entries-index",{attrs:{client:t.client}}):t._e()],1):t._e(),t._v(" "),t.isTabVisible("invoices-tab")?r("b-tab",{attrs:{title:"Invoices",active:"invoices-tab"===t.tabs[t.currentTabIndex]}},["invoices-tab"===t.tabs[t.currentTabIndex]?r("clients-invoices-index",{attrs:{client:t.client}}):t._e()],1):t._e()],1)],1):t._e()}),[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("thead",[r("tr",[r("th",{attrs:{scope:"col"}},[t._v("Name")]),t._v(" "),r("th",{attrs:{scope:"col"}},[t._v("User")]),t._v(" "),r("th",{attrs:{scope:"col"}},[t._v("Number OF Projects")]),t._v(" "),r("th",{attrs:{scope:"col"}},[t._v("Bill cycle")]),t._v(" "),r("th",{attrs:{scope:"col"}},[t._v("Bill cycle starts at")]),t._v(" "),r("th",{attrs:{scope:"col"}},[t._v("Status")])])])}],!1,null,"329635ed",null);e.default=F.exports}}]);