← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13438: Bank Details Modifications

 

------------------------------------------------------------
revno: 13438
committer: Samta Bajpayee<samta-bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-12-27 05:24:32 +0000
message:
  Bank Details Modifications
modified:
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm


--
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 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java	2013-12-21 09:11:48 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/action/LoadBankDetailsAction.java	2013-12-27 05:24:32 +0000
@@ -1,6 +1,8 @@
 package org.hisp.dhis.pbf.action;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import org.hisp.dhis.dataset.DataSet;
@@ -64,9 +66,13 @@
     public List<DataSet> getDataSets()
     {
         return dataSets;
-    }
-
-    private List<String> banks = new ArrayList<String>();
+    }    
+
+    public void setDataSets(List<DataSet> dataSets) {
+		this.dataSets = dataSets;
+	}
+
+	private List<String> banks = new ArrayList<String>();
 
     public List<String> getBanks()
     {
@@ -88,15 +94,31 @@
         OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUid );
         
         bankDetailsList.addAll( bankDetailsService.getBankDetails( organisationUnit ) );
-        
+        dataSets.clear();
         List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
         for( Lookup lookup : lookups )
         {
             Integer dataSetId = Integer.parseInt( lookup.getValue() );
             
             DataSet dataSet = dataSetService.getDataSet( dataSetId );
+            if(bankDetailsList.size() > 0)
+            {
+	            for(BankDetails bd : bankDetailsList)
+	            {
+	            	if(bd.getDataSet().getId() == dataSet.getId() && !dataSets.contains(bd.getDataSet()))
+	            	{}
+	            	else
+	            	{
+	            		dataSets.add(dataSet);
+	            		break;
+	            	}
+	            }
+            }
+            else
+            {
+            	dataSets.add( dataSet );
+            }
             
-            dataSets.add( dataSet );
         }
         
         lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.BANK ) );
@@ -104,7 +126,9 @@
         {
             banks.add( lookup.getValue() );
         }
-
+        
+        Collections.sort(dataSets);
+        System.out.println(dataSets.size());
         return SUCCESS;
     }
 }

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm	2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getBankDetails.vm	2013-12-27 05:24:32 +0000
@@ -1,8 +1,17 @@
+<style >
+	.mandatory
+	{
+		color:red;
+		font-size: 1.5em;
+	}
+</style>
 <script >
 $(function() {
 $("#bankDetails").tablesorter(); 
 $("#openAddBankDetail").button()
 			.click(function() {	
+			
+			validateAddBank();
 			$( "#addBankDetail" ).dialog('option', 'title', 'Add Bank Detail');
            	$('#dataSetId option[value=-1]').attr('selected','selected');
 			$("#dataSetId ").removeAttr('disabled');
@@ -20,9 +29,11 @@
 			autoOpen: false,			
 			modal: true,
 			buttons: {
-			"Save": function() {
-						
-                    var dataValue = {
+			"save" : {
+         		text: "Save",
+         		id: "button-save",
+         		click: function(){
+              		var dataValue = {
         		        			'dataSetId' : $("#dataSetId").val(),
         		        			'bank' : $("#bank").val(),
         		        			'branchName' : $("#branchName").val(),
@@ -37,8 +48,8 @@
                                 success: handleSuccess,
                                 error: handleError
                             } );
-                    	
-				},
+         		}   
+      		},
 				Cancel: function() {
 					$( this ).dialog( "close" );
 				}
@@ -97,6 +108,7 @@
 
 	function editBankData( organisationUnitId, dataSetId, bank, branchName, accountName, accountNumber)
 	{
+		validateAddBank();
 		$( "#addBankDetail" ).dialog('option', 'title', 'Edit Bank Detail');
 		$('#dataSetId option[value='+dataSetId+']').attr('selected','selected');
 		$('#dataSetId').attr('disabled','disabled');
@@ -126,6 +138,17 @@
         				});  	
 }
 selection.setListenerFunction( organisationUnitSelected );
+function validateAddBank()
+	{
+		if($("#dataSetId").val() != '-1' && $("#bank").val() != '-1' && $("#branchName").val() != "" && $("#accountName").val() != "" && $("#accountNumber").val() != "")
+        {
+        	$("#button-save").button( "option", "disabled", false ).removeClass("ui-state-disabled");
+        }
+        else
+        {
+			$("#button-save").button( "option", "disabled", true ).addClass("ui-state-disabled");       	
+        }
+	}
 </script>
 
 <table style="width:100%" id="bankDetails">
@@ -136,9 +159,9 @@
 			<th >Branch Name</th>
 			<th >Account Name</th>
 			<th >Account Number</th>
-			##if( $updateAuthority == 'Yes' )
+			#if( $auth.hasAccess("dhis-web-maintenance-pbf","deleteBankData"))
 				<th >Operations</th>
-			##end
+			#end
         </tr>
 	</thead>
 	<tbody id="list">
@@ -155,7 +178,7 @@
 				<td >$!bankDetails.branchName</td>
 				<td >$!bankDetails.accountName</td>
 				<td >$!bankDetails.accountNumber</td>
-			##if($updateAuthority == 'Yes')
+			#if( $auth.hasAccess("dhis-web-maintenance-pbf","deleteBankData"))
 	            <td>
 					<a href="javascript:deleteBankData('$bankDetails.organisationUnit.id','$bankDetails.dataSet.id')">
 						<img src="images/delete.png" width="17px"/>
@@ -164,18 +187,18 @@
 						<img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/>
 					</a>				
 				</td>
-			##end
+			#end
         </tr>
 		#end
     </tbody>
 </table>
-
+
 <div id="addBankDetail" title="Add New Bank Detail">
 	<table style="width:100%;table-layout:fixed;">
 		<tr >
-			<td style="width:40%;">PBF Type</td>
+			<td style="width:40%;">PBF Type <b class="mandatory">*</b></td>
 			<td style="width:60%;">
-				<select id="dataSetId" style="width:100%;">
+				<select id="dataSetId" style="width:100%;" onchange="validateAddBank()">
 					<option value="-1">Select PBF Type</option>
 					#foreach( $dataSet in $dataSets )
 						<option value="$dataSet.id">$dataSet.name</option>
@@ -184,9 +207,9 @@
 			</td>
         </tr>
 		<tr >
-			<td style="width:40%;">Bank</td>
+			<td style="width:40%;">Bank <b class="mandatory">*</b></td>
             <td style="width:60%;">
-                <select id="bank" style="width:100%;">
+                <select id="bank" style="width:100%;" onchange="validateAddBank()">
                     <option value="-1">Select Bank</option>
                     #foreach( $bank in $banks )
                         <option value="$bank">$bank</option>
@@ -195,16 +218,16 @@
             </td>
         </tr>
 		<tr >
-			<td style="width:40%;">Branch Name</td>
-			<td style="width:60%;"><input type="text" id="branchName" style="width:100%;"/></td>
+			<td style="width:40%;">Branch Name <b class="mandatory">*</b></td>
+			<td style="width:60%;"><input type="text" id="branchName" style="width:100%;" onblur="validateAddBank()"/></td>
         </tr>
 		<tr >
-			<td style="width:40%;">Account Name</td>
-			<td style="width:60%;"><input type="text" id="accountName" style="width:100%;"/></td>
+			<td style="width:40%;">Account Name <b class="mandatory">*</b></td>
+			<td style="width:60%;"><input type="text" id="accountName" style="width:100%;" onblur="validateAddBank()"/></td>
         </tr>
         <tr >
-            <td style="width:40%;">Account Number</td>
-            <td style="width:60%;"><input type="text" id="accountNumber" style="width:100%;"/></td>
+            <td style="width:40%;">Account Number <b class="mandatory">*</b></td>
+            <td style="width:60%;"><input type="text" id="accountNumber" style="width:100%;" onblur="validateAddBank()"/></td>
         </tr>
     </table>
 </div>
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm	2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadBankData.vm	2013-12-27 05:24:32 +0000
@@ -1,5 +1,13 @@
 <script >
 $(function() {
+	if($dataSets.size() <= 0)
+        {
+        	$("#openAddBankDetail").removeAttr( "disabled" );
+        }
+        else
+        {
+			$("#openAddBankDetail").attr( "disabled", true ).addClass("ui-state-disabled");       	
+        }
 });
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {
@@ -24,7 +32,7 @@
 <h3>Bank Detail Management</h3>
 <div style="width:100%">
 	Orgainsation Unit: &nbsp; <input type="text" id="orgUnit" name="orgUnit" readonly size="40"/>
-	<input type="button" value="Add New Bank Detail" style="float:right;" id="openAddBankDetail"/>
+	<input type="button" value="Add New Bank Detail" style="float:right;" id="openAddBankDetail" />
 </div>
 <br/><br/>
 <div id="loadBankDetails">

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm	2013-12-24 12:23:11 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadTariffData.vm	2013-12-27 05:24:32 +0000
@@ -1,4 +1,5 @@
 <script >
+
 $(function() {
 $("#tariffDetails").tablesorter(); 
 datePicker( 'startDate');
@@ -74,7 +75,8 @@
 	}
 
 	function editTariffDataValue( organisationUnitId, dataElementId, dataSetId, startDate, endDate, value )
-	{		
+	{	
+		validateAddTariff();
 		$( "#addTariff" ).dialog('option', 'title', 'Edit Tariff');
 		$('#pbfType option[value='+dataSetId+']').attr('selected','selected');
 		$('#pbfType').attr('disabled','disabled');
@@ -192,7 +194,7 @@
 	}
 </style>
 <div style="width:100%">
-	<input type="button" value="Add New Tariff" style="float:right;" id="openAddTariff"/>
+	<input type="button" value="Add New Tariff" style="float:right;" id="openAddTariff" />
 </div>
 <br/><br/>
 <input type="hidden" id="dataElementId" name="dataElementId" value="$!selecteddataElement.id"/>
@@ -236,7 +238,7 @@
 		#end
     </tbody>
 </table>
-
+
 <div id="addTariff" title="Add New Tariff">
 	<table style="width:100%;table-layout:fixed;">
 		<tr >