"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[8373],{2628:function(t,s,e){function r(t){var s=t[0],e=t[1],r=t[2];s/=255,e/=255,r/=255;var a,n,u=Math.max(s,e,r),i=Math.min(s,e,r),o=(u+i)/2;if(u==i)a=n=0;else{var l=u-i;switch(n=o>.5?l/(2-u-i):l/(u+i),u){case s:a=(e-r)/l+(e<r?6:0);break;case e:a=(r-s)/l+2;break;case r:a=(s-e)/l+4;break}a/=6}return[a,n,o]}function a(t){var s,e,r,a=t[0],n=t[1],u=t[2];if(0==n)s=e=r=u;else{function l(t,s,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(s-t)*e:e<.5?s:e<2/3?t+(s-t)*(2/3-e)*6:t}var i=u<.5?u*(1+n):u+n-u*n,o=2*u-i;s=l(o,i,a+1/3),e=l(o,i,a),r=l(o,i,a-1/3)}return[Math.round(255*s),Math.round(255*e),Math.round(255*r)]}function n(t){var s={};for(var e in t)if(null!=t[e].BROWSER_COLOR){var n=t[e].BROWSER_COLOR.replace("$00",""),u=[n.substring(4,6),n.substring(2,4),n.substring(0,2)];for(var i in u)u[i]=parseInt(u[i],16);var o=r(u);for(var i in o[2]=170/255,u=a(o),n="",u)u[i]<16&&(n+="0"),n+=u[i].toString(16);s[t[e].DOCEVENTKIND_ID]="#"+n}return s}e.d(s,{A:function(){return n}})},3138:function(t,s,e){e.r(s),e.d(s,{default:function(){return h}});var r=function(){var t=this,s=t._self._c;return t.stages.length>0?s("ButtonMenu",{attrs:{title:"Статус",dropdownTitle:"Выберите статус",icon:'<i class="fas fa-chevron-circle-down"></i>',showArrow:!0,buttonClasses:t.buttonClasses,showListIcons:!0,items:t.menuItems},on:{select:function(s){return t.setStage(s.stage)}}}):t._e()},a=[],n=e(2628),u=e(2779),i={name:"selectStatusButton",components:{ButtonMenu:()=>e.e(2466).then(e.bind(e,6433))},props:{stages:Array,statusColors:Array,statusId:{type:Number,default:null}},data(){return{colors:null,curStage:null}},computed:{buttonClasses(){return["uk-button","uk-button-small",null!==this.curStage?"uk-button-primary":"uk-button-default"]},menuItems(){let t=t=>{if(this.stageColor(t)){let s=this.curStage===t?"fas fa-chevron-circle-down":"fas fa-circle";return'<i class="'+s+'" style="color:'+this.stageColor(t)+'" />'}return this.curStage===t?'<i class="fas fa-check"></i>':null},s=this.stages.map((s=>({id:s.ID,title:s.NAME,icon:t(s),stage:s})));return s=[{id:0,title:"Все",icon:null===this.curStage?'<i class="fas fa-check"></i>':null,stage:null},...s],s}},watch:{statusId(){this.loadStatus()}},created(){this.colors=(0,n.A)(this.statusColors),this.loadStatus()},methods:{stageColor(t){return this.colors[t.STATUS_ID]},loadStatus(){this.statusId?this.curStage=this.stages.find((t=>t.STATUS_ID===this.statusId)):this.curStage=null},setStage(t){this.curStage=t,this.$emit("change",this.curStage),u.dropdown(this.$refs.dropdown).hide(!1)}}},o=i,l=e(1656),c=(0,l.A)(o,r,a,!1,null,null,null),h=c.exports}}]);
//# sourceMappingURL=SelectStatusButton.f82336c6.js.map