Author: jcouteau Date: 2013-09-13 14:31:00 +0200 (Fri, 13 Sep 2013) New Revision: 390 Url: http://chorem.org/projects/chorem/repository/revisions/390 Log: fixes #931 : integrate cancel capabilities in sales funnel Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-08-30 14:05:35 UTC (rev 389) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-cancel.html 2013-09-13 12:31:00 UTC (rev 390) @@ -5,9 +5,9 @@ <form class="form-horizontal"> <fieldset> <label for="cancelledDate">Date d'annulation</label> - <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="lead.cancelledDate" id="cancelledDate" class="datepicker" /> + <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="toCancel.cancelledDate" id="cancelledDate" class="datepicker" /> <label for="cancelledReason">Raison</label> - <input type="text" ng-model="lead.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" /> + <input type="text" ng-model="toCancel.cancelledReason" name="cancelledReason" id="cancelledReason" value="" class="text ui-widget-content ui-corner-all" /> </fieldset> </form> </div> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-08-30 14:05:35 UTC (rev 389) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/dialog-draftToSent.html 2013-09-13 12:31:00 UTC (rev 390) @@ -4,8 +4,8 @@ <div class="modal-body"> <form class="form-horizontal"> <fieldset> - <label for="sendDate">Date d'envoirrrrrrrrrrrr</label> - <input type="text" ui-date ng-model="draft.sendingDate" id="sendDate" class="datepicker" /> + <label for="sendDate">Date d'envoi</label> + <input type="text" ui-date ui-date-format="dd/mm/yy" ng-model="draft.sendingDate" id="sendDate" class="datepicker" /> </fieldset> </form> </div> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-08-30 14:05:35 UTC (rev 389) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/salesReports/salesFunnel.jsp 2013-09-13 12:31:00 UTC (rev 390) @@ -88,7 +88,7 @@ <li ng-repeat="draft in drafts" class="salesFunnelItem"> <div class="pull-left"> <a href="../wikitty/edit/{{draft.meta.id}}"/><i class="icon-edit"></i></a> - <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a></small> + <small><a href="/wikitty/Employee/view/{{draft.getField('Quotation', 'customer')}}">{{draft.getField('Quotation','customer')}}</a><span ng-hide="!draft.getField('Draft','sendingDate')"> - Deadline:{{draft.getField('Draft','sendingDate') | date:'dd/MM/yyyy'}}</span></small> <p> <span class="salesFunnelItemTitle"> <a class="name-link" href="/wikitty/Project/view/{{draft.getField('Quotation','project')}}"/>{{draft.getField('Quotation','projet')}}</a> @@ -112,8 +112,8 @@ <ul class="unstyled sents"> <li ng-repeat="sent in sents" class="salesFunnelItem"> <div class="pull-left"> - <a href="wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a> - <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a></small> + <a href="../wikitty/edit/{{sent.meta.id}}"/><i class="icon-edit"></i></a> + <small><a href="/wikitty/Employee/view/{{sent.getField('Quotation', 'customer')}}">{{sent.getField('Quotation','customer')}}</a><span ng-hide="!sent.getField('Sent','postedDate')"> - Répondu le:{{sent.getField('Sent','postedDate') | date:'dd/MM/yyyy'}}</span></a></small> <p> <span> <a class="name-link" href="/wikitty/Project/view/{{sent.getField('Quotation','project')}}"/>{{sent.getField('Quotation','projet')}}</a> Modified: trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js =================================================================== --- trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-08-30 14:05:35 UTC (rev 389) +++ trunk/chorem-webmotion/src/main/webapp/js/salesFunnel.js 2013-09-13 12:31:00 UTC (rev 390) @@ -119,7 +119,7 @@ $scope.lead = dialogModel.lead; $scope.drafts = dialogModel.drafts; $scope.leads = dialogModel.leads; - $scope.lead.sendingDate = new Date().toString("dd/mm/yy"); + //$scope.lead.sendingDate = new Date().toString("dd/mm/yy"); $scope.cancel = function(){ dialog.close(); @@ -223,8 +223,6 @@ $scope.sents = dialogModel.sents; $scope.leads = dialogModel.leads; $scope.drafts = dialogModel.drafts; - $scope.toCancel.cancelledDate = new Date(); - $scope.toCancel.cancelledReason = ""; $scope.cancel = function(){ dialog.close(); @@ -233,8 +231,18 @@ $scope.validate = function(){ //pass scope to the success function var scope = $scope; - $http.get(createUrl('sales/funnel/json/cancel/'+$scope.sent.meta.id),{params: {rejectedDate:$scope.sent.rejectedDate}}).success( + $http.get(createUrl('sales/funnel/json/cancel/'+$scope.toCancel.meta.id),{params: {cancelledDate:$scope.toCancel.cancelledDate, reason:$scope.toCancel.reason}}).success( function(data,status){ + if ($scope.sents.indexOf($scope.toCancel)!= -1) { + $scope.sents.splice($scope.sents.indexOf($scope.toCancel),1); + } + if ($scope.drafts.indexOf($scope.toCancel)!= -1) { + $scope.drafts.splice($scope.drafts.indexOf($scope.toCancel),1); + } + if ($scope.leads.indexOf($scope.toCancel)!= -1) { + $scope.leads.splice($scope.leads.indexOf($scope.toCancel),1); + } + dialog.close(); } );