dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30811
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15665: event-capture a little refactoring and recording of coordinates
------------------------------------------------------------
revno: 15665
committer: Abyot Asalefew Gizaw abyota@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2014-06-13 08:12:21 +0200
message:
event-capture a little refactoring and recording of coordinates
added:
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/selections.html
modified:
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js
dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css
--
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-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-06-12 23:12:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-06-13 06:12:21 +0000
@@ -25,6 +25,7 @@
"back": "Back",
"go_back": "Go back",
"required": "Required",
+ "number_required": "Number required",
"ok": "Ok",
"done": "Done",
"remove": "Remove",
@@ -71,5 +72,16 @@
"no": "NO",
"yes": "YES",
"offline_notification": "You are offline, data will be stored locally",
- "online_nofification": "You are online"
+ "online_nofification": "You are online",
+ "latitude": "Latitude",
+ "longitude": "Longitude",
+ "profile": "Profile",
+ "applications": "Apps",
+ "more_applications": "More apps",
+ "search_apps": "Search apps",
+ "settings": "Settings",
+ "account": "Account",
+ "help": "Help",
+ "log_out": "Log out",
+ "about_dhis2": "About DHIS 2"
}
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-06-12 23:12:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/index.html 2014-06-13 06:12:21 +0000
@@ -153,196 +153,7 @@
<!-- selection ends -->
<!-- event grid begins -->
- <div ng-if="selectedProgramStage && !eventRegistration && !editingEventInFull">
- <img src="../images/ajax-loader-bar.gif" ng-if="!eventFetched"/>
- <div ng-switch="dhis2Events.length">
- <div ng-switch-when="undefined">
- <h4>
- {{'empty_event_list'| translate}}
- </h4>
- </div>
- <div ng-switch-when="0">
- <h4 ng-if="eventFetched">
- {{'empty_event_list'| translate}}
- </h4>
- </div>
- <div ng-switch-default>
- <h4>
- {{'registered_events'| translate}}
- <button class="button button-std pull-right"
- ng-show="dhis2Events.length"
- ng-disabled="eventRegistration || editingEventInFull || editingEventInGrid"
- ng-click="showHideColumns()">
- {{'show_hide_columns'| translate}}
- </button>
- </h4>
-
- <!-- context menu for event grid -->
- <div id="contextMenu" class="contextMenu" style="width: 180px;">
- <ul id="contextMenuItems" class="contextMenuItems">
- <li><a href ng-click="showEditEventInFull()"><i class="fa fa-edit"></i> {{'edit'| translate}}</a></li>
- <li><a href ng-click="showEditEventInGrid()"><i class="fa fa-edit"></i> {{'edit_in_grid'| translate}}</a></li>
- <li><a href ng-click="removeEvent()"><i class="fa fa-trash-o"></i> {{'remove'| translate}}</a></li>
- </ul>
- </div>
- <!-- context menu ends -->
-
- <!-- grid begins -->
- <form name="outerForm" novalidate>
-
- <table class="listTable dhis2-table-striped-border dhis2-table-hover">
- <thead>
- <tr>
- <th ng-show="eventGridColumn.show"
-
- ng-repeat="eventGridColumn in eventGridColumns">
-
- <!-- sort icon begins -->
- <span ng-hide="eventGridColumn.showFilter" class="bold" ng-click="sortEventGrid(eventGridColumn)">
- <i ng-show="sortHeader == eventGridColumn.id && !reverse" class="fa fa-sort-desc"></i>
- <i ng-show="sortHeader == eventGridColumn.id && reverse" class="fa fa-sort-asc"></i>
- {{eventGridColumn.name}}
- </span>
- <!-- sort icon ends -->
-
- <!-- filter icon begins -->
- <span class='pull-right'>
- <span ng-show="eventGridColumn.type !='date' && eventGridColumn.type !='int'">
- <a href ng-click="searchInGrid(eventGridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[eventGridColumn.id] == undefined || filterText[eventGridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
- </span>
- <span ng-show="eventGridColumn.type ==='date' || eventGridColumn.type ==='int'">
- <a href ng-click="searchInGrid(eventGridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == '') && (filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
- </span>
- </span>
- <!-- filter icon ends -->
-
- <!-- filter input field begins -->
- <span ng-show="eventGridColumn.showFilter">
- <span ng-switch="eventGridColumn.type">
- <span ng-switch-when="int">
- <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
- <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
- </span>
- <span ng-switch-when="date">
- <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[eventGridColumn.id].start" data-ng-date readonly="readonly">
- <span ng-hide="filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == ''">
- <a href ng-click='removeStartFilterText(eventGridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>
- </span>
- <input style="width: 70%;" placeholder="{{'end_date' | translate}}" type="text" ng-model="filterText[eventGridColumn.id].end" data-ng-date readonly="readonly">
- <span ng-hide="filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == ''">
- <a href ng-click='removeEndFilterText(eventGridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>
- </span>
- </span>
- <span ng-switch-default>
- <input type="text" style="width: 90%;" ng-model="filterText[eventGridColumn.id]" ng-blur="searchInGrid(eventGridColumn)">
- </span>
- </span>
- </span>
- <!-- filter input field ends -->
-
- </th>
- </tr>
- </thead>
- <tbody id="list">
- <tr ng-repeat="dhis2Event in dhis2Events | orderBy:sortHeader:reverse | gridFilter:filterText:filterTypes">
-
- <!-- Visible when event is not under editing -->
- <td dhis-context-menu
- selected-item={{dhis2Event}}
- ng-click="showEventList()"
- ng-hide="(currentEvent.event == dhis2Event.event) || !eventGridColumn.show"
- ng-repeat="eventGridColumn in eventGridColumns">
- {{dhis2Event[eventGridColumn.id]}}
- </td>
-
- <!-- Visible when event is under editing - in grid -->
- <td style="cursor:default;"
- ng-dblclick="showEventList()"
- ng-if="(currentEvent.event == dhis2Event.event) && eventGridColumn.show"
- ng-repeat="eventGridColumn in eventGridColumns">
- <ng-form name="innerFormGrid">
- <div ng-switch="eventGridColumn.type">
- <div ng-switch-when="int">
- <input type="number"
- program-stage-data-element={{programStageDataElements[eventGridColumn.id]}}
- ng-model="dhis2Event[eventGridColumn.id]"
- ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:98%;"
- ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- />
- <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
- </div>
- <div ng-switch-when="string">
- <div class="container-fluid">
- <input type="text"
- ng-model="dhis2Event[eventGridColumn.id]"
- ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)"
- typeahead="option for option in programStageDataElements[eventGridColumn.id].dataElement.optionSet.options | filter:$viewValue | limitTo:20"
- typeahead-open-on-focus
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:98%;"
- ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- />
- <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
- </div>
- </div>
- <div ng-switch-when="bool">
- <select ng-model="dhis2Event[eventGridColumn.id]"
- ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:98%;"
- ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- />
- <option value="">{{'please_select'| translate}}</option>
- <option value="0">{{'no'| translate}}</option>
- <option value="1">{{'yes'| translate}}</option>
- </select>
- <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
- </div>
- <div ng-switch-when="date">
- <input type="text"
- placeholder="yyyy-mm-dd"
- ng-date
- ng-model="dhis2Event[eventGridColumn.id]"
- blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:98%;"
- ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- />
- <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
- </div>
- <div ng-switch-when="trueOnly">
- <input type="checkbox"
- ng-model="dhis2Event[eventGridColumn.id]"
- ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
- />
- <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid"><em title="{{'required'| translate}}" class="required">*</em></span>
- </div>
- </div>
- </ng-form>
- </td>
- </tr>
- </tbody>
- </table>
- <serverside-paginator></serverside-paginator>
- </form>
- <!-- grid ends -->
- </div>
- </div>
- </div>
+ <div ng-include="'views/eventList.html'"></div>
<!-- event grid ends -->
<!-- event update in full / registration begins-->
@@ -352,116 +163,14 @@
<span ng-if="editingEventInFull">{{'update_event'| translate}}</span>
<span ng-if="eventRegistration">{{'new_event'| translate}}</span>
</h3>
-
- <!-- custom form begins -->
+
<div class="bordered-div" ng-if="displayCustomForm">
- <label>{{selectedProgram.dateOfIncidentDescription}}</label>
- <input type="text"
- placeholder="yyyy-mm-dd"
- ng-date
- ng-model="currentEvent.eventDate"
- ng-disabled="editingEventInFull"
- ng-required="true"
- name="eventDate">
- <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'required'| translate}}</span>
- <hr>
- <dhis-custom-form custom-form-type="PROGRAM_STAGE" custom-form-object="selectedProgramStage"></dhis-custom-form>
+ <div ng-include="'views/customForm.html'"></div>
</div>
- <!-- custom form ends -->
-
- <!-- default form begins -->
+
<div class="bordered-div" style="width:50%;" ng-if="!displayCustomForm">
- <table class="dhis2-list-table-striped">
- <thead>
- <tr>
- <th>
- {{'data_element'| translate}}
- </th>
- <th>
- {{'value'| translate}}
- </th>
- </tr>
- </thead>
- <tbody id="list">
- <tr>
- <td>
- {{selectedProgram.dateOfIncidentDescription}}
- </td>
- <td>
- <input type="text"
- placeholder="yyyy-mm-dd"
- ng-date
- ng-model="currentEvent.eventDate"
- ng-disabled="editingEventInFull"
- ng-required="true"
- name="eventDate"
- style="width:99%;">
- <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'required'| translate}}</span>
- </td>
- </tr>
- <tr ng-repeat="eventGridColumn in eventGridColumns">
- <td >
- {{eventGridColumn.name}}
- </td>
- <td >
- <ng-form name="innerForm">
- <div ng-switch="eventGridColumn.type">
- <div ng-switch-when="int">
- <input type="number"
- ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:99%;"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
- </div>
- <div ng-switch-when="string">
- <div class="container-fluid">
- <input type="text"
- ng-model="currentEvent[eventGridColumn.id]"
- typeahead="option for option in programStageDataElements[eventGridColumn.id].dataElement.optionSet.options | filter:$viewValue | limitTo:20"
- typeahead-open-on-focus
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:99%;"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
- </div>
- </div>
- <div ng-switch-when="bool">
- <select ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:99%;"/>
- <option value="">{{'please_select'| translate}}</option>
- <option value="0">{{'no'| translate}}</option>
- <option value="1">{{'yes'| translate}}</option>
- </select>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
- </div>
- <div ng-switch-when="date">
- <input type="text"
- placeholder="yyyy-mm-dd"
- ng-date
- ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"
- style="width:99%;"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
- </div>
- <div ng-switch-when="trueOnly">
- <input type="checkbox"
- ng-model="currentEvent[eventGridColumn.id]"
- ng-required={{eventGridColumn.compulsory}}
- name="foo"/>
- <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
- </div>
- </div>
- </ng-form>
- </td>
- </tr>
- </tbody>
- </table>
+ <div ng-include="'views/defaultForm.html'"></div>
</div>
- <!-- default form ends -->
<!-- buttons for event registration / update begins -->
<div style="clear: both;">
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-06-03 06:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2014-06-13 06:12:21 +0000
@@ -368,6 +368,10 @@
dataValues: dataValues
};
+ if($scope.selectedProgramStage.captureCoordinates){
+ dhis2Event.coordinate = {latitude: $scope.currentEvent.coordinate.latitude ? $scope.currentEvent.coordinate.latitude : '',
+ longitude: $scope.currentEvent.coordinate.longitude ? $scope.currentEvent.coordinate.longitude : ''};
+ }
//send the new event to server
DHIS2EventFactory.create(dhis2Event).then(function(data) {
if (data.importSummaries[0].status === 'ERROR') {
@@ -430,6 +434,11 @@
updatedEvent.eventDate = Date.parse(updatedEvent.eventDate);
updatedEvent.eventDate = $filter('date')(updatedEvent.eventDate, 'yyyy-MM-dd');
+ if($scope.selectedProgramStage.captureCoordinates){
+ updatedEvent.coordinate = {latitude: $scope.currentEvent.coordinate.latitude ? $scope.currentEvent.coordinate.latitude : '',
+ longitude: $scope.currentEvent.coordinate.longitude ? $scope.currentEvent.coordinate.longitude : ''};
+ }
+
DHIS2EventFactory.update(updatedEvent).then(function(data){
//update original value
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-06-07 14:03:55 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js 2014-06-13 06:12:21 +0000
@@ -317,7 +317,7 @@
{
return function() {
return $.ajax( {
- url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,dataEntryForm,description,minDaysFromStart,repeatable,programStageDataElements[displayInReports,allowProvidedElsewhere,allowDateInFuture,compulsory,dataElement[id,name,type,optionSet[id]]]',
+ url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,captureCoordinates,dataEntryForm,description,minDaysFromStart,repeatable,programStageDataElements[displayInReports,allowProvidedElsewhere,allowDateInFuture,compulsory,dataElement[id,name,type,optionSet[id]]]',
type: 'GET'
}).done( function( response ){
_.each( _.values( response.programStages ), function( programStage ) {
=== modified file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css 2014-05-22 10:22:11 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/styles/style.css 2014-06-13 06:12:21 +0000
@@ -114,6 +114,7 @@
border-radius: 5px;
padding: 12px;
margin-bottom: 20px;
+ overflow: auto;
}
.nav, .pagination, .carousel, .panel-title a {
@@ -227,7 +228,7 @@
}
.button-std {
- width: 130px;
+ width: 130px;
}
/*----------------------------------------------------------------------------*/
=== added file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-06-13 06:12:21 +0000
@@ -0,0 +1,46 @@
+<table style='width: 50%;'>
+ <tr>
+ <td>
+ {{selectedProgram.dateOfIncidentDescription}}
+ </td>
+ <td>
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-model="currentEvent.eventDate"
+ ng-disabled="editingEventInFull"
+ ng-required="true"
+ name="eventDate"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'required'| translate}}</span>
+ </td>
+ </tr>
+ <tr ng-if="selectedProgramStage.captureCoordinates">
+ <td>
+ {{'latitude' | translate}}
+ </td>
+ <td>
+ <input type="number"
+ ng-model="currentEvent.coordinate.latitude"
+ name="latitude"
+ ng-required="false"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'number_required'| translate}}</span>
+ </td>
+ </tr>
+ <tr ng-if="selectedProgramStage.captureCoordinates">
+ <td>
+ {{'longitude' | translate}}
+ </td>
+ <td>
+ <input type="number"
+ ng-model="currentEvent.coordinate.longitude"
+ name="longitude"
+ ng-required="false"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'number_required'| translate}}</span>
+ </td>
+ </tr>
+</table>
+<hr>
+<dhis-custom-form custom-form-type="PROGRAM_STAGE" custom-form-object="selectedProgramStage"></dhis-custom-form>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-06-13 06:12:21 +0000
@@ -0,0 +1,115 @@
+<table class="dhis2-list-table-striped">
+ <thead>
+ <tr>
+ <th>
+ {{'data_element'| translate}}
+ </th>
+ <th>
+ {{'value'| translate}}
+ </th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ <tr>
+ <td>
+ {{selectedProgram.dateOfIncidentDescription}}
+ </td>
+ <td>
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-model="currentEvent.eventDate"
+ ng-disabled="editingEventInFull"
+ ng-required="true"
+ name="eventDate"
+ style="width:99%;">
+ <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'required'| translate}}</span>
+ </td>
+ </tr>
+ <tr ng-if="selectedProgramStage.captureCoordinates">
+ <td>
+ {{'latitude' | translate}}
+ </td>
+ <td>
+ <input type="number"
+ ng-model="currentEvent.coordinate.latitude"
+ name="latitude"
+ ng-required="false"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'number_required'| translate}}</span>
+ </td>
+ </tr>
+ <tr ng-if="selectedProgramStage.captureCoordinates">
+ <td>
+ {{'longitude' | translate}}
+ </td>
+ <td>
+ <input type="number"
+ ng-model="currentEvent.coordinate.longitude"
+ name="longitude"
+ ng-required="false"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'number_required'| translate}}</span>
+ </td>
+ </tr>
+ <tr ng-repeat="eventGridColumn in eventGridColumns">
+ <td >
+ {{eventGridColumn.name}}
+ </td>
+ <td >
+ <ng-form name="innerForm">
+ <div ng-switch="eventGridColumn.type">
+ <div ng-switch-when="int">
+ <input type="number"
+ ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+ </div>
+ <div ng-switch-when="string">
+ <div class="container-fluid">
+ <input type="text"
+ ng-model="currentEvent[eventGridColumn.id]"
+ typeahead="option for option in programStageDataElements[eventGridColumn.id].dataElement.optionSet.options | filter:$viewValue | limitTo:20"
+ typeahead-open-on-focus
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+ </div>
+ </div>
+ <div ng-switch-when="bool">
+ <select ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:99%;"/>
+ <option value="">{{'please_select'| translate}}</option>
+ <option value="0">{{'no'| translate}}</option>
+ <option value="1">{{'yes'| translate}}</option>
+ </select>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+ </div>
+ <div ng-switch-when="date">
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:99%;"/>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+ </div>
+ <div ng-switch-when="trueOnly">
+ <input type="checkbox"
+ ng-model="currentEvent[eventGridColumn.id]"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"/>
+ <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+ </div>
+ </div>
+ </ng-form>
+ </td>
+ </tr>
+ </tbody>
+</table>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/eventList.html 2014-06-13 06:12:21 +0000
@@ -0,0 +1,190 @@
+<div ng-if="selectedProgramStage && !eventRegistration && !editingEventInFull">
+ <img src="../images/ajax-loader-bar.gif" ng-if="!eventFetched"/>
+ <div ng-switch="dhis2Events.length">
+ <div ng-switch-when="undefined">
+ <h4>
+ {{'empty_event_list'| translate}}
+ </h4>
+ </div>
+ <div ng-switch-when="0">
+ <h4 ng-if="eventFetched">
+ {{'empty_event_list'| translate}}
+ </h4>
+ </div>
+ <div ng-switch-default>
+ <h4>
+ {{'registered_events'| translate}}
+ <button class="button button-std pull-right"
+ ng-show="dhis2Events.length"
+ ng-disabled="eventRegistration || editingEventInFull || editingEventInGrid"
+ ng-click="showHideColumns()">
+ {{'show_hide_columns'| translate}}
+ </button>
+ </h4>
+
+ <!-- context menu for event grid -->
+ <div id="contextMenu" class="contextMenu" style="width: 180px;">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a href ng-click="showEditEventInFull()"><i class="fa fa-edit"></i> {{'edit'| translate}}</a></li>
+ <li><a href ng-click="showEditEventInGrid()"><i class="fa fa-edit"></i> {{'edit_in_grid'| translate}}</a></li>
+ <li><a href ng-click="removeEvent()"><i class="fa fa-trash-o"></i> {{'remove'| translate}}</a></li>
+ </ul>
+ </div>
+ <!-- context menu ends -->
+
+ <!-- grid begins -->
+ <form name="outerForm" novalidate>
+
+ <table class="listTable dhis2-table-striped-border dhis2-table-hover">
+ <thead>
+ <tr>
+ <th ng-show="eventGridColumn.show"
+
+ ng-repeat="eventGridColumn in eventGridColumns">
+
+ <!-- sort icon begins -->
+ <span ng-hide="eventGridColumn.showFilter" class="bold" ng-click="sortEventGrid(eventGridColumn)">
+ <i ng-show="sortHeader == eventGridColumn.id && !reverse" class="fa fa-sort-desc"></i>
+ <i ng-show="sortHeader == eventGridColumn.id && reverse" class="fa fa-sort-asc"></i>
+ {{eventGridColumn.name}}
+ </span>
+ <!-- sort icon ends -->
+
+ <!-- filter icon begins -->
+ <span class='pull-right'>
+ <span ng-show="eventGridColumn.type !='date' && eventGridColumn.type !='int'">
+ <a href ng-click="searchInGrid(eventGridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [filterText[eventGridColumn.id] == undefined || filterText[eventGridColumn.id] == '']"><i class="fa fa-search"></i></span></a>
+ </span>
+ <span ng-show="eventGridColumn.type ==='date' || eventGridColumn.type ==='int'">
+ <a href ng-click="searchInGrid(eventGridColumn)" title="{{'search'| translate}}"><span ng-class="{true: 'filter-without-content', false: 'filter-with-content'} [(filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == '') && (filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == '')]"><i class="fa fa-search"></i></span></a>
+ </span>
+ </span>
+ <!-- filter icon ends -->
+
+ <!-- filter input field begins -->
+ <span ng-show="eventGridColumn.showFilter">
+ <span ng-switch="eventGridColumn.type">
+ <span ng-switch-when="int">
+ <input style="width: 45%;" placeholder="{{'lower_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].start" ng-blur="searchInGrid(eventGridColumn)">
+ <input style="width: 45%;" placeholder="{{'upper_limit' | translate}}" type="number" ng-model="filterText[eventGridColumn.id].end" ng-blur="searchInGrid(eventGridColumn)">
+ </span>
+ <span ng-switch-when="date">
+ <input style="width: 70%;" placeholder="{{'start_date' | translate}}" type="text" ng-model="filterText[eventGridColumn.id].start" data-ng-date readonly="readonly">
+ <span ng-hide="filterText[eventGridColumn.id].start == undefined || filterText[eventGridColumn.id].start == ''">
+ <a href ng-click='removeStartFilterText(eventGridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>
+ </span>
+ <input style="width: 70%;" placeholder="{{'end_date' | translate}}" type="text" ng-model="filterText[eventGridColumn.id].end" data-ng-date readonly="readonly">
+ <span ng-hide="filterText[eventGridColumn.id].end == undefined || filterText[eventGridColumn.id].end == ''">
+ <a href ng-click='removeEndFilterText(eventGridColumn.id)'><span class='black'><i class="fa fa-trash-o"></i></span></a>
+ </span>
+ </span>
+ <span ng-switch-default>
+ <input type="text" style="width: 90%;" ng-model="filterText[eventGridColumn.id]" ng-blur="searchInGrid(eventGridColumn)">
+ </span>
+ </span>
+ </span>
+ <!-- filter input field ends -->
+
+ </th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ <tr ng-repeat="dhis2Event in dhis2Events | orderBy:sortHeader:reverse | gridFilter:filterText:filterTypes">
+
+ <!-- Visible when event is not under editing -->
+ <td dhis-context-menu
+ selected-item={{dhis2Event}}
+ ng-click="showEventList()"
+ ng-hide="(currentEvent.event == dhis2Event.event) || !eventGridColumn.show"
+ ng-repeat="eventGridColumn in eventGridColumns">
+ {{dhis2Event[eventGridColumn.id]}}
+ </td>
+
+ <!-- Visible when event is under editing - in grid -->
+ <td style="cursor:default;"
+ ng-dblclick="showEventList()"
+ ng-if="(currentEvent.event == dhis2Event.event) && eventGridColumn.show"
+ ng-repeat="eventGridColumn in eventGridColumns">
+ <ng-form name="innerFormGrid">
+ <div ng-switch="eventGridColumn.type">
+ <div ng-switch-when="int">
+ <input type="number"
+ program-stage-data-element={{programStageDataElements[eventGridColumn.id]}}
+ ng-model="dhis2Event[eventGridColumn.id]"
+ ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:98%;"
+ ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ />
+ <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
+ </div>
+ <div ng-switch-when="string">
+ <div class="container-fluid">
+ <input type="text"
+ ng-model="dhis2Event[eventGridColumn.id]"
+ ng-blur="updateEventDataValue(dhis2Event, eventGridColumn.id)"
+ typeahead="option for option in programStageDataElements[eventGridColumn.id].dataElement.optionSet.options | filter:$viewValue | limitTo:20"
+ typeahead-open-on-focus
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:98%;"
+ ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ />
+ <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
+ </div>
+ </div>
+ <div ng-switch-when="bool">
+ <select ng-model="dhis2Event[eventGridColumn.id]"
+ ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:98%;"
+ ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ />
+ <option value="">{{'please_select'| translate}}</option>
+ <option value="0">{{'no'| translate}}</option>
+ <option value="1">{{'yes'| translate}}</option>
+ </select>
+ <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
+ </div>
+ <div ng-switch-when="date">
+ <input type="text"
+ placeholder="yyyy-mm-dd"
+ ng-date
+ ng-model="dhis2Event[eventGridColumn.id]"
+ blur-or-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ style="width:98%;"
+ ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ />
+ <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid" class="red"><em title="{{'required'| translate}}" class="required">*</em></span>
+ </div>
+ <div ng-switch-when="trueOnly">
+ <input type="checkbox"
+ ng-model="dhis2Event[eventGridColumn.id]"
+ ng-change="updateEventDataValue(dhis2Event, eventGridColumn.id)"
+ ng-required={{eventGridColumn.compulsory}}
+ name="foo"
+ ng-class="{true: 'update-success'} [currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ ng-class="{true: 'update-error'} [!currentElement.updated == true && currentElement.id == eventGridColumn.id]"
+ />
+ <span ng-show="outerForm.submitted && innerFormGrid.foo.$invalid"><em title="{{'required'| translate}}" class="required">*</em></span>
+ </div>
+ </div>
+ </ng-form>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <serverside-paginator></serverside-paginator>
+ </form>
+ <!-- grid ends -->
+ </div>
+ </div>
+</div>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/selections.html'
--- dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/selections.html 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-capture/src/main/webapp/dhis-web-event-capture/views/selections.html 2014-06-13 06:12:21 +0000
@@ -0,0 +1,34 @@
+<table>
+ <tr>
+ <td><label>{{'registering_unit'| translate}}</label></td>
+ <td><input type="text" class="fixed-width-text" selected-org-unit ng-model="selectedOrgUnit.name" value="{{selectedOrgUnit.name|| 'please_select'| translate}}" disabled="" style="height:14px"></td>
+ </tr>
+ <tr>
+ <td><label>{{'program'| translate}}</label></td>
+ <td>
+ <select id="programId"
+ class="fixed-width-select"
+ name="programId"
+ ng-model="selectedProgram"
+ ng-options="program as program.name for program in programs | orderBy: 'name'"
+ ng-change="loadEvents()"
+ ng-disabled="eventRegistration || editingEventInFull || editingEventInGrid">
+ <option value="">{{'please_select'| translate}}</option>
+ </select>
+ </td>
+ <td style='padding-left: 10px;'>
+ <button class="button button-std"
+ ng-show="selectedProgramStage"
+ ng-click="showEventRegistration()"
+ ng-disabled="eventRegistration || editingEventInFull || editingEventInGrid">
+ {{'register_event'| translate}}
+ </button>
+ </td>
+ <td ng-if="(editingEventInFull || eventRegistration) && customForm" style='padding-left: 10px;'>
+ <button class="button button-std"
+ ng-click="switchDataEntryForm()">
+ {{displayCustomForm ? 'use_default_form' : 'use_custom_form'| translate}}
+ </button>
+ </td>
+ </tr>
+</table>
\ No newline at end of file