2022-09-07 13:24:27 +03:00

88 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React from "react";
import Link from "next/link";
export default class InnerMenu extends React.Component
{
constructor(props)
{
super(props);
this.state = {
type: undefined,
finance: 0,
additional: 0,
fines:0,
pts: 0,
};
this.menuRef = React.createRef();
}
_checkEventsCount = () =>
{
const { events, types } = this.props;
const count = {
finance: 0,
additional: 0,
fines:0,
pts: 0,
};
for(let i in events)
{
count[types[events[i].event_type]]++;
}
return count;
}
render()
{
const { type } = this.props;
const count = this._checkEventsCount();
return (
<aside>
<ul className="aside_nav">
<li>
<Link href={`/events`} shallow>
<a className={ type === undefined ? "active" : "" }>Все события</a>
</Link>
</li>
{/*}
<li>
<Link href={`/events#restrictions`} shallow>
<a className={ type === "restrictions" ? "active" : "" }>Ограничения</a>
</Link>
</li>
{*/}
{/*}
<li>
<Link href={`/events#payments`} shallow>
<a className={ type === "payments" ? "active" : "" }>Платежи</a>
</Link>
</li>
{*/}
<li>
<Link href={`/events#finance`} shallow>
<a className={ type === "finance" ? "active" : "" }>Договоры { count.finance > 0 && (<span>{ count.finance }</span>) }</a>
</Link>
</li>
<li>
<Link href={`/events#additional`} shallow>
<a className={ type === "additional" ? "active" : "" }>Дополнительные услуги { count.additional > 0 && (<span>{ count.additional }</span>) }</a>
</Link>
</li>
<li>
<Link href={`/events#fines`} shallow>
<a className={ type === "fines" ? "active" : "" }>Штрафы { count.fines > 0 && (<span>{ count.fines }</span>) }</a>
</Link>
</li>
<li>
<Link href={`/events#pts`} shallow>
<a className={ type === "pts" ? "active" : "" }>ПТС { count.pts > 0 && (<span>{ count.pts }</span>) }</a>
</Link>
</li>
</ul>
</aside>
)
}
}