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 160d0d8a1f851f1ee2710fa4ed433f12eaa13ca1 Author: kootox <jean.couteau@gmail.com> Date: Tue Feb 3 14:29:34 2015 +0100 refs #882 : On peut créer une société et voir des employés --- .../webmotion/actions/crm/CompaniesAction.java | 46 +++++++++++++++++--- chorem-webmotion/src/main/resources/mapping | 6 ++- .../WEB-INF/jsp/crm/cards/addCompanyCard.jsp | 50 ++++++++++++++++++++++ .../WEB-INF/jsp/crm/cards/employeeInfoCard.jsp | 26 +++++++++++ .../WEB-INF/jsp/crm/cards/employeesListCard.jsp | 2 +- .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 2 +- .../src/main/webapp/WEB-INF/jsp/crm/company.jsp | 35 +++++++-------- .../WEB-INF/jsp/crm/{company2.jsp => employee.jsp} | 7 +-- 8 files changed, 141 insertions(+), 33 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 82ea60b..26c8cca 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 @@ -1,10 +1,7 @@ package org.chorem.webmotion.actions.crm; import org.chorem.ChoremClient; -import org.chorem.entities.Company; -import org.chorem.entities.ContactDetails; -import org.chorem.entities.Employee; -import org.chorem.entities.Note; +import org.chorem.entities.*; import org.debux.webmotion.server.WebMotionController; import org.debux.webmotion.server.render.Render; import org.nuiton.wikitty.query.WikittyQuery; @@ -46,7 +43,7 @@ public class CompaniesAction extends WebMotionController { List<ContactDetails> contactDetails = listContactDetails(client, id); List<Employee> employees = listEmployee(client, id); - return renderView("crm/company2.jsp", + return renderView("crm/company.jsp", "company", company, "contactDetails", contactDetails, "employees", employees, @@ -54,6 +51,29 @@ public class CompaniesAction extends WebMotionController { } /** + * Render the modal form content to create a company + * @return the modal form content + */ + public Render addCompanyForm() { + return renderView("crm/cards/addCompanyCard.jsp"); + } + + /** + * Create and save a new company + * @param client + * @param name + * @param type + * @return + */ + public Render addCompany(ChoremClient client, String name, String type) { + Company company = new CompanyImpl(); + company.setType(type); + company.setName(name); + client.store(company); + return listCompanies(client); + } + + /** * Render the modal form content to edit companies * @param client ChoremClient to fetch data * @param id the company to edit id @@ -81,6 +101,22 @@ public class CompaniesAction extends WebMotionController { return listCompanies(client); } + + public Render viewEmployee(ChoremClient client, String id) { + Employee employee = client.restore(Employee.class, id); + Company company = client.restore(Company.class, employee.getCompany()); + Person person = client.restore(Person.class, employee.getPerson()); + List<Note> notes = listNotes(client, id); + List<ContactDetails> contactDetails = listContactDetails(client, id); + + return renderView("crm/employee.jsp", + "company", company, + "person", person, + "contactDetails", contactDetails, + "notes", notes); + + } + 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 8d10522..7051a96 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -15,6 +15,7 @@ default.render=org.debux.webmotion.server.render.DefaultRender * /crm/export DecoratorFilter.decorate wmDecoratorNo=true * /crm/companies/* DecoratorFilter.decorate wmDecoratorNo=true * /crm/companies DecoratorFilter.decorate wmDecoratorNo=true +* /crm/employees/* 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 @@ -96,10 +97,13 @@ GET /* DecoratorFilter.decorate * /crm/quotation/edit/{id} action:crm.QuotationAction.edit * /crm/export action:crm.ExportAction.exportContactBase * /crm/companies action:crm.CompaniesAction.listCompanies +GET /crm/companies/add action:crm.CompaniesAction.addCompanyForm +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 -* /crm/companies/add action:crm.CompaniesAction.addCompany +GET /crm/employees/{id} action:crm.CompaniesAction.viewEmployee + GET /rest/project/projects?page={page}&count={count} action:project.ProjectsAction.findAllProjects page=1,count=10 GET /project/projects view:projects/projects.jsp diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addCompanyCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addCompanyCard.jsp new file mode 100644 index 0000000..de6e12c --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addCompanyCard.jsp @@ -0,0 +1,50 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@ 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/add"/>" data-pjax="#main"> +<div class="modal-header"> + + <div class="btn-group pull-left"> + <button for="submit-form" class="btn btn-danger" data-dismiss="modal"> + Cancel + </button> + </div> + + <div class="btn-group pull-right"> + <input type="submit" id="editForm-success" class="btn btn-success" data-dismiss="modal" value="Save"> + </div> + <h3 class="modal-title"> + Créer une société + </h3> + +</div> +<div class="modal-body"> + <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=""> + </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=""> + </div> + </div> + +</div> +</form> + +<div class="modal-footer"> +</div> + +<script type="text/javascript"> + $(document).ready(function() { + $("#editForm-success").click(function() { + $("#editForm").submit(); + }); + }); +</script> \ No newline at end of file diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeeInfoCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeeInfoCard.jsp new file mode 100644 index 0000000..e04d55b --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeeInfoCard.jsp @@ -0,0 +1,26 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<div class="panel panel-default"> + + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Informations</h3> + + <div class="btn-group pull-right"> + <a class="btn btn-primary" href="<c:url value="/crm/companies/${company.wikittyId}/edit"/>" data-toggle="modal" data-target="#editModal"> + <i class="fa fa-pencil"></i><span>Edit</span> + </a> + </div> + + </div> + + <div class="list-group"> + <div class="list-group-item"> + <p class="list-group-item-text">Nom</p> + <h4 class="list-group-item-heading">${person.firstName} ${person.lastName} </h4> + </div> + <div class="list-group-item"> + <p class="list-group-item-text">Société</p> + <h4 class="list-group-item-heading">${company.name} </h4> + </div> + </div> +</div> \ No newline at end of file diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp index 2349739..716571e 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp @@ -18,7 +18,7 @@ <div class="list-group"> <c:forEach var="employee" items="${employees}"> - <a class="list-group-item" href="#"> + <a class="list-group-item pjax" href="<c:url value="/crm/employees/${employee.wikittyId}"/>"> <h4 class="list-group-item-heading">${employee.person}</h4> <p class="list-group-item-text">${company.name}</p> </a> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/companies.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/companies.jsp index 9650231..2647236 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/companies.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/companies.jsp @@ -45,7 +45,7 @@ </div> </div> <div class="col-xs-3"> - <a class="btn btn-primary btn-block" href="/companies/add" + <a class="btn btn-primary btn-block" href="<c:url value="/crm/companies/add"/>" data-toggle="modal" data-target="#editModal"> <i class="fa fa-plus"></i> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company.jsp index a799023..2f734d3 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company.jsp @@ -1,20 +1,15 @@ -<%-- - #%L - Chorem :: webmotion - %% - Copyright (C) 2011 - 2014 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" %> + +<!-- company info card --> +<%@include file="cards/companyInfoCard.jsp" %> + +<!-- contact details card --> +<%@include file="cards/contactDetailsListCard.jsp" %> + +<!-- notes card --> +<%@include file="cards/notesListCard.jsp" %> + +<!--employees card --> +<%@include file="cards/employeesListCard.jsp" %> \ No newline at end of file diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/employee.jsp similarity index 60% rename from chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp rename to chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/employee.jsp index 2f734d3..2ded2e7 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/employee.jsp @@ -3,13 +3,10 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!-- company info card --> -<%@include file="cards/companyInfoCard.jsp" %> +<%@include file="cards/employeeInfoCard.jsp" %> <!-- contact details card --> <%@include file="cards/contactDetailsListCard.jsp" %> <!-- notes card --> -<%@include file="cards/notesListCard.jsp" %> - -<!--employees card --> -<%@include file="cards/employeesListCard.jsp" %> \ No newline at end of file +<%@include file="cards/notesListCard.jsp" %> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.