"use strict";(self.webpackChunkbeancount_web=self.webpackChunkbeancount_web||[]).push([[550],{2550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>D});var s=n(9284),r=n(9379);const i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z"}}]},name:"smile",theme:"outlined"};var a=n(3768),o=function(e,t){return s.createElement(a.A,(0,r.A)((0,r.A)({},e),{},{ref:t,icon:i}))};const l=s.forwardRef(o);var c=n(2069),d=n(2475),p=n(1896),h=n(7691),m=n(8168),u=n(4467),v=n(5547),y=n(4480),f=n.n(y),g=n(3135),x=n(7458),A=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(e);r{const[t]=E.A.useForm(),[n,r]=(0,s.useState)(!1);return(0,P.jsx)("div",{className:"add-event-drawer component",children:(0,P.jsx)(S.A,{title:"\u65b0\u589e\u4e8b\u4ef6",placement:"bottom",closable:!0,height:"60vh",className:"page-drawer",bodyStyle:{display:"flex",justifyContent:"center"},forceRender:!0,...e,children:(0,P.jsx)("div",{className:"page-form",children:(0,P.jsxs)(E.A,{name:"add-event-form",className:"page-form",size:"large",style:{textAlign:"left"},form:t,onFinish:()=>{const n=t.getFieldsValue();r(!0),(0,I.hd)("/api/auth/event",{method:"POST",body:n}).then((n=>{t.resetFields(),e.onClose(n)})).catch(console.error).finally((()=>{r(!1)}))},validateMessages:Y,children:[(0,P.jsx)(E.A.Item,{name:"date",initialValue:N()().format("YYYY-MM-DD"),rules:[{required:!0}],children:(0,P.jsx)(T.A,{type:"date",placeholder:"\u65f6\u95f4"})}),(0,P.jsx)(E.A.Item,{name:"types",rules:[{required:!0}],children:(0,P.jsx)(M.A,{mode:"tags",allowClear:!0,placeholder:"\u4e8b\u4ef6\u540d\u79f0",options:(e.types||[]).map((e=>({label:e,value:e})))})}),(0,P.jsx)(E.A.Item,{name:"description",rules:[{required:!0}],children:(0,P.jsx)(T.A,{placeholder:"\u4e8b\u4ef6\u5185\u5bb9"})}),(0,P.jsx)(E.A.Item,{children:(0,P.jsx)(p.A,{type:"primary",htmlType:"submit",loading:n,className:"submit-button",children:"\u4fdd\u5b58"})})]})})})})};var L=n(9811);class k extends s.Component{constructor(){super(...arguments),this.theme=this.context.theme,this.currentMonth=N()().format("YYYY-M"),this.eventTypeList=[],this.eventTypes=[],this.state={loading:!1,events:[],selectedMonth:this.currentMonth,drawerOpen:!1},this.handleOpenAddrawer=()=>{this.setState({drawerOpen:!0})},this.handleCloseAddDrawer=e=>{e&&e instanceof Array&&this.setState({events:[...this.state.events,...e]},(()=>{this.formatEventTypeList(this.state.events)})),this.setState({drawerOpen:!1})},this.formatEventTypeList=e=>{const t={};e.forEach((e=>{let{date:n,type:s,description:r}=e;t[s]?t[s].push({date:n,type:s,description:r}):t[s]=[{date:n,type:s,description:r}]})),this.eventTypeList=[],this.eventTypes=Object.keys(t).sort(),this.eventTypes.forEach((e=>{this.eventTypeList.push({type:e,events:t[e]||[]})}))},this.getAllEvents=()=>{this.setState({loading:!0}),(0,I.hd)("/api/auth/event/all").then((e=>{this.setState({events:e},(()=>{this.formatEventTypeList(e)}))})).catch(console.error).finally((()=>{this.setState({loading:!1})}))}}componentDidMount(){this.getAllEvents()}render(){return this.context.theme!==this.theme&&(this.theme=this.context.theme),(0,P.jsxs)("div",{className:"event-page",children:[(0,P.jsx)(z,{open:this.state.drawerOpen,types:this.eventTypes,onClose:this.handleCloseAddDrawer}),(0,P.jsx)("div",{className:"top-wrapper",children:(0,P.jsx)("div",{children:(0,P.jsx)(p.A,{size:"small",icon:(0,P.jsx)(l,{}),onClick:this.handleOpenAddrawer,children:"\u8bb0\u5f55\u4e8b\u4ef6"})})}),(0,P.jsx)("div",{children:this.state.loading?(0,P.jsx)(L.A,{}):(0,P.jsx)(h.A,{defaultActiveKey:"1",items:this.eventTypeList.map((e=>{let{type:t,events:n}=e;return{label:t,key:t,children:(0,P.jsx)(O,{children:n.map((e=>{let{date:t,description:n}=e;return(0,P.jsxs)(O.Item,{children:[n,(0,P.jsx)("span",{style:{fontSize:"12px",marginLeft:"10px",color:"gray"},children:t})]})}))})}}))})})]})}}k.contextType=d.A;const D=(0,c.A)(k)},2069:(e,t,n)=>{n.d(t,{A:()=>i});var s=n(9284),r=n(712);const i=e=>class extends s.Component{constructor(){super(...arguments),this.defaultCommodity={currency:"CNY",symbol:"\uffe5"},this.currentCommodity=window.localStorage.getItem("ledgerCurrency")}render(){return(0,r.jsx)(e,{...this.props,commodity:this.currentCommodity?JSON.parse(this.currentCommodity):this.defaultCommodity})}}}}]);