Skip to content

Commit

Permalink
RM-90850 Add wizard view (#13977)
Browse files Browse the repository at this point in the history
  • Loading branch information
mea-axelor authored Feb 17, 2025
1 parent 7f6d071 commit 3bb8015
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
import com.axelor.apps.project.service.batch.ProjectBatchInitServiceImpl;
import com.axelor.apps.project.service.config.ProjectConfigService;
import com.axelor.apps.project.service.config.ProjectConfigServiceImpl;
import com.axelor.apps.project.service.dashboard.ProjectManagementDashboardService;
import com.axelor.apps.project.service.dashboard.ProjectManagementDashboardServiceImpl;
import com.axelor.apps.project.service.roadmap.ProjectVersionRemoveService;
import com.axelor.apps.project.service.roadmap.ProjectVersionRemoveServiceImpl;
import com.axelor.apps.project.service.roadmap.ProjectVersionService;
Expand Down Expand Up @@ -138,5 +140,6 @@ protected void configure() {
bind(SprintGetService.class).to(SprintGetServiceImpl.class);
bind(ProjectVersionService.class).to(ProjectVersionServiceImpl.class);
bind(ProjectBatchInitService.class).to(ProjectBatchInitServiceImpl.class);
bind(ProjectManagementDashboardService.class).to(ProjectManagementDashboardServiceImpl.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Axelor Business Solutions
*
* Copyright (C) 2005-2025 Axelor (<http://axelor.com>).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.axelor.apps.project.service.dashboard;

import java.util.Map;

public interface ProjectManagementDashboardService {

Map<String, Object> getDate();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Axelor Business Solutions
*
* Copyright (C) 2005-2025 Axelor (<http://axelor.com>).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.axelor.apps.project.service.dashboard;

import com.axelor.apps.project.db.repo.ProjectRepository;
import com.axelor.apps.project.db.repo.ProjectTaskRepository;
import com.google.inject.Inject;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

public class ProjectManagementDashboardServiceImpl implements ProjectManagementDashboardService {
protected ProjectTaskRepository projectTaskRepo;
protected ProjectRepository projectRepo;

@Inject
public ProjectManagementDashboardServiceImpl(
ProjectTaskRepository projectTaskRepo, ProjectRepository projectRepo) {
this.projectTaskRepo = projectTaskRepo;
this.projectRepo = projectRepo;
}

@Override
public Map<String, Object> getDate() {
Map<String, Object> dataMap = new HashMap<>();
LocalDate todayDate = LocalDate.now();
dataMap.put("$fromDate", todayDate);
dataMap.put("$toDate", todayDate.plusDays(7));

return dataMap;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Axelor Business Solutions
*
* Copyright (C) 2005-2025 Axelor (<http://axelor.com>).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.axelor.apps.project.web;

import com.axelor.apps.base.service.exception.TraceBackService;
import com.axelor.apps.project.service.dashboard.ProjectManagementDashboardService;
import com.axelor.inject.Beans;
import com.axelor.rpc.ActionRequest;
import com.axelor.rpc.ActionResponse;
import com.google.inject.Singleton;

@Singleton
public class ProjectManagementDashboardController {

public void getDates(ActionRequest request, ActionResponse response) {

try {
response.setValues(Beans.get(ProjectManagementDashboardService.class).getDate());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ public void computeSprintDomainDashboard(ActionRequest request, ActionResponse r
String domain =
Beans.get(SprintGeneratorService.class).getSprintDomain(projectRepo.find(projectId));

response.setAttr("sprint", "domain", domain);
response.setAttr("$sprint", "domain", domain);
}
}
95 changes: 0 additions & 95 deletions axelor-project/src/main/resources/views/Dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,99 +328,4 @@
method="showTasksPerCategory"/>
</action-method>


<dashboard title="Project Dashboard" name="project.dashboard.sample" width="large"
onInit="action-chart-set-date-project">
<search-fields>
<field name="project" target="com.axelor.apps.project.db.Project" title="Project"
type="reference" colSpan="12" onChange="action-project-record-empty-sprint"/>
<field type="date" name="fromDate" title="From Date" required="true" colSpan="3"
onChange="action-project-record-empty-sprint-period"/>
<field type="date" name="toDate" title="To Date" required="true" colSpan="3"
onChange="action-project-record-empty-sprint-period"/>
<field type="reference" name="period" title="Allocation period"
target="com.axelor.apps.base.db.Period" colSpan="3" onChange="action-chart-set-period-date"
domain="self.year.typeSelect = 4 AND self.toDate &gt; :__date__ "/>
<field type="reference" name="sprint" title="Sprint"
target="com.axelor.apps.project.db.Sprint" colSpan="3" readonlyIf="!project"
onChange="action-chart-set-sprint-date"
onSelect="action-project-method-compute-sprint-domain"/>

</search-fields>

<dashlet height="350" action="project-project-task-action" canSearch="true" colSpan="12"/>
<dashlet height="350" action="project-planning-time-dashboard-action" canSearch="true"
colSpan="12"
if="__config__.app.isApp('employee') &amp;&amp; __config__.app.getApp('project')?.enablePlanification"
if-module="axelor-human-resource"/>
<dashlet height="350" action="project-allocation-line-action" canSearch="true"
colSpan="12"/>
</dashboard>

<action-view name="project-project-task-action"
model="com.axelor.apps.project.db.ProjectTask" title="Project tasks">
<view name="project-task-dashboard-grid" type="grid"/>
<view name="project-task-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (self.taskDate &lt;= :toDate and self.taskDate &gt;= :fromDate )
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>
<action-view name="project-planning-time-dashboard-action"
model="com.axelor.apps.project.db.ProjectPlanningTime" title="Project planning tasks">
<view name="project-planning-time-dashboard-grid" type="grid"/>
<view name="project-planning-time-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (( date(self.startDateTime) &lt;= date(:toDate) and date(self.startDateTime) &gt;=
date(:fromDate) )or
(date(self.endDateTime) &lt;= date(:toDate) and date(self.endDateTime)
&gt;= date(:fromDate) ))
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>
<action-view name="project-allocation-line-action"
model="com.axelor.apps.hr.db.AllocationLine" title="Project allocation lines">
<view name="project-allocation-line-grid" type="grid"/>
<view name="allocation-line-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (( date(self.period.fromDate ) &lt;= date(:toDate) and date(self.period.fromDate )
&gt;=
date(:fromDate) )or
(date(self.period.toDate) &lt;= date(:toDate) and
date(self.period.toDate)
&gt;= date(:fromDate) ))
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>

<action-record name="action-project-record-empty-sprint"
model="com.axelor.apps.project.db.Project">
<field name="sprint" expr="eval: null"/>
</action-record>
<action-record name="action-project-record-empty-sprint-period"
model="com.axelor.apps.project.db.Project">
<field name="sprint" expr="eval: null"/>
<field name="period" expr="eval: null"/>
</action-record>
<action-record model="com.axelor.apps.project.db.ProjectTask"
name="action-chart-set-date-project">
<field name="fromDate" expr="eval:__config__.date"/>
<field name="toDate" expr="eval:__config__.date.plusDays(6)"/>
</action-record>
<action-record model="com.axelor.apps.base.db.Period"
name="action-chart-set-period-date">
<field name="fromDate" expr="eval:__repo__(Period).find(period.id).fromDate "/>
<field name="toDate" expr="eval: __repo__(Period).find(period.id).toDate "/>
<field name="sprint" expr="eval: null"/>
</action-record>
<action-record model="com.axelor.apps.project.db.Sprint"
name="action-chart-set-sprint-date">
<field name="fromDate" expr="eval:__repo__(Sprint).find(sprint.id).fromDate "/>
<field name="toDate" expr="eval: __repo__(Sprint).find(sprint.id).toDate "/>
<field name="period" expr="eval: null"/>
</action-record>
<action-method name="action-project-method-compute-sprint-domain">
<call class="com.axelor.apps.project.web.SprintController"
method="computeSprintDomainDashboard"/>
</action-method>
</object-views>
10 changes: 5 additions & 5 deletions axelor-project/src/main/resources/views/Menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@
<view type="form" name="project-version-form"/>
</action-view>

<menuitem name="project.dashboard.sample" parent="project-reporting"
title="Projects and resources management" action="project.dashboard" order="1800"/>

<action-view name="project.dashboard" title="Projects and resources management">
<view type="dashboard" name="project.dashboard.sample"/>
<menuitem name="project-dashboard-wizard" parent="project-reporting"
title="Projects and resources management" action="project.wizard.form" order="1820"/>

<action-view name="project.wizard.form"
title="Projects and resources management wizard" model="com.axelor.utils.db.Wizard">
<view type="form" name="project-wizard-form"/>
</action-view>

</object-views>
113 changes: 113 additions & 0 deletions axelor-project/src/main/resources/views/ProjectWizard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?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_7.2.xsd">

<form name="project-wizard-form" title="Project Dashboard" model="com.axelor.utils.db.Wizard"
width="large" onNew="action-method-project-set-date" canNew="false" canDelete="false">
<panel name="filtersPanel">
<field name="$project" title="Project" colSpan="12" type="many-to-one"
onChange="action-project-record-empty-sprint,action-attrs-refresh-dashlets"
target="com.axelor.apps.project.db.Project"/>
<field name="$fromDate" title="From Date" colSpan="3" type="date"
onChange="action-project-record-empty-sprint-period,action-attrs-refresh-dashlets"
required="true"/>
<field name="$toDate" title="To Date" colSpan="3" type="date"
onChange="action-project-record-empty-sprint-period,action-attrs-refresh-dashlets"
required="true"/>
<field name="$period" title="Allocation period" colSpan="3" type="many-to-one"
onChange="action-project-record-set-period-date,action-attrs-refresh-dashlets"
target="com.axelor.apps.base.db.Period"
domain="self.year.typeSelect = 4 AND self.toDate > :__date__ "/>
<field name="$sprint" title="Sprint" readonlyIf="!$project" colSpan="3"
type="many-to-one"
onChange="action-project-record-set-sprint-date,action-attrs-refresh-dashlets"
onSelect="action-project-method-compute-sprint-domain"
target="com.axelor.apps.project.db.Sprint"/>
</panel>
<panel-dashlet name="project-project-task-action-dashlet" colSpan="12"
height="350" action="action-project-view-project-task" canSearch="true"/>
<panel-dashlet
if="__config__.app.isApp('employee') &amp;&amp; __config__.app.getApp('project')?.enablePlanification"
if-module="axelor-human-resource" name="project-planning-time-dashboard-action-dashlet"
colSpan="12" height="350" action="action-project-view-planning-time-dashboard"
canSearch="true"/>
<panel-dashlet name="project-allocation-line-action-dashlet" colSpan="12"
height="350" action="action-project-view-allocation-line" canSearch="true"/>
</form>
<action-method model="com.axelor.utils.db.Wizard"
name="action-method-project-set-date">
<call class="com.axelor.apps.project.web.ProjectManagementDashboardController"
method="getDates"/>
</action-method>

<action-view name="action-project-view-project-task"
model="com.axelor.apps.project.db.ProjectTask" title="Project tasks">
<view name="project-task-dashboard-grid" type="grid"/>
<view name="project-task-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (self.taskDate &lt;= :toDate and self.taskDate &gt;= :fromDate )
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>
<action-view name="action-project-view-planning-time-dashboard"
model="com.axelor.apps.project.db.ProjectPlanningTime" title="Project planning tasks">
<view name="project-planning-time-dashboard-grid" type="grid"/>
<view name="project-planning-time-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (( date(self.startDateTime) &lt;= date(:toDate) and date(self.startDateTime) &gt;=
date(:fromDate) )or
(date(self.endDateTime) &lt;= date(:toDate) and date(self.endDateTime)
&gt;= date(:fromDate) ))
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>
<action-view name="action-project-view-allocation-line"
model="com.axelor.apps.hr.db.AllocationLine" title="Project allocation lines">
<view name="project-allocation-line-grid" type="grid"/>
<view name="allocation-line-form" type="form"/>
<view-param name="popup" value="true"/>
<domain> (( date(self.period.fromDate ) &lt;= date(:toDate) and date(self.period.fromDate )
&gt;=
date(:fromDate) )or
(date(self.period.toDate) &lt;= date(:toDate) and
date(self.period.toDate)
&gt;= date(:fromDate) ))
and
(self.project=:project OR :project IS NULL)</domain>
</action-view>

<action-record name="action-project-record-empty-sprint"
model="com.axelor.apps.project.db.Project">
<field name="$sprint" expr="eval: null"/>
</action-record>
<action-record name="action-project-record-empty-sprint-period"
model="com.axelor.apps.project.db.Project">
<field name="$sprint" expr="eval: null"/>
<field name="$period" expr="eval: null"/>
</action-record>

<action-record model="com.axelor.apps.base.db.Period"
name="action-project-record-set-period-date">
<field name="$fromDate" expr="eval:__repo__(Period).find(period.id).fromDate" if="period"/>
<field name="$toDate" expr="eval: __repo__(Period).find(period.id).toDate" if="period"/>
<field name="$sprint" expr="eval: null"/>
</action-record>
<action-record model="com.axelor.apps.project.db.Sprint"
name="action-project-record-set-sprint-date">
<field name="$fromDate" expr="eval:__repo__(Sprint).find(sprint.id).fromDate" if="sprint"/>
<field name="$toDate" expr="eval: __repo__(Sprint).find(sprint.id).toDate" if="sprint"/>
<field name="$period" expr="eval: null"/>
</action-record>
<action-method name="action-project-method-compute-sprint-domain">
<call class="com.axelor.apps.project.web.SprintController"
method="computeSprintDomainDashboard"/>
</action-method>
<action-attrs name="action-attrs-refresh-dashlets">
<attribute name="refresh" expr="eval: true" for="project-project-task-action-dashlet"/>
<attribute name="refresh" expr="eval: true"
for="project-planning-time-dashboard-action-dashlet"/>
<attribute name="refresh" expr="eval: true"
for="project-allocation-line-action-dashlet"/>
</action-attrs>
</object-views>

0 comments on commit 3bb8015

Please sign in to comment.