<?page title="Main Menu" contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<?taglib uri="/WEB-INF/module.tld" prefix="module"?>
<zk xmlns:n="native">
	<menubar
		id="menubar"
		apply="org.zkoss.bind.BindComposer"
		viewModel="@id('vm') @init('info.bukova.isspst.ui.MainMenu')"
		autodrop="true">
		<menuitem
			label="${labels.Information}"
			href="/app/" />
		<menuseparator />
		<menu label="${labels.Orders}">
			<menupopup>
				<menuitem
					image="/img/beam-032.png"
					label="${labels.MaterialRequirements}"
					href="/main/orders/material/"
					disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}" />
				<menuitem
					image="/img/worker-032.png"
					label="${labels.ServiceRequirements}"
					href="/main/orders/services/"
					disabled="${not sec:isAllGranted('PERM_READ_SERVICES')}" />
				<menuseparator />
				<menuitem
					image="/img/hammer-016.png"
					label="${labels.ApprovedRequirementItems}"
					href="/main/orders/approved/"
					disabled="${not sec:isAllGranted('PERM_READ_APPROVED')}" />
				<menuitem
					image="/img/autotruck-016.png"
					label="${labels.CreatedOrders}"
					href="/main/orders/created/"
					disabled="${not sec:isAllGranted('PERM_READ_ORDER')}" />
				<menuseparator/>
				<menuitem
					image="/img/invoicing-016.png"
					label="${labels.Invoicing}"
					href="/main/invoicing/"
					disabled="${not sec:isAllGranted('PERM_READ_INVOICING')}"
					visible="${module:isActive('INVOICING') }" />
			</menupopup>
		</menu>
		<menu label="${labels.BussinessTrips}">
			<menupopup>
				<menuitem
					image="/img/req-trip-016.png"
					label="${labels.CurrentRequirements}"
					href="/main/trips/requirements/"
					disabled="${not sec:isAllGranted('PERM_READ_TRIPREQUIREMENTS')}" />
				<menuitem
					image="/img/pickup-024.png"
					label="${labels.TravelOrders}"
					href="/main/trips/bill"
					disabled="${not sec:isAllGranted('PERM_READ_TRIPBILL')}" />
			</menupopup>
		</menu>
		<menuseparator />
		<menu label="${labels.Lists}">
			<menupopup>
				<menuitem
					image="/img/palet-024.png"
					label="${labels.AgendaMaterial}"
					href="/lists/material"
					disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}" />
				<menuitem
					image="/img/painting-016.png"
					label="${labels.AgendaServices}"
					href="/lists/service"
					disabled="${not sec:isAllGranted('PERM_READ_SERVICES')}" />
				<menuitem
					label="${labels.AgendaSuppliers}"
					href="/lists/addressbook"
					disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}" />
				<menuitem
					image="/img/house-016.png"
					label="${labels.AgendaBuildings}"
					href="/lists/buildings"
					disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
				<menuitem
					image="/img/tape-measure-016.png"
					label="${labels.AgendaMUnits}"
					href="/lists/munits"
					disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" />
			</menupopup>
		</menu>
		<menu label="${labels.Settings}">
			<menupopup>
				<menuitem
					image="/img/global-setting-016.png"
					label="${labels.GlobalSettings}…"
					onClick="@command('globalSettings')" />
				<menuitem
					label="${labels.UserSettings}…"
					onClick="@command('userSettings')" />
				<menuitem
					label="${labels.AgendaWorkflow}"
					href="/settings/workflow"
					disabled="${not sec:isAllGranted('PERM_EDIT_WORKFLOW')}" />
				<menuitem
					label="${labels.NumberSeries}…"
					onClick="@command('numSeries')"
					disabled="${not sec:isAllGranted('ROLE_ADMIN')}" />
				<menu label="${labels.Administration}">
					<menupopup>
						<menuitem
							label="${labels.AgendaUsers}"
							href="/admin/users"
							disabled="${not sec:isAllGranted('PERM_READ_USERS')}" />
						<menuitem
							label="${labels.Permissions}"
							href="/admin/permissions"
							disabled="${not sec:isAllGranted('PERM_READ_PERMISSIONS')}" />
						<menuitem
							label="${labels.AgendaWorkgroups}"
							href="/admin/workgroups"
							disabled="${not sec:isAllGranted('PERM_READ_WORKGROUPS')}" />
					</menupopup>
				</menu>
			</menupopup>
		</menu>
		<menu label="${labels.User}">
			<menupopup>
				<menuitem
					image=""
					label="${labels.ChangePassword}…"
					onClick="@command('passwd')"
					visible="@load(vm.canChangePassword)" />
				<menuitem
					image="/img/unlock-016.png"
					label="${labels.Logout}"
					href="/j_spring_security_logout" />
			</menupopup>
		</menu>
		<menuseparator />
		<menuitem 
		  image="/img/search.png"
		  label="${labels.AgendaSearch}"
		  href="/app/search"
		  visible="${module:isActive('SEARCH') }"
		  disabled="${not sec:isAllGranted('PERM_SEARCH_SEARCH')}" />
	</menubar>
</zk>