%PDF- %PDF-
Direktori : /var/www/html/hr/web/js/ |
Current File : /var/www/html/hr/web/js/chunk-5afd6fbe.13471a71.js |
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5afd6fbe"],{"04c0":function(t,e,a){"use strict";a("d3b7"),a("3ca3"),a("ddb0"),a("2b3d");var o=a("1829"),n=a("18c2");e["a"]={list:function(t){return new Promise((function(e,a){o["a"].get("v1/holidays?".concat(Object(n["a"])(t))).then((function(t){return e(t.data)}),(function(t){return a(t)})).catch((function(t){return a(t)}))}))},downloadExcelExample:function(){return new Promise((function(t,e){Object(o["a"])({url:"v1/holidays/actions/downloadExcelExample",method:"GET",responseType:"blob"}).then((function(e){var a=window.URL.createObjectURL(new Blob([e.data])),o=document.createElement("a");o.href=a,o.setAttribute("download","holidays_import_example.xlsx"),document.body.appendChild(o),o.click(),t()}),(function(t){return e(t)}))}))},holidays:function(t){return new Promise((function(e,a){o["a"].get("v1/daysOff?".concat(Object(n["a"])(t))).then((function(t){return e(t.data)}),(function(t){return a(t)})).catch((function(t){return a(t)}))}))},getMonthData:function(t){return new Promise((function(e,a){o["a"].get("v1/getMonthData?".concat(Object(n["a"])(t))).then((function(t){return e(t.data)}),(function(t){return a(t)})).catch((function(t){return a(t)}))}))},create:function(t){return new Promise((function(e,a){o["a"].post("v1/holidays",t).then((function(t){return e(t.data)}),(function(t){return a(t)}))}))}}},5980:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[t.importError&&t.importError.message?a("div",{staticClass:"view-container"},[a("FileImportError",{attrs:{error:t.importError},on:{close:t.closeImportError}})],1):t._e(),a("div",{staticClass:"view-container"},[a("vue-portal",{attrs:{to:"hrsys-navbar-actions"}},[a("div",{staticClass:"flex"},[a("base-header-title",{attrs:{title:t.$t("modules.holidays")}}),a("vx-tooltip",{staticClass:"ml-2",attrs:{text:t.$t("buttons.create"),position:"bottom"}},[a("base-button",{staticClass:"self-end px-3",attrs:{icon:"plus"},on:{click:function(e){return t.$router.push({name:"holidayDetails",params:{id:0}})}}})],1),a("vx-tooltip",{attrs:{text:t.$t("buttons.import"),position:"bottom"}},[a("FileImport",{attrs:{options:t.flowConfig},on:{fileError:t.fileError,fileSuccess:t.fileSuccess}},[a("BaseIcon",{attrs:{"fixed-width":"",name:"upload"}})],1)],1),a("vx-tooltip",{staticClass:"ml-2",attrs:{text:t.$t("buttons.downloadExample"),position:"bottom"}},[a("base-button",{staticClass:"self-end px-3",attrs:{loading:t.downloading,icon:"download"},on:{click:t.downloadExcelExample}})],1)],1)]),a("base-loader",{attrs:{loading:t.loading}},[a("div",{staticClass:"flex relative py-5 justify-between w-full"},[a("div",{staticClass:"flex mx-auto"},[a("base-button",{staticClass:"px-2 py-2 rounded-full",attrs:{button:"filled",icon:"arrow-left"},on:{click:function(e){return t.changeYear(-1)}}}),a("div",{staticClass:"text-xl font-semibold mx-2 self-center"},[t._v(t._s(t.queryParams.year))]),a("base-button",{staticClass:"px-2 py-2 rounded-full",attrs:{button:"filled",icon:"arrow-right"},on:{click:function(e){return t.changeYear(1)}}})],1)]),a("holidays-table",{attrs:{header:t.tableHeader,holidays:t.list}})],1)],1)])},n=[],r=(a("d3b7"),a("ac1f"),a("841c"),a("c1df")),i=a("fc22"),s=a("2744"),c=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("vs-table",{attrs:{data:t.holidays},scopedSlots:t._u([{key:"default",fn:function(e){var o=e.data;return t._l(o,(function(e,o){return a("vs-tr",{key:o,attrs:{data:e}},[a("vs-td",{attrs:{data:e.name}},[t._v(" "+t._s(e.name)+" ")]),a("vs-td",{attrs:{data:e.date}},[t._v(" "+t._s(t._f("fromShortDate")(e.date,"MMMM Do"))+" ")])],1)}))}}])},[a("template",{slot:"thead"},t._l(t.header,(function(e,o){return a("vs-th",{key:o,staticClass:"text-base",class:{"float-right":e===t.$t("holidays.table.actions")}},[t._v(t._s(e)+" ")])})),1)],2)],1)},l=[],u={name:"HolidaysTable",components:{},props:{header:{type:Array,required:!0},holidays:{type:Array,required:!0},loading:{type:Boolean,default:!1}}},d=u,f=a("2877"),h=Object(f["a"])(d,c,l,!1,null,"7faba155",null),p=h.exports,m=a("04c0"),y={name:"Holidays",components:{FileImport:i["a"],FileImportError:s["a"],HolidaysTable:p},data:function(){return{downloading:!1,list:[],importError:{message:"",errors:[]},flowConfig:{singleFile:!0,testChunks:!1,allowDuplicateUploads:!0,attributes:{accept:".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"},target:"".concat("https://api.hr.coding.al/api/","v1/holidays/actions/import"),headers:{Authorization:"Bearer ".concat(localStorage.getItem("access_token"))}},queryParams:{year:r().year()},loading:!1}},methods:{getHolidays:function(){var t=this;this.loading=!0;var e=this;m["a"].list(this.queryParams).then((function(a){e.$router.push({query:t.queryParams}).catch((function(){})),t.list=a.data})).finally((function(){return t.loading=!1}))},changeYear:function(t){this.queryParams.year=parseInt(this.queryParams.year)+t,this.search()},search:function(){this.$router.push({query:this.queryParams}).catch((function(){})),this.getHolidays()},getUrlParams:function(){var t=this;this.$route.query.year&&(t.queryParams=Object.assign({},t.$route.query))},fileSuccess:function(){this.importError={},this.$notificationService.success(this.$t("holidays.import.success")),this.search()},fileError:function(t){this.importError=JSON.parse(t.message)},closeImportError:function(){this.importError={}},downloadExcelExample:function(){var t=this;this.downloading=!0,m["a"].downloadExcelExample().then((function(){t.downloading=!1})).catch((function(e){t.$notificationService.error(e),t.downloading=!1}))}},computed:{tableHeader:function(){return[this.$t("holidays.table.name"),this.$t("holidays.table.date")]}},created:function(){this.getUrlParams(),this.getHolidays()}},b=y,v=Object(f["a"])(b,o,n,!1,null,"76a8be4e",null);e["default"]=v.exports}}]); //# sourceMappingURL=chunk-5afd6fbe.13471a71.js.map