%PDF- %PDF-
Direktori : /var/www/html/hr/web/js/ |
Current File : /var/www/html/hr/web/js/chunk-98e249de.71ddf952.js |
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-98e249de"],{"0788":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("base-loader",{attrs:{loading:e.loadingData}},[n("project-details-component",{attrs:{action:e.$t("buttons."+[e.process]),clients:e.clients,currencies:e.currencies,loading:e.loadingContent,"loading-select":e.isLoadingSelect,managers:e.managers,project:e.projectData},on:{confirm:e.doProject,requestClients:e.getClients}})],1)},r=[],c=(n("99af"),n("d3b7"),n("ac1f"),n("5319"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"view-container"},[n("div",{staticClass:"flex flex-col justify-around items-center"},[n("div",{staticClass:"max-w-md w-full sm:w-1/2 lg:w-1/3 xl:w-1/3 flex flex-wrap content-center justify-center"},[n("ValidationObserver",{ref:"validator",staticClass:"w-full",scopedSlots:e._u([{key:"default",fn:function(t){var a=t.invalid;return[n("form",{on:{submit:function(t){return t.preventDefault(),e.submit()}}},[n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":e.$t("projects.table.code"),name:e.$t("projects.table.code"),autofocus:"",rules:"required|alpha_dash"},model:{value:e.project.code,callback:function(t){e.$set(e.project,"code",t)},expression:"project.code"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":e.$t("projects.table.name"),name:e.$t("projects.table.name"),autofocus:"",rules:"required"},model:{value:e.project.name,callback:function(t){e.$set(e.project,"name",t)},expression:"project.name"}}),n("base-multiselect",{attrs:{"allow-empty":!1,"input-label":e.$t("projects.table.client"),loading:e.loadingSelect,"max-height":200,options:e.clients,label:"name","track-by":"id"},on:{"search-change":function(t){return e.$emit("requestClients",t)}},model:{value:e.project.client,callback:function(t){e.$set(e.project,"client",t)},expression:"project.client"}}),n("base-multiselect",{attrs:{"allow-empty":!1,"custom-label":e.fullManagerName,"input-label":e.$t("projects.table.manager"),"max-height":200,options:e.managers,searchable:!0,"track-by":"id"},model:{value:e.project.manager,callback:function(t){e.$set(e.project,"manager",t)},expression:"project.manager"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":e.$t("projects.table.estimation"),name:e.$t("projects.table.estimation"),min:"0",rules:"required|numeric",type:"number"},model:{value:e.project.estimation,callback:function(t){e.$set(e.project,"estimation",t)},expression:"project.estimation"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":e.$t("projects.table.price"),name:e.$t("projects.table.price"),rules:"required|numeric",type:"number"},model:{value:e.project.price,callback:function(t){e.$set(e.project,"price",t)},expression:"project.price"}}),n("base-multiselect",{attrs:{"custom-label":e.customCurrencyLabel,"allow-empty":!1,"input-label":e.$t("projects.table.currency"),"max-height":200,options:e.currencies},on:{input:e.currencyChange},model:{value:e.project.currency,callback:function(t){e.$set(e.project,"currency",t)},expression:"project.currency"}}),n("date-picker",{staticClass:"w-ful",attrs:{"input-label":e.$t("projects.table.start_date"),name:e.$t("projects.table.start_date"),rules:"required",config:e.startDateConfig},model:{value:e.project.start_date,callback:function(t){e.$set(e.project,"start_date",t)},expression:"project.start_date"}}),n("date-picker",{staticClass:"w-ful",attrs:{"input-label":e.$t("projects.table.end_date"),name:e.$t("projects.table.end_date"),rules:"required",config:e.endDateConfig},model:{value:e.project.end_date,callback:function(t){e.$set(e.project,"end_date",t)},expression:"project.end_date"}}),n("base-textarea",{staticClass:"w-full",attrs:{"input-label":e.$t("projects.table.notes"),name:e.$t("projects.table.notes"),rows:"7"},model:{value:e.project.notes,callback:function(t){e.$set(e.project,"notes",t)},expression:"project.notes"}}),n("base-button",{staticClass:"w-full mb-5 mt-2",attrs:{disabled:a,loading:e.loading,button:"filled",color:"success",type:"submit"}},[e._v(" "+e._s(e.action)+" ")])],1)]}}])})],1)])])}),o=[],i=(n("b0c0"),n("96cf"),n("1da1")),s=n("e94a"),l=n("c1df"),u=n.n(l),d={name:"ProjectDetailsComponent",components:{DatePicker:s["a"]},props:{project:{type:Object,required:!0},managers:{type:Array,required:!0},clients:{type:Array,required:!0},currencies:{type:Array,required:!0},loadingSelect:{type:Boolean,default:!1},action:{type:String,required:!0},loading:{type:Boolean,default:!1}},computed:{endDateConfig:function(){return{minDate:u()(this.project.start_date).add(1,"day").toDate(),dateFormat:"d M Y"}},startDateConfig:function(){return{maxDate:this.project.end_date?u()(this.project.end_date).add(-1,"day").toDate():null,dateFormat:"d M Y"}}},methods:{submit:function(){var e=this;return Object(i["a"])(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.$refs.validator.validate();case 2:if(n=t.sent,n){t.next=5;break}return t.abrupt("return");case 5:e.$emit("confirm");case 6:case"end":return t.stop()}}),t)})))()},currencyChange:function(e){this.project.currency=e},fullManagerName:function(e){var t=e.name,n=e.surname;return"".concat(t," ").concat(n)},customCurrencyLabel:function(e){return this.$t("currencies.".concat(e))}}},p=d,f=n("2877"),m=Object(f["a"])(p,c,o,!1,null,null,null),j=m.exports,b=n("1226"),g=n("73e8"),h={name:"ProjectDetails",components:{ProjectDetailsComponent:j},data:function(){return{projectData:{currency:"EURO"},projectId:null,clients:[],managers:[],currencies:[],isLoadingSelect:!1,loadingContent:!1,loadingData:!1}},computed:{formattedData:function(){var e=Object.assign({},this.projectData);return e.client_id=e.client.id,e.manager_id=e.manager.id,delete e.client,delete e.manager,e},process:function(){return this.projectId?"update":"create"}},methods:{doProject:function(){"update"===this.process?this.updateProject():this.createProject()},createProject:function(){var e=this;this.loadingContent=!0,b["a"].create(this.formattedData).then((function(t){e.$notificationService.success("".concat(e.$t("projects.project")," ").concat(e.$t("notification.successCreate"))),e.$router.replace({name:"projectAssignees",params:{id:t.data.id}})})).catch((function(t){e.$notificationService.error(t.message)})).finally((function(){e.loadingContent=!1}))},updateProject:function(){var e=this;this.loadingContent=!0,b["a"].update(this.formattedData).then((function(){e.$notificationService.success("".concat(e.$t("projects.project")," ").concat(e.$t("notification.successUpdate")))})).catch((function(t){e.$notificationService.error(t.message)})).finally((function(){e.loadingContent=!1}))},getProjectDetails:function(){var e=this;this.loadingData=!0,b["a"].details(this.projectId).then((function(t){e.projectData=t.data})).catch((function(t){e.$notificationService.error(t.message)})).finally((function(){e.loadingData=!1}))},getManagers:function(){var e=this;b["a"].getManagers().then((function(t){e.managers=t.data}))},getCurrencies:function(){var e=this;b["a"].getCurrencies().then((function(t){e.currencies=t}))},getClients:function(e){var t=this;this.isLoadingSelect=!0,g["a"].list(e).then((function(e){t.clients=e.data,t.isLoadingSelect=!1}))}},mounted:function(){this.projectId=parseInt(this.$route.params.id),this.getCurrencies(),this.getManagers(),"update"===this.process&&this.getProjectDetails()}},v=h,$=Object(f["a"])(v,a,r,!1,null,"5c2e7107",null);t["default"]=$.exports},"73e8":function(e,t,n){"use strict";n("d3b7");var a=n("1829"),r=n("18c2");t["a"]={list:function(e){return new Promise((function(t,n){a["a"].get("v1/clients?".concat(Object(r["a"])(e))).then((function(e){return t(e.data)}),(function(e){return n(e)}))}))},details:function(e){return new Promise((function(t,n){a["a"].get("v1/clients/".concat(e)).then((function(e){return t(e.data)}),(function(e){return n(e)}))}))},create:function(e){return new Promise((function(t,n){a["a"].post("v1/clients",e).then((function(e){return t(e.data)}),(function(e){return n(e)}))}))},update:function(e){return new Promise((function(t,n){var r=e.id;a["a"].put("v1/clients/".concat(r),e).then((function(e){return t(e.data)}),(function(e){return n(e)}))}))},delete:function(e){return new Promise((function(t,n){a["a"].delete("v1/clients/".concat(e)).then((function(e){return t(e.data)}),(function(e){return n(e)}))}))}}}}]); //# sourceMappingURL=chunk-98e249de.71ddf952.js.map