meraproject/content/merakomis/js/react/1762006373520/848.app.js
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

1 line
11 KiB
JavaScript

"use strict";(self.webpackChunkmodule_bz=self.webpackChunkmodule_bz||[]).push([[848],{7848:(e,t,n)=>{n.r(t),n.d(t,{default:()=>_});var l,a,r,i,o=n(1504);class s extends o.Component{constructor(e){super(e),this.state={loading:!1,refreshing:!1,data:[],filterData:{}}}}l=s,r=void 0,(a="symbol"==typeof(i=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,"string");if("object"!=typeof l)return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(a="defaultProps"))?i:String(i))in l?Object.defineProperty(l,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):l[a]=r,s.defaultProps={};var m=n(6591),c=n(9584),u=n(6576),d=n(7888),h=n(2400),p=n(760),E=n(2480),f=n(7376),b=n(6904),g=n(1611),y=n(7696);function v(e,t,n){return t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,"string");if("object"!=typeof l)return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class _ extends s{constructor(...e){var t;super(...e),t=this,v(this,"wrap",void 0),v(this,"yearInput",void 0),v(this,"monthInput",void 0),v(this,"nameInput",void 0),v(this,"markInput",void 0),v(this,"getCountMonths",(function(){return 2})),v(this,"reload",(function(e=!1){let n={year:t.yearInput.getValue(),month:t.monthInput.getValue(),name:t.nameInput.getValue(),filter:t.state.filterData};e?t.setState({refreshing:!0}):t.setState({loading:!0}),d.API.requestTheme(".fot/import",n,(function(e,n){t.setState({loading:!1,refreshing:!1,data:e})})),console.log("send",n)})),v(this,"focusElement",void 0),v(this,"initValue",void 0),v(this,"filter",void 0)}componentDidMount(){this.reload()}refresh(){this.reload(!0)}openForm(e){var t=this;h.G.openForm("fot",{id:e.id},{onSubmit:function(){t.reload()},getCustomInput:h.G.app.props.getCustomInput,footerClassName:"dn"})}formatValue(){this.focusElement.innerHTML=this.focusElement.innerHTML.replace(/<[^>]*>/g,""),this.focusElement.innerHTML=this.focusElement.innerHTML.replace(/,/g,"."),this.focusElement.innerHTML=this.focusElement.innerHTML.replace(/[^\d.]/g,"");let e=parseFloat(this.focusElement.innerHTML);return isNaN(e)?(this.focusElement.innerHTML=this.initValue,null):(this.focusElement.innerHTML=e.toFixed(2),e)}update(e,t){var n=this;let l=this.formatValue();null!=l&&(e[t]=l,d.API.requestTheme(".fot/updateFromTable",{id:e.id,type:t,value:l},(function(e,t){n.refresh()})))}updateBudget(){var e=this;let t=this.formatValue();null!=t&&d.API.requestTheme(".fot.budget/updateFromTable",{id:this.state.data.budget.id,value:t},(function(t,n){e.refresh()}))}setFocusTd(e){this.focusElement=e.target,this.initValue=e.target.innerHTML}formatTd(e){13==e.which&&(this.focusElement.blur(),e.preventDefault())}restate(){this.forceUpdate(),console.log("restate")}sortEmps(e,t){let{data:n}=this.state,l=n.data[e],a=n.data[t],r=n.year+""+n.month,i=l[r].name,o=a[r].name;return i==o?0:1==f.cp.groups[f.wR].direction?i<o?1:-1:i>o?1:-1}render(){var e=this;let{loading:t,refreshing:n,data:l}=this.state,a=this.getCountMonths(),r=[],i=(new Date).getFullYear(),s=(new Date).getMonth()+1;for(let e=i+1;e>=2022;e--)r.push({id:e,title:e});return o.createElement("div",{id:"time_tracker",className:"not_me refreshable "+(n?" loading":"")},o.createElement(c.c,{className:"analysis_table"},o.createElement(u.c,null,o.createElement("div",{id:"project_card_content"},o.createElement("div",{ref:function(t){return e.wrap=t}},o.createElement("div",{id:"fot"},o.createElement("div",{id:"fot_title"},o.createElement("div",{className:"merakomis_title"},"ФОТ"),o.createElement("div",{id:"fot_filter"},o.createElement(m.Select,{options:r,value:parseInt(i),ref:function(t){return e.yearInput=t},onChange:this.reload.bind(this)}),o.createElement(m.Select,{options:[{id:1,title:"Январь"},{id:2,title:"Февраль"},{id:3,title:"Март"},{id:4,title:"Апрель"},{id:5,title:"Май"},{id:6,title:"Июнь"},{id:7,title:"Июль"},{id:8,title:"Август"},{id:9,title:"Сентябрь"},{id:10,title:"Октябрь"},{id:11,title:"Ноябрь"},{id:12,title:"Декабрь"}],value:parseInt(s),ref:function(t){return e.monthInput=t},onChange:this.reload.bind(this)}),o.createElement(m.Text,{placeholder:"Поиск по ФИО",value:"",ref:function(t){return e.nameInput=t},onKeyUp:this.reload.bind(this)}),o.createElement("button",{style:{margin:"0"},onClick:this.reload.bind(this),className:"btn only_icon mini_padding merakomis_icon_filter_refresh"}),o.createElement(y.c,{ref:function(t){return e.filter=t},showInputSearch:!1,data:{saved:this.state.data.saved,columns:[{name:"staffing",type:g.o.SELECT,value:0,label:"Должность",options:l&&l.options?l.options.staffing:[]},{name:"department",type:g.o.SELECT,value:0,label:"Подразделение",options:l&&l.options?l.options.department:[]},{name:"city",type:g.o.SELECT,value:0,label:"Локация",options:l&&l.options?l.options.city:[]},{name:"org",type:g.o.SELECT,value:0,label:"Юр. лицо",options:l&&l.options?l.options.org:[]},{name:"orgtype",type:g.o.SELECT,value:0,label:"Вид сотрудничества",options:l&&l.options?l.options.orgtype:[]},{name:"freelance",type:g.o.BOOLEAN,label:"Удалёнка",value:-1}]},customSwitcher:p.A.getCustomTableSwitcher(),onSubmit:function(t){console.log("filterSubmit",t),t||(t={}),e.setState({filterData:t},e.refresh)}}),o.createElement("form",{action:"/api/themes.merakomis.download/report/",method:"POST",target:"_blank"},o.createElement("input",{type:"hidden",value:JSON.stringify(this.state.data),name:"data"}),o.createElement("input",{type:"hidden",value:JSON.stringify({type:"money_fot"}),name:"options"}),o.createElement("button",{className:"btn green mini only_icon mini_padding merakomis_icon_download_wrap"},o.createElement("i",{className:"merakomis_icon_download"}))))),o.createElement(E.c,{title:"budget_title",text:"budget_subtitle",className:"mb_normal"}),l&&l.budget?o.createElement("div",{id:"fot_table_wrap"},o.createElement("table",{className:"merakomis_table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null),o.createElement("th",{className:"empty_cell"}),o.createElement("th",{colSpan:a,className:"th_bb"},"Бюджет, млн ₽"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null)),o.createElement("tr",null,o.createElement("th",null,"Бюджет"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,p.A.getMonthShort(l.prevMonth)," ",l.prevYear),o.createElement("th",null,p.A.getMonthShort(l.month)," ",l.year),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,"Флаг"))),o.createElement("tbody",null,o.createElement("tr",null,o.createElement("td",null,o.createElement("b",null,"Бюджет")),o.createElement("td",{className:"empty_cell"}),o.createElement("td",{className:"tar"},l.budget.other),o.createElement("td",{className:"tar pointer",contentEditable:!0,suppressContentEditableWarning:!0,onFocus:this.setFocusTd.bind(this),onKeyDown:this.formatTd.bind(this),onKeyUp:this.formatTd.bind(this),onBlur:this.updateBudget.bind(this)},l.budget.edit),o.createElement("td",{className:"empty_cell"}),o.createElement("td",{className:"tar"},l.budget.mark?o.createElement("b",{className:"color_red"},"Изм"):o.createElement("b",{className:""},"Ок")))),o.createElement("tbody",null))):null,o.createElement(E.c,{title:"budget_title2",text:"budget_subtitle2",className:"mt_normal mb_normal"}),o.createElement("div",{id:"fot_table_wrap"},o.createElement("table",{className:"merakomis_table w100"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",{colSpan:3}),o.createElement("th",{colSpan:a,className:"th_bb"},"ЗП, ₽"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",{colSpan:3}),o.createElement("th",{className:"empty_cell"}),o.createElement("th",{colSpan:a,className:"th_bb"},"ФОТ, ₽"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",{colSpan:a,className:"th_bb"},"Ставка, ₽/ч"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null)),o.createElement("tr",{className:"no_wrap"},o.createElement("th",null,o.createElement(f.gp,{title:"ФИО",name:"name",group:f.wR,onClick:this.restate.bind(this)})),o.createElement("th",null,"Должность"),o.createElement("th",null,"Подразделение"),o.createElement("th",null,p.A.getMonthShort(l.prevMonth)," ",l.prevYear),o.createElement("th",null,p.A.getMonthShort(l.month)," ",l.year),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,"Локация"),o.createElement("th",null,"Удалёнка"),o.createElement("th",null,"Юр. лицо"),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,p.A.getMonthShort(l.prevMonth)," ",l.prevYear),o.createElement("th",null,p.A.getMonthShort(l.month)," ",l.year),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,p.A.getMonthShort(l.prevMonth)," ",l.prevYear),o.createElement("th",null,p.A.getMonthShort(l.month)," ",l.year),o.createElement("th",{className:"empty_cell"}),o.createElement("th",null,"Флаг"))),o.createElement("tbody",null,l.data?Object.keys(l.data).sort(this.sortEmps.bind(this)).map((function(t){let n=l.data[t],a=l.year+""+l.month,r=l.prevYear+""+l.prevMonth,i=n[a],s=n[r];return o.createElement("tr",{key:t},o.createElement("td",null,s?o.createElement("span",{className:"link no_wrap",onClick:function(){return p.A.openModalProfile(s.emp_id)}},o.createElement(b.C,{archive:s.archive}),s?s.name:""):null),o.createElement("td",null,i.staffing),o.createElement("td",null,i.department),o.createElement("td",{className:"tar"},s?s.fzp:""),i?o.createElement("td",{className:"tar pointer",contentEditable:!0,suppressContentEditableWarning:!0,onFocus:e.setFocusTd.bind(e),onKeyDown:e.formatTd.bind(e),onKeyUp:e.formatTd.bind(e),onBlur:e.update.bind(e,i,"fzp")},i?i.fzp:""):o.createElement("td",null,o.createElement("i",null,"Нет данных")),o.createElement("td",{className:"empty_cell"}),o.createElement("td",null,i.location),o.createElement("td",null,i.freelance),o.createElement("td",null,i.org_type),o.createElement("td",{className:"empty_cell"}),o.createElement("td",{className:"tar"},s?s.fot:""),o.createElement("td",{className:"tar"},i?i.fot:""),o.createElement("td",{className:"empty_cell"}),o.createElement("td",{className:"tar"},s?s.per_hour:""),o.createElement("td",{className:"tar"},i?i.per_hour:""),o.createElement("td",{className:"empty_cell"}),o.createElement("td",null,o.createElement("b",{style:{color:i?i.color:""}},i?i.mark:"")))})):null)))))))))}}}}]);