dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #44002
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22332: tracker-capture: date validation directive applied to event execution and due dates
------------------------------------------------------------
revno: 22332
committer: Abyot Asalefew Gizaw <abyot@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 16:40:23 +0100
message:
tracker-capture: date validation directive applied to event execution and due dates
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2016-03-10 16:56:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js 2016-03-15 15:40:23 +0000
@@ -1419,22 +1419,6 @@
$scope.saveEventDateForEvent = function (eventToSave, reOrder) {
$scope.eventDateSaved = false;
- if (angular.isUndefined(eventToSave.eventDate) || eventToSave.eventDate === '') {
- $scope.invalidDate = eventToSave.event;
- $scope.validatedDateSetForEvent = {date: '', event: eventToSave};
- $scope.currentElement = {id: "eventDate", saved: false};
- return false;
- }
-
- var rawDate = angular.copy(eventToSave.eventDate);
- var convertedDate = DateUtils.format(eventToSave.eventDate);
-
- if (rawDate !== convertedDate) {
- $scope.invalidDate = eventToSave.event;
- $scope.validatedDateSetForEvent = {date: '', event: eventToSave};
- $scope.currentElement = {id: "eventDate", saved: false};
- return false;
- }
$scope.currentElement = {id: "eventDate", event: eventToSave.event, saved: false};
@@ -1469,22 +1453,8 @@
};
$scope.saveDueDate = function () {
-
$scope.dueDateSaved = false;
- if ($scope.currentEvent.dueDate === '') {
- $scope.invalidDueDate = $scope.currentEvent.event;
- return false;
- }
-
- var rawDate = angular.copy($scope.currentEvent.dueDate);
- var convertedDate = DateUtils.format($scope.currentEvent.dueDate);
-
- if (rawDate !== convertedDate) {
- $scope.invalidDueDate = $scope.currentEvent.event;
- return false;
- }
-
var e = {event: $scope.currentEvent.event,
enrollment: $scope.currentEvent.enrollment,
dueDate: DateUtils.formatFromUserToApi($scope.currentEvent.dueDate),
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html 2016-02-15 12:05:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/event-details.html 2016-03-15 15:40:23 +0000
@@ -7,9 +7,11 @@
placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
class="form-control hideInPrint"
ng-class="{'input-success': eventDateSaved}"
+ d2-date-validator
d2-date
max-date="0"
min-date=""
+ name="eventDate"
ng-model="currentEvent.eventDate"
ng-disabled="currentEvent.status === 'SKIPPED' || selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed"
ng-required="true"
@@ -18,7 +20,8 @@
class="form-control not-for-screen"
ng-class="{'input-success': eventDateSaved}"
value={{currentEvent.eventDate}}>
- <span ng-if="invalidDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
+ <div ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
</div>
<div ng-if="!currentStage.hideDueDate || !currentEvent.eventDate && currentEvent.status !== 'SKIPPED'" class="col-md-6">
<span ng-if="currentEvent.eventDate || currentEvent.status === 'SKIPPED' || currentEvent.dueDate">
@@ -31,15 +34,18 @@
placeholder="{{dhis2CalendarFormat.keyDateFormat}}"
class="form-control hideInPrint"
ng-class="{'input-success': dueDateSaved}"
- d2-date
+ d2-date-validator
+ d2-date
+ name="dueDate"
ng-model="currentEvent.dueDate"
blur-or-change="saveDueDate()"
ng-disabled="currentEvent.eventDate || !schedulingEnabled || currentEvent.enrollmentStatus !== 'ACTIVE' || currentEvent.editingNotAllowed"/>
<input type="text"
class="form-control not-for-screen"
ng-class="{'input-success': dueDateSaved}"
- value={{currentEvent.dueDate}}>
- <span ng-if="invalidDueDate === currentEvent.event" class="error">{{'date_required'| translate}}</span>
+ value={{currentEvent.dueDate}}>
+ <div ng-messages="outerForm.dueDate.$error" ng-if="interacted(outerForm.dueDate)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ </div>
</div>
</div>
<!-- event dates/scheduling end -->