Chorem-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 542 discussions
r395 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp css js
by jcouteau@users.chorem.org 02 Jan '14
by jcouteau@users.chorem.org 02 Jan '14
02 Jan '14
Author: jcouteau
Date: 2014-01-02 11:45:53 +0100 (Thu, 02 Jan 2014)
New Revision: 395
Url: http://chorem.org/projects/chorem/repository/revisions/395
Log:
fixes #938 : [Tableau de budget] Rajouter un moyen visuel pour voir les factures pr?\195?\169visionnelles - Un icone warning est rajout?\195?\169 en cas de facture pr?\195?\169visionnelle (regexp sur le pattern PREV)
refs #939 : [Tableau de budget] Refonte du pop-up de d?\195?\169tail - Clic dans toute la cellule pour afficher le pop-up. D?\195?\169but de tentative de refonte plus profonde du comportement sans succ?\195?\168s (d?\195?\169sactiv?\195?\169)
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
trunk/chorem-webmotion/src/main/webapp/css/chorem.less
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2013-12-17 10:55:59 UTC (rev 394)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardBudget.jsp 2014-01-02 10:45:53 UTC (rev 395)
@@ -81,17 +81,26 @@
</c:url>
<c:choose>
<c:when test="${data.getInvoices(d, c.userObject).isEmpty()}">
- <span class="withPopover"
- title='Aucune entrée <span><a href="${addDebtUrl}"><li class="icon-plus"></li>Debt</a><span> <span><a href="${addIncomeUrl}"><li class="icon-plus"></li>Income</a><span>'>
+ <div class="withPopover"
+ title='Aucune entrée <span><a href="${addDebtUrl}"><li class="icon-plus"></li>Debt</a><span> <span><a href="${addIncomeUrl}"><li class="icon-plus"></li>Income</a><span>'>
<f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/>
- </span>
+ </div>
</c:when>
<c:otherwise>
- <span class="withPopover"
- title='Detail pour <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/> <span><a href="${addDebtUrl}"><li class="icon-plus"></li>Debt</a><span> <span><a href="${addIncomeUrl}"><li class="icon-plus"></li>Income</a><span>'
- data-content='<w:display wikitties="${data.getInvoices(d, c.userObject)}" toString="<span class=\"withTooltip\" title=\"%FinancialTransaction.category$s: %FinancialTransaction.payer$s -> %FinancialTransaction.beneficiary$s\">%FinancialTransaction.reference|noref$s: %FinancialTransaction.amount|0.0$,.2f</span>"/>'>
+ <c:set var="prev" value="0"/>
+ <c:forEach var="invoice" items="${data.getInvoices(d, c.userObject)}}">
+ <c:if test='${invoice.matches("(.*)PREV(.*)")}'>
+ <c:set var="prev" value="1"/>
+ </c:if>
+ </c:forEach>
+ <div class="withPopover"
+ title='Detail pour <f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/> <span><a href="${addDebtUrl}"><li class="icon-plus"></li>Debt</a><span> <span><a href="${addIncomeUrl}"><li class="icon-plus"></li>Income</a><span>'
+ data-content='<w:display wikitties="${data.getInvoices(d, c.userObject)}" toString="<span class=\"withTooltip\" title=\"%FinancialTransaction.category$s: %FinancialTransaction.payer$s -> %FinancialTransaction.beneficiary$s\">%FinancialTransaction.reference|noref$s: %FinancialTransaction.amount|0.0$,.2f</span>"/>'>
+ <c:if test="${prev==1}">
+ <i class="icon-warning-sign icon-black"></i>
+ </c:if>
<f:formatNumber type="currency" value="${data.getAmount(d, c.userObject)}"/>
- </span>
+ </div>
</c:otherwise>
</c:choose>
</td>
Modified: trunk/chorem-webmotion/src/main/webapp/css/chorem.less
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2013-12-17 10:55:59 UTC (rev 394)
+++ trunk/chorem-webmotion/src/main/webapp/css/chorem.less 2014-01-02 10:45:53 UTC (rev 395)
@@ -134,6 +134,11 @@
.calendar em:before{left:13px;}
.calendar em:after{right:13px;}
+.prev{
+ border-color:red;
+ border-width:thin;
+}
+
/* Les differents niveaux pour le tableau de budget*/
.categorylevel (@level) {
margin-left: @level * 10px;
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-12-17 10:55:59 UTC (rev 394)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2014-01-02 10:45:53 UTC (rev 395)
@@ -31,12 +31,39 @@
}
$(function() {
- $('.withTooltip').tooltip({html:true});
-});
+ $('.withTooltip').tooltip({html:true});
+ });
+var enterShow = function (popover) {
+ if (popover.data('state') === 'hover') {
+ popover.popover('show');
+ }
+};
+var exitHide = function (popover) {
+ if (popover.data('state') === 'hover') {
+ popover.popover('hide');
+ }
+};
+
+var clickToggle = function (popover) {
+ if (popover.data('state') === 'hover') {
+ popover.data('state', 'pinned');
+ } else {
+ popover.data('state', 'hover')
+ popover.popover('hover');
+ }
+};
+
+/*$(function() {
+ $('.withPopover').data('state','hover').popover({trigger: 'manual'})
+ .on('mouseenter', enterShow($(this)))
+ .on('mouseleave', exitHide($(this)))
+ .on('click', clickToggle($(this)));
+});*/
+
$(function() {
- $('.withPopover').popover({trigger: 'click', html:true});
-});
+ $('.withPopover').popover({html:true});
+ });
$(function () {
$.datepicker.setDefaults($.datepicker.regional['fr']);
1
0
r394 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp
by jcouteau@users.chorem.org 17 Dec '13
by jcouteau@users.chorem.org 17 Dec '13
17 Dec '13
Author: jcouteau
Date: 2013-12-17 11:55:59 +0100 (Tue, 17 Dec 2013)
New Revision: 394
Url: http://chorem.org/projects/chorem/repository/revisions/394
Log:
Fixes #951 : Ajouter le CA TTC sur la page d'accueil
Fixes #952 : Ajouter les ?\195?\169volutions sur la page d'accueil
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-09-20 17:25:15 UTC (rev 393)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-12-17 10:55:59 UTC (rev 394)
@@ -403,40 +403,92 @@
.isNull(Interval.FQ_FIELD_INTERVAL_ENDDATE)
.end().setLimit(0);
- WikittyQueryResult<Double>[] invoices =
- client.findAllByQuery(Double.class,
- invoiceDebtQuery, invoiceIncomeQuery);
+ WikittyQueryResult<Double>[] invoices =
+ client.findAllByQuery(Double.class,
+ invoiceDebtQuery, invoiceIncomeQuery);
- WikittyQueryResult<String> touchs =
- client.findAllByQuery(touchQuery);
+ WikittyQueryResult<String> touchs =
+ client.findAllByQuery(touchQuery);
- // nombre de facture
- int invoiceDebtNb = invoices[0].getTotalResult();
- // montant total de toutes les factures
- double invoiceDebt = invoices[0].peek();
+ // nombre de facture
+ int invoiceDebtNb = invoices[0].getTotalResult();
+ // montant total de toutes les factures
+ double invoiceDebt = invoices[0].peek();
- // nombre de facture
- int invoiceIncomeNb = invoices[1].getTotalResult();
- // montant total de toutes les factures
- double invoiceIncome = invoices[1].peek();
+ // nombre de facture
+ int invoiceIncomeNb = invoices[1].getTotalResult();
+ // montant total de toutes les factures
+ double invoiceIncome = invoices[1].peek();
- int touchNb = touchs.getTotalResult();
+ int touchNb = touchs.getTotalResult();
- String touchQueryString = touchQuery.getCondition().toString();
+ //CA HT
+ double income = Double.valueOf(annualDebtIncome.get("incomes").toString()) +
+ Double.valueOf(annualDebtIncome.get("extraIncomes").toString());
- return renderView("dashboardSummary.jsp",
- "date", now,
- "now", "\"" + WikittyUtil.toString(now) + "\"", //DateFormatUtils.format(now, solRDateFormat),
- "inOneWeek", DateFormatUtils.format(inOneWeek, summaryDateFormat),
- "invoiceDebtNb", invoiceDebtNb,
- "invoiceDebt", invoiceDebt,
- "invoiceIncomeNb", invoiceIncomeNb,
- "invoiceIncome", invoiceIncome,
- "annualDebtIncome", annualDebtIncome,
- "pastAnnualDebtIncome", pastAnnualDebtIncome,
- "touchNb", touchNb,
- "touchQueryString", touchQueryString
- );
+ //CA HT année précédente
+ double pastIncome = Double.valueOf(pastAnnualDebtIncome.get("incomes").toString()) +
+ Double.valueOf(pastAnnualDebtIncome.get("extraIncomes").toString());
+
+ //Evolution du CA HT
+ double incomeEvolution = (income-pastIncome)/pastIncome;
+
+ //CA TTC
+ double incomeTTC = Double.valueOf(annualDebtIncome.get("incomesTTC").toString()) +
+ Double.valueOf(annualDebtIncome.get("extraIncomesTTC").toString());
+
+ //CA TTC année précédente
+ double pastIncomeTTC = Double.valueOf(pastAnnualDebtIncome.get("incomesTTC").toString()) +
+ Double.valueOf(pastAnnualDebtIncome.get("extraIncomesTTC").toString());
+
+ //Evolution du CA TTC
+ double incomeTTCEvolution = (incomeTTC-pastIncomeTTC)/pastIncomeTTC;
+
+ //dépenses TTC
+ double debtsTTC = Double.valueOf(annualDebtIncome.get("debtsTTC").toString());
+
+ //dépenses TTC année précédente
+ double pastDebtsTTC = Double.valueOf(pastAnnualDebtIncome.get("debtsTTC").toString());
+
+ //Evolution des dépenses TTC
+ double debtsTTCEvolution = (debtsTTC-pastDebtsTTC)/pastDebtsTTC;
+
+ //profitTTC
+ double profitTTC = incomeTTC - debtsTTC;
+
+ //profit TTC année précédente
+ double pastProfitTTC = pastIncomeTTC - pastDebtsTTC;
+
+ //Evolution profit TTC
+ double profitTTCEvolution = (profitTTC - pastProfitTTC) / pastProfitTTC;
+
+ String touchQueryString = touchQuery.getCondition().toString();
+
+ return renderView("dashboardSummary.jsp",
+ "date", now,
+ "now", "\"" + WikittyUtil.toString(now) + "\"", //DateFormatUtils.format(now, solRDateFormat),
+ "inOneWeek", DateFormatUtils.format(inOneWeek, summaryDateFormat),
+ "invoiceDebtNb", invoiceDebtNb,
+ "invoiceDebt", invoiceDebt,
+ "invoiceIncomeNb", invoiceIncomeNb,
+ "invoiceIncome", invoiceIncome,
+ "annualDebtIncome", annualDebtIncome,
+ "pastAnnualDebtIncome", pastAnnualDebtIncome,
+ "income", income,
+ "pastIncome", pastIncome,
+ "incomeEvolution", incomeEvolution,
+ "incomeTTC", incomeTTC,
+ "pastIncomeTTC", pastIncomeTTC,
+ "incomeTTCEvolution", incomeTTCEvolution,
+ "debtsTTC", debtsTTC,
+ "pastDebtsTTC", pastDebtsTTC,
+ "debtsTTCEvolution", debtsTTCEvolution,
+ "profitTTC", profitTTC,
+ "pastProfitTTC", pastProfitTTC,
+ "profitTTCEvolution", profitTTCEvolution,
+ "touchNb", touchNb,
+ "touchQueryString", touchQueryString
+ );
}
////////////////////////////////////////////////////////////////////////////
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-09-20 17:25:15 UTC (rev 393)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardSummary.jsp 2013-12-17 10:55:59 UTC (rev 394)
@@ -52,28 +52,42 @@
<li>Chiffre d'affaire HT:
<strong>
<a href='<c:url value="/wikitty/search?query=${annualDebtIncome.get('incomesQuery')} or ${annualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
- <f:formatNumber type="currency" value="${annualDebtIncome.get('incomes') + annualDebtIncome.get('extraIncomes')}"/>
+ <f:formatNumber type="currency" value="${income}"/>
</a>
</strong>
(N-1: <strong>
<a href='<c:url value="/wikitty/search?query=${pastAnnualDebtIncome.get('incomesQuery')} or ${pastAnnualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
- <f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('incomes') + pastAnnualDebtIncome.get('extraIncomes')}"/>
+ <f:formatNumber type="currency" value="${pastIncome}"/>
</a>
- </strong>)
+ </strong> - Évolution : <f:formatNumber type="percent" value="${incomeEvolution}"/>
+ </li>
+ <li>Chiffre d'affaire TTC:
+ <strong>
+ <a href='<c:url value="/wikitty/search?query=${annualDebtIncome.get('incomesQuery')} or ${annualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${incomeTTC}"/>
+ </a>
+ </strong>
+ (N-1: <strong>
+ <a href='<c:url value="/wikitty/search?query=${pastAnnualDebtIncome.get('incomesQuery')} or ${pastAnnualDebtIncome.get('extraIncomesQuery')} %23limit=2147483647"/>'>
+ <f:formatNumber type="currency" value="${pastIncomeTTC}"/>
+ </a>
+ </strong>) - Évolution : <f:formatNumber type="percent" value="${incomeTTCEvolution}"/>
+ </li>
<li>Dépenses TTC:
<strong>
<a href='<c:url value="/wikitty/search?query=${annualDebtIncome.get('debtsQuery')} %23limit=2147483647"/>'>
- <f:formatNumber type="currency" value="${annualDebtIncome.get('debtsTTC')}"/>
+ <f:formatNumber type="currency" value="${debtsTTC}"/>
</a>
</strong>
(N-1: <strong>
<a href='<c:url value="/wikitty/search?query=${pastAnnualDebtIncome.get('debtsQuery')} %23limit=2147483647"/>'>
- <f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('debtsTTC')}"/>
+ <f:formatNumber type="currency" value="${pastDebtsTTC}"/>
</a>
- </strong>)
+ </strong>) - Évolution : <f:formatNumber type="percent" value="${debtsTTCEvolution}"/>
+ </li>
<li>Bénéfice/perte:
- <strong><f:formatNumber type="currency" value="${annualDebtIncome.get('incomesTTC') + annualDebtIncome.get('extraIncomesTTC') - annualDebtIncome.get('debtsTTC')}"/></strong>
- (N-1: <strong><f:formatNumber type="currency" value="${pastAnnualDebtIncome.get('incomesTTC') + pastAnnualDebtIncome.get('extraIncomesTTC') - pastAnnualDebtIncome.get('debtsTTC')}"/></strong>)
+ <strong><f:formatNumber type="currency" value="${profitTTC}"/></strong>
+ (N-1: <strong><f:formatNumber type="currency" value="${pastProfitTTC}"/></strong>) - Évolution : <f:formatNumber type="percent" value="${profitTTCEvolution}"/>
</ul>
</div>
</div>
1
0
r393 - trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions
by jcouteau@users.chorem.org 20 Sep '13
by jcouteau@users.chorem.org 20 Sep '13
20 Sep '13
Author: jcouteau
Date: 2013-09-20 19:25:15 +0200 (Fri, 20 Sep 2013)
New Revision: 393
Url: http://chorem.org/projects/chorem/repository/revisions/393
Log:
fixes #936: [Tableau de budget] Changement des dates par d?\195?\169faut
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-09-20 15:44:12 UTC (rev 392)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-09-20 17:25:15 UTC (rev 393)
@@ -122,27 +122,6 @@
return attachments;
}
- /**
- * return le nombre de jour entre 2 dates. Les demi-journées doivent etre
- * posée jusqu'à 12h00
- *
- * @param v
- * @return
- */
-// public double computeVacationDays(Vacation v) {
-// Date endDate = v.getEndDate();
-// if (0 == DateUtils.getFragmentInSeconds(endDate, Calendar.DATE)) {
-// // on rajoute un jour pour que les vances du 01/01/2012 au 01/01/2012
-// // represente bien un jour plein
-// endDate = DateUtils.addDays(endDate, 1);
-// }
-// long end = endDate.getTime();
-// long begin = v.getBeginDate().getTime();
-//
-// double result = (end - begin) / (1000.0 * 3600.0 * 24.0);
-// return result;
-// }
-
public double computeWorkingDays(ChoremClient client, Time t) {
Configuration config = client.getConfiguration();
long workingTime = t.getEndDate().getTime() - t.getBeginDate().getTime();
@@ -842,7 +821,7 @@
if (start == null) {
start = new Date();
- start = DateUtils.addMonths(start, -1);
+ start = DateUtils.addMonths(start, -2);
}
if (end == null) {
1
0
20 Sep '13
Author: jcouteau
Date: 2013-09-20 17:44:12 +0200 (Fri, 20 Sep 2013)
New Revision: 392
Url: http://chorem.org/projects/chorem/repository/revisions/392
Log:
fixes #937 : [Facture] Aller directement au tableau de budget depuis la visualisation d'une facture
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionFinancialTransaction.jsp
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionFinancialTransaction.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionFinancialTransaction.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionFinancialTransaction.jsp 2013-09-20 15:44:12 UTC (rev 392)
@@ -0,0 +1,26 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2013 CodeLutin
+ %%
+ 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 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 <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<a class="btn btn-success" href="<c:url value="/report?report=budget"/>"><i class="icon-th icon-white"></i> Budget</a>
\ No newline at end of file
1
0
r391 - in trunk: . chorem-webmotion chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm chorem-webmotion/src/main/resources chorem-webmotion/src/main/webapp/WEB-INF/jsp
by jcouteau@users.chorem.org 13 Sep '13
by jcouteau@users.chorem.org 13 Sep '13
13 Sep '13
Author: jcouteau
Date: 2013-09-13 17:41:44 +0200 (Fri, 13 Sep 2013)
New Revision: 391
Url: http://chorem.org/projects/chorem/repository/revisions/391
Log:
Fixes #836 : Export contact base as csv.
It exports all employees, with email adress mobile phone and fix phone, coming from person/company/employee, each one overriding previous info if any (by importance order in fact).
Added:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExport.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExportModel.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ExportAction.java
Removed:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Company.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Project.java
Modified:
trunk/chorem-webmotion/pom.xml
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
trunk/pom.xml
Modified: trunk/chorem-webmotion/pom.xml
===================================================================
--- trunk/chorem-webmotion/pom.xml 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/chorem-webmotion/pom.xml 2013-09-13 15:41:44 UTC (rev 391)
@@ -171,6 +171,11 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-csv</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.debux.webmotion</groupId>
<artifactId>webmotion</artifactId>
</dependency>
Deleted: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Company.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Company.java 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Company.java 2013-09-13 15:41:44 UTC (rev 391)
@@ -1,7 +0,0 @@
-package org.chorem.webmotion.actions.crm;
-
-/**
- * @author jcouteau <couteau(a)codelutin.com>
- */
-public class Company {
-}
Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExport.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExport.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExport.java 2013-09-13 15:41:44 UTC (rev 391)
@@ -0,0 +1,77 @@
+package org.chorem.webmotion.actions.crm;
+
+/**
+ *
+ * @author couteau
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ContactRowForExport {
+
+ String firstName;
+ String lastName;
+ String company;
+ String address;
+ String mobilePhone;
+ String fixPhone;
+ String email;
+
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getMobilePhone() {
+ return mobilePhone;
+ }
+
+ public void setMobilePhone(String mobilePhone) {
+ this.mobilePhone = mobilePhone;
+ }
+
+ public String getFixPhone() {
+ return fixPhone;
+ }
+
+ public void setFixPhone(String fixPhone) {
+ this.fixPhone = fixPhone;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+}
Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExportModel.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExportModel.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ContactRowForExportModel.java 2013-09-13 15:41:44 UTC (rev 391)
@@ -0,0 +1,47 @@
+package org.chorem.webmotion.actions.crm;
+
+import org.nuiton.csv.ExportModel;
+import org.nuiton.csv.ExportableColumn;
+import org.nuiton.csv.ModelBuilder;
+
+/**
+ *
+ * @author couteau
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ContactRowForExportModel implements ExportModel<ContactRowForExport> {
+
+ @Override
+
+ public char getSeparator() {
+ return ';';
+ }
+
+ @Override
+
+ public Iterable<ExportableColumn<ContactRowForExport, Object>> getColumnsForExport() {
+
+ ModelBuilder<ContactRowForExport> modelBuilder = new ModelBuilder<ContactRowForExport>();
+
+ modelBuilder.newColumnForExport("FIRSTNAME", "firstName");
+
+ modelBuilder.newColumnForExport("LASTNAME", "lastName");
+
+ modelBuilder.newColumnForExport("COMPANY", "company");
+
+ modelBuilder.newColumnForExport("ADDRESS", "address");
+
+ modelBuilder.newColumnForExport("MOBILE", "mobilePhone");
+
+ modelBuilder.newColumnForExport("FIX", "fixPhone");
+
+ modelBuilder.newColumnForExport("EMAIL", "email");
+
+ return (Iterable) modelBuilder.getColumnsForExport();
+
+ }
+
+}
Added: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ExportAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ExportAction.java (rev 0)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/ExportAction.java 2013-09-13 15:41:44 UTC (rev 391)
@@ -0,0 +1,125 @@
+package org.chorem.webmotion.actions.crm;
+
+import org.apache.commons.io.IOUtils;
+import org.chorem.ChoremClient;
+import org.chorem.entities.ContactDetails;
+import org.chorem.entities.Employee;
+import org.chorem.entities.Company;
+import org.chorem.entities.Person;
+import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.render.Render;
+import org.nuiton.csv.Export;
+import org.nuiton.csv.ExportModel;
+import org.nuiton.wikitty.query.WikittyQuery;
+import org.nuiton.wikitty.query.WikittyQueryMaker;
+import org.nuiton.wikitty.query.WikittyQueryResult;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author couteau
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class ExportAction extends WebMotionController {
+
+ public Render exportContactBase(ChoremClient client) throws Exception {
+
+ // création du modèle d'export csv
+ ExportModel<ContactRowForExport> csvModel = new ContactRowForExportModel();
+
+ // les données à exporter
+ List<ContactRowForExport> datas = new ArrayList<ContactRowForExport>();
+
+ // recuperation des quotations en statut lead
+ WikittyQuery contactsQuery = new WikittyQueryMaker().and()
+ .exteq(Employee.EXT_EMPLOYEE)
+ .end().setLimit(WikittyQuery.MAX);
+
+ WikittyQueryResult<Employee> contacts =
+ client.findAllByQuery(Employee.class, contactsQuery);
+
+ for(Employee contact:contacts){
+ ContactRowForExport contactRow = new ContactRowForExport();
+ //Contact company
+ Company company = client.restore(Company.class, contact.getCompany(), "");
+ contactRow.setCompany(company.getName());
+
+ //contact names
+ Person person = client.restore(Person.class, contact.getPerson());
+ contactRow.setFirstName(person.getFirstName());
+ contactRow.setLastName(person.getLastName());
+
+ //start with person info
+ WikittyQuery personContactDetailsQuery = new WikittyQueryMaker().and()
+ .exteq(ContactDetails.EXT_CONTACTDETAILS)
+ .eq(ContactDetails.ELEMENT_FIELD_CONTACTDETAILS_TARGET, person.getWikittyId())
+ .end().setLimit(WikittyQuery.MAX);
+ WikittyQueryResult<ContactDetails> personContactDetails =
+ client.findAllByQuery(ContactDetails.class, personContactDetailsQuery);
+ for (ContactDetails detail:personContactDetails) {
+ addContactDetail(contactRow, detail);
+ }
+
+ //then company info (override person info if duplicate)
+ WikittyQuery companyContactDetailsQuery = new WikittyQueryMaker().and()
+ .exteq(ContactDetails.EXT_CONTACTDETAILS)
+ .eq(ContactDetails.ELEMENT_FIELD_CONTACTDETAILS_TARGET, company.getWikittyId())
+ .end().setLimit(WikittyQuery.MAX);
+ WikittyQueryResult<ContactDetails> companyContactDetails =
+ client.findAllByQuery(ContactDetails.class, companyContactDetailsQuery);
+ for (ContactDetails detail:companyContactDetails) {
+ addContactDetail(contactRow, detail);
+ }
+
+ //end with employee info (override previous info if duplicate)
+ WikittyQuery employeeContactDetailsQuery = new WikittyQueryMaker().and()
+ .exteq(ContactDetails.EXT_CONTACTDETAILS)
+ .eq(ContactDetails.ELEMENT_FIELD_CONTACTDETAILS_TARGET, contact.getWikittyId())
+ .end().setLimit(WikittyQuery.MAX);
+ WikittyQueryResult<ContactDetails> employeeContactDetails =
+ client.findAllByQuery(ContactDetails.class, employeeContactDetailsQuery);
+ for (ContactDetails detail:companyContactDetails) {
+ addContactDetail(contactRow, detail);
+ }
+
+ datas.add(contactRow);
+ }
+
+
+
+ // création d'un exporter
+ Export<ContactRowForExport> exporter = Export.newExport(csvModel, datas);
+
+ // lancement de l'export
+ OutputStream stream = new ByteArrayOutputStream();
+ exporter.write(stream);
+
+ return renderDownload(IOUtils.toInputStream(stream.toString()), "contacts.csv", "text/csv");
+ }
+
+ protected void addContactDetail(ContactRowForExport contact,ContactDetails detail) {
+ if ("email".equalsIgnoreCase(detail.getType())
+ || "mail".equalsIgnoreCase(detail.getType())){
+ contact.setEmail(detail.getValue());
+ }
+ if ("adresse".equalsIgnoreCase(detail.getType())){
+ contact.setAddress(detail.getValue());
+ }
+ if ("téléphone".equalsIgnoreCase(detail.getType())
+ || "telephone".equalsIgnoreCase(detail.getType())
+ || "phone".equalsIgnoreCase(detail.getType())){
+ if ("mobile".equalsIgnoreCase(detail.getName())){
+ contact.setMobilePhone(detail.getValue());
+ } else {
+ contact.setFixPhone(detail.getValue());
+ }
+ }
+
+ }
+}
Deleted: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Project.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Project.java 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/Project.java 2013-09-13 15:41:44 UTC (rev 391)
@@ -1,7 +0,0 @@
-package org.chorem.webmotion.actions.crm;
-
-/**
- * @author jcouteau <couteau(a)codelutin.com>
- */
-public class Project {
-}
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-09-13 15:41:44 UTC (rev 391)
@@ -11,8 +11,9 @@
* /fragment/* DecoratorFilter.decorate wmDecoratorNo=true
* /sales/funnel/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /sales/funnel/partial/* DecoratorFilter.decorate wmDecoratorNo=true
+* /crm/export DecoratorFilter.decorate wmDecoratorNo=true
* /project/json/* DecoratorFilter.decorate wmDecoratorNo=true
-* /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
+* /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /ascii/* DecoratorFilter.decorate wmDecoratorNo=true
* /rest/* DecoratorFilter.decorate wmDecoratorNo=true
GET /* DecoratorFilter.decorate
@@ -89,6 +90,8 @@
* /project/employee action:project.DashboardProjectAction.requestEmployee
* /crm/account/{id} action:crm.AccountAction.view
* /crm/quotation/edit/{id} action:crm.QuotationAction.edit
+* /crm/export action:crm.ExportAction.exportContactBase
+
#
# Wikitty Rest API
#
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/decorator.jsp 2013-09-13 15:41:44 UTC (rev 391)
@@ -97,6 +97,8 @@
<li class="divider"></li>
<li><a href="<c:url value="/wikitty/Touch/search"/>"><i class="icon-th-list icon-black"></i> All touch</a></li>
<li><a href="<c:url value="/wikitty/Touch/edit/new"/>"><i class="icon-plus icon-black"></i> Add touch</a></li>
+ <li class="divider"></li>
+ <li><a href="<c:url value="/crm/export"/>"> Export</li>
</ul>
</li>
<li class="dropdown nav-group">
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-09-13 12:31:00 UTC (rev 390)
+++ trunk/pom.xml 2013-09-13 15:41:44 UTC (rev 391)
@@ -90,6 +90,7 @@
<nuitonUtilsVersion>2.6.9</nuitonUtilsVersion>
<nuitonWebVersion>1.7</nuitonWebVersion>
<nuitonI18nVersion>2.3.1</nuitonI18nVersion>
+ <nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
<wikittyVersion>3.10-SNAPSHOT</wikittyVersion>
<slf4jVersion>1.6.1</slf4jVersion>
<javaxMailVersion>1.4.3</javaxMailVersion>
@@ -142,6 +143,14 @@
<version>${nuitonUtilsVersion}</version>
</dependency>
+
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-csv</artifactId>
+ <version>${nuitonCsvVersion}</version>
+ </dependency>
+
<dependency>
<groupId>org.nuiton.web</groupId>
<artifactId>nuiton-struts2</artifactId>
1
0
r390 - in trunk/chorem-webmotion/src/main/webapp: WEB-INF/jsp/salesReports js
by jcouteau@users.chorem.org 13 Sep '13
by jcouteau@users.chorem.org 13 Sep '13
13 Sep '13
Author: jcouteau
Date: 2013-09-13 14:31:00 +0200 (Fri, 13 Sep 2013)
New Revision: 390
Url: http://chorem.org/projects/chorem/repository/revisions/390
Log:
fixes #931 : integrate cancel capabilities in sales funnel
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-08-30 14:05:35 UTC (rev 389)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-09-13 12:31:00 UTC (rev 390)
@@ -5,9 +5,9 @@
<form class="form-horizontal">
<fieldset>
<label for="cancelledDate">Date d'annulation</label>
- <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.cancelledDate" id="cancelledDate" class="datepicker" />
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="toCancel.cancelledDate" id="cancelledDate" class="datepicker" />
<label for="cancelledReason">Raison</label>
- <input type="text" ng-model="lead.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
+ <input type="text" ng-model="toCancel.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
</fieldset>
</form>
</div>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-08-30 14:05:35 UTC (rev 389)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-09-13 12:31:00 UTC (rev 390)
@@ -4,8 +4,8 @@
<div class="modal-body">
<form class="form-horizontal">
<fieldset>
- <label for="sendDate">Date d'envoirrrrrrrrrrrr</label>
- <input type="text" ui-date ng-model="draft.sendingDate" id="sendDate" class="datepicker" />
+ <label for="sendDate">Date d'envoi</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="draft.sendingDate" id="sendDate" class="datepicker" />
</fieldset>
</form>
</div>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-30 14:05:35 UTC (rev 389)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-09-13 12:31:00 UTC (rev 390)
@@ -88,7 +88,7 @@
<li ng-repeat="draft in drafts" class="salesFunnelItem">
<div class="pull-left">
<a href="../wikitty/edit/{{draft.meta.id}}"/><i class="icon-edit"></i></a>
- <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a></small>
+ <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a><span ng-hide="!draft.getField('Draft','sendingDate')"> - Deadline:{{draft.getField('Draft','sendingDate') | date:'dd/MM/yyyy'}}</span></small>
<p>
<span class="salesFunnelItemTitle">
<a class="name-link" href="/wikitty/Project/view/{{draft.getField('Quotation','project')}}"/>{{draft.getField('Quotation','projet')}}</a>
@@ -112,8 +112,8 @@
<ul class="unstyled sents">
<li ng-repeat="sent in sents" class="salesFunnelItem">
<div class="pull-left">
- <a href="wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a>
- <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a></small>
+ <a href="../wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a>
+ <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a><span ng-hide="!sent.getField('Sent','postedDate')"> - Répondu le:{{sent.getField('Sent','postedDate') | date:'dd/MM/yyyy'}}</span></a></small>
<p>
<span>
<a class="name-link" href="/wikitty/Project/view/{{sent.getField('Quotation','project')}}"/>{{sent.getField('Quotation','projet')}}</a>
Modified: trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-08-30 14:05:35 UTC (rev 389)
+++ trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-09-13 12:31:00 UTC (rev 390)
@@ -119,7 +119,7 @@
$scope.lead = dialogModel.lead;
$scope.drafts = dialogModel.drafts;
$scope.leads = dialogModel.leads;
- $scope.lead.sendingDate = new Date().toString("dd/mm/yy");
+ //$scope.lead.sendingDate = new Date().toString("dd/mm/yy");
$scope.cancel = function(){
dialog.close();
@@ -223,8 +223,6 @@
$scope.sents = dialogModel.sents;
$scope.leads = dialogModel.leads;
$scope.drafts = dialogModel.drafts;
- $scope.toCancel.cancelledDate = new Date();
- $scope.toCancel.cancelledReason = "";
$scope.cancel = function(){
dialog.close();
@@ -233,8 +231,18 @@
$scope.validate = function(){
//pass scope to the success function
var scope = $scope;
- $http.get(createUrl('sales/funnel/json/cancel/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success(
+ $http.get(createUrl('sales/funnel/json/cancel/'+$scope.toCancel.meta.id),{params: {cancelledDate:$scope.toCancel.cancelledDate, reason:$scope.toCancel.reason}}).success(
function(data,status){
+ if ($scope.sents.indexOf($scope.toCancel)!= -1) {
+ $scope.sents.splice($scope.sents.indexOf($scope.toCancel),1);
+ }
+ if ($scope.drafts.indexOf($scope.toCancel)!= -1) {
+ $scope.drafts.splice($scope.drafts.indexOf($scope.toCancel),1);
+ }
+ if ($scope.leads.indexOf($scope.toCancel)!= -1) {
+ $scope.leads.splice($scope.leads.indexOf($scope.toCancel),1);
+ }
+
dialog.close();
}
);
1
0
r389 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions/sales resources webapp/WEB-INF/jsp/salesReports webapp/js
by jcouteau@users.chorem.org 30 Aug '13
by jcouteau@users.chorem.org 30 Aug '13
30 Aug '13
Author: jcouteau
Date: 2013-08-30 16:05:35 +0200 (Fri, 30 Aug 2013)
New Revision: 389
Url: http://chorem.org/projects/chorem/repository/revisions/389
Log:
Use angular to power up sales funnel
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html
trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
trunk/chorem-webmotion/src/main/webapp/js/chorem.js
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/sales/SalesAction.java 2013-08-30 14:05:35 UTC (rev 389)
@@ -32,10 +32,12 @@
import org.chorem.entities.Sent;
import org.chorem.entities.Started;
import org.chorem.entities.Cancelled;
+import org.chorem.webmotion.render.RenderWikitty;
import org.chorem.webmotion.render.RenderWikittyJson;
import org.debux.webmotion.server.WebMotionController;
import org.debux.webmotion.server.render.Render;
import org.nuiton.wikitty.WikittyUtil;
+import org.nuiton.wikitty.entities.Wikitty;
import java.text.ParseException;
import java.util.Date;
@@ -85,14 +87,14 @@
getContext().addInfoMessage("message", "Warning: Could not parse date " + rejectedDate);
}
client.store(rejected);
- return new RenderWikittyJson(rejected);
+ return new RenderWikitty().setModelWikitty((Wikitty) rejected);
}
public Render start(ChoremClient client, String id) {
Started started = client.restore(Started.class, id);
started.setStartedDate(new Date());
client.store(started);
- return new RenderWikittyJson(started);
+ return new RenderWikitty().setModelWikitty((Wikitty)started);
}
public Render answer(ChoremClient client, String id, String sendingDate,
@@ -106,7 +108,8 @@
}
draft.setReference(reference);
draft = client.store(draft);
- return new RenderWikittyJson(draft);
+ Wikitty w = client.castTo(Wikitty.class, draft);
+ return new RenderWikitty().setModelWikitty(w);
}
public Render cancel(ChoremClient client, String id, String cancelledDate,
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2013-08-30 14:05:35 UTC (rev 389)
@@ -10,6 +10,7 @@
* /wikitty-json/* DecoratorFilter.decorate wmDecoratorNo=true
* /fragment/* DecoratorFilter.decorate wmDecoratorNo=true
* /sales/funnel/json/* DecoratorFilter.decorate wmDecoratorNo=true
+* /sales/funnel/partial/* DecoratorFilter.decorate wmDecoratorNo=true
* /project/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true
* /ascii/* DecoratorFilter.decorate wmDecoratorNo=true
@@ -74,6 +75,11 @@
* /sales/report/salesPerAccount action:sales.SalesPerAccountReportAction.sales
* /sales/report/salesPerAccount/{account} action:sales.AccountSalesReportAction.sales
* /sales/funnel action:sales.FunnelAction.funnel
+* /sales/funnel/partial/dialog-leadToDraft.html view:salesReports/dialog-leadToDraft.html
+* /sales/funnel/partial/dialog-draftToSent.html view:salesReports/dialog-draftToSent.html
+* /sales/funnel/partial/dialog-sentToAccepted.html view:salesReports/dialog-sentToAccepted.html
+* /sales/funnel/partial/dialog-sentToRejected.html view:salesReports/dialog-sentToRejected.html
+* /sales/funnel/partial/dialog-cancel.html view:salesReports/dialog-cancel.html
* /sales/funnel/json/{method} action:sales.SalesAction.{method}
* /sales/funnel/json/{method}/{id} action:sales.SalesAction.{method}
* /project action:project.DashboardProjectAction.requestProject
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,17 @@
+<div class="modal-header" title="Proposition commerciale annulée">
+ <h3>Proposition commerciale annulée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="cancelledDate">Date d'annulation</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.cancelledDate" id="cancelledDate" class="datepicker" />
+ <label for="cancelledReason">Raison</label>
+ <input type="text" ng-model="lead.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Valider</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale envoyée">
+ <h3>Proposition commerciale envoyée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="sendDate">Date d'envoirrrrrrrrrrrr</label>
+ <input type="text" ui-date ng-model="draft.sendingDate" id="sendDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Envoyer</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-leadToDraft.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,17 @@
+<div class="modal-header" title="Proposition commerciale à envoyer">
+ <h3>Proposition commerciale à envoyer</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="sendingDate">Date d'envoi</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.sendingDate" id="sendingDate" class="datepicker" />
+ <label for="reference">Référence</label>
+ <input type="text" ng-model="lead.reference" id="reference" class="text ui-widget-content ui-corner-all" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Envoyer</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToAccepted.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale acceptée">
+ <h3>Proposition commerciale acceptée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="acceptedDate">Date d'acceptation</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="sent.acceptedDate" id="acceptedDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Accepter</button>
+</div>
\ No newline at end of file
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-sentToRejected.html 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,15 @@
+<div class="modal-header" title="Proposition commerciale rejetée">
+ <h3>Proposition commerciale rejetée</h3>
+</div>
+<div class="modal-body">
+ <form class="form-horizontal">
+ <fieldset>
+ <label for="rejectedDate">Date de rejet</label>
+ <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="sent.rejectedDate" id="rejectedDate" class="datepicker" />
+ </fieldset>
+ </form>
+</div>
+<div class="modal-footer">
+ <button ng-click="cancel()">Annuler</button>
+ <button ng-click="validate()">Rejeter</button>
+</div>
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-30 14:05:35 UTC (rev 389)
@@ -27,11 +27,17 @@
<head>
<link rel="stylesheet/less" href="<c:url value='/css/chorem-sales.css'/>">
+ <script type="text/javascript" src="<c:url value='/js/salesFunnel.js'/>"></script>
+ <script type="text/javascript" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.5.0.js"></script>
+ <script type="text/javascript" src="https://raw.github.com/angular-ui/ui-date/master/src/date.js"></script>
</head>
<body>
-<div class="row-fluid">
+<div ng-app="salesFunnel">
+
+<div class="row-fluid" ng-controller="salesFunnelController">
+
<ul id="funnelTabs" class="nav nav-tabs" data-tabs="funnelTabs">
<li class="active" >
<a href="#lead" data-toggle="tab">Leads</a>
@@ -48,150 +54,87 @@
<!-- LEADS TAB -->
<div class="tab-pane active" id="lead">
- <h4> Total : ${leadAmount}€ - Total espéré : ${leadAmountHope}€</h4>
+ <h4> Total : {{leadsAmount}}€ - Total espéré : {{leadsAmountHope}}€</h4>
<ul class="unstyled leads">
- <c:forEach var="q" items="${leads}">
- <li class="salesFunnelItem">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>">
- <i class="icon-edit"></i>
- </a>
- <small>
- <a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/>
- </a>
- </small>
- <p>
- <span class="salesFunnelItemTitle">
- <a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/>
- </a>
- </span> - <small>
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/>
- </small>
- </p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton lead" wikittyId="${q.wikittyId}">Répondre</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle">
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/>
- </p>
- <small>
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> -
- <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j
- </small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="lead in leads" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="../wikitty/edit/{{lead.meta.id}}"/>
+ <i class="icon-edit"></i>
+ </a>
+ <small>
+ <a href="/wikitty/Employee/view/{{lead.getField('Quotation', 'customer')}}">{{lead.getField('Quotation','customer')}}</a>
+ </small>
+ <p>
+ <span class="salesFunnelItemTitle">
+ <a class="name-link" href="/wikitty/Project/view/{{lead.getField('Quotation','project')}}"/>{{lead.getField('Quotation','projet')}}</a>
+ </span> - <small>{{lead.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="leadToDraft(lead)">Envoyer</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(lead)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{lead.getField('Quotation','amount')}} €</p>
+ <small>{{lead.getField('Quotation','category')}} - {{lead.getField('Quotation','estimatedDays')}}j - {{lead.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
<!-- DRAFT TAB -->
<div class="tab-pane" id="draft">
- <h4>Total : <span id="draftAmount">${draftAmount}</span>€ - Total espéré : <span id="draftAmountHope">${draftAmountHope}</span>€</h4>
+ <h4>Total : {{draftsAmount}}€ - Total espéré : {{draftsAmountHope}}€</h4>
<ul class="unstyled drafts">
- <c:forEach var="q" items="${drafts}">
- <li class="salesFunnelItem draft">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i class="icon-edit"></i></a>
- <small><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></a></small>
- <p><span class="salesFunnelItemTitle"><a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></a></span> - <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/></small></p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton draft" wikittyId="${q.wikittyId}">Envoyer</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></p>
- <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> - <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j - <w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="draft in drafts" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="../wikitty/edit/{{draft.meta.id}}"/><i class="icon-edit"></i></a>
+ <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a></small>
+ <p>
+ <span class="salesFunnelItemTitle">
+ <a class="name-link" href="/wikitty/Project/view/{{draft.getField('Quotation','project')}}"/>{{draft.getField('Quotation','projet')}}</a>
+ </span> - <small>{{draft.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="draftToSent(draft)">Envoyer</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(draft)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{draft.getField('Quotation','amount')}} €</p>
+ <small>{{draft.getField('Quotation','category')}} - {{draft.getField('Quotation','estimatedDays')}}j - {{draft.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
<!-- SENT TAB -->
<div class="tab-pane" id="sent">
- <h4> Total : <span id="sentAmount">${sentAmount}</span>€ - Total espéré : <span id="sentAmountHope">${sentAmountHope}</span>€</h4>
+ <h4> Total : {{sentsAmount}}€ - Total espéré : {{sentsAmountHope}}€</h4>
<ul class="unstyled sents">
- <c:forEach var="q" items="${sents}">
- <li class="salesFunnelItem sent">
- <div class="pull-left">
- <a href="<c:url value="/wikitty/edit/${q.wikittyId}"/>"><i class="icon-edit"></i></a>
- <small><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></a></small>
- <p><span class="salesFunnelItemTitle"><a class="name-link" href="<c:url value="/wikitty/Project/view/${q.project}"/>"><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></a></span> - <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.description" label=""/></small></p>
- </div>
- <a class="btn btn-success pull-right salesFunnelItemButton sent toAccepted" wikittyId="${q.wikittyId}">Accepté</a>
- <a class="btn btn-danger pull-right salesFunnelItemButton sent toRejected" wikittyId="${q.wikittyId}">Rejeté</a>
- <a class="btn btn-warning pull-right salesFunnelItemButton toCancelled" wikittyId="${q.wikittyId}">Annuler</a>
- <div class="pull-right salesFunnelItemPrice">
- <p class="salesFunnelItemTitle"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></p>
- <small><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/> - <w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/>j - <w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></small>
- </div>
- <div style="clear:both;"/>
- </li>
- </c:forEach>
+ <li ng-repeat="sent in sents" class="salesFunnelItem">
+ <div class="pull-left">
+ <a href="wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a>
+ <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a></small>
+ <p>
+ <span>
+ <a class="name-link" href="/wikitty/Project/view/{{sent.getField('Quotation','project')}}"/>{{sent.getField('Quotation','projet')}}</a>
+ </span> - <small>{{sent.getField('Quotation','description')}}</small>
+ </p>
+ </div>
+ <a class="btn btn-success pull-right" ng-click="sentToAccepted(sent)">Accepté</a>
+ <a class="btn btn-danger pull-right" ng-click="sentToRejected(sent)">Rejeté</a>
+ <a class="btn btn-warning pull-right" ng-click="cancel(sent)">Annuler</a>
+ <div class="pull-right">
+ <p class="salesFunnelItemTitle">{{sent.getField('Quotation','amount')}} €</p>
+ <small>{{sent.getField('Quotation','category')}} - {{sent.getField('Quotation','estimatedDays')}}j - {{sent.getField('Quotation','conversionHope')}} %</small>
+ </div>
+ <div style="clear:both;"/>
+ </li>
</ul>
</div>
-
- <div id="dialog-form-leadToDraft" title="Proposition commerciale à envoyer">
- <form>
- <fieldset>
- <label for="sendingDate">Date d'envoi</label>
- <input type="text" name="sendingDate" id="sendingDate" class="datepicker" />
- <label for="reference">Référence</label>
- <input type="text" name="reference" id="reference" value="" class="text ui-widget-content ui-corner-all" />
- <input type="hidden" name="id" id="lead-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-draftToSent" title="Proposition commerciale envoyée">
- <form>
- <fieldset>
- <label for="sendDate">Date d'envoi</label>
- <input type="text" name="sendDate" id="sendDate" class="datepicker" />
- <input type="hidden" name="id" id="draft-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-sentToAccepted" title="Proposition commerciale acceptée">
- <form>
- <fieldset>
- <label for="acceptedDate">Date d'acceptation</label>
- <input type="text" name="acceptedDate" id="acceptedDate" class="datepicker" />
- <input type="hidden" name="id" id="sent-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-sentToRejected" title="Proposition commerciale refusée">
- <form>
- <fieldset>
- <label for="rejectedDate">Date de refus</label>
- <input type="text" name="rejectedDate" id="rejectedDate" class="datepicker" />
- <input type="hidden" name="id" id="rejected-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
- <div id="dialog-form-toCancelled" title="Proposition commerciale annulée">
- <form>
- <fieldset>
- <label for="cancelledDate">Date d'annulation</label>
- <input type="text" name="cancelledDate" id="cancelledDate" class="datepicker" />
- <label for="cancelledReason">Raison</label>
- <input type="text" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" />
- <input type="hidden" name="id" id="cancelled-wikittyId"/>
- </fieldset>
- </form>
- </div>
-
</div>
</div>
+</div>
<div style="clear:both;"/>
</body>
\ No newline at end of file
Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-08-16 09:51:45 UTC (rev 388)
+++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2013-08-30 14:05:35 UTC (rev 389)
@@ -96,41 +96,6 @@
/*********** SALES FUNNEL FUNCTIONS**********************/
-function leadToDraft(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#lead-wikittyId").val(id);
- $("#dialog-form-leadToDraft" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function draftToSent(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#draft-wikittyId").val(id);
- $("#dialog-form-draftToSent" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function sentToAccepted(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#sent-wikittyId").val(id);
- $("#dialog-form-sentToAccepted" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function sentToRejected(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#rejected-wikittyId").val(id);
- $("#dialog-form-sentToRejected" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
-function toCancelled(){
- var id = $(this).attr('wikittyId');
- var oldQuotation = $(this).parent();
- $("#cancelled-wikittyId").val(id);
- $("#dialog-form-toCancelled" ).data("oldQuotation", oldQuotation).dialog( "open" );
-};
-
//ajout ble
//clic sur les cases à cocher half-day d'une vacation (VacationRequest)
@@ -266,451 +231,7 @@
return false;
});
- // ********************************************************************
- // * SALES FUNNEL *
- // ********************************************************************
-
- //Passage d'un lead -> draft
- $("a.lead").click(leadToDraft);
-
- $( "#dialog-form-leadToDraft" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var reference = $("#reference").val();
- var sendingDate = $("#sendingDate").val();
- var id = $("#lead-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#reference")).add($("#sendingDate")).add($("#lead-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/answer/", id,"?sendingDate=", sendingDate, "&reference=",reference),
- function(data){
- //success
- var wikittyId = data.meta.id;
- var wikitty = data.data;
-
- var li = $("<li></li>").addClass("salesFunnelItem draft");
-
- //leftDiv
- var leftDiv = $("<div></div>").addClass("pull-left");
- var aIconEdit = $("<a></a>")
- .attr("href", createUrl("/wikitty/edit/", wikittyId));
- var iconEdit = $("<i></i>").addClass("icon-edit");
- aIconEdit.append(iconEdit);
- leftDiv.append(aIconEdit);
- var smallAccount = $("<small></small>");
- if (wikitty["Quotation.customer"]!=null){
- var customer = data.preloaded[wikitty["Quotation.customer"]];
- var firstName = customer.preloaded[customer.data["Employee.person"]].data["Person.firstName"];
- var lastName = customer.preloaded[customer.data["Employee.person"]].data["Person.lastName"];
- var company = customer.preloaded[customer.data["Employee.company"]].data["Company.name"];
- }
- var aAccount = $("<a></a>")
- .text(firstName + " " + lastName + " (" + company + ")")
- .attr("href",createUrl("/wikitty/Employee/view/", wikitty["Quotation.customer"]));
- smallAccount.append(aAccount);
- leftDiv.append(smallAccount);
- var leftP = $("<p> - </p>");
- var itemTitleSpan = $('<span></span>').addClass('salesFunnelItemTitle');
-
- if (wikitty["Quotation.project"]!=null) {
- var aProject = $("<a/>")
- .addClass("nameLink")
- .attr("href" , createUrl("/wikitty/Project/view/", wikitty["Quotation.project"]))
- .text(data.preloaded[wikitty["Quotation.project"]].data["Project.name"]);
- }
- itemTitleSpan.append(aProject);
- var descriptionSmall = $('<small/>').text(wikitty["Quotation.description"]);
- leftP.append(descriptionSmall);
- leftP.prepend(itemTitleSpan);
- leftDiv.append(leftP);
-
- //button
- var aSend = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-success pull-right salesFunnelItemButton draft")
- .text("Envoyer")
- .click(draftToSent);
-
- var aCancelled = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-warning pull-right salesFunnelItemButton toCancelled")
- .text("Annuler")
- .click(toCancelled);
-
- //rightDiv
- var rightDiv = $("<div>").addClass("pull-right");
- var rightP = $("<p>").addClass("salesFunnelItemTitle").text(wikitty["Quotation.amount"] +" €");
- if (wikitty["Quotation.category"] != null) {
- var smallInfo = $("<small>")
- .text(data.preloaded[wikitty["Quotation.category"]].data["WikittyTreeNode.name"]
- + ' - ' + wikitty["Quotation.estimatedDays"] + 'j - ' +
- wikitty["Quotation.conversionHope"] + "%");
- }
- rightDiv.append(rightP);
- rightDiv.append(smallInfo);
-
- //clear:both
- var clearBoth=$("<div style='clear:both;'/>")
-
- li.append(leftDiv);
- li.append(aSend);
- li.append(aCancelled);
- li.append(rightDiv);
- li.append(clearBoth);
-
- var drafts = $(".drafts");
- drafts.append(li);
- oldQuotation.slideUp();
-
- //update draftAmount and draftAmountHope
- var draftAmount = parseInt($("#draftAmount").text()) + wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var draftAmountHope = parseInt($("#draftAmountHope").text()) + amountHope;
- $("#draftAmount").text(draftAmount);
- $("#draftAmountHope").text(draftAmountHope);
-
- //update leadAmount and leadAmountHope
- var leadAmount = parseInt($("#leadAmount").text()) - wikitty["Quotation.amount"];
- var leadAmountHope = parseInt($("#leadAmountHope").text()) - amountHope;
- $("#leadAmount").text(leadAmount);
- $("#leadAmountHope").text(leadAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#sendingDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un draft -> sent
- $("a.draft").click(draftToSent);
-
- $( "#dialog-form-draftToSent" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var sendingDate = $("#sendDate").val();
- var id = $("#draft-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#sendDate")).add($("#draft-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/send/", id,"?sendingDate=", sendingDate),
- function(data){
- //success
-
- var wikittyId = data.meta.id;
- var wikitty = data.data;
-
- var li = $("<li></li>").addClass("salesFunnelItem draft");
-
- //leftDiv
- var leftDiv = $("<div></div>").addClass("pull-left");
- var aIconEdit = $("<a></a>")
- .attr("href",createUrl("/wikitty/edit/", wikittyId));
- var iconEdit = $("<i></i>").addClass("icon-edit");
- aIconEdit.append(iconEdit);
- leftDiv.append(aIconEdit);
- var smallAccount = $("<small></small>");
- if (wikitty["Quotation.customer"]!=null){
- var customer = data.preloaded[wikitty["Quotation.customer"]];
- var firstName = customer.preloaded[customer.data["Employee.person"]].data["Person.firstName"];
- var lastName = customer.preloaded[customer.data["Employee.person"]].data["Person.lastName"];
- var company = customer.preloaded[customer.data["Employee.company"]].data["Company.name"];
- }
- var aAccount = $("<a></a>")
- .text(firstName + " " + lastName + " (" + company + ")")
- .attr("href", createUrl("/wikitty/Employee/view/", wikitty["Quotation.customer"]));
- smallAccount.append(aAccount);
- leftDiv.append(smallAccount);
- var leftP = $("<p> - </p>");
- var itemTitleSpan = $('<span></span>').addClass('salesFunnelItemTitle');
-
- if (wikitty["Quotation.project"]!=null) {
- var aProject = $("<a/>")
- .addClass("nameLink")
- .attr("href" , createUrl("/wikitty/Project/view/", wikitty["Quotation.project"]))
- .text(data.preloaded[wikitty["Quotation.project"]].data["Project.name"]);
- }
- itemTitleSpan.append(aProject);
- var descriptionSmall = $('<small/>').text(wikitty["Quotation.description"]);
- leftP.append(descriptionSmall);
- leftP.prepend(itemTitleSpan);
- leftDiv.append(leftP);
-
- //button
- var aAccepted = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-success pull-right salesFunnelItemButton sent toAccepted")
- .text("Accepté")
- .click(sentToAccepted);
- var aRejected = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-danger pull-right salesFunnelItemButton sent toRejected")
- .text("Rejeté")
- .click(sentToRejected);
- var aCancelled = $('<a/>')
- .attr('wikittyId', wikittyId)
- .addClass("btn btn-warning pull-right salesFunnelItemButton sent toCancelled")
- .text("Annuler")
- .click(toCancelled);
-
- //rightDiv
- var rightDiv = $("<div>").addClass("pull-right");
- var rightP = $("<p>").addClass("salesFunnelItemTitle").text(wikitty["Quotation.amount"] +" €");
- if (wikitty["Quotation.category"] != null) {
- var smallInfo = $("<small>")
- .text(data.preloaded[wikitty["Quotation.category"]].data["WikittyTreeNode.name"]
- + ' - ' + wikitty["Quotation.estimatedDays"] + 'j - ' +
- wikitty["Quotation.conversionHope"] + "%");
- }
- rightDiv.append(rightP);
- rightDiv.append(smallInfo);
-
- //clear:both
- var clearBoth=$("<div style='clear:both;'/>")
-
- li.append(leftDiv);
- li.append(aAccepted);
- li.append(aRejected);
- li.append(aCancelled);
- li.append(rightDiv);
- li.append(clearBoth);
-
- var sents = $(".sents");
- sents.append(li);
- oldQuotation.slideUp();
-
- //update draftAmount and draftAmountHope
- var draftAmount = parseInt($("#draftAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var draftAmountHope = parseInt($("#draftAmountHope").text()) - amountHope;
- $("#draftAmount").text(draftAmount);
- $("#draftAmountHope").text(draftAmountHope);
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) + wikitty["Quotation.amount"];
- var sentAmountHope = parseInt($("#sentAmountHope").text()) + amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#sendDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un sent vers accepted
- $("a.toAccepted").click(sentToAccepted);
-
- $( "#dialog-form-sentToAccepted" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var acceptedDate = $("#acceptedDate").val();
- var id = $("#sent-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#acceptedDate")).add($("#sent-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/accept/", id,"?acceptedDate=", acceptedDate),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#acceptedDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage d'un sent vers rejected
- $("a.toRejected").click(sentToRejected);
-
- $( "#dialog-form-sentToRejected" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var rejectedDate = $("#rejectedDate").val();
- var id = $("#rejected-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#rejectedDate")).add($("#rejected-wikittyId"))
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/reject/", id,"?rejectedDate=", rejectedDate),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //update sentAmount and sentAmountHope
- var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- $("#sentAmount").text(sentAmount);
- $("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
-
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#rejectedDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
- //Passage vers cancelled
- $("a.toCancelled").click(toCancelled);
-
- $( "#dialog-form-toCancelled" ).dialog({
- autoOpen: false,
- height: 300,
- width: 350,
- modal: true,
- buttons: {
- Ok: function() {
-
- var cancelledDate = $("#cancelledDate").val();
- var reason = $("#cancelledReason").val();
- var id = $("#cancelled-wikittyId").val();
- var oldQuotation = $(this).data('oldQuotation');
- var allFields = $([]).add($("#cancelledDate")).add($("#cancelled-wikittyId")).add($("#cancelledReason"));
-
- var dialog = $( this );
-
- $.post(createUrl("/sales/funnel/json/cancel/", id,"?cancelledDate=", cancelledDate,"&reason=",reason),
- function(data){
- //success
- oldQuotation.slideUp();
-
- var wikitty = data.data;
-
- //TODO JC20130527 update amounts
- //update sentAmount and sentAmountHope
- //var sentAmount = parseInt($("#sentAmount").text()) - wikitty["Quotation.amount"];
- //var amountHope = wikitty["Quotation.amount"]*wikitty["Quotation.conversionHope"]/100;
- //var sentAmountHope = parseInt($("#sentAmountHope").text()) - amountHope;
- //$("#sentAmount").text(sentAmount);
- //$("#sentAmountHope").text(sentAmountHope);
-
- allFields.val("");
- dialog.dialog( "close" );
-
- }).fail(function(){
- //fail
- //TODO JC20130212 retour utilisateur
- dialog.dialog( "close" );
- });
-
- },
- Cancel: function() {
- $( this ).dialog( "close" );
- }
- },
- close: function() {
- },
- open: function(event, ui) {
- var date = new Date();
- $("#cancelledDate").val(date.getDate() + "/" + (date.getMonth()+1)+"/"+date.getFullYear());
- }
- });
-
// ********************************************************************
// * PROJECT DASHBOARD *
// ********************************************************************
Added: trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-08-30 14:05:35 UTC (rev 389)
@@ -0,0 +1,242 @@
+var salesFunnel = angular.module('salesFunnel', ['wikitty', 'ui.bootstrap', 'ui.date']);
+
+salesFunnel.directive('datepicker', function() {
+ return {
+ restrict: 'A',
+ require : 'ngModel',
+ link : function (scope, element, attrs, ngModelCtrl) {
+ $(function(){
+ element.datepicker({
+ dateFormat:'dd/mm/yy',
+ onSelect:function (date) {
+ ngModelCtrl.$setViewValue(date);
+ scope.$apply();
+ }
+ });
+ });
+ }
+ }
+});
+
+
+var salesFunnelController = ['$scope', '$dialog', 'Wikitty', function ($scope, $dialog, Wikitty) {
+ $scope.wikittyId = '';
+ $scope.wikitty = {};
+
+ $scope.leads = {};
+ $scope.leadsAmount=0;
+ $scope.leadsAmountHope=0;
+ $scope.drafts={};
+ $scope.draftsAmount=0;
+ $scope.draftsAmountHope=0;
+ $scope.sents={};
+ $scope.sentsAmount=0;
+ $scope.sentsAmountHope=0;
+
+ Wikitty.query("extension = Quotation AND extension != Draft AND extension != Cancelled", function(w) {
+ $scope.leads= w;
+ });
+
+ Wikitty.query("extension = Draft AND extension != Sent AND extension != Cancelled", function(w) {
+ $scope.drafts= w;
+ });
+
+ Wikitty.query("extension = Sent AND extension != Accepted AND extension != Rejected AND extension != Cancelled", function(w) {
+ $scope.sents= w;
+ });
+
+ $scope.leadToDraft = function(lead){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-leadToDraft.html',
+ controller: 'LeadToDraftDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {lead:lead, leads:$scope.leads, drafts:$scope.drafts};
+ }
+ }
+ });
+ d.open();
+ //initFields();
+ };
+
+ $scope.draftToSent = function(draft){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-draftToSent.html',
+ controller: 'DraftToSentDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {draft:draft, drafts:$scope.drafts, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.sentToAccepted = function(sent){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-sentToAccepted.html',
+ controller: 'SentToAcceptedDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {sent:sent, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.sentToRejected = function(sent){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-sentToRejected.html',
+ controller: 'SentToRejectedDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {sent:sent, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+
+ $scope.cancel = function(toCancel){
+ var d = $dialog.dialog({
+ templateUrl: './funnel/partial/dialog-cancel.html',
+ controller: 'CancelDialogController',
+ resolve: {
+ dialogModel: function() {
+ return {toCancel:toCancel, leads:$scope.leads, drafts:$scope.drafts, sents:$scope.sents};
+ }
+ }
+ });
+ d.open();
+ };
+}];
+
+
+
+// Controller for the Lead To Draft Dialog
+var LeadToDraftDialogController = ['$scope', '$http', 'dialog', 'dialogModel', 'Wikitty', function ($scope, $http, dialog, dialogModel, Wikitty) {
+ $scope.lead = dialogModel.lead;
+ $scope.drafts = dialogModel.drafts;
+ $scope.leads = dialogModel.leads;
+ $scope.lead.sendingDate = new Date().toString("dd/mm/yy");
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/answer/'+$scope.lead.meta.id),
+ {params: {sendingDate:$scope.lead.sendingDate,reference:$scope.lead.reference}}).success(
+ function(data,status){
+ scope.drafts.push(new Wikitty(data));
+ scope.leads.splice(scope.leads.indexOf(scope.lead),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Draft To Sent Dialog
+var DraftToSentDialogController = ['$scope', '$http', 'dialog', 'dialogModel', 'Wikitty', function ($scope, $http, dialog, dialogModel, Wikitty) {
+ $scope.draft = dialogModel.draft;
+ $scope.drafts = dialogModel.drafts;
+ $scope.sents = dialogModel.sents;
+ //$scope.draft.sendingDate = new Date().toString("dd/mm/yy");
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/send/'+$scope.draft.meta.id),
+ {params: {sendingDate:$scope.draft.sendingDate}}).success(
+ function(data,status){
+ scope.sents.push(new Wikitty(data));
+ scope.drafts.splice(scope.drafts.indexOf(scope.draft),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Sent to Accepted Dialog
+var SentToAcceptedDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.sent = dialogModel.sent;
+ $scope.sents = dialogModel.sents;
+ $scope.sent.acceptedDate = new Date();
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/accept/'+$scope.sent.meta.id),
+ {params: {acceptedDate:$scope.sent.acceptedDate}}).success(
+ function(data,status){
+ $scope.sents.splice($scope.sents.indexOf(sent),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Sent to Rejected Dialog
+var SentToRejectedDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.sent = dialogModel.sent;
+ $scope.sents = dialogModel.sents;
+ $scope.sent.rejectedDate = new Date();
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/reject/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success(
+ function(data,status){
+ $scope.sents.splice($scope.sents.indexOf(sent),1);
+ dialog.close();
+ }
+ );
+ }
+}];
+
+
+
+// Controller for the Cancel Dialog
+var CancelDialogController = ['$scope', '$http', 'dialog', 'dialogModel', function ($scope, $http, dialog, dialogModel) {
+ $scope.toCancel = dialogModel.toCancel;
+ $scope.sents = dialogModel.sents;
+ $scope.leads = dialogModel.leads;
+ $scope.drafts = dialogModel.drafts;
+ $scope.toCancel.cancelledDate = new Date();
+ $scope.toCancel.cancelledReason = "";
+
+ $scope.cancel = function(){
+ dialog.close();
+ };
+
+ $scope.validate = function(){
+ //pass scope to the success function
+ var scope = $scope;
+ $http.get(createUrl('sales/funnel/json/cancel/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success(
+ function(data,status){
+ dialog.close();
+ }
+ );
+ }
+}];
\ No newline at end of file
1
0
Author: meynier
Date: 2013-08-16 11:51:45 +0200 (Fri, 16 Aug 2013)
New Revision: 388
Url: http://chorem.org/projects/chorem/repository/revisions/388
Log:
Update the documentation
Modified:
trunk/src/site/rst/calculations.rst
Modified: trunk/src/site/rst/calculations.rst
===================================================================
--- trunk/src/site/rst/calculations.rst 2013-08-16 09:07:56 UTC (rev 387)
+++ trunk/src/site/rst/calculations.rst 2013-08-16 09:51:45 UTC (rev 388)
@@ -146,16 +146,19 @@
-----------------
La classe **AdcCalculation** dans le package *org.chorem.project* gère le calcul du CJM [2]_ (ou ADC).
-Il existe deux types de CJM : le CJM réel est le CJM estimé. Une seule variable du calcul change : le temps productif sur l'année.
+Il existe deux types de CJM : le CJM réel et le CJM estimé. Une seule variable du calcul change : le temps productif sur l'année.
+
Dans le cas du CJM estimé, ce temps est calculé à partir du temps journalier et du taux de productivité.
-Dans le cas du CJM réel, il est calculé à partir des objets Time de l'année concernée.::
+Dans le cas du CJM réel, il est calculé à partir des objets Time de l'année concernée.
- adc = ( (expenses * employeeCost) / totalCompanyCost ) / productiveDays;
+Les dépenses sont calculées à partir de l'année concernée. Pour le CJM estimé, c'est l'année précédente qui est prise en compte.::
+ adc = ( (totalExpenses * employeeCost) / totalEmployeesCost ) / productiveDays;
+
2.1.1 Dépenses totales
~~~~~~~~~~~~~~~~~~~~~~
-Les dépenses totales sont la somme des paiements (FinancialTransaction) effectués par l'entreprise sur l'année. Une simple requête Wikitty est effectué afin de récupérer ces objets FinancialTransaction afin d'effectuer la somme des montants HT::
+Les dépenses totales sont la somme des paiements (FinancialTransaction) effectués par l'entreprise sur l'année. Une requête Wikitty est effectuée afin de récupérer ces objets FinancialTransaction afin d'effectuer la somme des montants HT::
totalExpenses = Σ expense
@@ -164,7 +167,7 @@
Le coût annuel de l'employé est le salaire à temps plein multiplié par le nombre de jours travaillé durant l'année::
- employeeCost = ( employee.salary + employee.otherPayments) * employee.partialTime * productiveDays
+ employeeCost = ( ( employee.salary + employee.otherPayments) / employee.partialTime) * productiveDays
2.1.3 Nombre de jours travaillés
@@ -186,12 +189,12 @@
productiveDays = ( Σ(times(employee)) / dailyHoursWorked ) * productivityRate
-2.1.4 Coût annuel de l'entreprise
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2.1.4 Coût annuel des employés
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Le coût annuel de l'entreprise est la somme des coûts annuels des employés productifs.::
- totalCompanyCost = Σ employeeCost(company.employees)
+ totalEmployeesCost = Σ employeeCost(company.employees)
.. [1] Taux Journalier Moyen (ADR : Average Daily Rate)
1
0
r387 - in trunk: chorem-entities/src/main/java/org/chorem/entities chorem-entities/src/main/java/org/chorem/project chorem-webmotion/src/main/java/org/chorem/webmotion/actions chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project
by meynier@users.chorem.org 16 Aug '13
by meynier@users.chorem.org 16 Aug '13
16 Aug '13
Author: meynier
Date: 2013-08-16 11:07:56 +0200 (Fri, 16 Aug 2013)
New Revision: 387
Url: http://chorem.org/projects/chorem/repository/revisions/387
Log:
Cleaned the code
Removed:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java
Modified:
trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
Modified: trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -41,6 +41,19 @@
DELIVERED, // developpement fini et livre (on peut envoyer la facture de fin)
RSV, // l'application est en verification en service regulier chez le client (~1 mois)
WARRANTY, // fin de la vsr, on passe en garantie et on peut facture le reste (s'il reste encore des choses)
- CLOSED // tout est fini et clos, plus rien a faire
+ CLOSED; // tout est fini et clos, plus rien a faire
+ String[] extensions = {
+ "Quotation",
+ "Draft",
+ "Sent",
+ "Rejected",
+ "Accepted",
+ "Started",
+ "Delivered",
+ "RSV",
+ "Warranty",
+ "Closed",
+ "Cancelled"
+ };
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/AdcCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -18,6 +18,7 @@
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
+import org.nuiton.wikitty.query.conditions.Aggregate;
/**
* Makes the calculation for the adc.
@@ -72,7 +73,7 @@
/**
* Initiate the start and end date to the beginning and end of the year
- * TODO : Manage this in the configuration of chorem
+ * TODO : Manage this in the admin configuration of chorem
*/
protected void initDate() {
Calendar cstart = new GregorianCalendar();
@@ -110,6 +111,8 @@
//Construct the query
WikittyQuery expenseQuery = new WikittyQueryMaker()
+ .select()
+ .sum(FinancialTransaction.ELEMENT_FIELD_FINANCIALTRANSACTION_AMOUNT)
.and()
.exteq(FinancialTransaction.EXT_FINANCIALTRANSACTION) //of type financial transaction
.or()
@@ -120,34 +123,42 @@
//The payment hapened during the year
.bw(FinancialTransaction.FQ_FIELD_FINANCIALTRANSACTION_EMITTEDDATE, start, end)
.end();
+ System.out.println("QUERY = " + expenseQuery);
- WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
-
+ //WikittyQueryResult<FinancialTransaction> result = client.findAllByQuery(FinancialTransaction.class, expenseQuery);
+ Double result = client.findByQuery(Double.class, expenseQuery);
//Calculates the total
- double total = 0;
- for(FinancialTransaction ft : result.getAll()) {
+ double total = result;
+ System.out.println("RESULT = " + result);
+ /*for(FinancialTransaction ft : result.getAll()) {
total += ft.getAmount();
- }
+ }*/
return total;
}
/**
- * Calculates the employee cost at full time
- * @return
+ * Calculates the employee cost at full time.
+ *
+ * @param e employee concerned
+ * @return employee cost at full time
*/
public double getMonthlyFullTimeCost(EmployeeHR e) {
double salary = e.getSalary();
double otherPayments = e.getOtherPayments();
double partialTime = e.getPartialTime();
- return ( ( salary + otherPayments) * (partialTime/100) );
+ return ( ( salary + otherPayments) * 100 ) / partialTime;
}
/**
- * calculates the estimated number of prodctive days when the employee will work
- * @return
+ * calculates the estimated number of productive days when the employee will work
+ *
+ * It takes the average number of days in a year (218) and multiplicates it by the partial time
+ * and the productivity rate
+ * @param e employee concerned
+ * @return estimated number of productive days
*/
public double getEstimatedNumberOfProductiveDays(EmployeeHR e) {
int daysInYear = 218; //It would be *much* better to calculate this or at least get it from input
@@ -159,7 +170,7 @@
/**
* Returns the real number of procuctive days in year, which is the sum of all the time object by the employee
- * @param e
+ * @param e employee concerned
* @return
*/
public double getRealNumberOfProductiveDays(EmployeeHR e) {
@@ -213,6 +224,7 @@
double total = 0;
for(EmployeeHR e : getEmployeesHR()) {
total += getYearCost(e, real);
+ System.out.println("total = " + total);
}
return total;
}
@@ -267,8 +279,9 @@
}
/**
- * Returns the employee's adc
- * @return
+ * Returns the employee's adc.
+ * See the documentation for a complete description of the operations made during this calculation.
+ * @return the employee's adc
*/
public double getAdc(boolean real) {
@@ -285,47 +298,23 @@
double cost = getYearCost(employee, real);
double totalCost = getTotalYearCost(real);
- System.out.println("EXPENSES : " + expenses);
- System.out.println("PROD DAYS : " + productiveDays);
- System.out.println("COST : " + expenses);
- System.out.println("TOTAL COST : " + expenses);
-
double adc = ( (expenses * cost) / totalCost ) / productiveDays;
return adc;
}
- public double getAdc() {
- return getAdc(false);
- }
- public Map<String, Double> getMultipleAdc() {
- return getMultipleAdc(false);
- }
/**
* Returns multiple adc form the given employee list.
* @param client
* @param employees
- * @return
+ * @return adc of the employees
*/
public Map<String, Double> getMultipleAdc(boolean real) {
if(employees.size() == 0)
return null;
- Calendar cend = new GregorianCalendar();
- cend.add(Calendar.YEAR, -1);
- cend.set(Calendar.MONTH, Calendar.DECEMBER);
- cend.set(Calendar.DAY_OF_MONTH, 31);
-
- Calendar cstart = new GregorianCalendar();
- cstart.add(Calendar.YEAR, -1);
- cstart.set(Calendar.MONTH, Calendar.JANUARY);
- cstart.set(Calendar.DAY_OF_MONTH, 1);
-
- Date start = cstart.getTime();
- Date end = cend.getTime();
-
//Calculate all the "static" values before
double expenses = getTotalExpenses();
@@ -359,10 +348,4 @@
}
-
-
-
-
-
-
}
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/Calculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,6 +1,7 @@
package org.chorem.project;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import org.chorem.ChoremClient;
@@ -72,26 +73,30 @@
/**
* Calculates the real number of days from the Time objects.
- * @return
+ * @return real number of days needed for the project/task
*/
public abstract double realDays();
/**
* Return the times (in hour) per employee for the current object
- * @return
+ * @return time spent on the project/task (per Employee)
*/
- protected abstract HashMap<Employee, Double> getTimes();
+ protected abstract Map<Employee, Double> getTimes();
/**
* Return the percentages for the current object
- * @return
+ * @return estimated time spent on the project/task (per Employee, in percentage)
*/
- protected abstract HashMap<Employee, Double> getPercentages();
+ protected abstract Map<Employee, Double> getPercentages();
- public HashMap<Employee, Double> getTimePercentages() {
- HashMap<Employee, Double> times = getTimes();
- HashMap<Employee, Double> timePercentages = new HashMap<Employee, Double>();
+ /**
+ * Calculates the percentage of time spent on the project/task
+ * @return time spent on the project/task (per Employee, in percentage)
+ */
+ public Map<Employee, Double> getTimePercentages() {
+ Map<Employee, Double> times = getTimes();
+ Map<Employee, Double> timePercentages = new HashMap<Employee, Double>();
double sum = 0;
Set<Employee> keySet = times.keySet();
for (Employee key : keySet) {
@@ -106,12 +111,12 @@
}
/**
* Return the average Return for all the employees, ponderated by the percentages
- * @return
+ * @return average estimated return
*/
public double avgReturn() {
//Fetch the percentages per employee
- HashMap<Employee, Double> percentages = getPercentages();
+ Map<Employee, Double> percentages = getPercentages();
if(percentages.size() == 0) {
return client.getConfiguration().getDailyReturn();
}
@@ -126,10 +131,10 @@
/**
* Calculates the real daily return from the different times object and the daily return of the employees.
- * @return
+ * @return real average return
*/
public double realReturn() {
- HashMap<Employee, Double> times = getTimes();
+ Map<Employee, Double> times = getTimes();
if(times.size() == 0) {
return client.getConfiguration().getDailyReturn();
}
@@ -139,9 +144,6 @@
double srp = client.getDailyReturn(key);
double hoursPerDay = client.getDailyHoursWorked(key);
- //TODO :Find a way to use the different work hours
-
- //}
realReturn += srp* ( times.get(key) / hoursPerDay ) ;
}
realReturn = realReturn/getRealDays();
@@ -160,8 +162,8 @@
/**
- * Gives the difference between the real number of days and the estimated value
- * @return
+ * Gives the difference between the real number of days and the estimated value of days spent
+ * @return difference between estimation and real time
*/
public double deltaDays() {
return getRealDays() - nbDays;
@@ -169,7 +171,7 @@
/**
* Calculates the real ADR from the real number of days.
- * @return
+ * @return real adr
*/
public double realAdr() {
double realDays = getRealDays();
@@ -179,7 +181,7 @@
/**
* Profit calculated from the estimated ADR and the estimated numer of days
- * @return
+ * @return expected profit
*/
public double expectedProfit() {
return amount - (nbDays*getAvgReturn());
@@ -187,15 +189,16 @@
/**
* Real profit (or loss) done when the quotation is closed.
- * @return
+ * @return real profit (or loss)
*/
public double lossOrProfit() {
return amount - (getRealDays() * getRealReturn());
}
/**
- * Average profit/loss per day
- * @return
+ * Average profit/loss per day.
+ * It is not currently used in the dashboards.
+ * @return average profit (or loss) per day
*/
public double resultPerDay() {
return getLossOrProfit() / getRealDays();
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/QuotationCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -2,6 +2,7 @@
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.chorem.ChoremClient;
import org.chorem.entities.Employee;
@@ -11,8 +12,13 @@
public class QuotationCalculation extends Calculation<Quotation> {
- private List<Task> tasks = null;
+ protected List<Task> tasks = null;
+ /**
+ * Initiate the calculation class
+ * @param q quotation
+ * @param client chorem client
+ */
public QuotationCalculation(Quotation q, ChoremClient client) {
super(q, q.getAmount(), q.getEstimatedDays(), client);
}
@@ -30,8 +36,8 @@
}
@Override
- public HashMap<Employee, Double> getPercentages() {
- HashMap<Employee, Double> percentages = new HashMap<Employee, Double>();
+ public Map<Employee, Double> getPercentages() {
+ Map<Employee, Double> percentages = new HashMap<Employee, Double>();
double totalDays = 0;
for(Task t : getTasks())
totalDays += t.getEstimatedDays();
@@ -39,7 +45,7 @@
List<Task> tasks = getTasks();
for(Task t : tasks) {
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
+ Map<Employee, Double> taskPercentages = new TaskCalculation(t, client).getPercentages();
for(Employee emp : taskPercentages.keySet()) {
double rate = (t.getEstimatedDays()/totalDays);
if(percentages.containsKey(emp)) {
@@ -53,22 +59,18 @@
}
}
- //Caluculate the average for each employee
- /*Set<Employee> keySet = percentages.keySet();
- for(Employee emp : keySet) {
- percentages.put(emp, percentages.get(emp)/tasks.size());
- }*/
+
return percentages;
}
@Override
- public HashMap<Employee, Double> getTimes() {
+ public Map<Employee, Double> getTimes() {
HashMap<Employee, Double> times = new HashMap<Employee, Double>();
for(Task t : getTasks()) {
- HashMap<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
+ Map<Employee, Double> taskPercentages = new TaskCalculation(t, client).getTimes();
for(Employee emp : taskPercentages.keySet()) {
if(times.containsKey(emp)) {
times.put(emp, times.get(emp) + taskPercentages.get(emp));
@@ -85,8 +87,8 @@
}
/**
- * Fetch the tasks of the quotation keep a reference
- * @return
+ * Fetch the tasks of the quotation and keep a reference
+ * @return lits of the quotation's task
*/
public List<Task> getTasks() {
if(tasks == null)
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TaskCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Map;
import org.chorem.ChoremClient;
import org.chorem.ChoremUtil;
@@ -53,8 +54,8 @@
}
@Override
- protected HashMap<Employee, Double> getPercentages() {
- HashMap<Employee, Double> pct = new HashMap<Employee, Double>();
+ protected Map<Employee, Double> getPercentages() {
+ Map<Employee, Double> pct = new HashMap<Employee, Double>();
//get all the Worker objects
WikittyQuery workerQuery = new WikittyQueryMaker()
.eq(Worker.ELEMENT_FIELD_WORKER_TASK, e)
@@ -72,8 +73,8 @@
}
@Override
- protected HashMap<Employee, Double> getTimes() {
- HashMap<Employee, Double> times = new HashMap<Employee, Double>();
+ protected Map<Employee, Double> getTimes() {
+ Map<Employee, Double> times = new HashMap<Employee, Double>();
Modified: trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-entities/src/main/java/org/chorem/project/TotalQuotationCalculation.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,7 +1,7 @@
package org.chorem.project;
-import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.chorem.entities.Employee;
import org.chorem.entities.Quotation;
@@ -9,7 +9,9 @@
/**
* Calculates the total values of the quotation calculations
* Usage : construct the cobject by sending the list of quotation in parameter, then you can get the totals
- * by using the total* methdds.
+ * by using the total methods.
+ * Fore the totalAmount and the total estimated days, juste call the getAmount and getEstimatedDays functions,
+ * as it is calculated during the object's initialisation.
* @author gwenn
*
*/
@@ -18,20 +20,20 @@
/**
* List of quotation calculation
*/
- private List<QuotationCalculation> calculations;
+ protected List<QuotationCalculation> calculations;
/**
- *
- * @param calculations list of calculation used to calculate the total.
+ * Initiates the calculation object by calculating the total amount and the total estimated days
+ * @param calculations list of QuotationCalculation objects used to calculate the total.
*/
public TotalQuotationCalculation(List<QuotationCalculation> calculations) {
super(null, totalAmount(calculations), totalEstimatedDays(calculations), null);
- //super(q, q.getAmount(), q.getEstimatedDays(), client);
this.calculations = calculations;
}
/**
- *
+ * Calculates the total amount of all the quotations
+ * This is a method called on initialisation. It shouldn't be called in any other context.
* @param calculations
* @return total amount
*/
@@ -45,9 +47,10 @@
}
/**
- *
+ * Calculates the total estimatedDays
+ * This is a method called on initialisation. It shouldn't be called in any other context.
* @param calculations
- * @return
+ * @return estimated days.
*/
private static double totalEstimatedDays(List<QuotationCalculation> calculations) {
double total = 0;
@@ -121,22 +124,24 @@
+ /*
+ * Those following methods should'nt be called
+ */
-
@Override
- public HashMap<Employee, Double> getPercentages() {
+ public Map<Employee, Double> getPercentages() {
return null;
}
@Override
- public HashMap<Employee, Double> getTimePercentages() {
+ public Map<Employee, Double> getTimePercentages() {
return null;
}
@Override
- public HashMap<Employee, Double> getTimes() {
+ public Map<Employee, Double> getTimes() {
return null;
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/AdcDashboardAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -68,7 +68,6 @@
- // simply return them
return renderView("dashboardAdc.jsp",
"employees", employees,
"from", from,
@@ -117,7 +116,7 @@
/**
- * Structure used to store information about an employee Used for the AJAX
+ * Structure used to store information about an employee. Used for the AJAX
* request
*
* @author gwenn
@@ -145,7 +144,7 @@
}
/**
- * Structure used to store information about an employee used for the
+ * Structure used to store information about an employee. used for the
* standard http request
*
* @author gwenn
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/EmployeeEditAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -2,7 +2,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -16,6 +15,7 @@
import org.chorem.entities.ADC;
import org.chorem.entities.ADCImpl;
import org.chorem.entities.Company;
+import org.chorem.entities.CompanyHR;
import org.chorem.entities.CompanyImpl;
import org.chorem.entities.Employee;
import org.chorem.entities.EmployeeHR;
@@ -93,8 +93,8 @@
Map<String, Object> params = call.getExtractParameters();
for(String key : params.keySet()) {
//Prevent false data
- if((key.equals("CompanyHR.dailyReturn")
- || key.equals("CompanyHR.dailyHoursWorked"))) {
+ if((key.equals(CompanyHR.FQ_FIELD_COMPANYHR_DAILYRETURN)
+ || key.equals(CompanyHR.FQ_FIELD_COMPANYHR_DAILYHOURSWORKED))) {
try {
double value = Double.parseDouble(((String[])params.get(key))[0]);
w.setFqField(key, value);
@@ -111,7 +111,7 @@
if(addExtension != null && addExtension.equals("true")) {
Wikitty w = client.restore(company.getWikittyId());
- w.addExtension(client.restoreExtensionLastVersion("CompanyHR"));
+ w.addExtension(client.restoreExtensionLastVersion(CompanyHR.EXT_COMPANYHR));
client.store(w);
}
@@ -221,8 +221,8 @@
*/
public Render editEmployeeValues(ChoremClient client, String employeeId, String salaryStr
, String productivityRateStr, String partialTimeStr, String dailyReturnStr, String otherPaymentsStr) {
+ Render render = null;
Wikitty employeeWikitty = client.restore(employeeId);
- Employee employee = new EmployeeImpl(employeeWikitty);
if(!employeeWikitty.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) {
employeeWikitty.addExtension(client.restoreExtensionLastVersion(EmployeeHR.EXT_EMPLOYEEHR));
}
@@ -273,32 +273,37 @@
if(partialTime > 100 || partialTime < 0) {
errors.add(new ErrorJson("partialTime", "Partial time must be between 0 and 100"));
}
- if(errors.size() != 0)
- return renderJSON("data", "error", "errors", errors);
+
+
+
+ if(errors.size() != 0) {
+ render = renderJSON("data", "error", "errors", errors);
+ }
+ else {
+ if(salary != 0)
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
+ employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
+ client.store(employeeWikitty);
- if(salary != 0)
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_SALARY, salary);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PRODUCTIVITYRATE, productivityRate);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_PARTIALTIME, partialTime);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_DAILYRETURN, dailyReturn);
- employeeWikitty.setFqField(EmployeeHR.FQ_FIELD_EMPLOYEEHR_OTHERPAYMENTS, otherPayments);
- client.store(employeeWikitty);
+ EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
- EmployeeData data = new EmployeeData(new EmployeeImpl(employeeWikitty), client);
+ EmployeeJson json = new EmployeeJson(
+ data.getSalary() + "",
+ data.getProductivityRate(),
+ data.getPartialTime(),
+ data.getDailyReturn(),
+ data.getDailyHoursWorked(),
+ data.getOtherPayments()
+ );
+ render = renderJSON("data", json);
+ }
+ return render;
- EmployeeJson json = new EmployeeJson(
- data.getSalary() + "",
- data.getProductivityRate(),
- data.getPartialTime(),
- data.getDailyReturn(),
- data.getDailyHoursWorked(),
- data.getOtherPayments()
- );
-
- return renderJSON("data", json);
-
}
/**
@@ -349,7 +354,7 @@
* @author gwenn
*
*/
- public class EmployeeData implements Comparable{
+ public class EmployeeData implements Comparable<EmployeeData>{
private Employee e;
private String salary;
@@ -413,8 +418,7 @@
}
@Override
- public int compareTo(Object o) {
- EmployeeData e = (EmployeeData)o;
+ public int compareTo(EmployeeData e) {
return this.getObject().getPerson(false).getLastName().compareTo(e.getObject().getPerson(false).getLastName());
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/DashboardProjectAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -10,6 +10,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -25,10 +26,8 @@
import org.chorem.entities.Project;
import org.chorem.entities.Task;
import org.chorem.entities.Time;
-import org.chorem.entities.Worker;
import org.chorem.project.QuotationCalculation;
import org.chorem.project.TotalQuotationCalculation;
-import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.query.WikittyQuery;
import org.nuiton.wikitty.query.WikittyQueryMaker;
import org.nuiton.wikitty.query.WikittyQueryResult;
@@ -56,7 +55,7 @@
WikittyQuery quotationQuery = new WikittyQueryMaker().ideq(quotationFilter).end();
WikittyQueryResult<Quotation> quotationResult = client.findAllByQuery(Quotation.class, quotationQuery);
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
+ Map<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
//If some quotation has been found
if(quotationResult != null && quotationResult.size() != 0) {
@@ -95,7 +94,7 @@
WikittyQueryResult<Quotation> quotationResult = null;
- HashMap<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
+ Map<Project, List<QuotationData>> projectData = new HashMap<Project, List<QuotationData>>();
//Fetch the projects from the id or the filter
WikittyQueryMaker projectQueryMaker = new WikittyQueryMaker();
@@ -184,7 +183,7 @@
Collection<Quotation> quotations = result.getAll();
- HashMap<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
+ Map<Quotation, QuotationCalculation> calculations = new HashMap<Quotation, QuotationCalculation>();
for(Quotation q : quotations) {
QuotationCalculation calc = new QuotationCalculation(q, client);
calc.calculate();
@@ -207,7 +206,7 @@
}
/**
- *
+ * Generate the employee page
* @param client
* @param id
* @param from
@@ -358,12 +357,12 @@
}
/**
- *
- * @param client
- * @param project_name
- * @param project_id
- * @param quotationFilter
- * @return
+ * Request the generation of the single-projetc page
+ * @param client chorem client
+ * @param project_name project name
+ * @param project_id project id
+ * @param quotationFilter quotation filter
+ * @return the project page
*/
public Render requestProject(ChoremClient client, String project_name, String project_id, String quotationFilter) {
if(quotationFilter == null)
@@ -380,24 +379,24 @@
return render;
}
/**
- *
- * @param client
- * @param from
- * @param to
- * @return
+ * Request the generation of the multi project page
+ * @param client chorem client
+ * @param from start date
+ * @param to end date
+ * @return the multi project page
*/
public Render requestMultiProject(ChoremClient client, Date from, Date to) {
return multiProjectFilter(client, from, to);
}
/**
- *
- * @param client
- * @param id
- * @param from
- * @param to
- * @param quotations
- * @return
+ * request the generation of the employee page
+ * @param client chorem client
+ * @param id employee id
+ * @param from start date
+ * @param to end date
+ * @param quotations quotation filter
+ * @return the employee page
*/
public Render requestEmployee(ChoremClient client, String id, Date from, Date to, String[] quotations) {
System.out.println("QUOTATIONS : " + Arrays.toString(quotations));
Deleted: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/Extensions.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -1,17 +0,0 @@
-package org.chorem.webmotion.actions.project;
-
-public interface Extensions {
- public static final String[] extensions = {
- "Quotation",
- "Draft",
- "Sent",
- "Rejected",
- "Accepted",
- "Started",
- "Delivered",
- "RSV",
- "Warranty",
- "Closed",
- "Cancelled"
- };
-}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationStatusAction.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -45,7 +45,6 @@
protected Wikitty upgradeInternal(ChoremClient client, String id, String[] extensionStr, Call call) {
log.debug("save: " + id);
- System.out.println("EXTENSIONS §§§§ : ");
System.out.println(Arrays.toString(extensionStr));
System.out.println(ChoremUtil.asList(null, extensionStr));
Wikitty w = client.restore(id);
@@ -59,7 +58,6 @@
return w;
Collection<WikittyExtension> exts = client.restoreExtensionLastVersion(extList);
- System.out.println("EXTENSION : " + exts);
w.addExtension(exts);
Map<String, Object> params = call.getExtractParameters();
String error = setWikittyField(w, "", params);
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:57:01 UTC (rev 386)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-16 09:07:56 UTC (rev 387)
@@ -6,7 +6,8 @@
import org.chorem.project.TaskCalculation;
/**
- *
+ * Represents a task withe the alert and the info linked to it.
+ * Used in a jsp page.
* @author gwenn
*
*/
1
0
r386 - in trunk: chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project src/site/rst
by meynier@users.chorem.org 14 Aug '13
by meynier@users.chorem.org 14 Aug '13
14 Aug '13
Author: meynier
Date: 2013-08-14 17:57:01 +0200 (Wed, 14 Aug 2013)
New Revision: 386
Url: http://chorem.org/projects/chorem/repository/revisions/386
Log:
Updated doc and src for the alert\/info managment
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
trunk/src/site/rst/calculations.rst
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/QuotationData.java 2013-08-14 15:57:01 UTC (rev 386)
@@ -46,13 +46,13 @@
boolean alert = false;
boolean info = false;
//Test if the statuses are correct
- if(t.getStatus().equalsIgnoreCase("Scheduled")) {
+ if("scheduled".equalsIgnoreCase(t.getStatus())) {
if(t.getBeginDate().before(now.getTime())) {
alert = true;
alertStr += "Task " + t.getName() + " should be started";
}
}
- else if(t.getStatus().equalsIgnoreCase("Started")) {
+ else if("started".equalsIgnoreCase(t.getStatus())) {
if(t.getEndDate().before(now.getTime())) {
alert = true;
@@ -60,8 +60,12 @@
}
}
- for(Time time : client.getTimes(t)) {
- if(time.getBeginDate().before(t.getBeginDate()) || time.getEndDate().before(t.getBeginDate())) {
+ List<Time> times = client.getTimes(t);
+
+
+ for(Time time : times) {
+ if((time.getBeginDate().before(t.getBeginDate()) || time.getEndDate().before(t.getBeginDate()))
+ || (times.size() != 0 && "scheduled".equalsIgnoreCase(t.getStatus()))) {
info=true;
infoStr = "Times have been added to the task but is is not started";
}
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/project/TaskData.java 2013-08-14 15:57:01 UTC (rev 386)
@@ -5,6 +5,11 @@
import org.chorem.entities.Task;
import org.chorem.project.TaskCalculation;
+/**
+ *
+ * @author gwenn
+ *
+ */
public class TaskData extends TaskCalculation {
Modified: trunk/src/site/rst/calculations.rst
===================================================================
--- trunk/src/site/rst/calculations.rst 2013-08-14 15:19:41 UTC (rev 385)
+++ trunk/src/site/rst/calculations.rst 2013-08-14 15:57:01 UTC (rev 386)
@@ -132,10 +132,13 @@
En cas de dépassement des délais ou autre déroulement non prévu, des alertes sont affichées sur le tableau de bord. Voici la liste des évenements déclenchant, pour l'instant, des alertes :
* La tâche devrait avoir commencé (statut "SCHEDULED" alors que la date de début est passée)
- * La tâche a été commencé en avance (statut "STARTED" alors que la date de début n'est pas passée)
* La tâche devrait être finie (statut "STARTED" alors que la date de fin est passée)
- * La tâche a été finie en avance (statut "FINISHED" alors que la date de début n'est pas passée)
+Des informations d'une importance inférieure sont également reportées sous forme d'informations pour les évenements suivants :
+
+ * Un temps a été ajouté alors que la tâche n'est pas commencée
+ * Un temps a été ajouté après la date de fin de la tâche
+
2. Gestion des employés
=======================
1
0