dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17172
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6753: CCEM: Equipmentmanagement work in progress
------------------------------------------------------------
revno: 6753
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-26 15:30:48 +0530
message:
CCEM: Equipmentmanagement work in progress
added:
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/action/GetOrganisationUnitAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/EquipmentSelectAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowAddInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentMenu.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryType.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseInventoryTypeAttributes.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/resources/struts.xml
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.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-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java 2012-04-26 10:00:48 +0000
@@ -1,6 +1,9 @@
package org.hisp.dhis.coldchain.inventory;
import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
public interface EquipmentInstanceService
{
@@ -11,7 +14,16 @@
void updateEquipmentInstance( EquipmentInstance equipmentInstance );
void deleteEquipmentInstance( EquipmentInstance equipmentInstance );
+
+ int createEquipment( EquipmentInstance equipmentInstance, List<EquipmentDetails> equipmentDetails );
Collection<EquipmentInstance> getAllEquipmentInstance();
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType );
+
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit );
+
+ int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType );
+
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java 2012-04-26 10:00:48 +0000
@@ -2,7 +2,10 @@
import java.util.Collection;
-public interface EquipmentInstanceStore
+import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+public interface EquipmentInstanceStore extends GenericStore<EquipmentInstance>
{
String ID = EquipmentInstanceStore.class.getName();
@@ -13,4 +16,14 @@
void deleteEquipmentInstance( EquipmentInstance equipmentInstance );
Collection<EquipmentInstance> getAllEquipmentInstance();
+
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit );
+
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType );
+
+ int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType );
+
+ Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max );
+
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeService.java 2012-04-26 10:00:48 +0000
@@ -13,4 +13,8 @@
void deleteInventoryType( InventoryType inventoryType );
Collection<InventoryType> getAllInventoryTypes();
+
+ InventoryType getInventoryTypeByName( String name );
+
+ InventoryType getInventoryType( int id );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeStore.java 2012-04-26 10:00:48 +0000
@@ -13,4 +13,8 @@
void deleteInventoryType( InventoryType inventoryType );
Collection<InventoryType> getAllInventoryTypes();
+
+ InventoryType getInventoryTypeByName( String name );
+
+ InventoryType getInventoryType( int id );
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java 2012-04-26 10:00:48 +0000
@@ -1,9 +1,12 @@
package org.hisp.dhis.coldchain.inventory;
import java.util.Collection;
+import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.springframework.transaction.annotation.Transactional;
+@Transactional
public class DefaultEquipmentInstanceService implements EquipmentInstanceService
{
@@ -18,33 +21,70 @@
this.equipmentInstanceStore = equipmentInstanceStore;
}
+ private EquipmentDetailsService equipmentDetailsService;
+
+ public void setEquipmentDetailsService( EquipmentDetailsService equipmentDetailsService )
+ {
+ this.equipmentDetailsService = equipmentDetailsService;
+ }
+
// -------------------------------------------------------------------------
// EquipmentInstance
// -------------------------------------------------------------------------
- @Transactional
+
@Override
public int addEquipmentInstance( EquipmentInstance equipmentInstance )
{
return equipmentInstanceStore.addEquipmentInstance( equipmentInstance );
}
- @Transactional
@Override
public void deleteEquipmentInstance( EquipmentInstance equipmentInstance )
{
equipmentInstanceStore.deleteEquipmentInstance( equipmentInstance );
}
- @Transactional
@Override
public Collection<EquipmentInstance> getAllEquipmentInstance()
{
return equipmentInstanceStore.getAllEquipmentInstance();
}
- @Transactional
@Override
public void updateEquipmentInstance( EquipmentInstance equipmentInstance )
{
equipmentInstanceStore.updateEquipmentInstance( equipmentInstance );
}
+ public int createEquipment( EquipmentInstance equipmentInstance, List<EquipmentDetails> equipmentDetails )
+ {
+ int equipmentInstanceId = addEquipmentInstance( equipmentInstance );
+
+ for( EquipmentDetails equipment : equipmentDetails )
+ {
+ equipmentDetailsService.addEquipmentDetails( equipment );
+ }
+
+ return equipmentInstanceId;
+ }
+
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit )
+ {
+ return equipmentInstanceStore.getEquipmentInstances( orgUnit );
+ }
+
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType )
+ {
+ return equipmentInstanceStore.getEquipmentInstances( orgUnit, inventoryType );
+ }
+
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max )
+ {
+ return equipmentInstanceStore.getEquipmentInstances( orgUnit, inventoryType, min, max );
+ }
+
+ @Override
+ public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
+ {
+ return equipmentInstanceStore.getCountEquipmentInstance( orgUnit, inventoryType );
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java 2012-04-21 12:57:24 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeService.java 2012-04-26 10:00:48 +0000
@@ -2,6 +2,7 @@
import java.util.Collection;
+import org.hibernate.Session;
import org.springframework.transaction.annotation.Transactional;
@Transactional
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeService.java 2012-04-26 10:00:48 +0000
@@ -2,6 +2,10 @@
import java.util.Collection;
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+
public class DefaultInventoryTypeService implements InventoryTypeService
{
// -------------------------------------------------------------------------
@@ -42,4 +46,14 @@
inventoryTypeStore.updateInventoryType( inventoryType );
}
+ public InventoryType getInventoryTypeByName( String name )
+ {
+ return inventoryTypeStore.getInventoryTypeByName( name );
+ }
+
+ public InventoryType getInventoryType( int id )
+ {
+ return inventoryTypeStore.getInventoryType( id );
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java 2012-04-26 10:00:48 +0000
@@ -2,12 +2,21 @@
import java.util.Collection;
+import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
import org.hisp.dhis.coldchain.inventory.EquipmentInstanceStore;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
-public class HibernateEquipmentInstanceStore implements EquipmentInstanceStore
+public class HibernateEquipmentInstanceStore
+ extends HibernateGenericStore<EquipmentInstance>
+ implements EquipmentInstanceStore
{
// -------------------------------------------------------------------------
// Dependencies
@@ -56,4 +65,41 @@
session.update( equipmentInstance );
}
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryTypeAttribute.class );
+ criteria.add( Restrictions.eq( "organisationUnit", orgUnit ) );
+
+ return criteria.list();
+ }
+
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryTypeAttribute.class );
+ criteria.add( Restrictions.eq( "organisationUnit", orgUnit ) );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+
+ return criteria.list();
+ }
+
+ public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
+ {
+ Number rs = (Number) getCriteria( Restrictions.eq( "organisationUnit", orgUnit ) ).add( Restrictions.eq( "inventoryType", inventoryType ) ).setProjection(
+ Projections.rowCount() ).uniqueResult();
+
+ return rs != null ? rs.intValue() : 0;
+ }
+
+ public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max )
+ {
+ String hql = "select e from EquipmentInstance e where e.organisationUnit = :orgUnit and e.inventoryType = :inventoryType order by e.id DESC";
+
+ return getQuery( hql ).setEntity( "organisationUnit", orgUnit ).setFirstResult( min ).setMaxResults(
+ max ).list();
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeStore.java 2012-04-26 10:00:48 +0000
@@ -2,9 +2,12 @@
import java.util.Collection;
+import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeStore;
public class HibernateInventoryTypeStore implements InventoryTypeStore
@@ -54,5 +57,21 @@
session.update( inventoryType );
}
+ public InventoryType getInventoryTypeByName( String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType.class );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ return (InventoryType) criteria.uniqueResult();
+ }
+
+ public InventoryType getInventoryType( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return (InventoryType) session.get( InventoryType.class, id );
+ }
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 10:00:48 +0000
@@ -32,6 +32,7 @@
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.EquipmentInstanceStore"
class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateEquipmentInstanceStore">
+ <property name="clazz" value="org.hisp.dhis.coldchain.inventory.EquipmentInstance" />
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.EquipmentStatusStore"
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/action/GetOrganisationUnitAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/action/GetOrganisationUnitAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/action/GetOrganisationUnitAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.coldchain.action;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetOrganisationUnitAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private Integer orgunitId;
+
+ public void setOrgunitId( Integer orgunitId )
+ {
+ this.orgunitId = orgunitId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgunitId );
+
+ message = organisationUnit.getName();
+
+ return SUCCESS;
+ }
+
+}
=== added directory 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment'
=== added directory 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action'
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,159 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOption;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddEquipmentAction implements Action
+{
+ public static final String PREFIX_ATTRIBUTE = "attr";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ private InventoryTypeService inventoryTypeService;
+
+ private InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService;
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ // -------------------------------------------------------------------------
+ // Input/ Output
+ // -------------------------------------------------------------------------
+
+ private Integer ouId;
+
+ private Integer itypeId;
+
+ private String message;
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ {
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouId );
+
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( itypeId );
+
+
+ // -----------------------------------------------------------------------------
+ // Preparing EquipmentInstance
+ // -----------------------------------------------------------------------------
+ EquipmentInstance equipmentInstance = new EquipmentInstance();
+
+ equipmentInstance.setInventoryType( inventoryType );
+ equipmentInstance.setOrganisationUnit( orgUnit );
+
+ // -----------------------------------------------------------------------------
+ // Preparing Equipment Details
+ // -----------------------------------------------------------------------------
+ HttpServletRequest request = ServletActionContext.getRequest();
+ String value = null;
+
+ List<InventoryTypeAttribute> inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+ List<EquipmentDetails> equipmentDeatilsList = new ArrayList<EquipmentDetails>();
+
+ EquipmentDetails equipmentDetails = null;
+ for ( InventoryTypeAttribute attribute : inventoryTypeAttributes )
+ {
+ value = request.getParameter( PREFIX_ATTRIBUTE + attribute.getId() );
+ if ( StringUtils.isNotBlank( value ) )
+ {
+ equipmentDetails = new EquipmentDetails();
+ equipmentDetails.setEquipmentInstance( equipmentInstance );
+ equipmentDetails.setInventoryTypeAttribute( attribute );
+
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) )
+ {
+ InventoryTypeAttributeOption option = inventoryTypeAttributeOptionService.getInventoryTypeAttributeOption( NumberUtils.toInt( value, 0 ) );
+ if ( option != null )
+ {
+ equipmentDetails.setInventoryTypeAttributeOption( option );
+ equipmentDetails.setValue( option.getName() );
+ }
+ else
+ {
+ // Someone deleted this option ...
+ }
+ }
+ else
+ {
+ equipmentDetails.setValue( value.trim() );
+ }
+ equipmentDeatilsList.add( equipmentDetails );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ // Creating Equipment Instance and saving equipment data
+ // -----------------------------------------------------------------------------
+ Integer id = equipmentInstanceService.createEquipment( equipmentInstance, equipmentDeatilsList );
+
+ message = id + "";
+
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters and Getters
+ // -------------------------------------------------------------------------
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ public void setInventoryTypeAttributeOptionService(
+ InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService )
+ {
+ this.inventoryTypeAttributeOptionService = inventoryTypeAttributeOptionService;
+ }
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ public void setOuId( Integer ouId )
+ {
+ this.ouId = ouId;
+ }
+
+ public void setItypeId( Integer itypeId )
+ {
+ this.itypeId = itypeId;
+ }
+
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/EquipmentSelectAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/EquipmentSelectAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/EquipmentSelectAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class EquipmentSelectAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitSelectionManager selectionManager;
+
+ public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ private List<InventoryType> inventoryTypes;
+
+ public List<InventoryType> getInventoryTypes()
+ {
+ return inventoryTypes;
+ }
+
+ private Integer orgUnitId;
+
+ public void setOrgUnitId( Integer orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+ if( organisationUnit == null )
+ {
+ System.out.println("Organisationunit is null");
+ }
+ else
+ {
+ System.out.println("Organisationunit is not null"+ orgUnitId);
+ }
+
+ if( organisationUnit == null && orgUnitId != null )
+ {
+ organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+ }
+
+ inventoryTypes = new ArrayList<InventoryType>( inventoryTypeService.getAllInventoryTypes() );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,152 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+public class GetEquipmentInstanceListAction extends ActionPagingSupport<EquipmentInstance>
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private EquipmentInstanceService equipmentInstanceService;
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<EquipmentInstance> equipmentInstanceList;
+
+ public List<EquipmentInstance> getEquipmentInstanceList()
+ {
+ return equipmentInstanceList;
+ }
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String inventoryTypeId;
+
+ public void setInventoryTypeId( String inventoryTypeId )
+ {
+ this.inventoryTypeId = inventoryTypeId;
+ }
+
+ private String inventoryTypeAttributeId;
+
+ public void setInventoryTypeAttributeId( String inventoryTypeAttributeId )
+ {
+ this.inventoryTypeAttributeId = inventoryTypeAttributeId;
+ }
+
+ private Boolean listAll;
+
+ public void setListAll( Boolean listAll )
+ {
+ this.listAll = listAll;
+ }
+
+ private Integer total;
+
+ public Integer getTotal()
+ {
+ return total;
+ }
+
+ private String searchText;
+
+ public String getSearchText()
+ {
+ return searchText;
+ }
+
+ public void setSearchText( String searchText )
+ {
+ this.searchText = searchText;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ System.out.println("insde GetEquipmentInstanceListAction");
+
+ OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
+
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
+
+
+ if ( listAll != null && listAll )
+ {
+ listAllEquipmentInstance( orgUnit, inventoryType );
+
+ return SUCCESS;
+ }
+
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( Integer.parseInt( inventoryTypeAttributeId ) );
+
+ listEquipmentInstancesByFilter( orgUnit, inventoryType, inventoryTypeAttribute, searchText);
+ //equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType ) );
+
+ return SUCCESS;
+ }
+
+ private void listAllEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
+ {
+ total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType );
+
+ this.paging = createPaging( total );
+
+ equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType, paging.getStartPos(), paging
+ .getPageSize() ) );
+ }
+
+ private void listEquipmentInstancesByFilter( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchKey )
+ {
+ //total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType, inventoryTypeAttribute, searchText );
+
+ this.paging = createPaging( total );
+
+ //equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType, inventoryTypeAttribute, searchText, paging.getStartPos(), paging.getPageSize() ) );
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowAddEquipmentFormAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,86 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowAddEquipmentFormAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String inventoryTypeId;
+
+ public void setInventoryTypeId( String inventoryTypeId )
+ {
+ this.inventoryTypeId = inventoryTypeId;
+ }
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+ private List<InventoryTypeAttribute> inventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getInventoryTypeAttributes()
+ {
+ return inventoryTypeAttributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ organisationUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
+
+ inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
+
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,103 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+ private CatalogTypeService catalogTypeService;
+
+ public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+ {
+ this.catalogTypeService = catalogTypeService;
+ }
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private Integer catalogType;
+
+ public void setCatalogType( Integer catalogType )
+ {
+ this.catalogType = catalogType;
+ }
+
+ private boolean tracking;
+
+ public void setTracking( boolean tracking )
+ {
+ this.tracking = tracking;
+ }
+
+ private List<Integer> selectedList;
+
+ public void setSelectedList( List<Integer> selectedList )
+ {
+ this.selectedList = selectedList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ InventoryType inventoryType = new InventoryType();
+
+ inventoryType.setName( name );
+ inventoryType.setDescription( description );
+ inventoryType.setTracking( tracking );
+
+ inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
+
+ Set<InventoryTypeAttribute> inventoryTypeSet = new HashSet<InventoryTypeAttribute>();
+ for( Integer inventoryTypeAttId : selectedList )
+ {
+ inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
+ }
+
+ inventoryType.setInventoryTypeAttributes( inventoryTypeSet );
+
+ inventoryTypeService.addInventoryType( inventoryType );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ inventoryType = inventoryTypeService.getInventoryType( id );
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java 2012-04-21 12:57:24 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java 2012-04-26 10:00:48 +0000
@@ -3,8 +3,10 @@
import java.util.ArrayList;
import java.util.List;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
import com.opensymphony.xwork2.Action;
@@ -20,6 +22,13 @@
this.inventoryTypeAttributeService = inventoryTypeAttributeService;
}
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -30,13 +39,30 @@
return inventoryTypeAttributes;
}
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
throws Exception
{
- inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+ System.out.println(" Inside GetInventoryTypeAttributeListAction");
+ if( id != null )
+ {
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( id );
+
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+ }
+ else
+ {
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+ }
/**
* TODO - need to write comparator for sorting the list
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeListAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetInventoryTypeListAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private List<InventoryType> inventoryTypes;
+
+ public List<InventoryType> getInventoryTypes()
+ {
+ return inventoryTypes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ inventoryTypes = new ArrayList<InventoryType>( inventoryTypeService.getAllInventoryTypes() );
+
+ /**
+ * TODO - need to write comparator for sorting the list
+ */
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,69 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ try
+ {
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( id );
+
+ inventoryTypeService.deleteInventoryType( inventoryType );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+ }
+
+ return ERROR;
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowAddInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowAddInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowAddInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,61 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowAddInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private CatalogTypeService catalogTypeService;
+
+ public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+ {
+ this.catalogTypeService = catalogTypeService;
+ }
+
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private List<CatalogType> catalogTypes;
+
+ public List<CatalogType> getCatalogTypes()
+ {
+ return catalogTypes;
+ }
+
+ private List<InventoryTypeAttribute> inventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getInventoryTypeAttributes()
+ {
+ return inventoryTypeAttributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ catalogTypes = new ArrayList<CatalogType>( catalogTypeService.getAllCatalogTypes() );
+
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,78 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUpdateInventoryTypeAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+ private List<InventoryTypeAttribute> availInventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getAvailInventoryTypeAttributes()
+ {
+ return availInventoryTypeAttributes;
+ }
+
+ private List<InventoryTypeAttribute> selInventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getSelInventoryTypeAttributes()
+ {
+ return selInventoryTypeAttributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( id ) );
+
+ availInventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+
+ selInventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+
+ availInventoryTypeAttributes.removeAll( selInventoryTypeAttributes );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,108 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.List;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ private CatalogTypeService catalogTypeService;
+
+ public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+ {
+ this.catalogTypeService = catalogTypeService;
+ }
+
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private Integer catalogType;
+
+ public void setCatalogType( Integer catalogType )
+ {
+ this.catalogType = catalogType;
+ }
+
+ private boolean tracking;
+
+ public void setTracking( boolean tracking )
+ {
+ this.tracking = tracking;
+ }
+
+ private List<Integer> selectedList;
+
+ public void setSelectedList( List<Integer> selectedList )
+ {
+ this.selectedList = selectedList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( id );
+
+ inventoryType.setName( name );
+ inventoryType.setDescription( description );
+ inventoryType.setTracking( tracking );
+
+ inventoryType.setCatalogType( catalogTypeService.getCatalogType( catalogType ) );
+
+ inventoryType.getInventoryTypeAttributes().clear();
+
+ for( Integer inventoryTypeAttId : selectedList )
+ {
+
+ inventoryType.getInventoryTypeAttributes().add( inventoryTypeAttributeService.getInventoryTypeAttribute( inventoryTypeAttId ) );
+ }
+
+ inventoryTypeService.updateInventoryType( inventoryType );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAction.java 2012-04-26 10:00:48 +0000
@@ -0,0 +1,74 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class ValidateInventoryTypeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ name = name.trim();
+
+ InventoryType match = inventoryTypeService.getInventoryTypeByName( name );
+
+ if ( match != null && (id == null || match.getId() != id.intValue()) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return INPUT;
+ }
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-25 09:03:17 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 10:00:48 +0000
@@ -162,11 +162,12 @@
ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
</bean>
-<!-- Inventory -->
+<!-- InventoryTypeAttribute -->
<bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeListAction"
class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeListAction"
scope="prototype">
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAttributeAction"
class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAttributeAction"
@@ -205,5 +206,80 @@
scope="prototype">
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
</bean>
+
+<!-- InventoryType -->
+ <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction"
+ class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ShowAddInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowAddInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+<!-- EquipmentDetails -->
+ <bean id="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
+ class="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction"
+ class="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction"
+ scope="prototype">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceListAction"
+ class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceListAction"
+ scope="prototype">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
+ scope="prototype">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-25 09:03:17 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-26 10:00:48 +0000
@@ -145,7 +145,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
-<!-- Inventory -->
+<!-- InventoryTypeAttribute -->
<action name="inventoryTypeAttributeList" class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeListAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-coldchain/inventoryTypeAttributeList.vm</param>
@@ -157,7 +157,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-coldchain/addInventoryTypeAttributeForm.vm</param>
<param name="javascripts">javascript/inventoryTypeAttribute.js</param>
- <param name="stylesheets">style/basic.css</param>
+ <param name="stylesheets">css/basic.css</param>
<param name="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_ADD</param>
</action>
@@ -179,7 +179,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-coldchain/updateInventoryTypeAttibuteForm.vm</param>
<param name="javascripts">javascript/inventoryTypeAttribute.js,../dhis-web-commons/javascripts/jQuery/ui/jquery.cluetip.min.js</param>
- <param name="stylesheets">style/basic.css</param>
+ <param name="stylesheets">css/basic.css</param>
<param name="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_UPDATE</param>
</action>
@@ -209,7 +209,92 @@
<result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryTypeAttribute.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
+
+<!-- InventoryType -->
+ <action name="inventoryTypeList" class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/inventoryTypeList.vm</param>
+ <param name="menu">/dhis-web-coldchain/menu.vm</param>
+ <param name="javascripts">javascript/inventoryType.js</param>
+ </action>
+ <action name="showAddInventoryTypeForm" class="org.hisp.dhis.coldchain.inventory.action.ShowAddInventoryTypeAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/addInventoryTypeForm.vm</param>
+ <param name="javascripts">javascript/inventoryType.js</param>
+ <param name="stylesheets">css/basic.css</param>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_ADD</param>
+ </action>
+ <action name="validateInventoryType" class="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+ <action name="addInventoryType"
+ class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAction">
+ <result name="success" type="redirect">inventoryTypeList.action</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_ADD</param>
+ </action>
+ <action name="showUpdateInventoryTypeForm"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/updateInventoryTypeForm.vm</param>
+ <param name="javascripts">javascript/inventoryType.js,../dhis-web-commons/javascripts/jQuery/ui/jquery.cluetip.min.js</param>
+ <param name="stylesheets">css/basic.css</param>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_UPDATE</param>
+ </action>
+ <action name="updateInventoryType"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAction">
+ <result name="success" type="redirect">inventoryTypeList.action</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_UPDATE</param>
+ </action>
+ <action name="removeInventoryType"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_DELETE</param>
+ </action>
+ <action name="getInventoryType"
+ class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAction">
+ <result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryType.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+<!-- EquipmentDetails -->
+ <action name="enquipmentSelect"
+ class="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/selectEquipment.vm</param>
+ <param name="menu">/dhis-web-coldchain/equipmentMenu.vm</param>
+ <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/equipment.js</param>
+ <param name="requiredAuthorities">F_EQUIPMENT_MANAGEMENT</param>
+ <interceptor-ref name="organisationUnitTreeStack" />
+ </action>
+ <action name="getOrganisationUnit"
+ class="org.hisp.dhis.coldchain.action.GetOrganisationUnitAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ </action>
+ <action name="getInventoryTypeAttributes" class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeListAction">
+ <result name="success" type="velocity-xml">/dhis-web-coldchain/responseInventoryTypeAttributes.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+ <action name="getEquipmentInstances" class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceListAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-coldchain/equipmentInstanceList.vm</param>
+ <param name="requiredAuthorities">F_EQUIPMENT_MANAGEMENT</param>
+ </action>
+ <action name="showAddEquipmentForm"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-coldchain/addEquipmentForm.vm</param>
+ <param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
+ </action>
+ <action name="addEquipment"
+ class="">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
+ </action>
+
</package>
</struts>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,93 @@
+## Macro for generating the jQuery validation rules
+#macro( validate $type $require )
+ #if( $type == "NUMBER" )
+ {validate:{ number:true #if($require), required:true #end }}
+ #elseif( $require )
+ {validate:{required:true}}
+ #end
+#end
+
+
+<script>
+
+ jQuery(document).ready( function(){
+
+ currentDiv = 'equipmentForm';
+ isSubmit = true;
+
+ jQuery("#equipmentForm").validate({
+ meta:"validate"
+ ,errorElement:"span"
+ ,submitHandler: function(form)
+ {
+ if( isSubmit )
+ {
+ addEquipment();
+ }
+ }
+ });
+ });
+
+</script>
+
+<h3>$i18n.getString( "add_new_equipment" )</h3>
+
+<form id="equipmentForm" name="equipmentForm" method="post" >
+<input type="text" name="ouId" value="$organisationUnit.id" />
+<input type="text" name="itypeId" vlaue="$inventoryType.id" />
+<table>
+ <tr>
+ <td>$i18n.getString( "registering_unit" ) : </td>
+ <td>$organisationUnit.name</td>
+ </tr>
+
+ <tr>
+ <td>$i18n.getString( "inventory_type" ) : </th>
+ <td>$inventoryType.name</th>
+ </tr>
+
+ <!-- InventoryType Attributes -->
+ <tr><td> </td><td> </td></tr>
+ <tr><th colspan="2" class="heading-column">$i18n.getString( "inventory_attribute_details" )</th></tr>
+ #foreach( $attribute in $inventoryTypeAttributes )
+ <tr>
+ <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+ <td class="input-column">
+ #if( $attribute.valueType == "YES/NO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" >
+ <option value="" >[$i18n.getString( "please_select" )]</option>
+ <option value="true">$i18n.getString( "yes" )</option>
+ <option value="false" >$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $attribute.valueType == "DATE" )
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )' />
+ <script type="text/javascript">
+ datePickerValid( 'attr$attribute.id' );
+ </script>
+ #elseif( $attribute.valueType == "COMBO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.attributeOptions )
+ <option value="$option.id" >$option.name</option>
+ #end
+ </select>
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ #end
+ </td>
+ </tr>
+ #end
+
+
+</table>
+<p>
+ <input type="submit" class="button" value="$i18n.getString( 'add' )"/>
+ <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadPatientList();"/>
+</p>
+
+</form>
+
+<script>
+ var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
+ var i18n_add_equipment_successfully = '$encoder.jsEscape( $i18n.getString( "add_equipment_successfully" ) , "'" )';
+</script>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,116 @@
+
+<script>
+
+jQuery(document).ready(function() {
+ validation2('addInventoryTypeForm', function(form) {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function() {
+ selectAllById('selectedList');
+ },
+ });
+
+ checkValueIsExist("name", "validateInventoryType.action");
+
+});
+
+</script>
+<h3>$i18n.getString( "create_new_inventorytype" )</h3>
+<form id="addInventoryTypeForm" action="addInventoryType.action" method="post" >
+
+<table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "inventorytype_details" )</th></tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true,rangelength:[2,160]}}"/></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="description" name="description" class="{validate:{required:true,minlength:2}}"/></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="tracking">$i18n.getString( "tracking" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="tracking" name="tracking">
+ <option value="true" >$i18n.getString( "yes" )</option>
+ <option value="false" selected="selected">$i18n.getString( "no" )</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="valueType">$i18n.getString( "catalog_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="catalogType" name="catalogType">
+ #foreach( $catalogType in $catalogTypes )
+ <option value="$catalogType.id">$catalogType.name</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <br/>
+
+ <table id="dataElementSelectionArea">
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_data_elements" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_data_elements" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">
+ #foreach( $inventoryTypeAttribute in $inventoryTypeAttributes )
+ <option value="$inventoryTypeAttribute.id">$inventoryTypeAttribute.name</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onClick="moveSelectedById( 'availableList', 'selectedList' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onClick="moveSelectedById( 'selectedList', 'availableList' )"/><br/>
+ </td>
+ <td>
+ <select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'selectedList', 'availableList' )"></select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='inventoryTypeList.action'" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+
+
+<span id='message'></span>
+
+</form>
+
+<script type="text/javascript">
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var isSubmit = true;
+</script>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,113 @@
+<table>
+ <tr>
+ <td class='text-column' >$i18n.getString( "search_result_matching_the_search_criteria" ):</td>
+ <td> </td>
+ <td> </td>
+ <td>
+ #if($!listAll)
+ $i18n.getString( "list_all_equipment" )
+ #else
+ $i18n.getString( "search_equipment_by_attributes" )
+ #end
+ </td>
+ </tr>
+
+ <tr>
+ <td class='text-column' >$i18n.getString( "total_result" )</td>
+ <td> </td>
+ <td> </td>
+ <td>$!total</td>
+ </tr>
+</table>
+
+#if( $equipmentInstanceList.size() > 0 )
+<table class="mainPageTable">
+ <tr>
+ <td>
+ <table class="listTable" id="equipmentList" width='100%'>
+ <col/>
+ <col/>
+ <col width="200"/>
+
+ <thead>
+ <tr>
+ <th>#</th>
+ <th>$i18n.getString( "id" )</th>
+ <th style="text-align:center" class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $equipmentInstance in $equipmentInstanceList )
+ <tr id="tr${equipmentInstance.id}" #alternate($mark) >
+
+ <td>
+ #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount )
+ $nr
+ </td>
+
+ <td>$!equipmentInstance.id</td>
+
+ <td>
+ <a href="javascript:showUpdateEquipmentForm( '$equipmentInstance.id' )" title='$i18n.getString( "edit_equipment" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_equipment" )'></a>
+ <a href="javascript:showEquipmentTrackingForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "migration_patient" )' style='width:25px; height:25px'></a>
+ <a href="javascript:removePatient( '$equipmentInstance.id', '$encoder.jsEncode( $equipmentInstance.id )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
+ <a href="javascript:showEquipmentDetails( '$equipmentInstance.id' )" title='$i18n.getString( "equipment_details" )'><img src="../images/information.png" alt='$i18n.getString( "equipment_details" )'></a>
+ </td>
+
+ </tr>
+ #set( $mark = !$mark)
+ #end
+ </tbody>
+
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="6">
+ <p></p>
+ <div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </div>
+ </td>
+ <td></td>
+ </tr>
+</table>
+
+<div id="detailsInfo"></div>
+
+#end
+<script type="text/javascript">
+ jQuery(document).ready(function(){
+ tableSorter( 'patientList' );
+ });
+ var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
+
+ var i18n_id = '$encoder.jsEscape( $i18n.getString( "id" ), "'")';
+ var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ), "'")';
+ var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ), "'")';
+ var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ), "'")';
+ var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ), "'")';
+ var i18n_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ), "'")';
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
+ var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';
+ var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+ var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
+ var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
+ var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+ var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+ var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
+ var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
+ var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
+ var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+ var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
+ var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
+ var i18n_scheduled_for = '$encoder.jsEscape( $i18n.getString( "scheduled_for" ) , "'")';
+ var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+ var i18n_create_new_encounter = '$encoder.jsEscape( $i18n.getString( "create_new_encounter" ) , "'")';
+ var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+</script>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentMenu.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentMenu.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentMenu.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,46 @@
+
+<a href="index.action"><h2>$i18n.getString( "coldchain_management" ) </h2></a>
+
+<ul>
+ <li><a href="enquipmentSelect.action">$i18n.getString( "equipment_registration " )</a></li>
+</ul>
+
+<br>
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+
+<script>
+function organisationUnitSelected( orgUnits )
+{
+ document.getElementById('selectedOrgunitID').value = orgUnits;
+
+ showById('selectDiv');
+ disable('listAllEquipmentBtn');
+
+ hideById('searchEquipmentDiv');
+ hideById('listEquipmentDiv');
+ hideById('editEquipmentDiv');
+ hideById('resultSearchDiv');
+
+ $.getJSON( 'getOrganisationUnit.action', {orgunitId:orgUnits[0]}
+ , function( json )
+ {
+ var type = json.response;
+ setFieldValue('selectedOrgunitText', json.message );
+
+ if( type == 'success' )
+ {
+ //showById('searchEquipmentDiv');
+ enable('listAllEquipmentBtn');
+ setInnerHTML('warnmessage','');
+ setFieldValue('selectedOrgunitText', json.message );
+ }
+ else if( type == 'input' )
+ {
+ setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
+ disable('listPatientBtn');
+ }
+ } );
+}
+selection.setListenerFunction( organisationUnitSelected );
+
+</script>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm 2012-04-21 12:57:24 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm 2012-04-26 10:00:48 +0000
@@ -36,7 +36,7 @@
<td style="text-align:center">
<a href="javascript:removeInventoryTypeAttribute( '$inventoryTypeAttribute.id', '$encoder.jsEncode( $inventoryTypeAttribute.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- </td>
+ </td>
<td style="text-align:center">
<a href="javascript:showInventoryTypeAttributeDetails( $inventoryTypeAttribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,81 @@
+
+<h3>$i18n.getString( "inventorytype_management" ) #openHelp( "inventorytype" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>
+ $i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
+ </td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddInventoryTypeForm.action'" style="width:70px"></td>
+ </tr>
+ </table>
+
+ <table class="listTable">
+ <col>
+ <col width="20">
+ <col width="20">
+ <col width="20">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th colspan="3">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $inventoryType in $inventoryTypes )
+ <tr id="tr${inventoryType.id}">
+
+ <td>$encoder.htmlEncode( $inventoryType.name )</td>
+
+ <td style="text-align:center">
+ <a href="showUpdateInventoryTypeForm.action?id=$inventoryType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ </td>
+
+ <td style="text-align:center">
+ <a href="javascript:removeInventoryType( '$inventoryType.id', '$encoder.jsEncode( $inventoryType.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ </td>
+
+ <td style="text-align:center">
+ <a href="javascript:showInventoryTypeDetails( $inventoryType.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+
+ </tr>
+ #end
+
+ </tbody>
+
+ </table>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "tracking" ):</label><br><span id="trackingField"></span></p>
+ <p><label class="bold">$i18n.getString( "catalog_type" ):</label><br><span id="catalogTypeField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_inventorytype" ) , "'" )';
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+ var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
+ var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
+ var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
+ var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
+ var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
+ var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
+ var i18n_all = '$encoder.jsEscape( $i18n.getString( "all" ) , "'")';
+</script>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 2012-04-26 10:00:48 +0000
@@ -0,0 +1,175 @@
+
+// ----------------------------------------------------------------
+// On InventoryType Change - Loading InventoryTypeAttributes
+// ----------------------------------------------------------------
+function inventoryTypeChange( inventoryTypeId )
+{
+ if( inventoryTypeId == "0" )
+ return;
+
+ showById('selectDiv');
+ disable('listAllEquipmentBtn');
+
+ hideById('searchEquipmentDiv');
+ hideById('listEquipmentDiv');
+ hideById('editEquipmentDiv');
+ hideById('resultSearchDiv');
+
+ jQuery('#loaderDiv').show();
+
+ $.post("getInventoryTypeAttributes.action",
+ {
+ id:inventoryTypeId
+ },
+ function(data)
+ {
+ showById('searchEquipmentDiv');
+ enable('listAllEquipmentBtn');
+ jQuery('#loaderDiv').hide();
+ populateInventoryTypeAttributes( data );
+ },'xml');
+}
+
+function populateInventoryTypeAttributes( data )
+{
+ var searchingAttributeId = document.getElementById("searchingAttributeId");
+ clearList( searchingAttributeId );
+
+ var invenTypeAttribs = data.getElementsByTagName("inventory-type-attribute");
+ for ( var i = 0; i < invenTypeAttribs.length; i++ )
+ {
+ var id = invenTypeAttribs[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var name = invenTypeAttribs[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
+
+ var option = document.createElement("option");
+ option.value = id;
+ option.text = name;
+ option.title = name;
+ searchingAttributeId.add(option, null);
+ }
+}
+
+//----------------------------------------------------------------
+//On LoadAllEquipments
+//----------------------------------------------------------------
+
+function loadAllEquipments()
+{
+ var orgUnitId = document.getElementById('selectedOrgunitID').value;
+ var inventoryType = document.getElementById('inventoryType');
+ var inventoryTypeId = inventoryType.options[ inventoryType.selectedIndex ].value;
+
+ if( inventoryTypeId == 0 )
+ {
+ alert("Plese select Inventorytype");
+ return;
+ }
+
+ hideById('editEquipmentDiv');
+ hideById('resultSearchDiv');
+
+ showById('selectDiv');
+ showById('searchEquipmentDiv');
+
+ jQuery('#loaderDiv').show();
+ contentDiv = 'listEquipmentDiv';
+
+ jQuery('#listEquipmentDiv').load('getEquipmentInstances.action',{
+ listAll:true,
+ orgUnitId:orgUnitId,
+ InventoryTypeId:inventoryTypeId
+ },
+ function(){
+ statusSearching = 0;
+ showById('listEquipmentDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+}
+
+//----------------------------------------------------------------
+// Load Equipments On Filter by InventoryType Attribute
+//----------------------------------------------------------------
+
+function loadEquipmentsByFilter( )
+{
+ var orgUnitId = document.getElementById('selectedOrgunitID').value;
+ var inventoryType = document.getElementById('inventoryType');
+ var inventoryTypeId = inventoryType.options[ inventoryType.selectedIndex ].value;
+ var searchText = document.getElementById('searchText').value;
+
+ if( inventoryTypeId == 0 )
+ {
+ alert("Plese select Inventorytype");
+ return;
+ }
+
+ var inventoryTypeAttribute = document.getElementById('searchingAttributeId');
+ var inventoryTypeAttributeId = inventoryTypeAttribute.options[ inventoryTypeAttribute.selectedIndex ].value;
+ hideById('editEquipmentDiv');
+ hideById('resultSearchDiv');
+
+ showById('selectDiv');
+ showById('searchEquipmentDiv');
+
+ jQuery('#loaderDiv').show();
+ contentDiv = 'listEquipmentDiv';
+
+ jQuery('#listEquipmentDiv').load('getEquipmentInstances.action',{
+ orgUnitId:orgUnitId,
+ inventoryTypeId:inventoryTypeId,
+ inventoryTypeAttributeId:inventoryTypeAttributeId,
+ searchText:searchText
+ },
+ function(){
+ statusSearching = 0;
+ showById('listEquipmentDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+}
+
+//----------------------------------------------------------------
+//Add Equipment
+//----------------------------------------------------------------
+
+function showAddEquipmentForm()
+{
+ var orgUnitId = document.getElementById('selectedOrgunitID').value;
+ var inventoryType = document.getElementById('inventoryType');
+ var inventoryTypeId = inventoryType.options[ inventoryType.selectedIndex ].value;
+ if( inventoryTypeId == 0 )
+ {
+ alert("Plese select inventorytype");
+ return;
+ }
+
+ hideById('listEquipmentDiv');
+ hideById('selectDiv');
+ hideById('searchEquipmentDiv');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#editEquipmentDiv').load('showAddEquipmentForm.action',{
+ orgUnitId:orgUnitId,
+ inventoryTypeId:inventoryTypeId
+ },
+ function()
+ {
+ showById('editEquipmentDiv');
+ jQuery('#loaderDiv').hide();
+ });
+}
+
+function addEquipment()
+{
+ $.ajax({
+ type: "POST",
+ url: 'addEquipment.action',
+ data: getParamsForDiv('editEquipmentDiv'),
+ success: function(json) {
+ var type = json.response;
+ jQuery('#resultSearchDiv').dialog('close');
+ }
+ });
+ return false;
+}
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js 2012-04-26 10:00:48 +0000
@@ -0,0 +1,28 @@
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showInventoryTypeDetails( inventoryTypeId )
+{
+ jQuery.getJSON( 'getInventoryType.action', { id: inventoryTypeId },
+ function ( json ) {
+ setInnerHTML( 'nameField', json.inventoryType.name );
+ setInnerHTML( 'descriptionField', json.inventoryType.description );
+
+ var tracking = ( json.inventoryType.tracking == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'trackingField', tracking );
+
+ setInnerHTML( 'catalogTypeField', json.inventoryType.catalogType );
+
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove InvenotryType
+// -----------------------------------------------------------------------------
+function removeInventoryType( invenotryTypeId, name )
+{
+ removeItem( invenotryTypeId, name, i18n_confirm_delete, 'removeInventoryType.action' );
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryType.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryType.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryType.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,9 @@
+{ "inventoryType":
+ {
+ "id": "${inventoryType.id}",
+ "name": "$!encoder.jsonEncode( ${inventoryType.name} )",
+ "description": "$!encoder.jsonEncode( ${inventoryType.description} )",
+ "catalogType": "$!encoder.jsonEncode( ${inventoryType.catalogType.name} )",
+ "tracking": "$!{inventoryType.tracking}"
+ }
+}
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-04-21 12:57:24 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-04-26 10:00:48 +0000
@@ -8,4 +8,11 @@
<h2>$i18n.getString( "inventory" )</h2>
<ul>
<li><a href="inventoryTypeAttributeList.action">$i18n.getString( "inventorytype_attribute" )</a></li>
+ <li><a href="inventoryTypeList.action">$i18n.getString( "inventorytype" )</a></li>
+</ul>
+
+
+<h2>$i18n.getString( "equipment" )</h2>
+<ul>
+ <li><a href="enquipmentSelect.action">$i18n.getString( "equipment" )</a></li>
</ul>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseInventoryTypeAttributes.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseInventoryTypeAttributes.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseInventoryTypeAttributes.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<inventory-type-attributes>
+ #foreach( $inventoryTypeAttribute in $inventoryTypeAttributes )
+ <inventory-type-attribute>
+ <id>$inventoryTypeAttribute.id</id>
+ <name>$inventoryTypeAttribute.name</name>
+ </inventory-type-attribute>
+ #end
+</inventory-type-attributes>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,161 @@
+
+<input type="hidden" id='selectedOrgunitID' />
+
+<div id='selectDiv'>
+
+ <h3>$i18n.getString( "equipment_management" ) #openHelp( "equipment" )</h3>
+
+ <table>
+ <tr>
+ <td><label>$i18n.getString( "registering_unit" )</label></td>
+ <td style="padding-right:5px"><input type="text" id='selectedOrgunitText' value="$!organisationUnit.name" readonly style="min-width:16em"></td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "inventorytype" )</label></td>
+ <td style="padding-right:5px">
+ <select id="inventoryType" style="min-width:16em" onchange="inventoryTypeChange( this.value )">
+ <option value="0">$i18n.getString( "select_inventorytype" )</option>
+ #foreach( $inventoryType in $inventoryTypes )
+ <option value="$inventoryType.id">$inventoryType.name</option>
+ #end
+ </select>
+ </td>
+ <td style="padding-right:5px"><input type="button" id='listAllEquipmentBtn' value="$i18n.getString( 'list_all_equipments' )" onclick='loadAllEquipments();'></td>
+ <td><span id='warnmessage' style='color:red'></span></td>
+ </tr>
+ </table>
+
+</div>
+
+<div id='searchEquipmentDiv' style='display:none'>
+ <table id='advancedSearchTB'>
+ <tbody>
+ <tr id='advSearchBox0'>
+ <td id='searchingAttributeIdTD'>
+ <select id="searchingAttributeId" name="searchingAttributeId" style="width:20.2em" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchingAttributeOnChange( this.value )">
+ </select>
+ <em title="$i18n.getString( "required" )" class="required">*</em></label>
+ </td>
+ <td>
+ <input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );'>
+
+ </td>
+ <td></td>
+ <td><input type="button" value='$i18n.getString( "search" )' onclick='loadEquipmentsByFilter();'></td>
+ <td> </td>
+ <td><input type="button" value='$i18n.getString( "add_new" )' onclick="showAddEquipmentForm();"></td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div id='listEquipmentDiv'></div> <!-- List All/Filtered Equipments -->
+<div id='editEquipmentDiv'></div> <!-- Add / Edit Equipment Form -->
+<div id='resultSearchDiv' style='font-size:13px'></div> <!-- List searching Equipment -->
+
+#parse( "/dhis-web-commons/loader/loader.vm" )
+
+<script>
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
+ var i18n_can_not_register_patient_for_orgunit = '$encoder.jsEscape( $i18n.getString( "can_not_register_patient_for_orgunit" ), "'")';
+ var i18n_please_select_village = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_village" ), "'")' + ']';
+ var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+ var i18n_select_program = '[' + '$encoder.jsEscape( $i18n.getString( "select_program" ), "'")' + ']';
+ var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+ var i18n_list_all_patient = '$encoder.jsEscape( $i18n.getString( "list_all_patient" ) , "'")';
+ var i18n_enrol_success = '$encoder.jsEscape( $i18n.getString( "enrol_success" ) , "'")';
+ var i18n_unenrol_success = '$encoder.jsEscape( $i18n.getString( "unenrol_success" ) , "'")';
+ var i18n_list_patients_by_program = '$encoder.jsEscape( $i18n.getString( "list_patients_by_program" ) , "'" )';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )';
+ var i18n_adding_patient_failed = '$encoder.jsEscape( $i18n.getString( "adding_patient_failed" ), "'")';
+ var i18n_updating_patient_failed = '$encoder.jsEscape( $i18n.getString( "updating_patient_failed" ), "'")';
+ var i18n_program_enrollment_failed = '$encoder.jsEscape( $i18n.getString( "program_enrollment_failed" ) , "'")';
+ var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+ var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+ var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
+ var i18n_date_invalid = '$encoder.jsEscape( $i18n.getString( "date_invalid" ) , "'")';
+ var i18n_date_less_incident = '$encoder.jsEscape( $i18n.getString( "date_less_incident" ) , "'")';
+ var i18n_enroll_to_program = '$encoder.jsEscape( $i18n.getString( "enroll_to_program" ) , "'")';
+ var i18n_update = '$encoder.jsEscape( $i18n.getString( "update" ) , "'")';
+ var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
+ var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';
+ var i18n_patient_attributes = '$encoder.jsEscape( $i18n.getString( "patient_attributes" ) , "'")';
+ var i18n_patient_id = '$encoder.jsEscape( $i18n.getString( "id" ) , "'")';
+ var i18n_patient_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'")';
+ var i18n_patient_demographics = '$encoder.jsEscape( $i18n.getString( "demographics" ) , "'")';
+ var i18n_patient_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'")';
+ var i18n_patient_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'")';
+ var i18n_patient_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ), "'")';
+ var i18n_patient_age = '$encoder.jsEscape( $i18n.getString( "age" ) , "'")';
+ var i18n_patient_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ) , "'")';
+ var i18n_patient_phone_number = '$encoder.jsEscape( $i18n.getString( "phone_number" ) , "'")';
+ var i18n_edit_this_patient = '$encoder.jsEscape( $i18n.getString( "edit_this_patient" ) , "'")';
+ var i18n_no_duplicate_found = '$encoder.jsEscape( $i18n.getString( "no_duplicate_found" ) , "'")';
+ var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
+ var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
+ var i18n_no_patients_found = '$encoder.jsEscape( $i18n.getString( "no_patients_found" ) , "'")';
+ var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
+ var i18n_duplicated_patient_list = '$encoder.jsEscape( $i18n.getString( "duplicated_patient_list" ) , "'")';
+ var i18n_duplicate_warning = '$encoder.jsEscape( $i18n.getString( "duplicate_warning" ) , "'")';
+ var i18n_search_by_name_identifier = '$encoder.jsEscape( $i18n.getString( "search_by_name_identifier" ) , "'")';
+ var i18n_search_by_program = '$encoder.jsEscape( $i18n.getString( "search_by_program" ) , "'")';
+ var i18n_create_new_patient = '$encoder.jsEscape( $i18n.getString( "create_new_patient" ) , "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_person" ) , "'")';
+ var i18n_representative_info = '$encoder.jsEscape( $i18n.getString( "representative_info" ) , "'")';
+ var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
+ var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';
+
+ var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+ var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
+ var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
+ var i18n_value_must_negative_integer = '$encoder.jsEscape( $i18n.getString( "value_must_negative_integer" ) , "'")';
+ var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n "
+ + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '"
+ + dateFormat.replace('yy', 'yyyy') + " '" ;
+ var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+ var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
+ var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
+ var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
+ var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
+ var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+ var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
+
+ var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
+ var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+ var i18n_please_fill_out_only_one_of_these_fields = '$encoder.jsEscape( $i18n.getString( "please_fill_out_only_one_of_these_fields" ) , "'")';
+ var checkedDuplicate = false;
+ // -1: no search anything
+ // 0: show list all patient
+ // 1: search with conditions
+ var statusSearching = -1;
+ isAjax = true;
+ contentDiv = '';
+
+ var searchTextBox = '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" onkeyup="searchPatientsOnKeyUp( event );">';
+ var trueFalseBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
+ trueFalseBox += '<option value="true">' + i18n_yes + '</option>';
+ trueFalseBox += '<option value="false">' + i18n_no + '</option>';
+ trueFalseBox += '</select>';
+ var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
+ #foreach ( $program in $programs )
+ programComboBox += '<option value="$program.id">$program.name</option>';
+ #end
+ programComboBox += '</select>';
+
+ #if( $status == 1 )
+ setFieldValue('selectedOrgunitText', i18n_please_select_village );
+ setInnerHTML('warnmessage', '' );
+ #elseif( $status == 2 )
+ setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
+ setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
+ #else
+ setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
+ setInnerHTML('warnmessage', '' );
+ showById('searchPatientDiv');
+ #end
+
+</script>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm 2012-04-26 10:00:48 +0000
@@ -0,0 +1,123 @@
+
+<script>
+
+jQuery(document).ready(function() {
+ validation2('updateInventoryTypeForm', function(form) {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function() {
+ selectAllById('selectedList');
+ },
+ });
+
+ checkValueIsExist("name", "validateInventoryType.action", {
+ id : $organisationUnitGroupSet.id
+ });
+
+});
+
+</script>
+<h3>$i18n.getString( "edit_inventorytype" )</h3>
+<form id="updateInventoryTypeForm" action="updateInventoryType.action" method="post" >
+
+<input type="hidden" id="id" name="id" value="$inventoryType.id"/>
+
+<table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "inventorytype_details" )</th></tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $inventoryType.name )" class="{validate:{required:true,rangelength:[2,160]}}"/></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $inventoryType.description )" class="{validate:{required:true,minlength:2}}"/></td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="tracking">$i18n.getString( "tracking" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="tracking" name="tracking">
+ <option value="true" #if( $inventoryType.tracking ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( !$inventoryType.tracking ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="valueType">$i18n.getString( "catalog_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="catalogType" name="catalogType">
+ #foreach( $catalogType in $catalogTypes )
+ <option value="$catalogType.id" #if( $inventoryType.catalogType.id ) selected="selected" #end>$catalogType.name</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+ <br/>
+
+ <table id="dataElementSelectionArea">
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_attributes" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_attributes" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">
+ #foreach( $inventoryTypeAttribute in $availInventoryTypeAttributes )
+ <option value="$inventoryTypeAttribute.id">$inventoryTypeAttribute.name</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onClick="moveSelectedById( 'availableList', 'selectedList' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onClick="moveSelectedById( 'selectedList', 'availableList' )"/><br/>
+ </td>
+ <td>
+ <select id="selectedList" name="selectedList" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" ondblclick="moveSelectedById( 'selectedList', 'availableList' )">
+ #foreach( $inventoryTypeAttribute1 in $selInventoryTypeAttributes )
+ <option value="$inventoryTypeAttribute1.id">$inventoryTypeAttribute1.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='inventoryTypeList.action'" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+
+<span id='message'></span>
+
+</form>
+
+<script type="text/javascript">
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var isSubmit = true;
+</script>