2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
import{_ as N,l as P,r as u,s as c,t as V,v as e,x as t,K as r,L as z,A as C,y as n,B as f,C as M,$ as h,E as m,F as L,U as Y,M as i,f as F,R as j,T as B,S as I,D as T,Q as U,X as R,aP as q,z as K,b_ as J,bY as W}from"./index-edfacc9f.js";import{a as Z}from"./VVirtualScroll-302a72dc.js";import{V as $}from"./VCheckbox-5dac2d55.js";import{V as ee}from"./VForm-b2da0ad2.js";import"./VCheckboxBtn-daeeb7e0.js";import"./VSelectionControl-3f909ce8.js";import"./VInput-6f1d004c.js";const te={props:{type_fetch:{type:String,default:"best"},persons:{type:Array,default:()=>[]},myrealdep:{type:Object,default:()=>{}}},setup(d,{emit:_}){P();const p=u(!1);let l=u(),x=u(),y=u(),o=u();return d.type_fetch=="thanks"?x="api/vote/setthanks/":d.type_fetch=="best"&&(x="api/vote/setbest/"),{approveCandidate:()=>{l.value==="False"||l.value===""?y.value=!1:y.value=l.value,p.value=!0},voteSend:()=>{console.log(l.value),Y.post(x,{cand_name_id:l.value},{headers:{"Content-Type":"application/json"}}).then(g=>{p.value=!1,window.location.reload()})},vote:l,approve_name:y,aproveFalseMessage:o,dialog:p}}},le=i("p",null,"Выбранный кандидат",-1);function ae(d,_,p,l,x,y){return c(),V(ee,{onSubmit:l.voteSend},{default:e(()=>[t(r,{id:"scroll-window-chekbox",height:"300",elevation:"0"},{default:e(()=>[t(Z,{items:p.persons.filter(o=>o.id_dict_department!=1),"item-height":40},{default:e(({item:o})=>[t($,{modelValue:l.vote,"onUpdate:modelValue":_[0]||(_[0]=k=>l.vote=k),id:o.fio,value:o.fio,label:o.fio,required:""},null,8,["modelValue","id","value","label"])]),_:1},8,["items"])]),_:1}),t(L,{class:"justify-center vote-button-back"},{default:e(()=>[t(z,{"max-width":"500",modelValue:l.dialog,"onUpdate:modelValue":_[2]||(_[2]=o=>l.dialog=o)},{activator:e(()=>[t(C,{variant:"elevated",color:"teal-darken-1",onClick:l.approveCandidate},{default:e(()=>[n("Подтвердить выбор")]),_:1},8,["onClick"])]),default:e(()=>[t(r,{class:"justify-center align-center"},{default:e(()=>[t(f,null,{default:e(()=>[n("Вы подтверждаете выбор?")]),_:1}),t(M,null,{default:e(()=>[n("После подтверждения внесение измений станет невозможным.")]),_:1}),le,l.approve_name?(c(),V(f,{key:0},{default:e(()=>[n(h(l.approve_name),1)]),_:1})):(c(),V(f,{key:1},{default:e(()=>[n("Кандидат не выбран повторите голосование")]),_:1})),t(m,{class:"d-flex flex-rows justify-center align-center",cols:"12"},{default:e(()=>[t(m,{cols:"2"},{default:e(()=>[l.approve_name?(c(),V(C,{key:0,variant:"elevated",color:"green-darken-1",onClick:l.voteSend},{default:e(()=>[n("ДА")]),_:1},8,["onClick"])):(c(),V(C,{key:1,variant:"elevated",color:"green-darken-1",onClick:l.voteSend,disabled:""},{default:e(()=>[n("ДА")]),_:1},8,["onClick"]))]),_:1}),t(m,{cols:"2"},{default:e(()=>[t(C,{variant:"elevated",color:"red-darken-1",onClick:_[1]||(_[1]=o=>l.dialog=!1)},{default:e(()=>[n("НЕТ")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["onSubmit"])}const ne=N(te,[["render",ae]]);const se={components:{},props:{usersvotedbest:{type:Array,default:()=>[]},uservotedthanks:{type:Array,default:()=>[]},all_cod:{type:Array,default:()=>[]}},setup(d){P().user.login;let _=u([]),p=u([]);u([]),u([]),u();const l=F({get(){return Math.round(d.uservotedthanks.length*100/(d.all_cod.length+1))}}),x=F({get(){return Math.round(d.usersvotedbest.length*100/(d.all_cod.length+1))}}),y=F({get(){return w(d.usersvotedbest)}}),o=F({get(){let b=[];return d.uservotedthanks.forEach(s=>{let a=b.findIndex(v=>v.cand_name==s.cand_name);a==-1?b.push({...s,total:1}):b[a].total+=1}),b.sort((s,a)=>a.total-s.total)}}),k=b=>{let s={};for(let[a,v]of Object.entries(b))a in s||(s[a]=[]),v.forEach(D=>{let O=s[a].findIndex(G=>G.cand_name==D.cand_name);O>-1?s[a][O].total+=1:s[a].push(D)}),s[a]=s[a].sort((D,O)=>O.total-D.total);return s},w=b=>{let s=[];b.forEach(v=>{s.push({...v,total:1})});let a=Object.groupBy(s,({department_user:v})=>v);return k(a)};F({get(){return[]}});const g=F({get(){let b=d.usersvotedbest.reduce((a,v)=>[...a,v.voted_user],[]);console.log(d.usersvotedbest);let s=Object.groupBy(d.all_cod.filter(a=>b.includes(a.login)==!1),({department:a})=>a);return console.log(s),H(s)}}),A=F({get(){console.log(d.usersvotedbest);let b=d.uservotedthanks.reduce((a,v)=>[...a,v.voted_user],[]),s=Object.groupBy(d.all_cod.filter(a=>b.includes(a.login)==!1),({department:a})=>a);return H(s)}}),H=b=>{let s={};for(let[a,v]of Object.entries(b))a in s||(s[a]=[]),v.forEach(D=>{s[a].push(D)}),s[a]=s[a].sort((D,O)=>O.total-D.total);return s};return{max_thn:o,max_bst:y,perc_best:x,result_thn:_,result_bst:p,perc_thanks:l,notvotedthanks:A,notvotedbest:g}}};function oe(d,_,p,l,x,y){return c(),V(T,{justify:"center",align:"center",class:"pa-2"},{default:e(()=>[t(m,{justify:"center",align:"center",class:"flex-column"},{default:e(()=>[t(r,{width:"700",height:"820",class:"elevation-12"},{default:e(()=>[t(r,{class:"mb-2",color:"teal-darken-1",elevation:"0"},{default:e(()=>[t(f,{color:"teal-darken-1"},{default:e(()=>[n("«Мой коллега самый лучший»")]),_:1})]),_:1}),t(r,{class:"px-2"},{default:e(()=>[t(f,{class:"bg-teal-darken-1"},{default:e(()=>[n("Процент проголосовавших")]),_:1}),t(M,{class:"text-h6 pa-1"},{default:e(()=>[n(h(l.perc_best)+"% ",1)]),_:1})]),_:1}),t(r,{class:"mb-2"},{default:e(()=>[t(f,{class:"bg-teal-darken-1"},{default:e(()=>[n("Лидер номинации")]),_:1})]),_:1}),t(r,{class:"scroll-leaders",elevation:"0"},{default:e(()=>[(c(!0),j(I,null,B(l.max_bst,(o,k)=>(c(),V(r,{key:k,elevation:"0"},{default:e(()=>[t(f,null,{default:e(()=>[n(h(k),1)]),_:2},1024),(c(!0),j(I,null,B(o.slice(0,3),w=>(c(),j("div",{key:w.name},h(w.cand_name)+" - "+h(w.total),1))),128))]),_:2},1024))),128))]),_:1}),t(r,{color:"teal-darken-1",class:"ma-2"},{default:e(()=>[t(f,null,{default:e(()=>[n("ФИО не участвовавших в голосовании")]),_:1})]),_:1}),t(r,{elevation:"0"},{default:e(()=>[t(r,{class:"scroll-window",elevation:"0"},{default:e(()=>[(c(!0),j(I,null,B(Object.entries(l.notvotedbest),([o,k])=>(c(),V(r,null,{default:e(()=>[t(f,null,{default:e(()=>[n(h(o),1)]),_:2},1024),(c(!0),j(I,null,B(k,w=>(c(),j("div",null,h(w.fio),1))),256))]),_:2},1024))),256))]),_:1})]),_:1})]),_:1})]),_:1}),t(m,{justify:"center",align:"center"},{default:e(()=>[t(r,{width:"700",height:"820",class:"elevation-12"},{default:e(()=>[t(r,{class:"mb-2",color:"teal-darken-1",elevation:"0"},{default:e(()=>[t(f,null,{default:e(()=>[n("«Хочу сказать Спасибо!»")]),_:1})]),_:1}),t(r,{class:"px-2"},{default:e(()=>[t(f,{class:"bg-teal-darken-1"},{default:e(()=>[n("Процент проголосовавших")]),_:1}),t(M,{class:"text-h6 pa-1"},{default:e(()=>[n(h(l.perc_thanks)+"% ",1)]),_:1})]),_:1}),t(r,{color:"teal-darken-1"},{default:e(()=>[t(f,null,{default:e(()=>[n("Лидер номинации")]),_:1})]),_:1}),t(r,{class:"scroll-leaders pt-4",elevation:"0"},{default:e(()=>[(c(!0),j(I,null,B(l.max_thn.slice(0,3),o=>(c(),j("div",null,h(o.cand_name)+" - "+h(o.total),1))),256))]),_:1}),t(r,{color:"teal-darken-1",class:"ma-2"},{default:e(()=>[t(f,null,{default:e(()=>[n("ФИО не участвовавших в голосовании")]),_:1})]),_:1}),t(r,{class:"scroll-window",elevation:"0"},{default:e(()=>[(c(!0),j(I,null,B(Object.entries(l.notvotedthanks),([o,k])=>(c(),V(r,null,{default:e(()=>[t(f,null,{default:e(()=>[n(h(o),1)]),_:2},1024),(c(!0),j(I,null,B(k,w=>(c(),j("div",null,h(w.fio),1))),256))]),_:2},1024))),256))]),_:1})]),_:1})]),_:1})]),_:1})}const re=N(se,[["render",oe]]);const de={data:()=>({displayDays:0,displayHours:0,displayMinutes:0}),computed:{_seconds:()=>1e3,_minutes(){return this._seconds*60},_hours(){return this._minutes*60},_days(){return this._hours*24}},mounted(){this.countDown()},methods:{countDown(){const d=setInterval(()=>{const _=new Date,l=new Date(2024,11-1,14,10,10,10).getTime()-_.getTime();if(l<0){clearInterval(d);return}const x=Math.floor(l/this._days),y=Math.floor(l%this._days/this._hours),o=Math.floor(l%this._hours/this._minutes);this.displayMinutes=o<10?"0"+o:o,this.displayHours=o<10&o>10?"0"+y:y,this.displayDays=x},1e3)}}},ie=i("h3",null,"ДО КОНЦА ГОЛОСОВАНИЯ ОСТАЛОСЬ:",-1),ce={class:"card-count"};function ue(d,_,p,l,x,y){return c(),j(I,null,[ie,i("div",ce,h(d.displayDays)+" дней "+h(d.displayHours)+" часов "+h(d.displayMinutes)+" минут",1)],64)}const _e=N(de,[["render",ue]]),Q="/assets/click3-8abcd36a.gif";let X=u(!1),E=P();const fe={components:{VoteForm:ne,CountDown:_e,VoteAdmin:re},setup(){u([]),u([]),u([]),u([]);let d=u(!1),_=u(!1);const p=u({id_dict_department:0,id:0});u([!0,!0]);const l=u([]),x=u(!1),y=u(!1),o=u({usersvotedbest:[],uservotedthanks:[]});Y.get("/api/vote/getvoteinfo/").then(s=>{l.value=s.data.allcod,p.value=l.value.find(a=>a.login===E.user.login),console.log(p.value),o.value=s.data.voteresults,console.log(s.data.voteresults)});const k=()=>{x.value=!x.value},w=()=>{y.value=!y.value};["9966-00-134","9966-00-141","9966-00-011","9966-00-125"].includes(E.user.login)&&(X=!0);const g=F({get(){return l.value.filter(a=>a.id!=p.value.id).sort((a,v)=>v.fio>a.fio?-1:v.fio<a.fio?1:0)}}),A=F({get(){return!(o.value.uservotedthanks.findIndex(a=>a.voted_user===E.user.login)>-1)}}),H=F({get(){return!(o.value.usersvotedbest.findIndex(a=>a.voted_user===E.user.login)>-1)}}),b=F({get(){return console.log(l.value),l.value.filter(a=>a.id_dict_department===p.value.id_dict_department&&a.id!=p.value.id).sort((a,v)=>v.fio>a.fio?-1:v.fio<a.fio?1:0)}});return{myrealdep:p,allsorted:g,mydepartment:b,isFlipped1:x,toggleFlip1:k,isFlipped2:y,toggleFlip2:w,account_login:E,admin_panel:X,voted_bst:_,voted_thn:d,uservotedthanks:A,uservotedbest:H,voteresults:o}}},S=d=>(J("data-v-53613449"),d=d(),W(),d),ve={class:"flip-card-inner"},he={key:0,class:"flip-card-front"},pe={class:"justify-center"},ge=S(()=>i("p",null,"ВЫ УЖЕ ПРОГОЛОСОВАЛИ.",-1)),me=S(()=>i("p",null,"СПАСИБО!",-1)),ye={class:"justify-center"},ke=S(()=>i("br",null,null,-1)),be=S(()=>i("br",null,null,-1)),je=S(()=>i("br",null,null,-1)),xe={class:"flip-card-back"},we={class:"flip-card-inner"},Ve={key:0,class:"flip-card-front"},Ce={class:"justify-center"},Fe=S(()=>i("p",null,"ВЫ УЖЕ ПРОГОЛОСОВАЛИ.",-1)),Se=S(()=>i("p",null,"СПАСИБО!",-1)),Me={class:"justify-center"},De=S(()=>i("br",null,null,-1)),Ie=S(()=>i("br",null,null,-1)),Ae=S(()=>i("br",null,null,-1)),Be={class:"flip-card-back"};function Oe(d,_,p,l,x,y){const o=U("vote-form"),k=U("vote-admin"),w=U("count-down");return c(),V(T,{justify:"center",class:"d-flex align-start h-100"},{default:e(()=>[t(m,{cols:"12",class:"d-flex align-center justify-center vote-main-title pa-0 ma-0"},{default:e(()=>[t(m,{cols:"6",class:"pb-0 mb-0"},{default:e(()=>[n("ВЫБИРАЕМ ЛУЧШИХ СОТРУДНИКОВ 2024")]),_:1})]),_:1}),t(m,{cols:"12",justify:"center",class:"d-flex vote-card-container"},{default:e(()=>[t(m,{cols:"6",justify:"center",align:"center"},{default:e(()=>[i("div",{class:q(["flip-card",{flipped:l.isFlipped1}])},[i("div",ve,[l.uservotedbest?(c(),j("div",{key:1,class:"flip-card-front",onClick:_[0]||(_[0]=(...g)=>l.toggleFlip1&&l.toggleFlip1(...g))},[t(r,{class:"justify-center elevation-24",width:"500",height:"510",elevated:""},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n("ЛУЧШИЙ В ОТДЕЛЕ")]),_:1}),i("div",ye,[i("div",null,[t(r,{class:"vote-card-information",variant:"flat"},{default:e(()=>[t(M,{class:"justify-center align-center vote-card-information-title"},{default:e(()=>[n(" Выберите сотрудника,"),ke,n(" который, на Ваш взгляд,"),be,n(" внес наибольший вклад в результат работы"),je,n(" Отдела в 2024 году ")]),_:1})]),_:1})]),t(C,{height:100,variant:"flat",type:"button"},{default:e(()=>[t(R,{width:100,cover:"",src:Q})]),_:1})])]),_:1})])):(c(),j("div",he,[t(r,{class:"justify-center elevation-24",width:"500",height:"510",elevated:""},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n("ЛУЧШИЙ В ОТДЕЛЕ")]),_:1}),i("div",pe,[i("div",null,[t(r,{class:"vote-card-information",flat:""},{default:e(()=>[t(M,{class:"justify-center align-center vote-card-information-title"},{default:e(()=>[ge,me]),_:1})]),_:1})])])]),_:1})])),i("div",xe,[t(r,{class:"justify-center elevation-24",width:"500",height:"510"},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n(" МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ ")]),_:1}),t(M,null,{default:e(()=>[t(o,{type_fetch:"best",persons:l.mydepartment,myrealdep:l.myrealdep,onVoted:l.toggleFlip1},null,8,["persons","myrealdep","onVoted"])]),_:1}),t(L,{class:"justify-center vote-button-back"},{default:e(()=>[t(C,{onClick:l.toggleFlip1,variant:"elevated",color:"teal-darken-1",type:"button"},{default:e(()=>[n("назад")]),_:1},8,["onClick"])]),_:1})]),_:1})])])],2)]),_:1}),t(m,{cols:"6",justify:"center",align:"center"},{default:e(()=>[i("div",{class:q(["flip-card",{flipped:l.isFlipped2}])},[i("div",we,[l.uservotedthanks?(c(),j("div",{key:1,class:"flip-card-front",onClick:_[1]||(_[1]=(...g)=>l.toggleFlip2&&l.toggleFlip2(...g))},[t(r,{class:"justify-center elevation-24",width:"500",height:"510",variant:"elevated"},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n("ХОЧУ СКАЗАТЬ СПАСИБО")]),_:1}),i("div",Me,[i("div",null,[t(r,{class:"vote-card-information",variant:"flat"},{default:e(()=>[t(M,{class:"justify-center align-center vote-card-information-title"},{default:e(()=>[n(" Выберите сотрудника "),De,n(" (не из Вашего отдела),"),Ie,n(" которому Вы лично готовы обьявить"),Ae,n(" благодарность по итогам работы в 2024 году ")]),_:1})]),_:1})]),t(C,{height:100,variant:"flat",type:"button"},{default:e(()=>[t(R,{width:100,cover:"",src:Q})]),_:1})])]),_:1})])):(c(),j("div",Ve,[t(r,{class:"justify-center elevation-24",width:"500",height:"510",variant:"elevated"},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n("ХОЧУ СКАЗАТЬ СПАСИБО")]),_:1}),i("div",Ce,[i("div",null,[t(r,{class:"vote-card-information",variant:"flat"},{default:e(()=>[t(M,{class:"justify-center align-center vote-card-information-title"},{default:e(()=>[Fe,Se]),_:1})]),_:1})])])]),_:1})])),i("div",Be,[t(r,{class:"justify-center elevation-24",width:"500",height:"510",variant:"elevated"},{default:e(()=>[t(f,{class:"vote-title"},{default:e(()=>[n(" ХОЧУ СКАЗАТЬ СПАСИБО ")]),_:1}),t(M,null,{default:e(()=>[t(o,{type_fetch:"thanks",persons:l.allsorted,myrealdep:l.myrealdep,onVoted:l.toggleFlip2},null,8,["persons","myrealdep","onVoted"])]),_:1}),t(L,{class:"justify-center vote-button-back"},{default:e(()=>[t(C,{onClick:l.toggleFlip2,variant:"elevated",color:"teal-darken-1",type:"button"},{default:e(()=>[n("назад")]),_:1},8,["onClick"])]),_:1})]),_:1})])])],2)]),_:1})]),_:1}),t(m,{cols:"12",class:"d-flex justify-center align-end pa-0"},{default:e(()=>[l.admin_panel?(c(),V(m,{key:0,justify:"center",align:"center",cols:"6",class:"pa-0"},{default:e(()=>[t(z,null,{activator:e(({props:g})=>[t(C,K(g,{variant:"plain",class:"procent_card_font pa-0"}),{default:e(()=>[n(h(Math.round((l.voteresults.usersvotedbest.filter(A=>A.department_user==l.mydepartment[0].department).length*100/(l.mydepartment.length+1)).toFixed(2)))+"% ",1)]),_:2},1040)]),default:e(({isActive:g})=>[t(T,{justify:"center",class:"h-100 admin-vote"},{default:e(()=>[t(r,{width:"1500",height:"900"},{default:e(()=>[t(k,{usersvotedbest:l.voteresults.usersvotedbest,uservotedthanks:l.voteresults.uservotedthanks,all_cod:l.allsorted},null,8,["usersvotedbest","uservotedthanks","all_cod"]),t(T,{justify:"center",align:"center"},{default:e(()=>[t(C,{color:"teal-darken-1",onClick:A=>g.value=!1},{default:e(()=>[n("ЗАКРЫТЬ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:1})]),_:1})):(c(),V(m,{key:1,justify:"center",align:"center",cols:"6",class:"procent_card_font pa-0"},{default:e(()=>[i("span",null,h(Math.round((l.voteresults.usersvotedbest.filter(g=>g.department_user==l.mydepartment[0].department).length*100/(l.mydepartment.length+1)).toFixed(2)))+"%",1)]),_:1})),l.admin_panel?(c(),V(m,{key:2,justify:"center",align:"center",cols:"6",class:"pa-0"},{default:e(()=>[t(z,null,{activator:e(({props:g})=>[t(C,K(g,{variant:"plain",class:"procent_card_font pa-0"}),{default:e(()=>[i("span",null,h(Math.round((l.voteresults.uservotedthanks.length*100/(l.allsorted.length+1)).toFixed(2)))+"%",1)]),_:2},1040)]),default:e(({isActive:g})=>[t(T,{justify:"center",class:"h-100 admin-vote"},{default:e(()=>[t(r,{width:"1500",height:"900"},{default:e(()=>[t(k,{usersvotedbest:l.voteresults.usersvotedbest,uservotedthanks:l.voteresults.uservotedthanks,all_cod:l.allsorted},null,8,["usersvotedbest","uservotedthanks","all_cod"]),t(T,{justify:"center",align:"center"},{default:e(()=>[t(C,{color:"teal-darken-1",onClick:A=>g.value=!1},{default:e(()=>[n("ЗАКРЫТЬ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:1})]),_:1})):(c(),V(m,{key:3,justify:"center",align:"center",cols:"6",class:"procent_card_font pa-0"},{default:e(()=>[i("span",null,h(Math.round((l.voteresults.uservotedthanks.length*100/(l.allsorted.length+1)).toFixed(2)))+"%",1)]),_:1}))]),_:1}),t(m,{cols:"12",class:"d-flex justify-center align-start pa-0"},{default:e(()=>[t(m,{justify:"center",align:"center",cols:"6",class:"vote-cards_cell"},{default:e(()=>[t(w)]),_:1})]),_:1})]),_:1})}const Pe=N(fe,[["render",Oe],["__scopeId","data-v-53613449"]]);export{Pe as default};
|