branch feature/882 created (now 5349107)
This is an automated email from the git hooks/post-receive script. New change to branch feature/882 in repository chorem. See http://git.chorem.org/chorem.git at 5349107 refs #882 : complete note CRUD in companies slot This branch includes the following new commits: new 3446bf7 refs #882 : CRM Poc using Bootcards. To be continued. (Roughly showing companies list + each company info) new 03e6fd5 Merge branch 'develop' into feature/882 new 8af2c93 refs #882 : fix cards rendering new 1942c95 refs #882 : Can now edit companies new 160d0d8 refs #882 : On peut créer une société et voir des employés new 3821244 refs #882: On peut maintenant éditer des coordonnées et supprimer des sociétés new b40dc73 refs #882 : Clean Bootcards and PJax calls js, removing all reference to mobile browsing, target is desktop new 0fa7ab3 ref #882 : full ContactDetails CRUD on companies new 5349107 refs #882 : complete note CRUD in companies slot The 9 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 53491077788febb3be71bdd7edce0828ea27ec2d Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 18:20:06 2015 +0100 refs #882 : complete note CRUD in companies slot commit 0fa7ab303d3b51ecab2e15bf24905aafeb4107a0 Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 15:52:29 2015 +0100 ref #882 : full ContactDetails CRUD on companies commit b40dc7324f66811de07fc2c64db4a07b211e105e Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 14:30:19 2015 +0100 refs #882 : Clean Bootcards and PJax calls js, removing all reference to mobile browsing, target is desktop 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 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 commit 1942c9560a4fec497777fe4bd8f215945b3b8398 Author: kootox <jean.couteau@gmail.com> Date: Tue Feb 3 10:45:20 2015 +0100 refs #882 : Can now edit companies commit 8af2c93288be9d78cf5be582dfd77cb43cbd72ee Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:52:57 2015 +0100 refs #882 : fix cards rendering commit 03e6fd588a8a419c7d432fc71887e385c74246de Merge: 3446bf7 ad12bdc Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:17:15 2015 +0100 Merge branch 'develop' into feature/882 commit 3446bf77ef341663cf16ab44f6d5f1a694db5bcd Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:09:36 2015 +0100 refs #882 : CRM Poc using Bootcards. To be continued. (Roughly showing companies list + each company info) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 3446bf77ef341663cf16ab44f6d5f1a694db5bcd Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:09:36 2015 +0100 refs #882 : CRM Poc using Bootcards. To be continued. (Roughly showing companies list + each company info) --- .../webmotion/actions/crm/CompaniesAction.java | 85 ++++ chorem-webmotion/src/main/resources/mapping | 4 + .../WEB-INF/jsp/crm/cards/companyInfoCard.jsp | 26 ++ .../jsp/crm/cards/contactDetailsListCard.jsp | 28 ++ .../WEB-INF/jsp/crm/cards/employeesListCard.jsp | 29 ++ .../webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp | 34 ++ .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 435 +++++++++++++++++++++ .../src/main/webapp/WEB-INF/jsp/crm/company2.jsp | 13 + 8 files changed, 654 insertions(+) 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 new file mode 100644 index 0000000..d282feb --- /dev/null +++ b/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java @@ -0,0 +1,85 @@ +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.debux.webmotion.server.WebMotionController; +import org.debux.webmotion.server.render.Render; +import org.nuiton.wikitty.query.WikittyQuery; +import org.nuiton.wikitty.query.WikittyQueryMaker; + +import java.util.List; + +/** + * Created by couteau on 28/01/15. + */ +public class CompaniesAction extends WebMotionController { + /** + * Rend le graphe des devis envoyés par mois + * + * @param client + * @return + */ + public Render listCompanies(ChoremClient client) { + + //list all the companies + WikittyQuery companiesQuery = new WikittyQueryMaker().exteq(Company.EXT_COMPANY).end(); + List<Company> companies = client.findAllByQuery(Company.class, companiesQuery).getAll(); + + //get the first company info to init the page + Company company = companies.get(0); + List<Note> notes = listNotes(client, company.getWikittyId()); + List<ContactDetails> contactDetails = listContactDetails(client, company.getWikittyId()); + List<Employee> employees = listEmployee(client, company.getWikittyId()); + + return renderView("crm/companies.jsp", + "companies", companies, + "company", company, + "contactDetails", contactDetails, + "employees", employees, + "notes", notes); + } + + public Render viewCompany(ChoremClient client, String id) { + Company company = client.restore(Company.class, id); + List<Note> notes = listNotes(client, id); + List<ContactDetails> contactDetails = listContactDetails(client, id); + List<Employee> employees = listEmployee(client, id); + + return renderView("crm/company2.jsp", + "company", company, + "contactDetails", contactDetails, + "employees", employees, + "notes", notes); + + } + + public List<Note> listNotes(ChoremClient client, String companyId) { + WikittyQuery notesQuery = new WikittyQueryMaker().and() + .exteq(Note.EXT_NOTE) + .eq(Note.FQ_FIELD_NOTE_TARGET, companyId).end(); + List<Note> notes = client.findAllByQuery(Note.class, notesQuery).getAll(); + + return notes; + } + + public List<ContactDetails> listContactDetails(ChoremClient client, String companyId) { + WikittyQuery contactDetailsQuery = new WikittyQueryMaker().and() + .exteq(ContactDetails.EXT_CONTACTDETAILS) + .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, companyId).end(); + List<ContactDetails> contactDetails = client.findAllByQuery(ContactDetails.class, contactDetailsQuery).getAll(); + + return contactDetails; + } + + public List<Employee> listEmployee(ChoremClient client, String companyId) { + WikittyQuery employeesQuery = new WikittyQueryMaker().and() + .exteq(Employee.EXT_EMPLOYEE) + .eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).end(); + List<Employee> employees = client.findAllByQuery(Employee.class, employeesQuery).getAll(); + + return employees; + } +} diff --git a/chorem-webmotion/src/main/resources/mapping b/chorem-webmotion/src/main/resources/mapping index e1bf470..f813fca 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -13,6 +13,7 @@ default.render=org.debux.webmotion.server.render.DefaultRender * /sales/funnel/json/* DecoratorFilter.decorate wmDecoratorNo=true * /sales/funnel/partial/* DecoratorFilter.decorate wmDecoratorNo=true * /crm/export DecoratorFilter.decorate wmDecoratorNo=true +* /crm/companies/* 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 @@ -93,6 +94,9 @@ GET /* DecoratorFilter.decorate * /crm/account/{id} action:crm.AccountAction.view * /crm/quotation/edit/{id} action:crm.QuotationAction.edit * /crm/export action:crm.ExportAction.exportContactBase +* /crm/companies action:crm.CompaniesAction.listCompanies +* /crm/companies/{id} action:crm.CompaniesAction.viewCompany +* /crm/companies/add action:crm.CompaniesAction.addCompany 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/companyInfoCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.jsp new file mode 100644 index 0000000..3c90b3d --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.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="#" 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">${company.name}</h4> + </div> + <div class="list-group-item"> + <p class="list-group-item-text">Type</p> + <h4 class="list-group-item-heading">${company.type}</h4> + </div> + </div> +</div> \ No newline at end of file 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 new file mode 100644 index 0000000..3f42b1e --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp @@ -0,0 +1,28 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<div class="panel panel-default"> + + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Coordonnées</h3> + <div class="btn-group pull-right"> + <a class="btn btn-primary" href="#" + data-toggle="modal" + data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> + + </div> + + <div class="list-group"> + + <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> + </c:forEach> + + </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 new file mode 100644 index 0000000..10cb08e --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp @@ -0,0 +1,29 @@ + <%@page contentType="text/html" pageEncoding="UTF-8"%> + +<div id="contactCard"> + +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Contacts</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#" data-toggle="modal" data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#" data-toggle="modal" data-target="#editModal"> + <i class="fa fa-pencil"></i><span>Edit</span> + </a> + </div> + <div class="list-group"> + + <c:forEach var="employee" items="${employees}"> + <a class="list-group-item" href="#"> + <h4 class="list-group-item-heading">${employee.person}</h4> + <p class="list-group-item-text">${company.name}</p> + </a> + </c:forEach> + + </div> + +</div> \ No newline at end of file diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp new file mode 100644 index 0000000..56f91db --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp @@ -0,0 +1,34 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<div class="panel panel-default"> + + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Notes</h3> + + <div class="btn-group pull-right"> + <a class="btn btn-primary" href="#" + data-toggle="modal" + data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> + + </div> + + <div class="list-group"> + + <c:forEach var="note" items="${notes}"> + <a class="list-group-item" href="#"> + <h4 class="list-group-item-heading">${note.title}</h4> + <p class="list-group-item-text">${note.date}</p> + </a> + </c:forEach> + + </div> + + <div class="panel-footer"> + <small class="pull-left">List Card Footer</small> + </div> + + </div> \ No newline at end of file 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 new file mode 100644 index 0000000..33934e5 --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/companies.jsp @@ -0,0 +1,435 @@ +<%-- + #%L + Chorem :: webmotion + %% + Copyright (C) 2011 - 2015 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"%> + +<head> + <link href="https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.0/css/bootcards-desktop..." rel="stylesheet"> + <link href="https://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" /> +</head> + +<body> + + <div class="container bootcards-container push-right"> + + <div class="row"> + + <!-- left list column --> + <div class="col-sm-5 bootcards-list" id="list" data-title="Companies"> + <div class="panel panel-default"> + <div class="panel-body"> + <div class="search-form"> + <div class="row"> + <div class="col-xs-9"> + <div class="form-group"> + <input type="text" class="form-control" placeholder="Search Companies..."> + <i class="fa fa-search"></i> + </div> + </div> + <div class="col-xs-3"> + <a class="btn btn-primary btn-block" href="#" onclick="bootcards.hideOffCanvasMenu()" > + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> + </div> + </div> + </div><!--panel body--> + + <div class="list-group"> + + <c:forEach var="company" items="${companies}"> + <a class="list-group-item pjax" href="<c:url value="/crm/companies/${company.wikittyId}"/>""> + <i class="fa fa-3x fa-building-o pull-left"></i> + <h4 class="list-group-item-heading">${company.name}</h4> + <p class="list-group-item-text">${company.type} </p> + </a> + </c:forEach> + + </div><!--list-group--> + </div><!--panel--> + + </div><!--list--> + + <!--list details column--> + <div id='listDetails' class="col-sm-7 bootcards-cards hidden-xs"> + + <!-- 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" %> + + + </div><!--list-details--> + + </div><!--row--> + + + </div><!--container--> + + <!--edit contact modal--> + <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModal" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + + <form class="form-horizontal" method="POST" action="/contacts/{{contact.id}}" data-pjax="#main"> + + <div class="modal-header"> + + <div class="btn-group pull-left"> + <button class="btn btn-danger" data-dismiss="modal"> + Cancel + </button> + </div> + + <div class="btn-group pull-right"> + <button class="btn btn-success" data-dismiss="modal"> + <i class="fa fa-check"></i>Save + </button> + </div> + + <h4 class="modal-title"> + Edit Contact + </h4> + </div> + + <div class="modal-body"> + <input type="hidden" name="companyId" value="{{contact.companyId}}"> + <input type="hidden" name="_method" value="put"> + <div class="form-group"> + <label class="col-xs-4 control-label">First Name</label> + <div class="col-xs-8"> + <input type="text" name="firstName" class="form-control" placeholder="First Name" + value="Sofia"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-4 control-label">Last Name</label> + <div class="col-xs-8"> + <input type="text" name="lastName" class="form-control" placeholder="Last Name" + value="Acey"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-4 control-label">Company</label> + <div class="col-xs-8"> + <input type="text" name="department" class="form-control" placeholder="Department" + value="Masung Corp."> + </div> + </div> + <div class="form-group"> + <label class="col-xs-4 control-label">Phone</label> + <div class="col-xs-8"> + <input type="text" name="phone" class="form-control" + placeholder="Phone" + value="+1 650-555-0055"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-4 control-label">Email</label> + <div class="col-xs-8"> + <input type="email" name="email" class="form-control" placeholder="Email" + value="Sofia.Acey@masung.com"> + </div> + </div> + + </div> + </form> + + <div class="modal-footer"> + <button type="button" class="btn btn-danger btn-block" + onclick="bootcards.confirmDelete('contact'); return false;"> + <i class="fa fa-trash-o"></i> + Delete Contact + </button> + </div> + + </div><!--modal-content--> + </div> + </div><!--modal--> + + <!-- Bootstrap & jQuery core JavaScript + ================================================== --> + <!-- Placed at the end of the document so the pages load faster --> + <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.pjax/1.9.2/jquery.pjax.min.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> + + <!-- Bootcards JS --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.0/js/bootcards.js"></script> + + <!--recommended: FTLabs FastClick library--> + <script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.3/fastclick.min.js"></script> + + <script type="text/javascript"> + + /* + * Initialize Bootcards. + * + * Parameters: + * - offCanvasBackdrop (boolean): show a backdrop when the offcanvas is shown + * - offCanvasHideOnMainClick (boolean): hide the offcanvas menu on clicking outside the off canvas + * - enableTabletPortraitMode (boolean): enable single pane mode for tablets in portraitmode + * - disableRubberBanding (boolean): disable the iOS rubber banding effect + * - disableBreakoutSelector (boolean) : for iOS apps that are added to the home screen: + jQuery selector to target links for which a fix should be added to not + allow those links to break out of fullscreen mode. + */ + bootcards.init( { + offCanvasBackdrop : true, + offCanvasHideOnMainClick : true, + enableTabletPortraitMode : true, + disableRubberBanding : true + }); + + //enable FastClick + window.addEventListener('load', function() { + FastClick.attach(document.body); + }, false); + + //activate the sub-menu options in the offcanvas menu + $('.collapse').collapse(); + + //highlight first list group option (if non active yet) + if ( $('.list-group a.active').length === 0 ) { + $('.list-group a').first().addClass('active'); + } + + /* + * Add click handlers to links to force a pjax (partial) load + * http://pjax.heroku.com/ + */ + bootcards.addPJaxHandlers = function(pjaxTarget) { + + //add pjax click handler to links + $('a.pjax').off().on('click', function(e) { + var $this = $(this); + var tgtUrl = $this.attr('href'); + + $.pjax( { + container : pjaxTarget, + url : tgtUrl + }); + + //add active class if this is a list item (removing it from all siblings) + if ($this.hasClass('list-group-item')) { + $this + .addClass('active') + .siblings() + .removeClass('active'); + } + + e.preventDefault(); + }); + + }; + + //pjax on all a's that have the data-pjax attribute (the attribute's value is the pjax target container) + $(document).ready( function() { + + //publish event when changing main menu option + $("a[data-title]").on("click", function() { + $.Topic( "navigateTo" ).publish( $(this).data("title") ); + }); + + var $body = $("body"); + + //fix for status bar bug in iOS 8 + if (bootcards.isFullScreen) { + $body + .prepend("<div class='statusbar' />") + .addClass("fullscreen"); + } + + //destroy modals on close (to reload the contents when using the remote property) + $body.on('hidden.bs.modal', '.modal', function () { + $(this).removeData('bs.modal'); + }); + + var pjaxTarget = (bootcards.isXS() ? '#list' : '#listDetails'); + + if (bootcards.isXS() ) { + + //restrict footer to only 4 items + var $footer = $(".navbar-fixed-bottom .btn-group"); + if ($footer.length>0) { + var $links = $('a', $footer); + + if ($links.length > 4) { + $links.each( function(idx) { + if (idx >= 4) { this.remove(); } + }); + } + } + + } + + bootcards.addPJaxHandlers(pjaxTarget); + + $(document) + .pjax('a[data-pjax]') + .on('submit', 'form[data-pjax]', function(event) { + //use pjax to submit forms + $.pjax.submit(event); + }) + .on('pjax:start', function(event) { + + //hide the offcanvas menu + $("#offCanvasMenu").removeClass("active"); + $("#main").removeClass("active"); + + }) + .on('pjax:end', function(event) { + + var $tgt = $(event.target); + var tgtId = $tgt.attr('id'); + + if ( bootcards.isXS() ) { + //function only performed on small screens (smartphones) + + //we only use the list column + var details = $('#listDetails'); + if (details.length>0) { + details.remove(); + } + + //change class on container elements (list>card and vice versa) + if ( tgtId == 'main') { + + $('#list') + .removeClass('bootcards-cards') + .addClass('bootcards-list'); + + //show the back button + $('.btn-menu').removeClass('hidden'); + $('.btn-back').addClass('hidden'); + + //get the panel + var $main = $("#main"); + var $panel = $("#main > .panel"); + if ($panel.length>0) { + + var row = $('<div class="row"></div>'); + var container = $('<div class="col-sm-5 bootcards-list" id="list"></div>') + .appendTo(row); + + $panel.appendTo(container); + + row.appendTo($main); + } + + } else if (tgtId == 'list') { + + var $list = $('#list'); + + if ( !$list.hasClass('bootcards-cards')) { + + $list + .addClass('bootcards-cards') + .removeClass('bootcards-list'); + + //show the menu button + $('.btn-menu').addClass('hidden'); + $('.btn-back').removeClass('hidden'); + + //scroll to the top of the card + $list.animate({scrollTop:0}, '500', 'easeOutExpo'); + } + + } + + } + + bootcards.addPJaxHandlers(pjaxTarget); + + //highlight first list group option (if non active yet) + if ( $('.list-group a.active').length === 0 ) { + $('.list-group a').first().addClass('active'); + } + + //enable single pane portrait mode when loading content with pjax + if ( tgtId == 'main' && bootcards.portraitModeEnabled ) { + + //do some cleaning up first + if (bootcards.listOffcanvasToggle) { + bootcards.listOffcanvasToggle.remove(); + bootcards.listTitleEl.remove(); + Bootcards.OffCanvas.$menuTitleEl.remove(); + } + bootcards.listOffcanvasToggle = null; + bootcards.listTitleEl = null; + Bootcards.OffCanvas.$menuTitleEl = null; + bootcards.listEl = null; + bootcards.cardsEl = null; + + bootcards._setOrientation(true); + + if (bootcards.listTitleEl) { + bootcards.listTitleEl.find('button').show(); + } + + //add the resize events again + $(window) + .off() + .on( 'resize', function() { + setTimeout( function() { + bootcards._setOrientation(false); + if (chartSalesProductType !== null) { chartSalesProductType.redraw(); } + if (closedSalesChart !== null) { closedSalesChart.redraw(); } + if (dbSizeChart !== null) { dbSizeChart.redraw(); } + if (barChartClosedSales !== null) { barChartClosedSales.redraw(); } + } , 250); + } ); + + } + + }) + .on('pjax:complete', function(event) { + //called after a pjax content update + + //check for any modals to close + var modal = $(event.relatedTarget).closest('.modal'); + if (modal.length) { + modal.modal('hide'); + } + + }); + + }); + + + /* + * Enable FTLabs' FastClick + * https://github.com/ftlabs/fastclick + */ + window.addEventListener('load', function() { + FastClick.attach(document.body); + }, false); + + </script> + </body> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp new file mode 100644 index 0000000..972664c --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp @@ -0,0 +1,13 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<!-- 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 -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 03e6fd588a8a419c7d432fc71887e385c74246de Merge: 3446bf7 ad12bdc Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:17:15 2015 +0100 Merge branch 'develop' into feature/882 .../chorem/webmotion/actions/sales/ProjectSalesReportAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 8af2c93288be9d78cf5be582dfd77cb43cbd72ee Author: kootox <jean.couteau@gmail.com> Date: Fri Jan 30 15:52:57 2015 +0100 refs #882 : fix cards rendering --- .../main/java/org/chorem/webmotion/actions/crm/CompaniesAction.java | 4 ---- .../src/main/webapp/WEB-INF/jsp/crm/cards/contactDetailsListCard.jsp | 2 ++ .../src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp | 4 +++- .../src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp | 2 ++ 4 files changed, 7 insertions(+), 5 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 d282feb..ab0c2ad 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 @@ -53,7 +53,6 @@ public class CompaniesAction extends WebMotionController { "contactDetails", contactDetails, "employees", employees, "notes", notes); - } public List<Note> listNotes(ChoremClient client, String companyId) { @@ -61,7 +60,6 @@ public class CompaniesAction extends WebMotionController { .exteq(Note.EXT_NOTE) .eq(Note.FQ_FIELD_NOTE_TARGET, companyId).end(); List<Note> notes = client.findAllByQuery(Note.class, notesQuery).getAll(); - return notes; } @@ -70,7 +68,6 @@ public class CompaniesAction extends WebMotionController { .exteq(ContactDetails.EXT_CONTACTDETAILS) .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, companyId).end(); List<ContactDetails> contactDetails = client.findAllByQuery(ContactDetails.class, contactDetailsQuery).getAll(); - return contactDetails; } @@ -79,7 +76,6 @@ public class CompaniesAction extends WebMotionController { .exteq(Employee.EXT_EMPLOYEE) .eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).end(); List<Employee> employees = client.findAllByQuery(Employee.class, employeesQuery).getAll(); - return employees; } } 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..241cbb8 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 @@ -1,5 +1,7 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + <div class="panel panel-default"> <div class="panel-heading clearfix"> 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 10cb08e..1b918df 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 @@ -1,4 +1,6 @@ - <%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <div id="contactCard"> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp index 56f91db..78606e3 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp @@ -1,5 +1,7 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + <div class="panel panel-default"> <div class="panel-heading clearfix"> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 1942c9560a4fec497777fe4bd8f215945b3b8398 Author: kootox <jean.couteau@gmail.com> Date: Tue Feb 3 10:45:20 2015 +0100 refs #882 : Can now edit companies --- .../webmotion/actions/crm/CompaniesAction.java | 52 +++-- chorem-webmotion/src/main/resources/mapping | 5 +- .../WEB-INF/jsp/crm/cards/companyInfoCard.jsp | 6 +- .../jsp/crm/cards/contactDetailsListCard.jsp | 2 - .../WEB-INF/jsp/crm/cards/editCompanyCard.jsp | 56 +++++ .../WEB-INF/jsp/crm/cards/employeesListCard.jsp | 2 - .../webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp | 48 ++--- .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 238 +++++++-------------- .../src/main/webapp/WEB-INF/jsp/crm/company2.jsp | 2 + 9 files changed, 210 insertions(+), 201 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 ab0c2ad..82ea60b 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 @@ -12,20 +12,18 @@ import org.nuiton.wikitty.query.WikittyQueryMaker; import java.util.List; -/** - * Created by couteau on 28/01/15. - */ public class CompaniesAction extends WebMotionController { /** - * Rend le graphe des devis envoyés par mois + * Render the company screen (company list + first company displayed) * - * @param client - * @return + * @param client ChoremClient to fetch data + * @return the page */ public Render listCompanies(ChoremClient client) { //list all the companies - WikittyQuery companiesQuery = new WikittyQueryMaker().exteq(Company.EXT_COMPANY).end(); + WikittyQuery companiesQuery = new WikittyQueryMaker().exteq(Company.EXT_COMPANY) + .end().addSortAscending(Company.ELEMENT_FIELD_COMPANY_NAME).setLimit(WikittyQuery.MAX);; List<Company> companies = client.findAllByQuery(Company.class, companiesQuery).getAll(); //get the first company info to init the page @@ -55,26 +53,54 @@ public class CompaniesAction extends WebMotionController { "notes", notes); } - public List<Note> listNotes(ChoremClient client, String companyId) { + /** + * 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 editCompany(ChoremClient client, String id) { + Company company = client.restore(Company.class, id); + return renderView("crm/cards/editCompanyCard.jsp", + "company", company); + } + + /** + * Save the edited company + * @param client ChoremClient to fetch data + * @param id the company to edit id + * @param name the new name + * @param type the new type + * @return the modal form content + */ + public Render updateCompany(ChoremClient client, String id, String name, String type) { + Company company = client.restore(Company.class, id); + company.setName(name); + company.setType(type); + client.store(company); + return listCompanies(client); + } + + protected List<Note> listNotes(ChoremClient client, String companyId) { WikittyQuery notesQuery = new WikittyQueryMaker().and() .exteq(Note.EXT_NOTE) - .eq(Note.FQ_FIELD_NOTE_TARGET, companyId).end(); + .eq(Note.FQ_FIELD_NOTE_TARGET, companyId).end().setLimit(WikittyQuery.MAX);; List<Note> notes = client.findAllByQuery(Note.class, notesQuery).getAll(); return notes; } - public List<ContactDetails> listContactDetails(ChoremClient client, String companyId) { + protected List<ContactDetails> listContactDetails(ChoremClient client, String companyId) { WikittyQuery contactDetailsQuery = new WikittyQueryMaker().and() .exteq(ContactDetails.EXT_CONTACTDETAILS) - .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, companyId).end(); + .eq(ContactDetails.FQ_FIELD_CONTACTDETAILS_TARGET, companyId).end().setLimit(WikittyQuery.MAX);; List<ContactDetails> contactDetails = client.findAllByQuery(ContactDetails.class, contactDetailsQuery).getAll(); return contactDetails; } - public List<Employee> listEmployee(ChoremClient client, String companyId) { + protected List<Employee> listEmployee(ChoremClient client, String companyId) { WikittyQuery employeesQuery = new WikittyQueryMaker().and() .exteq(Employee.EXT_EMPLOYEE) - .eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).end(); + .eq(Employee.FQ_FIELD_EMPLOYEE_COMPANY, companyId).end().setLimit(WikittyQuery.MAX);; List<Employee> employees = client.findAllByQuery(Employee.class, employeesQuery).getAll(); return employees; } diff --git a/chorem-webmotion/src/main/resources/mapping b/chorem-webmotion/src/main/resources/mapping index f813fca..8d10522 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -14,6 +14,7 @@ default.render=org.debux.webmotion.server.render.DefaultRender * /sales/funnel/partial/* DecoratorFilter.decorate wmDecoratorNo=true * /crm/export DecoratorFilter.decorate wmDecoratorNo=true * /crm/companies/* DecoratorFilter.decorate wmDecoratorNo=true +* /crm/companies 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 @@ -95,7 +96,9 @@ GET /* DecoratorFilter.decorate * /crm/quotation/edit/{id} action:crm.QuotationAction.edit * /crm/export action:crm.ExportAction.exportContactBase * /crm/companies action:crm.CompaniesAction.listCompanies -* /crm/companies/{id} action:crm.CompaniesAction.viewCompany +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 /rest/project/projects?page={page}&count={count} action:project.ProjectsAction.findAllProjects page=1,count=10 diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.jsp index 3c90b3d..36c0066 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/companyInfoCard.jsp @@ -6,7 +6,7 @@ <h3 class="panel-title pull-left">Informations</h3> <div class="btn-group pull-right"> - <a class="btn btn-primary" href="#" data-toggle="modal" data-target="#editModal"> + <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> @@ -16,11 +16,11 @@ <div class="list-group"> <div class="list-group-item"> <p class="list-group-item-text">Nom</p> - <h4 class="list-group-item-heading">${company.name}</h4> + <h4 class="list-group-item-heading">${company.name} </h4> </div> <div class="list-group-item"> <p class="list-group-item-text">Type</p> - <h4 class="list-group-item-heading">${company.type}</h4> + <h4 class="list-group-item-heading">${company.type} </h4> </div> </div> </div> \ No newline at end of file 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 241cbb8..3f42b1e 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 @@ -1,7 +1,5 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - <div class="panel panel-default"> <div class="panel-heading clearfix"> 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 new file mode 100644 index 0000000..9c9c40c --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editCompanyCard.jsp @@ -0,0 +1,56 @@ +<%@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/${company.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"> + 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"> + Edit Company + </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}"> + </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}"> + </div> + </div> + +</div> +</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> +</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/employeesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/employeesListCard.jsp index 1b918df..2349739 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 @@ -1,7 +1,5 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - <div id="contactCard"> <div class="panel panel-default"> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp index 78606e3..5cfe10d 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp @@ -1,36 +1,34 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - <div class="panel panel-default"> - <div class="panel-heading clearfix"> - <h3 class="panel-title pull-left">Notes</h3> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Notes</h3> - <div class="btn-group pull-right"> - <a class="btn btn-primary" href="#" - data-toggle="modal" - data-target="#editModal"> - <i class="fa fa-plus"></i> - <span>Add</span> - </a> - </div> + <div class="btn-group pull-right"> + <a class="btn btn-primary" href="#" + data-toggle="modal" + data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> - </div> + </div> - <div class="list-group"> + <div class="list-group"> - <c:forEach var="note" items="${notes}"> - <a class="list-group-item" href="#"> - <h4 class="list-group-item-heading">${note.title}</h4> - <p class="list-group-item-text">${note.date}</p> - </a> - </c:forEach> + <c:forEach var="note" items="${notes}"> + <a class="list-group-item" href="#"> + <h4 class="list-group-item-heading">${note.title}</h4> + <p class="list-group-item-text">${note.date}</p> + </a> + </c:forEach> - </div> + </div> - <div class="panel-footer"> - <small class="pull-left">List Card Footer</small> - </div> + <div class="panel-footer"> + <small class="pull-left">List Card Footer</small> + </div> - </div> \ No newline at end of file +</div> \ No newline at end of file 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 33934e5..9650231 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 @@ -24,169 +24,97 @@ <head> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.0/css/bootcards-desktop..." rel="stylesheet"> <link href="https://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" /> + <script src="//code.jquery.com/jquery-2.1.3.min.js"></script> </head> <body> - <div class="container bootcards-container push-right"> - - <div class="row"> - - <!-- left list column --> - <div class="col-sm-5 bootcards-list" id="list" data-title="Companies"> - <div class="panel panel-default"> - <div class="panel-body"> - <div class="search-form"> - <div class="row"> - <div class="col-xs-9"> - <div class="form-group"> - <input type="text" class="form-control" placeholder="Search Companies..."> - <i class="fa fa-search"></i> - </div> - </div> - <div class="col-xs-3"> - <a class="btn btn-primary btn-block" href="#" onclick="bootcards.hideOffCanvasMenu()" > - <i class="fa fa-plus"></i> - <span>Add</span> - </a> - </div> - </div> - </div> - </div><!--panel body--> - - <div class="list-group"> - - <c:forEach var="company" items="${companies}"> - <a class="list-group-item pjax" href="<c:url value="/crm/companies/${company.wikittyId}"/>""> - <i class="fa fa-3x fa-building-o pull-left"></i> - <h4 class="list-group-item-heading">${company.name}</h4> - <p class="list-group-item-text">${company.type} </p> - </a> - </c:forEach> - - </div><!--list-group--> - </div><!--panel--> - - </div><!--list--> - - <!--list details column--> - <div id='listDetails' class="col-sm-7 bootcards-cards hidden-xs"> - - <!-- 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" %> - - - </div><!--list-details--> - - </div><!--row--> - - - </div><!--container--> + <div class="container bootcards-container" id="main"> + + <div class="row"> + + <div class="col-sm-6 bootcards-list" id="list" data-title="Companies"> + <div class="panel panel-default"> + <div class="panel-body"> + <div class="search-form"> + <div class="row"> + <div class="col-xs-9"> + <div class="form-group"> + <input type="text" class="form-control" placeholder="Search Companies..."> + <i class="fa fa-search"></i> + </div> + </div> + <div class="col-xs-3"> + <a class="btn btn-primary btn-block" href="/companies/add" + data-toggle="modal" + data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Add</span> + </a> + </div> + </div> + </div> + </div> + <div class="list-group"> + <c:forEach var="company" items="${companies}"> + <a class="list-group-item pjax" href="<c:url value="/crm/companies/${company.wikittyId}"/>"> + <i class="fa fa-3x fa-building-o pull-left"></i> + <h4 class="list-group-item-heading">${company.name}</h4> + <p class="list-group-item-text">${company.type} </p> + </a> + </c:forEach> + + </div> + <div class="panel-footer"> + <small class="pull-left">Built with Bootcards - Detailed List</small> + </div> + </div> + </div> + + + <div class="col-sm-6 bootcards-cards hidden-xs" id="listDetails"> + + <!-- 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" %> + + </div> + </div> + + + </div> + + <!-- Load the required JavaScript libraries --> + <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> + <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> + + <script src="//cdnjs.cloudflare.com/ajax/libs/jquery.pjax/1.9.2/jquery.pjax.min.js"></script> + <script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.3/fastclick.min.js"></script> + + <!-- Bootcards JS file --> + <script src="https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.0/js/bootcards.js"></script> - <!--edit contact modal--> - <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModal" aria-hidden="true"> + <!--modals--> + <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModal" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"></div> + </div> + </div> + <div class="modal fade" id="docsModal" tabindex="-1" role="dialog" aria-labelledby="docsModal" aria-hidden="true"> <div class="modal-dialog"> - <div class="modal-content"> - - <form class="form-horizontal" method="POST" action="/contacts/{{contact.id}}" data-pjax="#main"> - - <div class="modal-header"> - - <div class="btn-group pull-left"> - <button class="btn btn-danger" data-dismiss="modal"> - Cancel - </button> - </div> - - <div class="btn-group pull-right"> - <button class="btn btn-success" data-dismiss="modal"> - <i class="fa fa-check"></i>Save - </button> - </div> - - <h4 class="modal-title"> - Edit Contact - </h4> - </div> - - <div class="modal-body"> - <input type="hidden" name="companyId" value="{{contact.companyId}}"> - <input type="hidden" name="_method" value="put"> - <div class="form-group"> - <label class="col-xs-4 control-label">First Name</label> - <div class="col-xs-8"> - <input type="text" name="firstName" class="form-control" placeholder="First Name" - value="Sofia"> - </div> - </div> - <div class="form-group"> - <label class="col-xs-4 control-label">Last Name</label> - <div class="col-xs-8"> - <input type="text" name="lastName" class="form-control" placeholder="Last Name" - value="Acey"> - </div> - </div> - <div class="form-group"> - <label class="col-xs-4 control-label">Company</label> - <div class="col-xs-8"> - <input type="text" name="department" class="form-control" placeholder="Department" - value="Masung Corp."> - </div> - </div> - <div class="form-group"> - <label class="col-xs-4 control-label">Phone</label> - <div class="col-xs-8"> - <input type="text" name="phone" class="form-control" - placeholder="Phone" - value="+1 650-555-0055"> - </div> - </div> - <div class="form-group"> - <label class="col-xs-4 control-label">Email</label> - <div class="col-xs-8"> - <input type="email" name="email" class="form-control" placeholder="Email" - value="Sofia.Acey@masung.com"> - </div> - </div> - - </div> - </form> - - <div class="modal-footer"> - <button type="button" class="btn btn-danger btn-block" - onclick="bootcards.confirmDelete('contact'); return false;"> - <i class="fa fa-trash-o"></i> - Delete Contact - </button> - </div> - - </div><!--modal-content--> + <div class="modal-content"></div> </div> - </div><!--modal--> - - <!-- Bootstrap & jQuery core JavaScript - ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> - <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> - <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.pjax/1.9.2/jquery.pjax.min.js"></script> - <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> - - <!-- Bootcards JS --> - <script src="https://cdnjs.cloudflare.com/ajax/libs/bootcards/1.1.0/js/bootcards.js"></script> - - <!--recommended: FTLabs FastClick library--> - <script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.3/fastclick.min.js"></script> + </div> - <script type="text/javascript"> + <script type="text/javascript"> /* * Initialize Bootcards. diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp index 972664c..2f734d3 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/company2.jsp @@ -1,5 +1,7 @@ <%@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" %> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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>.
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>.
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 b40dc7324f66811de07fc2c64db4a07b211e105e Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 14:30:19 2015 +0100 refs #882 : Clean Bootcards and PJax calls js, removing all reference to mobile browsing, target is desktop --- .../webmotion/actions/crm/CompaniesAction.java | 1 + .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 230 +-------------------- chorem-webmotion/src/main/webapp/js/crm.js | 72 +++++++ 3 files changed, 76 insertions(+), 227 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 73818ef..39ab445 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 @@ -8,6 +8,7 @@ import org.debux.webmotion.server.render.RenderView; import org.nuiton.wikitty.query.WikittyQuery; import org.nuiton.wikitty.query.WikittyQueryMaker; +import javax.servlet.http.HttpServletRequest; import java.util.List; public class CompaniesAction extends WebMotionController { 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 2647236..783f7eb 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 @@ -33,7 +33,7 @@ <div class="row"> - <div class="col-sm-6 bootcards-list" id="list" data-title="Companies"> + <div class="col-sm-6 bootcards-list" id="list"> <div class="panel panel-default"> <div class="panel-body"> <div class="search-form"> @@ -72,7 +72,7 @@ </div> - <div class="col-sm-6 bootcards-cards hidden-xs" id="listDetails"> + <div class="col-sm-6 bootcards-cards" id="listDetails"> <!-- company info card --> <%@include file="cards/companyInfoCard.jsp" %> @@ -134,230 +134,6 @@ enableTabletPortraitMode : true, disableRubberBanding : true }); - - //enable FastClick - window.addEventListener('load', function() { - FastClick.attach(document.body); - }, false); - - //activate the sub-menu options in the offcanvas menu - $('.collapse').collapse(); - - //highlight first list group option (if non active yet) - if ( $('.list-group a.active').length === 0 ) { - $('.list-group a').first().addClass('active'); - } - - /* - * Add click handlers to links to force a pjax (partial) load - * http://pjax.heroku.com/ - */ - bootcards.addPJaxHandlers = function(pjaxTarget) { - - //add pjax click handler to links - $('a.pjax').off().on('click', function(e) { - var $this = $(this); - var tgtUrl = $this.attr('href'); - - $.pjax( { - container : pjaxTarget, - url : tgtUrl - }); - - //add active class if this is a list item (removing it from all siblings) - if ($this.hasClass('list-group-item')) { - $this - .addClass('active') - .siblings() - .removeClass('active'); - } - - e.preventDefault(); - }); - - }; - - //pjax on all a's that have the data-pjax attribute (the attribute's value is the pjax target container) - $(document).ready( function() { - - //publish event when changing main menu option - $("a[data-title]").on("click", function() { - $.Topic( "navigateTo" ).publish( $(this).data("title") ); - }); - - var $body = $("body"); - - //fix for status bar bug in iOS 8 - if (bootcards.isFullScreen) { - $body - .prepend("<div class='statusbar' />") - .addClass("fullscreen"); - } - - //destroy modals on close (to reload the contents when using the remote property) - $body.on('hidden.bs.modal', '.modal', function () { - $(this).removeData('bs.modal'); - }); - - var pjaxTarget = (bootcards.isXS() ? '#list' : '#listDetails'); - - if (bootcards.isXS() ) { - - //restrict footer to only 4 items - var $footer = $(".navbar-fixed-bottom .btn-group"); - if ($footer.length>0) { - var $links = $('a', $footer); - - if ($links.length > 4) { - $links.each( function(idx) { - if (idx >= 4) { this.remove(); } - }); - } - } - - } - - bootcards.addPJaxHandlers(pjaxTarget); - - $(document) - .pjax('a[data-pjax]') - .on('submit', 'form[data-pjax]', function(event) { - //use pjax to submit forms - $.pjax.submit(event); - }) - .on('pjax:start', function(event) { - - //hide the offcanvas menu - $("#offCanvasMenu").removeClass("active"); - $("#main").removeClass("active"); - - }) - .on('pjax:end', function(event) { - - var $tgt = $(event.target); - var tgtId = $tgt.attr('id'); - - if ( bootcards.isXS() ) { - //function only performed on small screens (smartphones) - - //we only use the list column - var details = $('#listDetails'); - if (details.length>0) { - details.remove(); - } - - //change class on container elements (list>card and vice versa) - if ( tgtId == 'main') { - - $('#list') - .removeClass('bootcards-cards') - .addClass('bootcards-list'); - - //show the back button - $('.btn-menu').removeClass('hidden'); - $('.btn-back').addClass('hidden'); - - //get the panel - var $main = $("#main"); - var $panel = $("#main > .panel"); - if ($panel.length>0) { - - var row = $('<div class="row"></div>'); - var container = $('<div class="col-sm-5 bootcards-list" id="list"></div>') - .appendTo(row); - - $panel.appendTo(container); - - row.appendTo($main); - } - - } else if (tgtId == 'list') { - - var $list = $('#list'); - - if ( !$list.hasClass('bootcards-cards')) { - - $list - .addClass('bootcards-cards') - .removeClass('bootcards-list'); - - //show the menu button - $('.btn-menu').addClass('hidden'); - $('.btn-back').removeClass('hidden'); - - //scroll to the top of the card - $list.animate({scrollTop:0}, '500', 'easeOutExpo'); - } - - } - - } - - bootcards.addPJaxHandlers(pjaxTarget); - - //highlight first list group option (if non active yet) - if ( $('.list-group a.active').length === 0 ) { - $('.list-group a').first().addClass('active'); - } - - //enable single pane portrait mode when loading content with pjax - if ( tgtId == 'main' && bootcards.portraitModeEnabled ) { - - //do some cleaning up first - if (bootcards.listOffcanvasToggle) { - bootcards.listOffcanvasToggle.remove(); - bootcards.listTitleEl.remove(); - Bootcards.OffCanvas.$menuTitleEl.remove(); - } - bootcards.listOffcanvasToggle = null; - bootcards.listTitleEl = null; - Bootcards.OffCanvas.$menuTitleEl = null; - bootcards.listEl = null; - bootcards.cardsEl = null; - - bootcards._setOrientation(true); - - if (bootcards.listTitleEl) { - bootcards.listTitleEl.find('button').show(); - } - - //add the resize events again - $(window) - .off() - .on( 'resize', function() { - setTimeout( function() { - bootcards._setOrientation(false); - if (chartSalesProductType !== null) { chartSalesProductType.redraw(); } - if (closedSalesChart !== null) { closedSalesChart.redraw(); } - if (dbSizeChart !== null) { dbSizeChart.redraw(); } - if (barChartClosedSales !== null) { barChartClosedSales.redraw(); } - } , 250); - } ); - - } - - }) - .on('pjax:complete', function(event) { - //called after a pjax content update - - //check for any modals to close - var modal = $(event.relatedTarget).closest('.modal'); - if (modal.length) { - modal.modal('hide'); - } - - }); - - }); - - - /* - * Enable FTLabs' FastClick - * https://github.com/ftlabs/fastclick - */ - window.addEventListener('load', function() { - FastClick.attach(document.body); - }, false); - </script> + <script src="<c:url value='/js/crm.js'/>"></script> </body> diff --git a/chorem-webmotion/src/main/webapp/js/crm.js b/chorem-webmotion/src/main/webapp/js/crm.js new file mode 100644 index 0000000..7bee651 --- /dev/null +++ b/chorem-webmotion/src/main/webapp/js/crm.js @@ -0,0 +1,72 @@ +//highlight first list group option (if non active yet) +if ( $('.list-group a.active').length === 0 ) { + $('.list-group a').first().addClass('active'); +} + +//pjax +bootcards.addPJaxHandlers = function(){ + //add pjax click handler to links + $('a.pjax').off().on('click', function(e) { + var $this = $(this); + var tgtUrl = $this.attr('href'); + + $.pjax( { + container : '#listDetails', + url : tgtUrl + }); + + //add active class if this is a list item (removing it from all siblings) + if ($this.hasClass('list-group-item')) { + $this + .addClass('active') + .siblings() + .removeClass('active'); + } + + e.preventDefault(); + }); + //$(document).pjax('a[data-target]') +} + + //pjax on all a's that have the data-pjax attribute (the attribute's value is the pjax target container) + $(document).ready( function() { + + var $body = $("body"); + + //destroy modals on close (to reload the contents when using the remote property) + $body.on('hidden.bs.modal', '.modal', function () { + $(this).removeData('bs.modal'); + }); + + bootcards.addPJaxHandlers(); + + $(document) + .pjax('a[data-pjax]') + .on('submit', 'form[data-pjax]', function(event) { + //use pjax to submit forms + $.pjax.submit(event); + }) + .on('pjax:end', function(event) { + + var $tgt = $(event.target); + var tgtId = $tgt.attr('id'); + + bootcards.addPJaxHandlers(); + + //highlight first list group option (if non active yet) + if ( $('.list-group a.active').length === 0 ) { + $('.list-group a').first().addClass('active'); + } + }) + .on('pjax:complete', function(event) { + //called after a pjax content update + + //check for any modals to close + var modal = $(event.relatedTarget).closest('.modal'); + if (modal.length) { + modal.modal('hide'); + } + + }); + + }); \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 0fa7ab303d3b51ecab2e15bf24905aafeb4107a0 Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 15:52:29 2015 +0100 ref #882 : full ContactDetails CRUD on companies --- .../webmotion/actions/crm/CompaniesAction.java | 46 +++++++++++++++++++--- chorem-webmotion/src/main/resources/mapping | 11 ++++-- ...ctDetailsCard.jsp => addContactDetailsCard.jsp} | 13 +++--- .../jsp/crm/cards/contactDetailsListCard.jsp | 5 ++- .../jsp/crm/cards/editContactDetailsCard.jsp | 6 ++- .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 4 +- .../src/main/webapp/WEB-INF/jsp/crm/company.jsp | 4 +- 7 files changed, 67 insertions(+), 22 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 39ab445..f584114 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 @@ -130,19 +130,55 @@ public class CompaniesAction extends WebMotionController { } - public Render editContactDetails(ChoremClient client, String id){ - ContactDetails cd = client.restore(ContactDetails.class, id); + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // // + // CONTACT DETAILS // + // // + /////////////////////////////////////////////////////////////////////////////////////////////////////// + + public Render editContactDetails(ChoremClient client, String cd_id, String id){ + ContactDetails cd = client.restore(ContactDetails.class, cd_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); + public Render updateContactDetails(ChoremClient client, String id, String cd_id, String type, String value, String name){ + ContactDetails cd = client.restore(ContactDetails.class, cd_id); cd.setName(name); cd.setType(type); cd.setValue(value); client.store(cd); - return viewCompany(client, cd.getTarget()); + List<ContactDetails> contactDetails = listContactDetails(client, id); + Company company = client.restore(Company.class, id); + return renderView("crm/cards/contactDetailsListCard.jsp", + "company", company, + "contactDetails", contactDetails); + } + + public Render deleteContactDetails(ChoremClient client, String id, String cd_id){ + client.delete(cd_id); + List<ContactDetails> contactDetails = listContactDetails(client, id); + Company company = client.restore(Company.class, id); + return renderView("crm/cards/contactDetailsListCard.jsp", + "company", company, + "contactDetails", contactDetails); + } + + public Render addContactDetailsForm(String id){ + return renderView("crm/cards/addContactDetailsCard.jsp", + "companyId", id); + } + + public Render addContactDetails(ChoremClient client, String id, String type, String value, String name){ + ContactDetails cd = new ContactDetailsImpl(); + cd.setName(name); + cd.setType(type); + cd.setValue(value); + cd.setTarget(id); + client.store(cd); + List<ContactDetails> contactDetails = listContactDetails(client, id); + return renderView("crm/cards/contactDetailsListCard.jsp", + "contactDetails", contactDetails); } protected List<Note> listNotes(ChoremClient client, String companyId) { diff --git a/chorem-webmotion/src/main/resources/mapping b/chorem-webmotion/src/main/resources/mapping index 0880157..bd4c17e 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -95,8 +95,11 @@ GET /* DecoratorFilter.decorate * /project/json/getGanttInfo/{id} action:project.GanttAction.getGanttInfo * /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 + +#### CRM Companies part#### * /crm/companies action:crm.CompaniesAction.listCompanies GET /crm/companies/add action:crm.CompaniesAction.addCompanyForm POST /crm/companies/add action:crm.CompaniesAction.addCompany @@ -104,9 +107,11 @@ GET /crm/companies/{id} action:crm.CompaniesAction.viewCompany POST /crm/companies/{id} action:crm.CompaniesAction.updateCompany 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/companies/{id}/contactDetails/add action:crm.CompaniesAction.addContactDetailsForm +POST /crm/companies/{id}/contactDetails/add action:crm.CompaniesAction.addContactDetails +POST /crm/companies/{id}/contactDetails/{cd_id} action:crm.CompaniesAction.updateContactDetails +GET /crm/companies/{id}/contactDetails/{cd_id}/edit action:crm.CompaniesAction.editContactDetails +POST /crm/companies/{id}/contactDetails/{cd_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/editContactDetailsCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addContactDetailsCard.jsp similarity index 76% copy from chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp copy to chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addContactDetailsCard.jsp index bb40671..e8a9087 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addContactDetailsCard.jsp @@ -2,11 +2,13 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<form id="editForm" class="form-horizontal pjax" method="POST" action="<c:url value="/crm/contactDetails/${contactDetail.wikittyId}"/>" data-pjax="#main"> +<form id="editForm" class="form-horizontal" method="POST" + action="<c:url value="/crm/companies/${companyId}/contactDetails/add"/>" + data-pjax="#contactDetailsListCard"> <div class="modal-header"> <div class="btn-group pull-left"> - <buttonclass="btn btn-danger" data-dismiss="modal"> + <button class="btn btn-danger" data-dismiss="modal"> Cancel </button> </div> @@ -15,7 +17,7 @@ <input type="submit" id="editForm-success" class="btn btn-success" data-dismiss="modal" value="Save"> </div> <h3 class="modal-title"> - Éditer une coordonnées + Ajouter une coordonnée </h3> </div> @@ -46,11 +48,6 @@ </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> - Supprimer la coordonnée - </button> </div> <script type="text/javascript"> 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 e70bb0e..7b88908 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 @@ -1,11 +1,12 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <div class="panel panel-default"> <div class="panel-heading clearfix"> <h3 class="panel-title pull-left">Coordonnées</h3> <div class="btn-group pull-right"> - <a class="btn btn-primary" href="#" + <a class="btn btn-primary" href="<c:url value="/crm/companies/${company.wikittyId}/contactDetails/add"/>" data-toggle="modal" data-target="#editModal"> <i class="fa fa-plus"></i> @@ -25,7 +26,7 @@ <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"> + <a class="btn btn-primary pull-right" href="<c:url value="/crm/companies/${company.wikittyId}/contactDetails/${contactDetail.wikittyId}/edit"/>" data-toggle="modal" data-target="#editModal"> <i class="fa fa-pencil"></i><span>Edit</span> </a> </div> diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp index bb40671..77b222a 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editContactDetailsCard.jsp @@ -2,11 +2,13 @@ <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<form id="editForm" class="form-horizontal pjax" method="POST" action="<c:url value="/crm/contactDetails/${contactDetail.wikittyId}"/>" data-pjax="#main"> +<form id="editForm" class="form-horizontal" method="POST" + action="<c:url value="/crm/companies/${contactDetail.target}/contactDetails/${contactDetail.wikittyId}"/>" + data-pjax="#contactDetailsListCard"> <div class="modal-header"> <div class="btn-group pull-left"> - <buttonclass="btn btn-danger" data-dismiss="modal"> + <button class="btn btn-danger" data-dismiss="modal"> Cancel </button> </div> 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 783f7eb..2300c86 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 @@ -78,7 +78,9 @@ <%@include file="cards/companyInfoCard.jsp" %> <!-- contact details card --> - <%@include file="cards/contactDetailsListCard.jsp" %> + <div id="contactDetailsListCard"> + <%@include file="cards/contactDetailsListCard.jsp" %> + </div> <!-- notes card --> <%@include file="cards/notesListCard.jsp" %> 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 2f734d3..3a39518 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 @@ -6,7 +6,9 @@ <%@include file="cards/companyInfoCard.jsp" %> <!-- contact details card --> -<%@include file="cards/contactDetailsListCard.jsp" %> +<div id="contactDetailsListCard"> + <%@include file="cards/contactDetailsListCard.jsp" %> +</div> <!-- notes card --> <%@include file="cards/notesListCard.jsp" %> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
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 53491077788febb3be71bdd7edce0828ea27ec2d Author: kootox <jean.couteau@gmail.com> Date: Wed Feb 4 18:20:06 2015 +0100 refs #882 : complete note CRUD in companies slot --- .../webmotion/actions/crm/CompaniesAction.java | 58 ++++++++++++++++++-- chorem-webmotion/src/main/resources/mapping | 10 ++++ .../webapp/WEB-INF/jsp/crm/cards/addNoteCard.jsp | 59 ++++++++++++++++++++ .../webapp/WEB-INF/jsp/crm/cards/editNoteCard.jsp | 63 ++++++++++++++++++++++ .../webapp/WEB-INF/jsp/crm/cards/noteInfoCard.jsp | 33 ++++++++++++ .../webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp | 8 +-- .../src/main/webapp/WEB-INF/jsp/crm/companies.jsp | 4 +- .../src/main/webapp/WEB-INF/jsp/crm/company.jsp | 4 +- 8 files changed, 231 insertions(+), 8 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 f584114..e179857 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,11 +4,10 @@ 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; -import javax.servlet.http.HttpServletRequest; +import java.util.Date; import java.util.List; public class CompaniesAction extends WebMotionController { @@ -22,7 +21,7 @@ public class CompaniesAction extends WebMotionController { //list all the companies WikittyQuery companiesQuery = new WikittyQueryMaker().exteq(Company.EXT_COMPANY) - .end().addSortAscending(Company.ELEMENT_FIELD_COMPANY_NAME).setLimit(WikittyQuery.MAX);; + .end().addSortAscending(Company.ELEMENT_FIELD_COMPANY_NAME).setLimit(WikittyQuery.MAX); List<Company> companies = client.findAllByQuery(Company.class, companiesQuery).getAll(); //get the first company info to init the page @@ -181,6 +180,59 @@ public class CompaniesAction extends WebMotionController { "contactDetails", contactDetails); } + + /////////////////////////////////////////////////////////////////////////////////////////////////////// + // // + // NOTES // + // // + /////////////////////////////////////////////////////////////////////////////////////////////////////// + + public Render editNote(ChoremClient client, String note_id, String id){ + Note note = client.restore(Note.class, note_id); + return renderView("crm/cards/editNoteCard.jsp", + "note", note); + } + + public Render updateNote(ChoremClient client, String id, String note_id, Date date, String title, String content){ + Note note = client.restore(Note.class, note_id); + note.setDate(date); + note.setTitle(title); + note.setContent(content); + note = client.store(note); + return renderView("crm/cards/noteInfoCard.jsp", + "note", note); + } + + public Render deleteNote(ChoremClient client, String id, String note_id){ + client.delete(note_id); + return viewCompany(client, id); + } + + public Render viewNote(ChoremClient client, String id, String note_id){ + Note note = client.restore(Note.class, note_id); + return renderView("crm/cards/noteInfoCard.jsp", + "note", note); + } + + public Render addNoteForm(String id){ + return renderView("crm/cards/addNoteCard.jsp", + "companyId", id); + } + + public Render addNote(ChoremClient client, String id, Date date, String title, String content){ + Note note = new NoteImpl(); + note.setDate(date); + note.setTitle(title); + note.setContent(content); + note.setTarget(id); + client.store(note); + List<Note> notes = listNotes(client, id); + Company company = client.restore(Company.class, id); + return renderView("crm/cards/notesListCard.jsp", + "company", company, + "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 bd4c17e..661b799 100644 --- a/chorem-webmotion/src/main/resources/mapping +++ b/chorem-webmotion/src/main/resources/mapping @@ -107,14 +107,24 @@ GET /crm/companies/{id} action:crm.CompaniesAction.viewCompany POST /crm/companies/{id} action:crm.CompaniesAction.updateCompany GET /crm/companies/{id}/edit action:crm.CompaniesAction.editCompany POST /crm/companies/{id}/delete action:crm.CompaniesAction.deleteCompany + GET /crm/companies/{id}/contactDetails/add action:crm.CompaniesAction.addContactDetailsForm POST /crm/companies/{id}/contactDetails/add action:crm.CompaniesAction.addContactDetails POST /crm/companies/{id}/contactDetails/{cd_id} action:crm.CompaniesAction.updateContactDetails GET /crm/companies/{id}/contactDetails/{cd_id}/edit action:crm.CompaniesAction.editContactDetails POST /crm/companies/{id}/contactDetails/{cd_id}/delete action:crm.CompaniesAction.deleteContactDetails + +GET /crm/companies/{id}/note/add action:crm.CompaniesAction.addNoteForm +POST /crm/companies/{id}/note/add action:crm.CompaniesAction.addNote +GET /crm/companies/{id}/note/{note_id} action:crm.CompaniesAction.viewNote +POST /crm/companies/{id}/note/{note_id} action:crm.CompaniesAction.updateNote +GET /crm/companies/{id}/note/{note_id}/edit action:crm.CompaniesAction.editNote +POST /crm/companies/{id}/note/{note_id}/delete action:crm.CompaniesAction.deleteNote + 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 GET /project/editProject.html view:projects/editProject.html diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addNoteCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addNoteCard.jsp new file mode 100644 index 0000000..424e1c8 --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/addNoteCard.jsp @@ -0,0 +1,59 @@ +<%@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/${companyId}/note/add"/>" + data-pjax="#notesListCard"> +<div class="modal-header"> + + <div class="btn-group pull-left"> + <button 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"> + Ajouter une note + </h3> + +</div> +<div class="modal-body"> + <div class="form-group"> + <label class="col-xs-3 control-label">Date</label> + <div class="col-xs-9"> + <input type="date" name="date" class="form-control" placeholder="Date" + value="${note.date}"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-3 control-label">Titre</label> + <div class="col-xs-9"> + <input type="text" name="title" class="form-control" placeholder="Titre" + value="${note.title}"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-3 control-label">Contenu</label> + <div class="col-xs-9"> + <textarea name="content" class="form-control" placeholder="Contenu" + value="${note.content}"/> + </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/editNoteCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editNoteCard.jsp new file mode 100644 index 0000000..4d40566 --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/editNoteCard.jsp @@ -0,0 +1,63 @@ +<%@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" %> + +<form id="editForm" class="form-horizontal" method="POST" + action="<c:url value="/crm/companies/${note.target}/note/${note.wikittyId}"/>" + data-pjax="#listDetails"> +<div class="modal-header"> + + <div class="btn-group pull-left"> + <button 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"> + Éditer une note + </h3> + +</div> +<div class="modal-body"> + <div class="form-group"> + <label class="col-xs-3 control-label">Date</label> + <div class="col-xs-9"> + <input type="date" name="date" class="form-control" placeholder="Date" + value="<f:formatDate value="${note.date}" pattern="dd/MM/yyyy" />"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-3 control-label">Titre</label> + <div class="col-xs-9"> + <input type="text" name="title" class="form-control" placeholder="Titre" + value="${note.title}"> + </div> + </div> + <div class="form-group"> + <label class="col-xs-3 control-label">Contenu</label> + <div class="col-xs-9"> + <textarea name="content" class="form-control" placeholder="Contenu">${note.content}</textarea> + </div> + </div> + +</div> +</form> + +<div class="modal-footer"> + <form method="POST" action="<c:url value="/crm/companies/${note.target}/note/${note.wikittyId}/delete"/>" + data-pjax="#listDetails" onsubmit="return confirm('Are you sure you want to delete?');"> + <input type="submit" class="btn btn-danger btn-block" value="Supprimer la note"> + </form> +</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/noteInfoCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/noteInfoCard.jsp new file mode 100644 index 0000000..f6b4f8b --- /dev/null +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/noteInfoCard.jsp @@ -0,0 +1,33 @@ +<%@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" %> + +<div class="panel panel-default"> + + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Note</h3> + + <div class="btn-group pull-right"> + <a class="btn btn-primary" href="<c:url value="/crm/companies/${note.target}/note/${note.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">Titre</p> + <h4 class="list-group-item-heading">${note.title} </h4> + </div> + <div class="list-group-item"> + <p class="list-group-item-text">Date</p> + <h4 class="list-group-item-heading"><f:formatDate value="${note.date}" pattern="dd/MM/yyyy" /> </h4> + </div> + <div class="list-group-item"> + <p class="list-group-item-text">Contenu</p> + <h4 class="list-group-item-heading">${note.content} </h4> + </div> + </div> +</div> \ No newline at end of file diff --git a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp index 5cfe10d..ba0c610 100644 --- a/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp +++ b/chorem-webmotion/src/main/webapp/WEB-INF/jsp/crm/cards/notesListCard.jsp @@ -1,4 +1,6 @@ <%@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" %> <div class="panel panel-default"> @@ -6,7 +8,7 @@ <h3 class="panel-title pull-left">Notes</h3> <div class="btn-group pull-right"> - <a class="btn btn-primary" href="#" + <a class="btn btn-primary" href="<c:url value="/crm/companies/${company.wikittyId}/note/add"/>" data-toggle="modal" data-target="#editModal"> <i class="fa fa-plus"></i> @@ -19,9 +21,9 @@ <div class="list-group"> <c:forEach var="note" items="${notes}"> - <a class="list-group-item" href="#"> + <a class="list-group-item pjax" href="<c:url value="/crm/companies/${company.wikittyId}/note/${note.wikittyId}"/>"> <h4 class="list-group-item-heading">${note.title}</h4> - <p class="list-group-item-text">${note.date}</p> + <p class="list-group-item-text"><f:formatDate value="${note.date}" pattern="dd/MM/yyyy" /></p> </a> </c:forEach> 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 2300c86..28c3e04 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 @@ -83,7 +83,9 @@ </div> <!-- notes card --> - <%@include file="cards/notesListCard.jsp" %> + <div id="notesListCard"> + <%@include file="cards/notesListCard.jsp" %> + </div> <!--employees card --> <%@include file="cards/employeesListCard.jsp" %> 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 3a39518..035d92c 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 @@ -11,7 +11,9 @@ </div> <!-- notes card --> -<%@include file="cards/notesListCard.jsp" %> +<div id="notesListCard"> + <%@include file="cards/notesListCard.jsp" %> +</div> <!--employees card --> <%@include file="cards/employeesListCard.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>.
participants (1)
-
chorem.org scm