<li class="nav-header">MAIN</li>

<li class="nav-item">
	<a href="{{ url('home') }}" @class(['nav-link','active'=>($path=request()->path()) === 'u/home'])>
		<i class="nav-icon fas fa-home"></i> <p>Home</p>
	</a>
</li>

<!-- ORDERS -->
<li @class(['nav-item','has-treeview','menu-open'=>$x=preg_match('#^order#',$path),'menu-closed'=>! $x])>
	<a href="#" @class(['nav-link','active'=>$path === 'order'])>
		<i class="nav-icon fas fa-cash-register"></i>
		<p>Orders <i class="fas fa-angle-left right"></i></p>
	</a>

	<ul class="nav nav-treeview">
		<li class="nav-item">
			<a href="{{ url('order') }}" @class(['nav-link','active'=>$path === 'order'])>
				<i class="fas fa-tag nav-icon"></i> <p>New Order</p>
			</a>
		</li>
	</ul>
</li>

@can('wholesaler')
	<!-- PAYMENTS -->
	<li @class(['nav-item','has-treeview','menu-open'=>$x=preg_match('#^r/payment/#',$path),'menu-closed'=>! $x])>
		<a href="#" @class(['nav-link','active'=>preg_match('#^r/payment/#',$path)])>
			<i class="nav-icon fas fa-receipt"></i>
			<p>Payments <i class="fas fa-angle-left right"></i></p>
		</a>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('r/payment/new') }}" @class(['nav-link','active'=>$path === 'r/payment/new'])>
					<i class="fas fa-money-bill nav-icon"></i> <p>New Payment</p>
				</a>
			</li>

			<li class="nav-item">
				<a href="{{ url('r/payment/unapplied') }}" @class(['nav-link','active'=>$path === 'r/payment/unapplied'])>
					<i class="fas fa-receipt nav-icon"></i> <p>Unapplied</p>
				</a>
			</li>
		</ul>
	</li>
@endcan

@can('wholesaler')
	<li class="nav-header">ADMIN</li>

	<li class="nav-item">
		<a href="{{ url('auth/intuit') }}" @class(['nav-link','active'=>preg_match('#^auth/intuit#',$path)])>
			<i class="nav-icon fas fa-calculator"></i> <p>Quickbooks Link</p>
		</a>
	</li>

	<li class="nav-item">
		<a href="{{ url('a/setup') }}" @class(['nav-link','active'=>preg_match('#^a/setup#',$path)])>
			<i class="nav-icon fas fa-cogs"></i> <p>Site Setup</p>
		</a>
	</li>

	<!-- CHECKOUT (PAYMENTS) -->
	<li class="nav-item">
		<a href="{{ url('a/checkout') }}" @class(['nav-link','active'=>preg_match('#^a/checkout#',$path)])>
			<i class="nav-icon fas fa-money-check-alt"></i> <p>Checkout</p>
		</a>
	</li>

	<!-- PRODUCTS -->
	<li class="nav-item">
		<a href="{{ url('a/product') }}" @class(['nav-link','active'=>preg_match('#^a/product#',$path)])>
			<i class="nav-icon fas fa-barcode"></i> <p>Products</p>
		</a>
	</li>

	<!-- SUPPLIERS -->
	<li @class(['nav-item','has-treeview','menu-open'=>$x=preg_match('#^a/supplier#',$path),'menu-closed'=>! $x])>
		<a href="#" @class(['nav-link','active'=>preg_match('#^a/supplier#',$path)])>
			<i class="nav-icon fas fa-user-tag"></i>
			<p>Suppliers <i class="fas fa-angle-left right"></i></p>
		</a>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('a/supplier') }}" @class(['nav-link','active'=>preg_match('#^a/supplier(/[cost|details]+/[0-9]+)?$#',$path)])>
					<i class="nav-icon fas fa-cogs"></i> <p>Configuration</p>
				</a>
			</li>

			<li class="nav-item">
				<a href="{{ url('a/supplier/product/new') }}" @class(['nav-link','active'=>preg_match('#^a/supplier/product/(add|edit)#',$path)])>
					<i class="nav-icon fas fa-barcode"></i> <p>New Product</p>
				</a>
			</li>
		</ul>
	</li>

	<li @class(['nav-item','has-treeview','menu-open'=>$x=preg_match('#^a/report/(accounts|products|services)#',$path),'menu-closed'=>! $x])>
		<a href="#" @class(['nav-link','active'=>preg_match('#^a/report/(accounts|products|services)#',$path)])>
			<i class="nav-icon fas fa-list"></i> <p>REPORT<i class="fas fa-angle-left right"></i></p>
		</a>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('a/report/accounts') }}" @class(['nav-link','active'=>$path === 'a/report/accounts'])>
					<i class="nav-icon fas fa-users"></i> <p>Accounts</p>
				</a>
			</li>
		</ul>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('a/report/products') }}" @class(['nav-link','active'=>$path === 'a/report/products'])>
					<i class="nav-icon fas fa-barcode"></i> <p>Products</p>
				</a>
			</li>
		</ul>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('a/report/services') }}" @class(['nav-link','active'=>$path === 'a/report/services'])>
					<i class="nav-icon fas fa-layer-group"></i> <p>Services</p>
				</a>
			</li>
		</ul>
	</li>
@endcan

@can('reseller')
	<li class="nav-header">RESELLER</li>

	<li @class(['nav-item','has-treeview','menu-open'=>$x=preg_match('#^r/report/(charge|domain|email|hosting)#',$path),'menu-closed'=>! $x])>
		<a href="#" @class(['nav-link','active'=>preg_match('#^r/report/(charge|domain|email|hosting)#',$path)])>
			<i class="nav-icon fas fa-list"></i> <p>REPORT<i class="fas fa-angle-left right"></i></p>
		</a>

		<ul class="nav nav-treeview">
			<li class="nav-item">
				<a href="{{ url('r/report/charge/pending') }}" @class(['nav-link','active'=>$path === 'r/report/charge/pending'])>
					<i class="nav-icon fas fa-list"></i> <p>Charges Unprocessed</p>
				</a>
			</li>

			<li class="nav-item">
				<a href="{{ url('r/report/domain') }}" @class(['nav-link','active'=>$path === 'r/report/domain'])>
					<i class="nav-icon fas fa-globe-asia"></i> <p>Domain Names</p>
				</a>
			</li>

			<li class="nav-item">
				<a href="{{ url('r/report/email') }}" @class(['nav-link','active'=>$path === 'r/report/email'])>
					<i class="nav-icon fas fa-envelope"></i> <p>Email Hosting</p>
				</a>
			</li>

			<li class="nav-item">
				<a href="{{ url('r/report/hosting') }}" @class(['nav-link','active'=>$path === 'r/report/hosting'])>
					<i class="nav-icon fas fa-sitemap"></i> <p>Web Hosting</p>
				</a>
			</li>
		</ul>
	</li>
@endcan