This is an automated email from the git hooks/post-receive script. New commit to branch feature/882 in repository chorem. See http://git.chorem.org/chorem.git commit 3821244fb976ed6e9ada7f823c2a138536f4e103 Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 09:56:29 2015 +0100 refs #882: On peut maintenant éditer des coordonnées et supprimer des sociétés --- .../webmotion/actions/crm/CompaniesAction.java | 27 ++++++++++++++++++++++ chorem-webmotion/src/main/resources/mapping | 7 +++++- .../jsp/crm/cards/contactDetailsListCard.jsp | 13 +++++++++-- .../WEB-INF/jsp/crm/cards/editCompanyCard.jsp | 9 ++++---- ...tCompanyCard.jsp => editContactDetailsCard.jsp} | 24 +++++++++++-------- 5 files changed, 63 insertions(+), 17 deletions(-) diff --git a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java index 26c8cca..73818ef 100644 --- a/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java +++ b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java @@ -4,6 +4,7 @@ import org.chorem.ChoremClient; import org.chorem.entities.*; import org.debux.webmotion.server.WebMotionController; import org.debux.webmotion.server.render.Render; +import org.debux.webmotion.server.render.RenderView; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; @@ -101,6 +102,17 @@ public class CompaniesAction extends WebMotionController { return listCompanies(client); } + /** + * Render the modal form content to edit companies + * @param client ChoremClient to fetch data + * @param id the company to edit id + * @return the modal form content + */ + public Render deleteCompany(ChoremClient client, String id) { + client.delete(id); + return listCompanies(client); + } + public Render viewEmployee(ChoremClient client, String id) { Employee employee = client.restore(Employee.class, id); @@ -117,6 +129,21 @@ public class CompaniesAction extends WebMotionController { } + public Render editContactDetails(ChoremClient client, String id){ + ContactDetails cd = client.restore(ContactDetails.class, id); + return renderView("crm/cards/editContactDetailsCard.jsp", + "contactDetail", cd); + } + + public Render updateContactDetails(ChoremClient client, String id, String type, String value, String name){ + ContactDetails cd = client.restore(ContactDetails.class, id); + cd.setName(name); + cd.setType(type); + cd.setValue(value); + client.store(cd); + return viewCompany(client, cd.getTarget()); + } + protected List<Note> listNotes(ChoremClient client, String companyId) { WikittyQuery notesQuery = new WikittyQueryMaker().and() .exteq(Note.EXT_NOTE) diff --git a/chorem-webmotion/src/main/resources/mapping b/chorem-webmotion/src/main/resources/mapping index 7051a96..0880157 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -16,6 +16,7 @@ default.render=org.debux.webmotion.server.render.DefaultRender * /crm/companies/* DecoratorFilter.decorate wmDecoratorNo=true * /crm/companies DecoratorFilter.decorate wmDecoratorNo=true * /crm/employees/* DecoratorFilter.decorate wmDecoratorNo=true +* /crm/contactDetails/* DecoratorFilter.decorate wmDecoratorNo=true * /project/editProject.html DecoratorFilter.decorate wmDecoratorNo=true * /financial/expenseAccounts/expenseAccountEntryEdit.html DecoratorFilter.decorate wmDecoratorNo=true * /hr/employeeEdit/json/* DecoratorFilter.decorate wmDecoratorNo=true @@ -101,7 +102,11 @@ GET /crm/companies/add action:crm.CompaniesAction.addCompanyF POST /crm/companies/add action:crm.CompaniesAction.addCompany GET /crm/companies/{id} action:crm.CompaniesAction.viewCompany POST /crm/companies/{id} action:crm.CompaniesAction.updateCompany -* /crm/companies/{id}/edit action:crm.CompaniesAction.editCompany +GET /crm/companies/{id}/edit action:crm.CompaniesAction.editCompany +POST /crm/companies/{id}/delete action:crm.CompaniesAction.deleteCompany +POST /crm/contactDetails/{id} action:crm.CompaniesAction.updateContactDetails +GET /crm/contactDetails/{id}/edit action:crm.CompaniesAction.editContactDetails +POST /crm/contactDetails/{id}/delete action:crm.CompaniesAction.deleteContactDetails GET /crm/employees/{id} action:crm.CompaniesAction.viewEmployee diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp index 3f42b1e..e70bb0e 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp @@ -19,8 +19,17 @@ <c:forEach var="contactDetail" items="${contactDetails}"> <div class="list-group-item"> - <p class="list-group-item-text">${contactDetail.type}</p> - <h4 class="list-group-item-heading">${contactDetail.value}</h4> + <div class="row"> + <div class="col-sm-9"> + <p class="list-group-item-text">${contactDetail.name} - ${contactDetail.type}</p> + <h4 class="list-group-item-heading">${contactDetail.value}</h4> + </div> + <div class="col-sm-3"> + <a class="btn btn-primary pull-right" href="<c:url value="/crm/contactDetails/${contactDetail.wikittyId}/edit"/>" data-toggle="modal" data-target="#editModal"> + <i class="fa fa-pencil"></i><span>Edit</span> + </a> + </div> + </div> </div> </c:forEach> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp index 9c9c40c..b62a686 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp @@ -40,11 +40,10 @@ </form> <div class="modal-footer"> - <button type="button" class="btn btn-danger btn-block" - onclick="bootcards.confirmDelete('company'); return false;"> - <i class="fa fa-trash-o"></i> - Delete Company - </button> + <form method="POST" action="<c:url value="/crm/companies/${company.wikittyId}/delete"/>" + data-pjax="#main" onsubmit="return confirm('Are you sure you want to delete?');"> + <input type="submit" class="btn btn-danger btn-block" value="Supprimer la société"> + </form> </div> <script type="text/javascript"> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp similarity index 60% copy from chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp copy to chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp index 9c9c40c..bb40671 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp @@ -2,11 +2,11 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<form id="editForm" class="form-horizontal" method="POST" action="<c:url value="/crm/companies/${company.wikittyId}"/>" data-pjax="#main"> +<form id="editForm" class="form-horizontal pjax" method="POST" action="<c:url value="/crm/contactDetails/${contactDetail.wikittyId}"/>" data-pjax="#main"> <div class="modal-header"> <div class="btn-group pull-left"> - <button for="submit-form" class="btn btn-danger" data-dismiss="modal"> + <buttonclass="btn btn-danger" data-dismiss="modal"> Cancel </button> </div> @@ -15,24 +15,30 @@ <input type="submit" id="editForm-success" class="btn btn-success" data-dismiss="modal" value="Save"> </div> <h3 class="modal-title"> - Edit Company + Éditer une coordonnées </h3> </div> <div class="modal-body"> - <input type="hidden" name="_method" value="put"> <div class="form-group"> <label class="col-xs-3 control-label">Nom</label> <div class="col-xs-9"> - <input type="text" name="name" class="form-control" placeholder="Nom de la société" - value="${company.name}"> + <input type="text" name="name" class="form-control" placeholder="Nom de la coordonnée" + value="${contactDetail.name}"> </div> </div> <div class="form-group"> <label class="col-xs-3 control-label">Type</label> <div class="col-xs-9"> - <input type="text" name="type" class="form-control" placeholder="Type de société" - value="${company.type}"> + <input type="text" name="type" class="form-control" placeholder="Type de coordonnées" + value="${contactDetail.type}"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-3 control-label">Valeur</label> + <div class="col-xs-9"> + <input type="text" name="value" class="form-control" placeholder="Valeur de la coordonnée" + value="${contactDetail.value}"> </div> </div> @@ -43,7 +49,7 @@ <button type="button" class="btn btn-danger btn-block" onclick="bootcards.confirmDelete('company'); return false;"> <i class="fa fa-trash-o"></i> - Delete Company + Supprimer la coordonnée </button> </div> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.