dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17060
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6671: CCEM_InventoryTypeAttribute - Workinprogress
------------------------------------------------------------
revno: 6671
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-04-21 18:27:24 +0530
message:
CCEM_InventoryTypeAttribute - Workinprogress
added:
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java
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/RemoveInventoryTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAttributeOptionAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeAttributeForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeAttributeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryTypeAttribute.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeAttributeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryTypeAttribute.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeAttibuteForm.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeOptionService.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/hibernate/HibernateInventoryTypeAttributeOptionStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeAttributeStore.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties
local/in/dhis-web-coldchain/src/main/resources/struts.xml
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/InventoryTypeAttribute.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java 2012-04-21 12:57:24 +0000
@@ -1,8 +1,11 @@
package org.hisp.dhis.coldchain.inventory;
import java.io.Serializable;
+import java.util.HashSet;
import java.util.Set;
+import org.hisp.dhis.patient.PatientAttributeOption;
+
public class InventoryTypeAttribute implements Serializable
{
public static final String TYPE_DATE = "DATE";
@@ -150,4 +153,10 @@
this.attributeOptions = attributeOptions;
}
+ public void addAttributeOptions( InventoryTypeAttributeOption option )
+ {
+ if ( attributeOptions == null )
+ attributeOptions = new HashSet<InventoryTypeAttributeOption>();
+ attributeOptions.add( option );
+ }
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionService.java 2012-04-21 12:57:24 +0000
@@ -12,5 +12,11 @@
void deleteInventoryTypeAttributeOption( InventoryTypeAttributeOption inventoryTypeAttributeOption );
+ InventoryTypeAttributeOption getInventoryTypeAttributeOption( int id );
+
Collection<InventoryTypeAttributeOption> getAllInventoryTypeAttributeOptions();
+
+ Collection<InventoryTypeAttributeOption> get( InventoryTypeAttribute inventoryTypeAttribute);
+
+ InventoryTypeAttributeOption get( InventoryTypeAttribute inventoryTypeAttribute, String name );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeOptionStore.java 2012-04-21 12:57:24 +0000
@@ -12,6 +12,11 @@
void deleteInventoryTypeAttributeOption( InventoryTypeAttributeOption inventoryTypeAttributeOption );
+ InventoryTypeAttributeOption getInventoryTypeAttributeOption( int id );
+
Collection<InventoryTypeAttributeOption> getAllInventoryTypeAttributeOptions();
+ Collection<InventoryTypeAttributeOption> get( InventoryTypeAttribute inventoryTypeAttribute);
+
+ InventoryTypeAttributeOption get( InventoryTypeAttribute inventoryTypeAttribute, String name );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeService.java 2012-04-21 12:57:24 +0000
@@ -13,5 +13,10 @@
void deleteInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute );
Collection<InventoryTypeAttribute> getAllInventoryTypeAttributes();
+
+ InventoryTypeAttribute getInventoryTypeAttribute( int id );
+
+ InventoryTypeAttribute getInventoryTypeAttributeByName( String name );
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttributeStore.java 2012-04-21 12:57:24 +0000
@@ -13,4 +13,9 @@
void deleteInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute );
Collection<InventoryTypeAttribute> getAllInventoryTypeAttributes();
+
+ InventoryTypeAttribute getInventoryTypeAttribute( int id );
+
+ InventoryTypeAttribute getInventoryTypeAttributeByName( String name );
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeOptionService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryTypeAttributeOptionService.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/DefaultInventoryTypeAttributeOptionService.java 2012-04-21 12:57:24 +0000
@@ -44,4 +44,18 @@
inventoryTypeAttributeOptionStore.updateInventoryTypeAttributeOption( inventoryTypeAttributeOption );
}
+ public Collection<InventoryTypeAttributeOption> get( InventoryTypeAttribute inventoryTypeAttribute)
+ {
+ return inventoryTypeAttributeOptionStore.get( inventoryTypeAttribute );
+ }
+
+ public InventoryTypeAttributeOption get( InventoryTypeAttribute inventoryTypeAttribute, String name )
+ {
+ return inventoryTypeAttributeOptionStore.get( inventoryTypeAttribute, name );
+ }
+
+ public InventoryTypeAttributeOption getInventoryTypeAttributeOption( int id )
+ {
+ return inventoryTypeAttributeOptionStore.getInventoryTypeAttributeOption( id );
+ }
}
=== 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-16 11:29:53 +0000
+++ 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
@@ -4,6 +4,7 @@
import org.springframework.transaction.annotation.Transactional;
+@Transactional
public class DefaultInventoryTypeAttributeService implements InventoryTypeAttributeService
{
// -------------------------------------------------------------------------
@@ -20,30 +21,39 @@
// -------------------------------------------------------------------------
// InventoryTypeAttribute
// -------------------------------------------------------------------------
- @Transactional
+
@Override
public int addInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
{
return inventoryTypeAttributeStore.addInventoryTypeAttribute( inventoryTypeAttribute );
}
- @Transactional
+
@Override
public void deleteInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
{
inventoryTypeAttributeStore.deleteInventoryTypeAttribute( inventoryTypeAttribute );
}
- @Transactional
+
@Override
public Collection<InventoryTypeAttribute> getAllInventoryTypeAttributes()
{
return inventoryTypeAttributeStore.getAllInventoryTypeAttributes();
}
- @Transactional
+
@Override
public void updateInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
{
inventoryTypeAttributeStore.updateInventoryTypeAttribute( inventoryTypeAttribute );
}
+ public InventoryTypeAttribute getInventoryTypeAttribute( int id )
+ {
+ return inventoryTypeAttributeStore.getInventoryTypeAttribute( id );
+ }
+
+ public InventoryTypeAttribute getInventoryTypeAttributeByName( String name )
+ {
+ return inventoryTypeAttributeStore.getInventoryTypeAttributeByName( name );
+ }
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeAttributeOptionStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeAttributeOptionStore.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/HibernateInventoryTypeAttributeOptionStore.java 2012-04-21 12:57:24 +0000
@@ -2,8 +2,11 @@
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.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOption;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionStore;
@@ -55,5 +58,32 @@
session.update( inventoryTypeAttributeOption );
}
-
+
+ public InventoryTypeAttributeOption getInventoryTypeAttributeOption( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return (InventoryTypeAttributeOption) session.get( InventoryTypeAttributeOption.class, id );
+ }
+
+ public Collection<InventoryTypeAttributeOption> get( InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryTypeAttributeOption.class );
+ criteria.add( Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) );
+
+ return criteria.list();
+ }
+
+ public InventoryTypeAttributeOption get( InventoryTypeAttribute inventoryTypeAttribute, String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryTypeAttributeOption.class );
+ criteria.add( Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ return (InventoryTypeAttributeOption) criteria.uniqueResult();
+ }
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeAttributeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryTypeAttributeStore.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/HibernateInventoryTypeAttributeStore.java 2012-04-21 12:57:24 +0000
@@ -2,10 +2,13 @@
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.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeStore;
+import org.hisp.dhis.reports.Report_in;
public class HibernateInventoryTypeAttributeStore implements InventoryTypeAttributeStore
{
@@ -55,5 +58,21 @@
session.update( inventoryTypeAttribute );
}
+ public InventoryTypeAttribute getInventoryTypeAttribute( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return (InventoryTypeAttribute) session.get( InventoryTypeAttribute.class, id );
+ }
+ public InventoryTypeAttribute getInventoryTypeAttributeByName( String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryTypeAttribute.class );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ return (InventoryTypeAttribute) criteria.uniqueResult();
+ }
+
}
=== added directory 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory'
=== added directory 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action'
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.List;
+
+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.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddInventoryTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ private InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService;
+
+ public void setInventoryTypeAttributeOptionService(
+ InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService )
+ {
+ this.inventoryTypeAttributeOptionService = inventoryTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // 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 String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private boolean mandatory;
+
+ public void setMandatory( boolean mandatory )
+ {
+ this.mandatory = mandatory;
+ }
+
+ private List<String> attrOptions;
+
+ public void setAttrOptions( List<String> attrOptions )
+ {
+ this.attrOptions = attrOptions;
+ }
+
+ private Integer noChars;
+
+ public void setNoChars( Integer noChars )
+ {
+ this.noChars = noChars;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ System.out.println("Inside AddInventoryTypeAttributeAction");
+
+ InventoryTypeAttribute inventoryTypeAttribute = new InventoryTypeAttribute();
+
+ inventoryTypeAttribute.setName( name );
+ inventoryTypeAttribute.setDescription( description );
+ inventoryTypeAttribute.setMandatory( mandatory );
+ inventoryTypeAttribute.setNoChars( noChars );
+ inventoryTypeAttribute.setValueType( valueType );
+
+ inventoryTypeAttributeService.addInventoryTypeAttribute( inventoryTypeAttribute );
+
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ InventoryTypeAttributeOption opt = null;
+ for ( String optionName : attrOptions )
+ {
+ opt = new InventoryTypeAttributeOption();
+ opt.setName( optionName );
+ opt.setInventoryTypeAttribute( inventoryTypeAttribute );
+ inventoryTypeAttribute.addAttributeOptions( opt );
+ inventoryTypeAttributeOptionService.addInventoryTypeAttributeOption( opt );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetInventoryTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private InventoryTypeAttribute inventoryTypeAttribute;
+
+ public InventoryTypeAttribute getInventoryTypeAttribute()
+ {
+ return inventoryTypeAttribute;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ System.out.println("inside GetInventoryTypeAttributeAction");
+
+ inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( id );
+
+ return SUCCESS;
+ }
+
+}
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,48 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetInventoryTypeAttributeListAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private List<InventoryTypeAttribute> inventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getInventoryTypeAttributes()
+ {
+ return inventoryTypeAttributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ throws Exception
+ {
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+
+ /**
+ * 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/RemoveInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,71 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveInventoryTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // 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
+ {
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( id );
+
+ inventoryTypeAttributeService.deleteInventoryTypeAttribute( inventoryTypeAttribute );
+ }
+ 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/RemoveInventoryTypeAttributeOptionAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAttributeOptionAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/RemoveInventoryTypeAttributeOptionAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOption;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveInventoryTypeAttributeOptionAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService;
+
+ public void setInventoryTypeAttributeOptionService(
+ InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService )
+ {
+ this.inventoryTypeAttributeOptionService = inventoryTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ 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
+ {
+
+ InventoryTypeAttributeOption attributeOption = inventoryTypeAttributeOptionService.getInventoryTypeAttributeOption( id );
+
+ if ( attributeOption != null )
+ {
+ //int count = equipment.countByInventoryTypeAttributeOption( attributeOption );
+ //if ( count > 0 )
+ //{
+ // message = i18n.getString( "warning_delete_patient_attribute_option" );
+ // return INPUT;
+ //}
+ //else
+ {
+ inventoryTypeAttributeOptionService.deleteInventoryTypeAttributeOption( attributeOption );
+ message = i18n.getString( "success_delete_inventorytype_attribute_option" );
+ return SUCCESS;
+ }
+ }
+ else
+ {
+ message = i18n.getString( "error_delete_inventorytype_attribute_option" );
+ return ERROR;
+ }
+ }
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUpdateInventoryTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private InventoryTypeAttribute inventoryTypeAttribute;
+
+ public InventoryTypeAttribute getInventoryTypeAttribute()
+ {
+ return inventoryTypeAttribute;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( id );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,144 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.ServletActionContext;
+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.InventoryTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateInventoryTypeAttributeAction implements Action
+{
+ public static final String PREFIX_ATTRIBUTE_OPTION = "attrOption";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private InventoryTypeAttributeService inventoryTypeAttributeService;
+
+ public void setInventoryTypeAttributeService( InventoryTypeAttributeService inventoryTypeAttributeService )
+ {
+ this.inventoryTypeAttributeService = inventoryTypeAttributeService;
+ }
+
+ private InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService;
+
+ public void setInventoryTypeAttributeOptionService(
+ InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService )
+ {
+ this.inventoryTypeAttributeOptionService = inventoryTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private int id;
+
+ public void setId( int 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 String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private boolean mandatory;
+
+ public void setMandatory( boolean mandatory )
+ {
+ this.mandatory = mandatory;
+ }
+
+ private List<String> attrOptions;
+
+ public void setAttrOptions( List<String> attrOptions )
+ {
+ this.attrOptions = attrOptions;
+ }
+
+ private Integer noChars;
+
+ public void setNoChars( Integer noChars )
+ {
+ this.noChars = noChars;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( id );
+
+ inventoryTypeAttribute.setName( name );
+ inventoryTypeAttribute.setDescription( description );
+ inventoryTypeAttribute.setMandatory( mandatory );
+ inventoryTypeAttribute.setNoChars( noChars );
+ inventoryTypeAttribute.setValueType( valueType );
+
+ HttpServletRequest request = ServletActionContext.getRequest();
+ Collection<InventoryTypeAttributeOption> attributeOptions = inventoryTypeAttributeOptionService.get( inventoryTypeAttribute );
+
+ if ( attributeOptions != null && attributeOptions.size() > 0 )
+ {
+ String value = null;
+ for ( InventoryTypeAttributeOption option : attributeOptions )
+ {
+ value = request.getParameter( PREFIX_ATTRIBUTE_OPTION + option.getId() );
+ if ( StringUtils.isNotBlank( value ) )
+ {
+ option.setName( value.trim() );
+ inventoryTypeAttributeOptionService.updateInventoryTypeAttributeOption( option );
+ // inventoryTypeAttributeOptionService.updateInventoryTypeAttributeValues( option );
+ }
+ }
+ }
+
+ if ( attrOptions != null )
+ {
+ InventoryTypeAttributeOption opt = null;
+ for ( String optionName : attrOptions )
+ {
+ opt = inventoryTypeAttributeOptionService.get( inventoryTypeAttribute, optionName );
+ if ( opt == null )
+ {
+ opt = new InventoryTypeAttributeOption();
+ opt.setName( optionName );
+ opt.setInventoryTypeAttribute( inventoryTypeAttribute );
+ inventoryTypeAttribute.addAttributeOptions( opt );
+ inventoryTypeAttributeOptionService.addInventoryTypeAttributeOption( opt );
+ }
+ }
+ }
+
+ inventoryTypeAttributeService.updateInventoryTypeAttribute( inventoryTypeAttribute );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ValidateInventoryTypeAttributeAction.java 2012-04-21 12:57:24 +0000
@@ -0,0 +1,76 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class ValidateInventoryTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+ 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 message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ System.out.println("Inside validateInvenotryTypeAttribute ");
+
+ name = name.trim();
+
+ InventoryTypeAttribute match = inventoryTypeAttributeService.getInventoryTypeAttributeByName( 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-21 10:23:39 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-21 12:57:24 +0000
@@ -93,5 +93,51 @@
scope="prototype">
<property name="catalogTypeService"
ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
- </bean>
+ </bean>
+
+
+<!-- Inventory -->
+ <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" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeOptionAction"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeOptionAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeAction"
+ scope="prototype">
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
+ </bean>
+
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties'
--- local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-04-21 10:23:39 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-04-21 12:57:24 +0000
@@ -25,4 +25,9 @@
everything_is_ok = Everything is OK
catalogType = Catalog Type
confirm_delete = Are you sure you want to delete this catalog type?
-catalogType_management = Catalog Type management
\ No newline at end of file
+catalogType_management = Catalog Type management
+
+inventorytype_attribute_management = Inventorytype Attribute Management
+inventorytype_attribute = Inventorytype Attribute
+create_new_inventorytype_attribute = Create new inventorytype attribute
+inventorytype_attribute_details = Inventorytype attribute details
\ 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-21 10:23:39 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-21 12:57:24 +0000
@@ -85,7 +85,73 @@
<param name="page">/dhis-web-coldchain/catalogTypeList.vm</param>
<param name="menu">/dhis-web-coldchain/menu.vm</param>
<param name="javascripts">javascript/catalogType.js</param>
- </action>
+ </action>
+
+<!-- Inventory -->
+ <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>
+ <param name="menu">/dhis-web-coldchain/menu.vm</param>
+ <param name="javascripts">javascript/inventoryTypeAttribute.js</param>
+ </action>
+
+ <action name="showAddInventoryTypeAttributeForm" class="org.hisp.dhis.coldchain.action.NoAction">
+ <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="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_ADD</param>
+ </action>
+
+ <action name="addInventoryTypeAttribute"
+ class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAttributeAction">
+ <result name="success" type="redirect">inventoryTypeAttributeList.action</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_ADD</param>
+ </action>
+
+ <action name="validateInventoryTypeAttribute"
+ class="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAttributeAction">
+ <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="showUpdateInventoryTypeAttributeForm"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAttributeAction">
+ <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="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_UPDATE</param>
+ </action>
+
+ <action name="updateInventoryTypeAttribute"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeAttributeAction">
+ <result name="success" type="redirect">inventoryTypeAttributeList.action</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_UPDATE</param>
+ </action>
+
+ <action name="removeInventoryTypeAttribute"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeAction">
+ <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_INVENTORYTYPEATTRIBUTE_DELETE</param>
+ </action>
+
+ <action name="removeInventoryTypeAttributeOption"
+ class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAttributeOptionAction">
+ <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>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPEATTRIBUTE_DELETE</param>
+ </action>
+
+ <action name="getInventoryTypeAttribute"
+ class="org.hisp.dhis.coldchain.inventory.action.GetInventoryTypeAttributeAction">
+ <result name="success" type="velocity-json">/dhis-web-coldchain/jsonInventoryTypeAttribute.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
</package>
</struts>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeAttributeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeAttributeForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeAttributeForm.vm 2012-04-21 12:57:24 +0000
@@ -0,0 +1,80 @@
+<script type="text/javascript" src="javascript/addInventoryTypeAttributeForm.js"></script>
+
+<h3>$i18n.getString( "create_new_inventorytype_attribute" )</h3>
+<form id="addInventoryTypeAttributeForm" action="addInventoryTypeAttribute.action" method="post" >
+
+<table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "inventorytype_attribute_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="mandatory">$i18n.getString( "mandatory" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="mandatory" name="mandatory">
+ <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="noChar">$i18n.getString( "no_of_char" )</label></td>
+ <td>
+ <input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" />
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="valueType" name="valueType" onchange="ATTRIBUTE_OPTION.selectValueType(this);">
+ <option value="NUMBER" selected="selected">$i18n.getString( "number" )</option>
+ <option value="TEXT">$i18n.getString( "text" )</option>
+ <option value="YES/NO">$i18n.getString( "yes_no" )</option>
+ <option value="DATE">$i18n.getString( "date" )</option>
+ <option value="COMBO">$i18n.getString( "attribute_combo_type" )</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr id="attributeComboRow">
+ <td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
+ </td>
+ <td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
+ </tr>
+
+ </tbody>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='inventoryTypeAttributeList.action'" />
+ </td>
+ </tr>
+</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/css/basic.css'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css 2012-04-21 12:57:24 +0000
@@ -0,0 +1,90 @@
+.heading-column { width : 30.5em;}
+td.input-column { width : 30.5em;}
+td.input-column input, td.input-column select { width: 28.5em;}
+td.error {padding-left:1em}
+
+textarea{
+ width:320px;
+ text-align:left;
+}
+
+input[type="text"]{
+ width:320px;
+ text-align:left;
+}
+
+select
+{
+ width:325px;
+ text-align:left;
+}
+
+input[type="button"], input[type="submit"]
+{
+ width: 160px;
+ padding-left:5px;
+ padding-right:5px;
+}
+
+input.filterButton
+{
+ width: 30px;
+ padding-left:5px;
+ padding-right:5px;
+ text-align:center;
+}
+
+.hidden
+{
+ display: none;
+}
+
+.visible
+{
+ display: block;
+}
+
+.imgButton
+{
+ cursor:pointer;
+}
+
+fieldset
+{
+ border: 1px solid #3f5d8e;
+}
+
+tr.selected{
+ background-color:#3399FF;
+ color:#FFFFFF;
+}
+
+#selectedList tr{
+ cursor:pointer;
+}
+
+.dataElementDiv
+{
+ overflow:auto;
+ height:20em;
+ width:30em;
+ border:1px solid #9DA1AA;
+}
+
+.dataElementDiv table
+{
+ width:100%;
+}
+
+.small-button {
+ font-size: .8em !important;
+}
+
+.ui-autocomplete { height: 100px; overflow-y: scroll; overflow-x: hidden; }
+
+
+input.autocompleted-field
+{
+ width:25em;
+ text-align:left;
+}
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeAttributeList.vm 2012-04-21 12:57:24 +0000
@@ -0,0 +1,81 @@
+
+<h3>$i18n.getString( "inventorytype_attribute_management" ) #openHelp( "inventorytype_attribute" )</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='showAddInventoryTypeAttributeForm.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( $inventoryTypeAttribute in $inventoryTypeAttributes )
+ <tr id="tr${inventoryTypeAttribute.id}">
+
+ <td>$encoder.htmlEncode( $inventoryTypeAttribute.name )</td>
+
+ <td style="text-align:center">
+ <a href="showUpdateInventoryTypeAttributeForm.action?id=$inventoryTypeAttribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ </td>
+
+ <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 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>
+ </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( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
+ <p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
+
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_inventorytype_attribute" ) , "'" )';
+ 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/addInventoryTypeAttributeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeAttributeForm.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeAttributeForm.js 2012-04-21 12:57:24 +0000
@@ -0,0 +1,21 @@
+jQuery(document).ready( function(){
+ validation( 'addInventoryTypeAttributeForm', function(form){
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
+ }
+ }, function(){
+ isSubmit = true;
+
+ var fields = jQuery("#addInventoryTypeAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
+ });
+
+ jQuery("#attributeComboRow").hide();
+
+ checkValueIsExist( "name", "validateInventoryTypeAttribute.action");
+ });
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryTypeAttribute.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryTypeAttribute.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryTypeAttribute.js 2012-04-21 12:57:24 +0000
@@ -0,0 +1,95 @@
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showInventoryTypeAttributeDetails( inventoryTypeAttributeId )
+{
+ jQuery.getJSON( 'getInventoryTypeAttribute.action', { id: inventoryTypeAttributeId },
+ function ( json ) {
+ setInnerHTML( 'nameField', json.inventoryTypeAttribute.name );
+ setInnerHTML( 'descriptionField', json.inventoryTypeAttribute.description );
+
+ var mandatory = ( json.inventoryTypeAttribute.mandatory == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'mandatoryField', mandatory );
+
+ setInnerHTML( 'valueTypeField', json.inventoryTypeAttribute.valueType );
+
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove InvenotryType Attribute
+// -----------------------------------------------------------------------------
+function removeInventoryTypeAttribute( invenotryTypeAttributeId, name )
+{
+ removeItem( invenotryTypeAttributeId, name, i18n_confirm_delete, 'removeInventoryTypeAttribute.action' );
+}
+
+ATTRIBUTE_OPTION =
+{
+ selectValueType : function (this_)
+ {
+ if ( jQuery(this_).val() == "COMBO" )
+ {
+ jQuery("#attributeComboRow").show();
+ if( jQuery("#attrOptionContainer").find("input").length ==0 )
+ {
+ ATTRIBUTE_OPTION.addOption();
+ ATTRIBUTE_OPTION.addOption();
+ }
+ }else {
+ jQuery("#attributeComboRow").hide();
+ }
+ },
+ checkOnSubmit : function ()
+ {
+ if( jQuery("#valueType").val() != "COMBO" )
+ {
+ jQuery("#attrOptionContainer").children().remove();
+ return true;
+ }else {
+ $("input","#attrOptionContainer").each(function(){
+ if( !jQuery(this).val() )
+ jQuery(this).remove();
+ });
+ if( $("input","#attrOptionContainer").length < 2)
+ {
+ alert(i118_at_least_2_option);
+ return false;
+ }else return true;
+ }
+ },
+ addOption : function ()
+ {
+ jQuery("#attrOptionContainer").append(ATTRIBUTE_OPTION.createInput());
+ },
+ remove : function (this_, optionId)
+ {
+
+ if( jQuery(this_).siblings("input").attr("name") != "attrOptions")
+ {
+ jQuery.get("removeInvenotryTypeAttributeOption.action?id="+optionId,function(data){
+ if( data.response == "success")
+ {
+ jQuery(this_).parent().parent().remove();
+ showSuccessMessage( data.message );
+ }else
+ {
+ showErrorMessage( data.message );
+ }
+ });
+ }else
+ {
+ jQuery(this_).parent().parent().remove();
+ }
+ },
+ removeInAddForm : function(this_)
+ {
+ jQuery(this_).parent().parent().remove();
+ },
+ createInput : function ()
+ {
+ return "<tr><td><input type='text' name='attrOptions' /><a href='#' style='text-decoration: none; margin-left:0.5em;' title='"+i18n_remove_option+"' onClick='ATTRIBUTE_OPTION.remove(this,null)'>[ - ]</a></td></tr>";
+ }
+}
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeAttributeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeAttributeForm.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeAttributeForm.js 2012-04-21 12:57:24 +0000
@@ -0,0 +1,19 @@
+jQuery(document).ready( function(){
+ validation( 'updateInventoryTypeAttributeForm', function(form){
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
+ }
+ }, function(){
+ isSubmit = true;
+
+ var fields = $("#addInventoryTypeAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
+ });
+
+ checkValueIsExist( "name", "validateInventoryTypeAttribute.action", {id:getFieldValue('id')});
+});
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryTypeAttribute.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryTypeAttribute.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonInventoryTypeAttribute.vm 2012-04-21 12:57:24 +0000
@@ -0,0 +1,9 @@
+{ "inventoryTypeAttribute":
+ {
+ "id": "${inventoryTypeAttribute.id}",
+ "name": "$!encoder.jsonEncode( ${inventoryTypeAttribute.name} )",
+ "description": "$!encoder.jsonEncode( ${inventoryTypeAttribute.description} )",
+ "mandatory": "$!{inventoryTypeAttribute.mandatory}",
+ "valueType": "$!encoder.jsonEncode( ${inventoryTypeAttribute.valueType} )",
+ }
+}
\ 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 10:23:39 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-04-21 12:57:24 +0000
@@ -3,5 +3,9 @@
<ul>
<li><a href="coldChainCatalogTypeAttribute.action">$i18n.getString( "catalogType_attribute" )</a></li>
<li><a href="catalogType.action">$i18n.getString( "catalogType" )</a></li>
-
-</ul>
\ No newline at end of file
+</ul>
+
+<h2>$i18n.getString( "inventory" )</h2>
+<ul>
+ <li><a href="inventoryTypeAttributeList.action">$i18n.getString( "inventorytype_attribute" )</a></li>
+</ul>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeAttibuteForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeAttibuteForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeAttibuteForm.vm 2012-04-21 12:57:24 +0000
@@ -0,0 +1,99 @@
+<script type="text/javascript" src="javascript/updateInventoryTypeAttributeForm.js"></script>
+
+<h3>$i18n.getString( "edit_inventorytype_attribute" )</h3>
+
+<form id="updateInventoryTypeAttributeForm" name="updateInventoryTypeAttributeForm" action="updateInventoryTypeAttribute.action" method="post" >
+
+<div style="display:inline">
+ <input type="hidden" id="id" name="id" value="$inventoryTypeAttribute.id">
+</div>
+
+ <table id="detailsList">
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "inventorytype_attribute_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $inventoryTypeAttribute.name )" class="{validate:{required:true,rangelength:[2,160]}}"></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "description" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $inventoryTypeAttribute.description )" class="{validate:{required:true,minlength:2}}"></td>
+ </tr>
+
+ <tr>
+ <td><label for="mandatory">$i18n.getString( "mandatory" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td>
+ <select id="mandatory" name="mandatory">
+ <option value="true" #if( $inventoryTypeAttribute.mandatory ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( !$inventoryTypeAttribute.mandatory ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td><label for="noChar">$i18n.getString( "no_of_char" )</label></td>
+ <td>
+ <input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" value="$!inventoryTypeAttribute.noChars">
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td>
+ <select id="valueType" name="valueType" onchange="ATTRIBUTE_OPTION.selectValueType(this);">
+ <option value="NUMBER" #if( $inventoryTypeAttribute.valueType == 'NUMBER' ) selected="selected" #end>$i18n.getString( "number" )</option>
+ <option value="TEXT" #if( $inventoryTypeAttribute.valueType == 'TEXT' ) selected="selected" #end>$i18n.getString( "text" )</option>
+ <option value="YES/NO" #if( $inventoryTypeAttribute.valueType == 'YES/NO' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
+ <option value="DATE" #if( $inventoryTypeAttribute.valueType == 'DATE' ) selected="selected" #end>$i18n.getString( "date" )</option>
+ <option value="COMBO" #if( $inventoryTypeAttribute.valueType == 'COMBO' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr id="attributeComboRow">
+ <td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td >
+ <table id="attrOptionContainer">
+ #foreach($option in $inventoryTypeAttribute.attributeOptions)
+ <tr><td>
+ <input type='text' name='attrOption$option.id' value="$option.name" style="width:28em;"/><a href='#' style='text-decoration: none; margin-left:0.5em;' title='$i18n.getString( "remove_option" )' onClick='ATTRIBUTE_OPTION.remove(this,$option.id)'>[ - ]</a>
+ </td>
+ </tr>
+ #end
+ </table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a></td>
+ <td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
+ </tr>
+
+ </tbody>
+
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'update' )">
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='inventoryTypeAttributeList.action'">
+ </td>
+ </tr>
+ </table>
+</form>
+
+<script>
+ if( jQuery('#valueType').val() == "COMBO")
+ {
+ jQuery("#attributeComboRow").show();
+ }
+ else
+ {
+ jQuery("#attributeComboRow").hide();
+ }
+
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var isSubmit = true;
+</script>