This is an automated email from the git hooks/post-receive script. New commit to branch chorem-ng in repository chorem. See http://git.chorem.org/chorem.git commit 9d623fd7a98c2dda1c45b7772f35914644f6d79e Author: kootox <jean.couteau@gmail.com> Date: Sat Apr 4 15:54:20 2015 +0200 refs #1211 : View company --- .../main/webapp/crm/partials/companies.list.html | 6 +- .../main/webapp/crm/partials/companyInfoCard.html | 26 ++++++++ .../src/main/webapp/crm/partials/companyPanel.html | 14 ++++ .../crm/partials/contactDetailsListCard.html | 24 +++++++ .../webapp/crm/partials/employeesListCard.html | 20 ++++++ .../main/webapp/crm/partials/invoicesListCard.html | 21 ++++++ .../main/webapp/crm/partials/notesListCard.html | 21 ++++++ chorem-ui-angular/src/main/webapp/js/chorem.js | 2 + chorem-ui-angular/src/main/webapp/js/crm/crm.js | 6 ++ .../src/main/webapp/js/crm/crmControllers.js | 77 +++++++++++++++++++--- 10 files changed, 204 insertions(+), 13 deletions(-) diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/companies.list.html b/chorem-ui-angular/src/main/webapp/crm/partials/companies.list.html index 0e10dd4..d66ea9b 100644 --- a/chorem-ui-angular/src/main/webapp/crm/partials/companies.list.html +++ b/chorem-ui-angular/src/main/webapp/crm/partials/companies.list.html @@ -23,13 +23,13 @@ </div> <div class="list-group"> - <a class="list-group-item" href="#/companies/{{company.wikittyId}}" + <a class="list-group-item" href="#/companies/{{company.id}}" ng-repeat="company in filteredItems" ng-class="{'active':isItemSelected(company)}" ng-click="selectItem(company)"> <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> + <h4 class="list-group-item-heading">{{company.Company.name}}</h4> + <p class="list-group-item-text">{{company.Company.type}} </p> </a> </div> diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/companyInfoCard.html b/chorem-ui-angular/src/main/webapp/crm/partials/companyInfoCard.html new file mode 100644 index 0000000..f11a294 --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/companyInfoCard.html @@ -0,0 +1,26 @@ +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Détails de la société</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#/companies/{{company.id}}/edit"> + <i class="fa fa-pencil"></i> + <span>Edit</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#/companies/{{company.id}}/edit"> + <i class="fa fa-pencil"></i> + <span>Edit</span> + </a> + </div> + <div class="list-group"> + <div class="list-group-item"> + <i class="fa fa-2x fa-building-o pull-left"></i> + <label>Nom</label> + <h4 class="list-group-item-heading">{{company.Company.name}}</h4> + </div> + <div class="list-group-item"> + <label>Type</label> + <h4 class="list-group-item-heading">{{company.Company.type}}</h4> + </div> + </div> +</div> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/companyPanel.html b/chorem-ui-angular/src/main/webapp/crm/partials/companyPanel.html new file mode 100644 index 0000000..b2c5191 --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/companyPanel.html @@ -0,0 +1,14 @@ +<!-- company info card --> +<ng-include src="'crm/partials/companyInfoCard.html'"></ng-include> + +<!-- contact details card --> +<ng-include src="'crm/partials/contactDetailsListCard.html'"></ng-include> + +<!-- notes card --> +<ng-include src="'crm/partials/notesListCard.html'"></ng-include> + +<!--employees card --> +<ng-include src="'crm/partials/employeesListCard.html'"></ng-include> + +<!--invoices card--> +<ng-include src="'crm/partials/invoicesListCard.html'"></ng-include> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/contactDetailsListCard.html b/chorem-ui-angular/src/main/webapp/crm/partials/contactDetailsListCard.html new file mode 100644 index 0000000..7fb412a --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/contactDetailsListCard.html @@ -0,0 +1,24 @@ +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Moyens de contact</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#/companies/{{company.wikittyId}}/contactDetails/add" + data-toggle="modal" + data-target="#editModal"> + <i class="fa fa-plus"></i> + <span>Ajouter</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#/companies/{{company.wikittyId}}/contactDetails/add"> + <i class="fa fa-plus"></i> + <span>Ajouter</span> + </a> + </div> + <div class="list-group"> + <a class="list-group-item" ng-repeat="contact in contactDetails" + href="#/companies/{{company.wikittyId}}/contactDetails/{{contact.wikittyId}}"> + <label>{{contact.type}} - {{contact.name}}</label> + <h4 class="list-group-item-heading">{{contact.value}}</h4> + </a> + </div> +</div> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/employeesListCard.html b/chorem-ui-angular/src/main/webapp/crm/partials/employeesListCard.html new file mode 100644 index 0000000..4439360 --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/employeesListCard.html @@ -0,0 +1,20 @@ +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Employés</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#/companies/{{company.wikittyId}}/employees/add"> + <i class="fa fa-plus"></i><span>Ajouter</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#/companies/{{company.wikittyId}}/employees/add"> + <i class="fa fa-plus"></i><span>Ajouter</span> + </a> + </div> + <div class="list-group"> + <a class="list-group-item" ng-repeat="employee in employees" + href="#/companies/{{company.wikittyId}}/employees/{{employee.wikittyId}}"> + <label>{{employee.description}}</label> + <h4 class="list-group-item-heading">{{employee.person.firstName}} {{employee.person.lastName}}</h4> + </a> + </div> +</div> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/invoicesListCard.html b/chorem-ui-angular/src/main/webapp/crm/partials/invoicesListCard.html new file mode 100644 index 0000000..89d5ad6 --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/invoicesListCard.html @@ -0,0 +1,21 @@ +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Factures</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#/companies/{{company.wikittyId}}/invoices/add"> + <i class="fa fa-pencil"></i> + <span>Ajouter</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#/companies/{{company.wikittyId}}/invoices/add"> + <i class="fa fa-plus"></i> + <span>Ajouter</span> + </a> + </div> + <div class="list-group"> + <a class="list-group-item" ng-repeat="invoice in invoices" href="#/companies/{{company.wikittyId}}/invoices/{{invoice.wikittyId}}"/> + <label>{{invoice.emittedDate | date : dd/MM/yyy}} - {{invoice.description}}</label> + <h4 class="list-group-item-heading">{{invoice.reference}} - {{invoice.amount|currency}}</h4> + </a> + </div> +</div> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/crm/partials/notesListCard.html b/chorem-ui-angular/src/main/webapp/crm/partials/notesListCard.html new file mode 100644 index 0000000..81c3653 --- /dev/null +++ b/chorem-ui-angular/src/main/webapp/crm/partials/notesListCard.html @@ -0,0 +1,21 @@ +<div class="panel panel-default"> + <div class="panel-heading clearfix"> + <h3 class="panel-title pull-left">Notes</h3> + <div class="btn-group pull-right visible-xs"> + <a class="btn btn-primary" href="#/companies/{{company.wikittyId}}/notes/add"> + <i class="fa fa-pencil"></i> + <span>Ajouter</span> + </a> + </div> + <a class="btn btn-primary pull-right hidden-xs" href="#/companies/{{company.wikittyId}}/notes/add"> + <i class="fa fa-plus"></i> + <span>Ajouter</span> + </a> + </div> + <div class="list-group"> + <a class="list-group-item" ng-repeat="note in notes" href="#/companies/{{company.wikittyId}}/notes/{{note.wikittyId}}"/> + <h4 class="list-group-item-heading">{{note.title}}</h4> + <label>{{note.date | date : dd/MM/yyy}}</label> + </a> + </div> +</div> \ No newline at end of file diff --git a/chorem-ui-angular/src/main/webapp/js/chorem.js b/chorem-ui-angular/src/main/webapp/js/chorem.js index 0735cea..a9cd7ab 100644 --- a/chorem-ui-angular/src/main/webapp/js/chorem.js +++ b/chorem-ui-angular/src/main/webapp/js/chorem.js @@ -12,6 +12,8 @@ chorem.config( [ '$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) { + $urlRouterProvider.when('','/'); + ////////////////////////// // State Configurations // ////////////////////////// diff --git a/chorem-ui-angular/src/main/webapp/js/crm/crm.js b/chorem-ui-angular/src/main/webapp/js/crm/crm.js index 6db23de..b2e42ca 100644 --- a/chorem-ui-angular/src/main/webapp/js/crm/crm.js +++ b/chorem-ui-angular/src/main/webapp/js/crm/crm.js @@ -20,6 +20,12 @@ choremCRM.config( url: '/add', templateUrl: 'crm/partials/companyCreateCard.html', controller:'CompanyCreateController' + }) + + .state('crm.companies.view', { + url: '/:companyId', + templateUrl: 'crm/partials/companyPanel.html', + controller:'CompanyDetailController' }); }]); diff --git a/chorem-ui-angular/src/main/webapp/js/crm/crmControllers.js b/chorem-ui-angular/src/main/webapp/js/crm/crmControllers.js index c5a1381..da70e5c 100644 --- a/chorem-ui-angular/src/main/webapp/js/crm/crmControllers.js +++ b/chorem-ui-angular/src/main/webapp/js/crm/crmControllers.js @@ -18,12 +18,13 @@ choremCRMControllers.controller('CompanyListController', function ($scope, $http $scope.selectItem=function(selectedCompany){ $scope.selectedItem = selectedCompany; + $state.go('crm.companies.view', { companyId: selectedCompany.id }); }; $scope.selectItemById=function(id){ for (var index in $scope.items) { var company = $scope.items[index]; - if (company.wikittyId===id){ + if (company.id===id){ $scope.selectedItem=company; } } @@ -38,7 +39,7 @@ choremCRMControllers.controller('CompanyListController', function ($scope, $http for (var index in $scope.items) { var company = $scope.items[index]; var regexp = new RegExp($scope.searchTerm,"i"); - if (company.name.match(regexp)){ + if (company.Company.name.match(regexp)){ $scope.filteredItems.push(company); } } @@ -71,16 +72,16 @@ choremCRMControllers.controller('CompanyListController', function ($scope, $http } $scope.refresh=function(){ - $http.get('companies').success(function(data){ + $http.get('services/v1/Company').success(function(data){ $scope.items = data; - if ($state.params.companyId){ + //if ($state.params.companyId){ //company selected - $scope.selectItemById($state.params.companyId); - $state.go('crm.companies', { companyId: $state.params.companyId }); - } else { - $scope.selectedItem=$scope.items[0]; - $state.go('crm.companies', { companyId: $scope.selectedItem.wikittyId }); - } + //$scope.selectItemById($state.params.companyId); + //$state.go('crm.companies.view', { companyId: $state.params.companyId }); + //} else { + //$scope.selectedItem=$scope.items[0]; + //$state.go('crm.companies.view', { companyId: $scope.selectedItem.id }); + //} $scope.filter(); }); }; @@ -89,6 +90,62 @@ choremCRMControllers.controller('CompanyListController', function ($scope, $http }); +choremCRMControllers.controller('CompanyDetailController', function ($scope, $http, $state){ + + $scope.companyId=$state.params.companyId; + + $scope.updateCompany=function(){ + if ($scope.companyId){ + $http.get('services/v1/Company/'+$scope.companyId).success(function(data){ + $scope.company = data; + }); + } + }; + + //get back contact details for the company + $scope.updateContactDetails=function(){ + if ($scope.companyId){ + $http.get('contactDetails?target='+$scope.companyId).success(function(data){ + $scope.contactDetails = data; + }); + } + }; + + //get back notes for the company + $scope.updateNotes=function(){ + if ($scope.companyId){ + $http.get('notes?target='+$scope.companyId).success(function(data){ + $scope.notes = data; + }); + } + }; + + //get back employees for the company + $scope.updateEmployees=function(){ + if ($scope.companyId){ + $http.get('employees?company='+$scope.companyId).success(function(data){ + $scope.employees = data; + }); + } + }; + + //get back invoices for the company + $scope.updateInvoices=function(){ + if ($scope.companyId){ + $http.get('invoices?payer='+$scope.companyId).success(function(data){ + $scope.invoices = data; + }); + } + }; + + $scope.updateCompany(); + $scope.updateContactDetails(); + $scope.updateNotes(); + $scope.updateEmployees(); + $scope.updateInvoices(); + +}); + choremCRMControllers.controller('CompanyCreateController', function ($scope, $http, $window) { $scope.saveCompany = function(){ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.