<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">

	<menuitem name="helpdesk-root" title="Helpdesk" order="-80" if="__config__.app.isApp('helpdesk')"
		icon="fa-life-ring" icon-background="#b6473f"/>
	
	<menuitem title="Current tickets" name="helpdesk-ticket-current" action="helpdesk.ticket.current" order="-100" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.ticket.current" title="Tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<domain>self.statusSelect in (0,1)</domain>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="My tickets" name="helpdesk-my-ticket-all" action="helpdesk.my.ticket.all" order="-90" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.my.ticket.all" title="My tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<domain>self.assignedToUser = :_user</domain>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="My team tickets" name="helpdesk-my-team-ticket-all" action="helpdesk.my.team.ticket.all" order="-80" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.my.team.ticket.all" title="My team tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<domain>self.assignedToUser.activeTeam = :_myActiveTeam</domain>
		<context name="_myActiveTeam" expr="call:com.axelor.apps.base.service.user.UserService:getUserActiveTeam()"/>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="Not assigned tickets" name="helpdesk-not-assigned-ticket" action="helpdesk.not.assigned.ticket" order="-70" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.not.assigned.ticket" title="Not assigned tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<domain>self.assignedToUser = null</domain>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="Late tickets" name="helpdesk-late-ticket" action="helpdesk.late.ticket" order="-60" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.late.ticket" title="Late tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<domain>(self.endDateT != null and self.endDateT &gt; self.deadlineDateT) or (self.endDateT = null and self.deadlineDateT &lt; :_date)</domain>
		<context name="_date" expr="eval: __datetime__"/>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="All tickets" name="helpdesk-ticket-all" action="helpdesk.ticket.all" order="-50" parent="helpdesk-root"/>
	
	<action-view name="helpdesk.ticket.all" title="All tickets" model="com.axelor.apps.helpdesk.db.Ticket">
		<view type="kanban" name="ticket-kanban"/>
		<view type="grid" name="ticket-grid"/>
		<view type="form" name="ticket-form"/>
		<view type="calendar" name="ticket-calendar"/>
		<context name="_user" expr="eval: __user__"/>
	</action-view>
	
	<menuitem title="Reportings" name="helpdesk-reporting" order="-20" parent="helpdesk-root" icon="fa-bar-chart"/>
	
	<menuitem title="Ticket" name="helpdesk-report-ticket" action="helpdesk.report.ticket" parent="helpdesk-reporting"/>

	<action-view name="helpdesk.report.ticket" title="Ticket Details">
		<view type="dashboard" name="helpdesk.ticket.dashboard"/>
		<context name="_user_id" expr="eval:__user__.id" />
		<context name="_myActiveTeam" expr="eval:__user__.activeTeam != null ? __user__.activeTeam.id : 0"/>
	</action-view>
	
	<menuitem title="SLA" name="helpdesk-report-sla" action="helpdesk.report.sla" parent="helpdesk-reporting" if="__config__.app.getApp('helpdesk').getIsSla()"/>
	
	<action-view name="helpdesk.report.sla" title="SLA Details">
	  <view name="helpdesk.sla.dashboard" type="dashboard"/>
	  <context name="_user_id" expr="eval:__user__.id"/>
	</action-view>
	
	<menuitem title="Configuration" name="helpdesk-config" order="-10" parent="helpdesk-root" icon="fa-cog"/>
	
	<menuitem title="SLA policies" name="helpdesk-sla-policies-all" action="helpdesk.sla.policies.all" parent="helpdesk-config" if="__config__.app.getApp('helpdesk').getIsSla()"/>
	
	<action-view name="helpdesk.sla.policies.all" title="SLA policies" model="com.axelor.apps.helpdesk.db.Sla">
		<view type="grid" name="sla-grid"/>
		<view type="form" name="sla-form"/>
	</action-view>
	
	<menuitem title="Ticket types" name="helpdesk-ticket-types-all" action="helpdesk-ticket-types-all" parent="helpdesk-config"/>
	
	<action-view name="helpdesk-ticket-types-all" title="Ticket types" model="com.axelor.apps.helpdesk.db.TicketType">
		<view type="grid" name="ticket-type-grid"/>
		<view type="form" name="ticket-type-form"/>
	</action-view>
	
</object-views>
