dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36550
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18694: tracker-capture: menu to delete relationships
------------------------------------------------------------
revno: 18694
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-26 15:59:40 +0100
message:
tracker-capture: menu to delete relationships
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
--
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/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-03-25 16:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js 2015-03-26 14:59:40 +0000
@@ -5,9 +5,12 @@
$rootScope,
$modal,
$location,
+ TEIService,
AttributesFactory,
CurrentSelection,
- RelationshipFactory) {
+ RelationshipFactory,
+ ModalService,
+ DialogService) {
$rootScope.showAddRelationshipDiv = false;
$scope.relatedProgramRelationship = false;
@@ -79,6 +82,45 @@
}
};
+ $scope.removeRelationship = function(rel){
+
+ var modalOptions = {
+ closeButtonText: 'cancel',
+ actionButtonText: 'delete',
+ headerText: 'delete',
+ bodyText: 'are_you_sure_to_delete_relationship'
+ };
+
+ ModalService.showModal({}, modalOptions).then(function(result){
+
+ var index = -1;
+ for(var i=0; i<$scope.selectedTei.relationships.length; i++){
+ if($scope.selectedTei.relationships[i].relationship === rel.relId){
+ index = i;
+ break;
+ }
+ }
+
+ if( index !== -1 ){
+ $scope.selectedTei.relationships.splice(index,1);
+ TEIService.update($scope.selectedTei, $scope.optionSets, $scope.attributesById).then(function(response){
+ if(response.status !== 'SUCCESS'){//update has failed
+ var dialogOptions = {
+ headerText: 'update_error',
+ bodyText: response.description
+ };
+ DialogService.showDialog({}, dialogOptions);
+ return;
+ }
+
+ var selections = CurrentSelection.get();
+ CurrentSelection.set({tei: $scope.selectedTei, te: $scope.selectedTei.trackedEntity, prs: selections.prs, pr: $scope.selectedProgram, prNames: selections.prNames, prStNames: selections.prStNames, enrollments: selections.enrollments, selectedEnrollment: $scope.selectedEnrollment, optionSets: selections.optionSets});
+ setRelationships();
+ });
+ }
+ });
+ };
+
$scope.showDashboard = function(teiId, relId){
var dashboardProgram = null;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2015-02-24 16:15:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship.html 2015-03-26 14:59:40 +0000
@@ -31,11 +31,14 @@
{{att.name}}
</th>
</tr>
- <tr ng-click="showDashboard(rel.trackedEntityInstance, rel.relId)" ng-repeat="rel in relatedTeis" title="{{'go_to_dashboard'| translate}}">
- <td>{{rel.relName}}</td>
- <td ng-repeat="att in attributes" ng-if="att.displayInListNoProgram">
+ <tr ng-repeat="rel in relatedTeis">
+ <td title="{{'go_to_dashboard'| translate}}" ng-click="showDashboard(rel.trackedEntityInstance, rel.relId)">{{rel.relName}}</td>
+ <td title="{{'go_to_dashboard'| translate}}" ng-click="showDashboard(rel.trackedEntityInstance, rel.relId)" ng-repeat="att in attributes" ng-if="att.displayInListNoProgram">
{{rel.attributes[att.id]}}
</td>
+ <td ng-click="removeRelationship(rel)" title="{{'delete_relationship'| translate}}">
+ <i class="fa fa-trash-o"></i>
+ </td>
</tr>
</table>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-03-19 10:18:00 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-03-26 14:59:40 +0000
@@ -244,8 +244,10 @@
save_and_go_back=Save and go back
save_and_continue=Save and continue
save_relationship=Save relationship
+delete_relationship=Delete relationship
go_back=Go back
cancel=Cancel
+are_you_sure_to_delete_relationship=Are you sure you want to delete the relationship?
are_you_sure_to_delete_enrollment=Are you sure you want to delete the selected enrollment?
are_you_sure_to_complete_enrollment=Are you sure you want to complete the selected enrollment?
are_you_sure_to_terminate_enrollment=Are you sure you want to terminate the selected enrollment?