This commit is contained in:
romankko2 committed 2022-12-12 21:15:00 +01:00
1 parent 024fe7f1d4
commit 0061092833
159 files changed
+1194

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
"use strict";(self["webpackChunkjandl"]=self["webpackChunkjandl"]||[]).push([[61],{2908:function(e,t,a){a.d(t,{Z:function(){return h}});var l=a(3396),n=a(3862),s=a(7139),o=a(165);const i={class:"wrapper"},r={key:0,class:"suggestion"},d={class:"hidden-part"};function u(e,t,a,u,c,p){return(0,l.wg)(),(0,l.iD)("div",i,[(0,l.Wm)(o.hw,{label:"Vyhľadať zamestnanca",variant:"solo",modelValue:c.search,"onUpdate:modelValue":t[0]||(t[0]=e=>c.search=e),onKeydown:t[1]||(t[1]=(0,n.D2)((e=>p.optionSelected()),["enter"])),class:(0,s.C_)({error:a.validations?.$errors?.length}),hint:a.validations?.$errors?c.errorUtils.parseErrors(a.validations?.$errors):null},null,8,["modelValue","class","hint"]),p.suggestion?((0,l.wg)(),(0,l.iD)("div",r,[(0,l._)("span",d,(0,s.zw)(p.suggestion._suggestionHiddenPart),1),(0,l._)("span",null,(0,s.zw)(p.suggestion._suggestionShownPart),1)])):(0,l.kq)("",!0)])}var c=a(7648),p={emits:["option-selected"],props:{options:{type:Array,required:!0},validations:{type:Object||null,required:!1}},data(){return{errorUtils:c.Z,search:""}},computed:{suggestion(){const e=this._normalize(this.search);if(!e.length||!this.options.length)return null;const t=this.options.filter((t=>{const a=this._normalize(t.value);return e==a.slice(0,e.length)}));if(!t[0])return null;const a={...t[0],_suggestionHiddenPart:t[0].value.slice(0,e.length),_suggestionShownPart:t[0].value.slice(e.length,t[0].value.length)};return a}},methods:{optionSelected(){this.suggestion&&(this.$emit("option-selected",this.suggestion),this.search="")},_normalize(e){return e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}}},m=a(89);const v=(0,m.Z)(p,[["render",u],["__scopeId","data-v-2aea25fa"]]);var h=v},61:function(e,t,a){a.d(t,{Z:function(){return $}});var l=a(3396),n=a(7139),s=a(3862),o=a(870),i=a(251),r=a(1334),d=a(3601),u=a(3289),c=a(165);const p={class:"d-flex justify-space-between align-center modal-header"};function m(e,t,a,m,v,h){const f=(0,l.up)("Z-autocomplete"),g=(0,l.up)("W-loadable");return(0,l.wg)(),(0,l.j4)(d.B,{modelValue:h.show,"onUpdate:modelValue":t[3]||(t[3]=e=>h.show=e),"max-width":"650","max-height":"90%",height:"700px"},{default:(0,l.w5)((()=>[(0,l.Wm)(g,{content:v.allEmployees,class:"h-100"},{default:(0,l.w5)((()=>[(0,l.Wm)(i._,{height:"100%",class:"d-flex flex-column"},{default:(0,l.w5)((()=>[(0,l._)("div",p,[(0,l._)("h1",null,(0,n.zw)(v.team.id?"Upraviť tím":"Vytvoriť tím"),1),(0,l.Wm)(u.t,{onClick:t[0]||(t[0]=(0,s.iM)((e=>h.show=!1),["stop"])),icon:"mdi-close",size:"large"})]),(0,l.Wm)(r.h,{class:"d-flex flex-column modal-content"},{default:(0,l.w5)((()=>[(0,l.Wm)(c.hw,{class:(0,n.C_)(["modal-input",{error:v.v$.team.name.$errors.length}]),label:"Názov tímu",variant:"solo",hint:v.v$.team.name.$errors?v.errorUtils.parseErrors(v.v$.team.name.$errors):null,modelValue:v.team.name,"onUpdate:modelValue":t[1]||(t[1]=e=>v.team.name=e)},null,8,["class","hint","modelValue"]),((0,l.wg)(!0),(0,l.iD)(l.HY,null,(0,l.Ko)(v.team.employees,((e,t)=>((0,l.wg)(),(0,l.iD)("div",{class:"employee-position w-100",key:e.id},[(0,l.Wm)(c.hw,{class:"modal-input",disabled:"",label:"Zamestanec",variant:"solo",modelValue:v.team.employees[t]._fullName,"onUpdate:modelValue":e=>v.team.employees[t]._fullName=e},null,8,["modelValue","onUpdate:modelValue"]),(0,l.Wm)(u.t,{class:"remove-input",onClick:(0,s.iM)((e=>v.team.employees.splice(t,1)),["stop"]),icon:"mdi-close",size:"small"},null,8,["onClick"])])))),128)),(0,l.Wm)(f,{options:h.employeesOptions,validations:v.v$.team.employees,class:"modal-input",onOptionSelected:h.employeeSelected},null,8,["options","validations","onOptionSelected"])])),_:1}),(0,l.Wm)(o.T,{class:"z-btn",onClick:t[2]||(t[2]=e=>h.save())},{default:(0,l.w5)((()=>[(0,l.Uk)((0,n.zw)(v.team.id?"UPRAVIŤ":"VYTVORIŤ"),1)])),_:1})])),_:1})])),_:1},8,["content"])])),_:1},8,["modelValue"])}a(7658);var v=a(2908),h=a(3053),f=a(9117),g=a(7648),y=a(5941);const b=e=>e.length;var _={components:{ZAutocomplete:v.Z},props:{visible:{type:Boolean,required:!0},teamId:{type:Number||null,required:!1,default:null}},data(){return{allEmployees:null,v$:(0,h.ZP)(),errorUtils:g.Z,team:{name:"",employees:[]}}},validations(){return{team:{name:{required:f.C1},employees:{atLeastOne:b}}}},async created(){this.teamId&&await this._load();try{const e=await this.$axios.get_auth_data("v1/employees");this.allEmployees=this._enrichEmployeesByFullName(e)}catch(e){this.$toast.error(e)}},methods:{async save(){if(!await this.v$.$validate())return y.log(this.v$);try{this.team.id?await this._edit():await this._create(),this.$router.push({name:"Overview - Teams"}),this.show=!1}catch(e){y.log(e)}},async _create(){try{await this.$axios.post_auth("v1/teams",this.team)}catch(e){this.$toast.error(e.response.data.error)}},async _edit(){try{await this.$axios.post_auth(`v1/teams/${this.team.id}`,this.team)}catch(e){this.$toast.error(e.response.data.error)}},async _load(){try{const e=await this.$axios.get_auth_data(`v1/teams/${this.teamId}`);e.employees=this._enricLine truncated
//# sourceMappingURL=61.803f4174.js.map