%PDF- %PDF-
Direktori : /var/www/html/hr/web/js/ |
Current File : /var/www/html/hr/web/js/chunk-ea1eac90.3edd6dff.js |
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ea1eac90"],{"6cf9":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("vue-portal",{attrs:{to:"hrsys-navbar"}},[n("div",{staticClass:"flex text-2xl font-bold text-center"},[n("base-back-button"),n("base-header-title",{attrs:{title:t.$t("clients.client")}})],1)]),n("base-loader",{attrs:{loading:t.loadingdata}},[n("client-details-component",{attrs:{action:t.$t("buttons."+[t.process]),client:t.clientData,loading:t.loadingContent},on:{confirm:t.doClient}})],1)],1)},i=[],l=(n("99af"),n("d3b7"),n("ac1f"),n("5319"),function(){var t=this,e=t.$createElement,n=t._self._c||e;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:t._u([{key:"default",fn:function(e){var a=e.invalid;return[n("form",{on:{submit:function(e){return e.preventDefault(),t.submit()}}},[n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":t.$t("clients.table.name"),name:t.$t("clients.table.name"),rules:"required|alpha_spaces"},model:{value:t.client.name,callback:function(e){t.$set(t.client,"name",e)},expression:"client.name"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":t.$t("clients.table.address"),name:t.$t("clients.table.address")},model:{value:t.client.address,callback:function(e){t.$set(t.client,"address",e)},expression:"client.address"}}),n("base-input",{staticClass:"w-full",attrs:{label:t.$t("clients.table.email"),"label-placeholder":t.$t("clients.table.email"),name:t.$t("clients.table.email"),type:"email"},model:{value:t.client.email,callback:function(e){t.$set(t.client,"email",e)},expression:"client.email"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":t.$t("clients.table.phone"),name:t.$t("clients.table.phone")},model:{value:t.client.phone,callback:function(e){t.$set(t.client,"phone",e)},expression:"client.phone"}}),n("base-input",{staticClass:"w-full",attrs:{"label-placeholder":t.$t("clients.table.vat_number"),name:t.$t("clients.table.vat_number")},model:{value:t.client.vat_number,callback:function(e){t.$set(t.client,"vat_number",e)},expression:"client.vat_number"}}),n("base-button",{staticClass:"w-full mb-5 mt-2",attrs:{disabled:a,loading:t.loading,button:"filled",color:"success",type:"submit"}},[t._v(" "+t._s(t.action)+" ")])],1)]}}])})],1)])])}),c=[],s=(n("96cf"),n("1da1")),r={name:"ClientDetailsComponent",props:{client:{type:Object,required:!0},action:{type:String,required:!0},loading:{type:Boolean,default:!1}},methods:{submit:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.$refs.validator.validate();case 2:if(n=e.sent,n){e.next=5;break}return e.abrupt("return");case 5:t.$emit("confirm");case 6:case"end":return e.stop()}}),e)})))()}}},o=r,u=n("2877"),d=Object(u["a"])(o,l,c,!1,null,null,null),f=d.exports,m=n("73e8"),p=n("5a78"),b={name:"ClientDetails",components:{BaseLoader:p["default"],ClientDetailsComponent:f},data:function(){return{clientData:{},clientId:null,loadingdata:!1,loadingContent:!1}},methods:{doClient:function(){"update"===this.process?this.updateClient():this.createClient()},getClientDetails:function(){var t=this;this.loadingdata=!0,m["a"].details(this.clientId).then((function(e){t.clientData=e.data})).catch((function(e){t.$notificationService.error(e.message)})).finally((function(){return t.loadingdata=!1}))},createClient:function(){var t=this;this.loadingContent=!0,m["a"].create(this.clientData).then((function(){t.$notificationService.success("".concat(t.$t("clients.client")," ").concat(t.$t("notification.successCreate"))),t.$router.replace({name:"clients"})})).catch((function(e){t.$notificationService.error(e.message)})).finally((function(){t.loadingContent=!1}))},updateClient:function(){var t=this;this.loadingContent=!0,m["a"].update(this.clientData).then((function(){t.$notificationService.success("".concat(t.$t("clients.client")," ").concat(t.$t("notification.successUpdate")))})).catch((function(e){t.$notificationService.error(e.message)})).finally((function(){return t.loadingContent=!1}))}},computed:{process:function(){return this.clientId?"update":"create"}},mounted:function(){this.clientId=parseInt(this.$route.params.id),"update"===this.process&&this.getClientDetails()}},h=b,v=Object(u["a"])(h,a,i,!1,null,"5f826e58",null);e["default"]=v.exports},"73e8":function(t,e,n){"use strict";n("d3b7");var a=n("1829"),i=n("18c2");e["a"]={list:function(t){return new Promise((function(e,n){a["a"].get("v1/clients?".concat(Object(i["a"])(t))).then((function(t){return e(t.data)}),(function(t){return n(t)}))}))},details:function(t){return new Promise((function(e,n){a["a"].get("v1/clients/".concat(t)).then((function(t){return e(t.data)}),(function(t){return n(t)}))}))},create:function(t){return new Promise((function(e,n){a["a"].post("v1/clients",t).then((function(t){return e(t.data)}),(function(t){return n(t)}))}))},update:function(t){return new Promise((function(e,n){var i=t.id;a["a"].put("v1/clients/".concat(i),t).then((function(t){return e(t.data)}),(function(t){return n(t)}))}))},delete:function(t){return new Promise((function(e,n){a["a"].delete("v1/clients/".concat(t)).then((function(t){return e(t.data)}),(function(t){return n(t)}))}))}}}}]); //# sourceMappingURL=chunk-ea1eac90.3edd6dff.js.map