Author: mble Date: 2012-12-07 17:58:26 +0100 (Fri, 07 Dec 2012) New Revision: 284 Url: http://chorem.org/projects/chorem/repository/revisions/284 Log: Updates for VacationRequest : Can delete Request from Dashboard Removed: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java trunk/chorem-webmotion/src/main/resources/mapping trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp trunk/chorem-webmotion/src/main/webapp/js/chorem.js Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardHRAction.java 2012-12-07 16:58:26 UTC (rev 284) @@ -23,52 +23,20 @@ package org.chorem.webmotion.actions; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.LinkedList; import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateFormatUtils; -import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.ChoremClient; -import org.chorem.ChoremQueryHelper; -import org.chorem.ChoremQueryMaker; -import org.chorem.entities.Attachment; -import org.chorem.entities.Category; -import org.chorem.entities.Configuration; -import org.chorem.entities.Employee; import org.chorem.entities.EmployeeHR; import org.chorem.entities.Interval; -import org.chorem.entities.Invoice; -import org.chorem.entities.Quotation; -import org.chorem.entities.QuotationStatus; -import org.chorem.entities.Task; -import org.chorem.entities.TaskStatus; -import org.chorem.entities.Time; -import org.chorem.entities.Touch; import org.chorem.entities.Vacation; import org.chorem.entities.VacationRequest; -import org.chorem.entities.VacationStatus; import org.debux.webmotion.server.WebMotionController; import org.debux.webmotion.server.render.Render; -import org.nuiton.util.DateUtil; -import org.nuiton.wikitty.WikittyUtil; -import org.nuiton.wikitty.entities.Element; import org.nuiton.wikitty.entities.ElementField; -import org.nuiton.wikitty.entities.WikittyExtension; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; import org.nuiton.wikitty.query.WikittyQueryResult; -import org.nuiton.wikitty.query.WikittyQueryResultTreeNode; -import org.nuiton.wikitty.query.conditions.Aggregate; /** * @@ -86,7 +54,8 @@ static final public String budgetDateFormat = "MM/yyyy"; static final public String summaryDateFormat = "dd/MM/yyyy hh:mm"; - + + public Render vacationFilter(ChoremClient client, String query) { // recuperation des vacances WikittyQuery vacationQuery = new WikittyQueryMaker().and() @@ -123,8 +92,7 @@ } - - /** + /** * Les vacances * @param client * @param query @@ -133,56 +101,6 @@ public Render requestVacation(ChoremClient client, String query) { return vacationFilter(client, query); } - - - - public Render vacationRequestFilter(ChoremClient client, String query) { - // recuperation des vacances - WikittyQuery vacationRequestQuery = new WikittyQueryMaker().and() - .parse(query) - .exteq(VacationRequest.EXT_VACATIONREQUEST) - .end() - .addSortAscending(new ElementField(VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST)); - WikittyQueryResult<String> vacationIds = - client.findAllByQuery(vacationRequestQuery); - - List<VacationRequest> vacationRequests = - client.restore(VacationRequest.class, vacationIds.getAll(), - "Vacation.vacationRequest;VacationRequest.employeeRequest"); - - - WikittyQuery employeeHRRequestQuery = new WikittyQueryMaker().and() - .parse(query) - .exteq(EmployeeHR.EXT_INTERVAL) - .exteq(EmployeeHR.EXT_EMPLOYEE) - .exteq(EmployeeHR.EXT_EMPLOYEEHR) - .end(); - - WikittyQueryResult<String> employeeHRIds = - client.findAllByQuery(employeeHRRequestQuery); - - List<EmployeeHR> employeeHRRequests = - client.restore(EmployeeHR.class, employeeHRIds.getAll()); - - - - return renderView("dashboardVacationRequest.jsp", - "vacations", vacationRequests, "employes", employeeHRRequests); - - } - - - /** - * Les vacances - * @param client - * @param query - * @return - */ - public Render vacationRequest(ChoremClient client, String query) { - return vacationRequestFilter(client, query); - } - - } Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-12-07 16:58:26 UTC (rev 284) @@ -520,7 +520,7 @@ newW.add(index); } } else { - + // si des nouvelles valeurs sont en parametre, on change les valeurs // actuel du wikitty Map<String, Object> params = call.getExtractParameters(); @@ -539,7 +539,7 @@ Wikitty w = new WikittyImpl(); w.addExtension(newExts); // on ajoute le nouveau wikitty au bon endroit - ws.add(newW.get(ii)+1, w); + ws.add(newW.get(ii+1), w); } return renderView(jspRender, "ws", ws, "extensions", exts); } @@ -571,6 +571,7 @@ return renderURL("/wikitty/view/"+w.getWikittyId()); } + public Render saveMulti(ChoremClient client, String[] ids, Call call) { log.debug("save: " + ids); @@ -583,11 +584,9 @@ if (w == null) { w = new WikittyImpl(); } - String[] extension = (String[]) params.get(id + ".extension"); - List<WikittyExtension> exts = client.restoreExtensionAndDependenciesLastVesion(Arrays.asList(extension)); w.addExtension(exts); @@ -597,9 +596,7 @@ toSave.add(w); newIds.add(w.getWikittyId()); } - client.storeWikitty(toSave); - return renderURL("/wikitty/search?query=id={" + StringUtils.join(newIds, ",") + "}"); } Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/HrAction.java 2012-12-07 16:58:26 UTC (rev 284) @@ -1,20 +1,11 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ + package org.chorem.webmotion.actions; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; +import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedHashSet; import java.util.List; import org.chorem.entities.*; import java.util.Map; -import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -22,7 +13,6 @@ import org.debux.webmotion.server.call.Call; import org.debux.webmotion.server.render.Render; import org.nuiton.wikitty.WikittyUtil; -import org.nuiton.wikitty.entities.BusinessEntity; import org.nuiton.wikitty.entities.Wikitty; import org.nuiton.wikitty.entities.WikittyExtension; import org.nuiton.wikitty.entities.WikittyImpl; @@ -37,16 +27,15 @@ * to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(HrAction.class); - private Map<String, Object> params = new HashMap<String, Object>(); private String dateDuJour = ""; + // mettre isAnswer à true si on arrive en tant qu'administrateur pour saisir une réponse private boolean isAnswer = true; - - public Render editVacationRequest(ChoremClient client, String id, String[] extension, Call call) { - + String ids = ""; + String separator = ","; boolean newVR = false; Wikitty w = client.restore(id); @@ -54,128 +43,153 @@ if (w == null) { w = new WikittyImpl(); newVR = true; + ids = w.getWikittyId(); + List<String> extensionNames = Arrays.asList(VacationRequest.EXT_VACATIONREQUEST); + List<WikittyExtension> newExts = + client.restoreExtensionAndDependenciesLastVesion(extensionNames); + w.addExtension(newExts); + client.store(w); } - + String[] extVac = StringUtils.split(Vacation.EXT_VACATION); - Map<String,List<Wikitty>> wRelated = super.searchAsMap(client, extVac, id, 1); - String separator = ","; - - + // Stocke dans une Map les Wikitty de type Vacation liés à la VacationRequest + Map<String, List<Wikitty>> wRelated = super.searchAsMap(client, extVac, id, 1); + // edition VacationRequest existante (pas new) if (!newVR) { - ids = w.getFieldAsString(VacationRequest.EXT_VACATIONREQUEST, + // ajout de l'employeeHR (Request) dans les ids + ids = w.getFieldAsString(VacationRequest.EXT_VACATIONREQUEST, VacationRequest.FIELD_VACATIONREQUEST_EMPLOYEEREQUEST) - +separator+id; + + separator + id; + } - + else { + //extension = extVac; + Wikitty wVac = new WikittyImpl(); + ids += separator + wVac.getWikittyId(); +// wVac.addToField(Vacation.FQ_FIELD_VACATION_VACATIONREQUEST, id); +// client.store(wVac); + } + // ajout des id Vacation liés à la VacationRequest for (String ws : wRelated.keySet()) { int size = wRelated.get(ws).size(); - for (int ii=0;ii<size;ii++) { + for (int ii = 0; ii < size; ii++) { String wid = wRelated.get(ws).get(ii).getWikittyId(); - ids = ids + separator + wid; + ids += separator + wid; } - + } return editMultiRender(client, ids, extension, call, "editVacationRequest.jsp"); } - - + public Render editVacationDiv(ChoremClient client, String ids, String[] extension, Call call) { return editMultiRender(client, ids, extension, call, "vacationDiv.jsp"); } - public Render saveVacationRequest(ChoremClient client, String[] ids, Call call) { log.debug("saveVacationRequest: " + ids); - + String idVR = ""; - String reqStatus = ""; + String oldReqStatus = ""; + String newReqStatus = ""; Double vacAmount = 0.0; String typeLeave = ""; Wikitty wEmployeeReq = null; - + this.dateDuJour = WikittyUtil.toString((new java.util.Date())); this.params = call.getExtractParameters(); String keyParams = ""; - //this.isAnswer = (isAdmin.equals("yes")); - - - + for (String id : ids) { Wikitty w = client.restore(id); if (w == null) { w = new WikittyImpl(); } - + if (w.hasExtension(VacationRequest.EXT_VACATIONREQUEST)) { - keyParams = id+"."+VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST; + oldReqStatus = w.getFieldAsString(VacationRequest.EXT_VACATIONREQUEST, + VacationRequest.FIELD_VACATIONREQUEST_STATUSREQUEST); + keyParams = id + "." + VacationRequest.FQ_FIELD_VACATIONREQUEST_STATUSREQUEST; if (this.params.containsKey(keyParams)) { - reqStatus = StringUtils.join((String[])this.params.get(keyParams)); + newReqStatus = StringUtils.join((String[]) this.params.get(keyParams)); } } - - - if (w.hasExtension(EmployeeHR.EXT_EMPLOYEEHR)) { wEmployeeReq = w; } - - + // si ce n'est pas une réponse c'est une demande if (!this.isAnswer) { // on enregistre la date de demande - updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, + updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, VacationRequest.FIELD_VACATIONREQUEST_DATEREQUEST, this.dateDuJour); - + // pour chaque période (Vacation) on enregistre le champ vacationRequest pour lier la période à la demande updateVacationRequestField(w, Vacation.EXT_VACATION, Vacation.FIELD_VACATION_VACATIONREQUEST, idVR); - + } else { // on enregistre la date de réponse - updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, + updateVacationRequestField(w, VacationRequest.EXT_VACATIONREQUEST, VacationRequest.FIELD_VACATIONREQUEST_DATEANSWER, this.dateDuJour); - // si la réponse est "ACCEPTEE" : pour chaque période demandée on met à jour les soldes de l'Employé + // si l'ancien status de la demande est différent de "ACCEPTEE" ou "FERMETURE ANNUELLE" + // si le nouveau status (réponse) est "ACCEPTEE" : pour chaque période demandée on met à jour les soldes de l'Employé if (w.hasExtension(Vacation.EXT_VACATION)) { - for (int ii=0;ii<10;ii++) System.out.println(" GAZOU"); - System.out.println("gazou reqStatus = "+reqStatus); - System.out.println("gazou wEmployeeReq = "+wEmployeeReq.getWikittyId() + " ... "+ wEmployeeReq.toString()); - if ( (reqStatus.equals("ACCEPTEE") || (reqStatus.equals("FERMETURE ANNUELLE"))) && (wEmployeeReq != null)) { - - keyParams = id+"."+Vacation.FQ_FIELD_VACATION_AMOUNT; + if ((!oldReqStatus.equals("ACCEPTEE")) && (!oldReqStatus.equals("FERMETURE ANNUELLE"))) { + if ((newReqStatus.equals("ACCEPTEE") || (newReqStatus.equals("FERMETURE ANNUELLE"))) && (wEmployeeReq != null)) { + + keyParams = id + "." + Vacation.FQ_FIELD_VACATION_AMOUNT; vacAmount = 0.0; if (this.params.containsKey(keyParams)) { - vacAmount = Double.parseDouble(StringUtils.join((String[])this.params.get(keyParams))); + vacAmount = Double.parseDouble(StringUtils.join((String[]) this.params.get(keyParams))); } - - for (int ii=0;ii<30;ii++) System.out.println("gazou"); - System.out.println("keyParams = "+keyParams); - for (int ii=0;ii<30;ii++) System.out.println("gazou"); - System.out.println("vacAmount = "+ String.valueOf(vacAmount)); // fin gazou - - keyParams = id+"."+Vacation.FQ_FIELD_VACATION_TYPELEAVE; + + keyParams = id + "." + Vacation.FQ_FIELD_VACATION_TYPELEAVE; typeLeave = ""; if (this.params.containsKey(keyParams)) { - typeLeave = StringUtils.join((String[])this.params.get(keyParams)); - } - - for (int ii=0;ii<30;ii++) System.out.println("gazou"); - System.out.println("keyParams = "+keyParams); - for (int ii=0;ii<30;ii++) System.out.println("gazou"); - System.out.println("typeLeave = "+ typeLeave); // fin gazou - + typeLeave = StringUtils.join((String[]) this.params.get(keyParams)); + } + updateAmounts(wEmployeeReq, vacAmount, typeLeave); } } + } } - } + } call.setExtractParameters(this.params); return saveMulti(client, ids, call); } - + // cette méthode est spécifique à VacationRequest : + // elle ne s'appuie pas sur la méthode delete de GenericAction (non terminée) + public Render deleteVacationRequest(ChoremClient client, String id, Call call) { + log.debug("deleteVacationRequest: " + id); + String separator = ","; + + Wikitty w = client.restore(id); + if (w != null) { + + String[] extVac = StringUtils.split(Vacation.EXT_VACATION); + // Stocke dans une Map les Wikitty de type Vacation liés à la VacationRequest + Map<String, List<Wikitty>> wRelated = super.searchAsMap(client, extVac, id, 1); + + // Parcours les Vacations liées et les supprime + for (String ws : wRelated.keySet()) { + int size = wRelated.get(ws).size(); + for (int ii = 0; ii < size; ii++) { + String wid = wRelated.get(ws).get(ii).getWikittyId(); + client.delete(wid); + } + } + // supprime la VacationRequest + client.delete(id); + } + return renderURL("report?report=requestVacation"); + + } + // écriture d'une "value" dans un champ "fieldname" private void updateVacationRequestField(Wikitty w, String extensionName, String fieldName, String value) { if ((w != null) && (w.hasExtension(extensionName))) { @@ -183,36 +197,28 @@ this.params.put(cleParams, StringUtils.split(value)); } } - - - + + // private void updateAmounts(Wikitty wEmployeeReq, Double amount, String typeLeave) { -// String typeLeave = w.getFieldAsString(Vacation.EXT_VACATION, Vacation.FIELD_VACATION_TYPELEAVE); -// float amount = w.getFieldAsFloat(Vacation.EXT_VACATION, Vacation.FIELD_VACATION_AMOUNT); Double eAmount = 0.0; - if (typeLeave.equals("CONGES ANNUELS")) { - eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PAIDLEAVE) - amount; - updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_PAIDLEAVE, Double.toString(eAmount)); - + } else if (typeLeave.equals("RTT")) { - eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_RTT) - amount; - updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_RTT, Double.toString(eAmount)); - + } else { - eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, + eAmount = wEmployeeReq.getFieldAsDouble(EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_OTHERLEAVE) - amount; - updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, + updateVacationRequestField(wEmployeeReq, EmployeeHR.EXT_EMPLOYEEHR, EmployeeHR.FIELD_EMPLOYEEHR_OTHERLEAVE, Double.toString(eAmount)); } } - - - - } \ No newline at end of file Modified: trunk/chorem-webmotion/src/main/resources/mapping =================================================================== --- trunk/chorem-webmotion/src/main/resources/mapping 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/resources/mapping 2012-12-07 16:58:26 UTC (rev 284) @@ -50,6 +50,7 @@ * /hr/vacationRequest/edit/{id} action:HrAction.editVacationRequest * /hr/vacationDiv/{ids} action:HrAction.editVacationDiv * /hr/vacationRequest/save action:HrAction.saveVacationRequest +* /hr/vacationRequest/delete/{id} action:HrAction.deleteVacationRequest * /sales view:sales.jsp * /sales/{method} action:SalesAction.{method} -* /sales/{method}/{id} action:SalesAction.{method} \ No newline at end of file +* /sales/{method}/{id} action:SalesAction.{method}>>>>>>> .r283 Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardRequestVacation.jsp 2012-12-07 16:58:26 UTC (rev 284) @@ -27,10 +27,10 @@ <h1>${title}</h1> + <table class="table table-striped table-bordered table-condensed"> <thead> <tr> - <th></th> <th>Employee</th> <th>Type</th> <th>Start date</th> @@ -38,28 +38,36 @@ <th>Days</th> <th>Status</th> <th>Request Date</th> + <th colspan="2">Vacation Request</th> + </tr> </thead> - + <tbody> <c:forEach var="q" items="${vacations}"> <c:forEach var="emp" items="${employes}"> <c:if test="${emp.getWikittyId() eq q.getVacationRequest(true).employeeRequest}"> - <tbody> + <tr> - <td><a href="hr/vacationRequest/edit/${q.vacationRequest}" />Edit</a></td> + <td>${emp.toString()}</td> <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.typeLeave" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td> + <td class="datetime"><w:display wikitty="${q.wikitty}" fqfield="Interval.beginDate" label=""/></td> <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Interval.endDate" label=""/></td> <td><w:display wikitty="${q.wikitty}" fqfield="Vacation.amount" label=""/></td> <td><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).statusRequest}" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" toString="${q.getVacationRequest(false).dateRequest}" label=""/></td> + <td class="date">${q.getVacationRequest(false).dateRequest}</td> + <td><a href="hr/vacationRequest/edit/${q.vacationRequest}" />Edit request</a></td> + <td><c:if test="${q.getVacationRequest(true).statusRequest eq 'EN PREVISION'}"> + <a href="hr/vacationRequest/delete/${q.vacationRequest}" />Delete request</a> + </c:if> + </td> </tr> - </tbody> + </c:if> </c:forEach> </c:forEach> + </tbody> </table> Deleted: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardVacationRequest.jsp 2012-12-07 16:58:26 UTC (rev 284) @@ -1,72 +0,0 @@ -<%-- - #%L - Chorem webmotion - $Id:$ - $HeadURL:$ - %% - Copyright (C) 2011 - 2012 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" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %> -<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%> - -<h1>${title}</h1> - -<table class="table table-striped table-bordered table-condensed"> - <thead> - <tr> - <th></th> - <th>Employee</th> - - <th>Status</th> - <th>Request Date</th> - </tr> - </thead> - - - <c:forEach var="emp" items="${employes}"> - - <c:forEach var="q" items="${vacations}"> - <tbody> - <c:if test="${emp.getWikittyId() eq q.employeeRequest}"> - <tr> - <td><a href="hr/vacationRequest/edit/${q}" />Edit</a></td> - - - - - - <td>${emp.toString()}</td> - - - - - - - <td><w:display wikitty="${q.wikitty}" toString="${q.statusRequest}" label=""/></td> - <td class="date"><w:display wikitty="${q.wikitty}" toString="${q.dateRequest}" label=""/></td> - </tr> - </c:if> - </tbody> - </c:forEach> - - </c:forEach> - -</table> - - Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/editVacationRequest.jsp 2012-12-07 16:58:26 UTC (rev 284) @@ -28,13 +28,8 @@ <c:if test="${not empty ws}"> <form class="form-horizontal" method="post" accept-charset="ISO-8859-15" action="<c:url value="/hr/vacationRequest/save"/>" enctype="multipart/form-data"> <c:forEach var="wikitty" items="${ws}"> - - - - <!-- EmployeeHR --> - <c:forEach var="ext" items="${wikitty.getExtensions()}"> <c:if test="${ext.name eq 'EmployeeHR'}"> <input type="hidden" name="ids" value="${wikitty.id}"/> @@ -52,69 +47,60 @@ </c:if> </c:forEach> - - - <!-- get(1) est la VacationRequest --> - <c:forEach var="ext" items="${wikitty.getExtensions()}"> <c:if test="${ext.name eq 'VacationRequest'}"> - <input type="hidden" name="ids" value="${wikitty.id}"/> - <input type="hidden" name="${wikitty.id}.extension" value="${ext.name}"> - <h3><w:display wikitty="${wikitty}" fqfield="VacationRequest.employeeRequest" label=""/> : Request for leave periods </h3> - <div hidden="hidden"> - <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeRequest" fqfield="VacationRequest.employeeRequest" /> - <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeWriter" fqfield="VacationRequest.employeeWriter" /> - </div> - <br /> - <div class="well"> - <p> - <button class="btn btn-success" type="submit" href="../../../report?report=requestVacation"> - <i class="icon-ok icon-white"></i> Save - </button> - <a class="btn btn-info" href="../../../report?report=requestVacation"> - <i class="icon-remove icon-white"></i> Cancel - </a> - <a class="btn btn-warning" href="#"> - <i class="icon-plus icon-white"></i> Duplicate - </a> - <h4>Status of request : - <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.statusRequest" fqfield="VacationRequest.statusRequest"/> - </h4> - </p> - </div> - <br /> - - + <input type="hidden" name="ids" value="${wikitty.id}"/> + <input type="hidden" name="${wikitty.id}.extension" value="${ext.name}"> + <c:if test="${wikitty.getFieldAsString('VacationRequest','employeeRequest') eq null}"> + Employee : + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeRequest" fqfield="VacationRequest.employeeRequest"/> + </c:if> + <h3><w:display wikitty="${wikitty}" fqfield="VacationRequest.employeeRequest" label=""/> : Request for leave periods </h3> + + <div hidden="hidden"> + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeRequest" fqfield="VacationRequest.employeeRequest" /> + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.employeeWriter" fqfield="VacationRequest.employeeWriter" /> + </div> + <br /> + <div class="well"> + <p> + <button class="btn btn-success" type="submit" href="../../../report?report=requestVacation"> + <i class="icon-ok icon-white"></i> Save + </button> + <a class="btn btn-info" href="../../../report?report=requestVacation"> + <i class="icon-remove icon-white"></i> Cancel + </a> + <a class="btn btn-warning" href="#"> + <i class="icon-plus icon-white"></i> Duplicate + </a> + <h4>Status of request : + <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.statusRequest" fqfield="VacationRequest.statusRequest"/> + </h4> + </p> + </div> + <br /> <div id="bottom" class="row"> - <a class="btn btn-success" href="<c:url value="#"/>"><i class="icon-plus icon-white"></i> Add new period</a> + <br /> + <input type="button" id="btn-vacation-add" class="btn btn-success" value="Add new period"> <br /><br /> <label class="control-label">Comments : </label> <w:input wikitty="${wikitty}" name="${wikitty.id}.VacationRequest.commentRequest" fqfield="VacationRequest.commentRequest" defaultValue="Commentaires"/> <br /><br /> + </div> </c:if> </c:forEach> - - - - - - </c:forEach> - - - <!-- Vacations --> - <c:forEach var="wikitty" items="${ws}"> - <c:forEach var="ext" items="${wikitty.getExtensions()}"> - <c:if test="${ext.name eq 'Vacation'}"> - <div class="row"> - <jsp:include page="/hr/vacationDiv/${wikitty.id}"/> - </div> - </c:if> - </c:forEach> - </c:forEach> - - + <!-- Vacations --> + <c:forEach var="wikitty" items="${ws}"> + <c:forEach var="ext" items="${wikitty.getExtensions()}"> + <c:if test="${ext.name eq 'Vacation'}"> + <div> + <jsp:include page="/hr/vacationDiv/${wikitty.id}"/> + </div> + </c:if> + </c:forEach> + </c:forEach> </form> </c:if> \ No newline at end of file Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/vacationDiv.jsp 2012-12-07 16:58:26 UTC (rev 284) @@ -28,12 +28,14 @@ <div name="vacationDiv"> <c:if test="${not empty ws}"> <c:forEach var="wikittyd" items="${ws}"> + + <c:if test="${wikittyd != null}"> <h4>Period of vacation :</h4> <input type="hidden" name="ids" value="${wikittyd.id}"/> <input type="hidden" name="${wikittyd.id}.extension" value="Interval"> <input type="hidden" name="${wikittyd.id}.extension" value="Vacation"> <div class="well"> - <p class="intervalvacation"> + <table> <tr> @@ -61,8 +63,9 @@ <td> <input type="checkbox" class="halfEnd" value="end" /> half-day</td> </tr> </table> - </p> + </div> + </c:if> </c:forEach> </c:if> Modified: trunk/chorem-webmotion/src/main/webapp/js/chorem.js =================================================================== --- trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-12-05 17:13:07 UTC (rev 283) +++ trunk/chorem-webmotion/src/main/webapp/js/chorem.js 2012-12-07 16:58:26 UTC (rev 284) @@ -92,10 +92,6 @@ } -function gazou() { - $(".beginDateTR :checkbox").attr('checked',true); -}; - $(document).ready(function() { $('.beginDateTR :checkbox').change(function(){ var dtetim = $(this).parent().parent().children('.beginDateTD').children('input'); @@ -111,3 +107,23 @@ change12or00(dtetim,dtetimVal,$(this).attr("checked")); }); }); + + +// ajout d'une vacation dans editVacationRequest +$(document).ready(function() { + $('#btn-vacation-add').click(function(){ + + jQuery.ajax({ + type: 'GET', + url:'/chorem/hr/vacationDiv/new', + data:'', + sucess: function(data, textStatus, jqXHR){ + + }, + error: function(jqXHR, textStatus, errorThrown) { + + } + }) + }) + +});