PDA

View Full Version : Row Editor having stack Over flow



shanika
15 Dec 2010, 1:29 AM
Hi !

I am having a problem with a row Editor .
I have a grid which is having a row Editor.
This row editor has 10 combo boxes related to each other.
Now when I edit one record it gives me Stock over Flow exception :s.

Can Someone Help me to fix this issue

//Shanika

mankz
15 Dec 2010, 1:47 AM
You'll need to post some code to get help.

shanika
15 Dec 2010, 1:57 AM
here is the full code

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="se.marakanda.mwaf.util.presentation.CachedResourceVersionHandler" %>
<%@ page import="se.marakanda.maccess.entity.model.UserProfileDTO" %>
<%@ page import="se.marakanda.mutil.i18n.I18NHelper" %>
<script type="text/javascript" src="/ebaftersales/scripts/AfterSalesCommon.js"></script>
<script type="text/javascript" src="/ebaftersales/scripts/RowEditor.js"></script>
<link rel="stylesheet" type="text/css" href="/ebaftersales/css/afterSales.css" />
<link rel="stylesheet" type="text/css" href="/ebaftersales/css/RowEditor.css" />

<jsp:include page="/ebaftersales/scripts/AfterSalesCommon.jsp"/>
<%
UserProfileDTO userProfileDto = (UserProfileDTO) session.getAttribute("CURRENT_USER_PROFILE");
I18NHelper i18NHelper = new I18NHelper();
i18NHelper.setLocale(userProfileDto.getLocale());
%>

<div id="orderBatchProcess"></div>
<style type="text/css">
.other-cell-color{
colour:'red'
}

.print_underline
{
display: inline-block;
/*height: 1em;*/
border-bottom: 1px solid #FF0000;
}


</style>
<script type="text/javascript">

base_width_size = 900;
base_height_size = 622;
var paramsObj = new Object();
var form = null ;
var grid = null ;

var comps = null ;
var orderStoreIndex = -1 ;
var strManufacturerCriteria = null ;
var strSeparator1 = '#' ;
var strSeparator2 = '_' ;


var strCategory = null ;
var strModel = null ;
var strProductCode = null ;
var strOwnerType = null ;
var strManufacturer = null ;
var strMode= null ;
var strClaimType = null ;
var strSymptomCategory = null ;
var strSymptomCode = null ;
var strType = null ;
var strOrderType = null ;
var ownerWhoDid = null ;
var strobjectDID = null ;
var message_valid_IMEI = false ;
var originID_disabled = true ;



var Order = Ext.data.Record.create([
{name: 'itemID', type: 'string'},
{name: 'Category', type: 'string'},
{name: 'objectTypeDid', type: 'number'},
{name: 'ownerWhoDid', type: 'number'},
{name: 'strobjectDID', type: 'number'},
{name: 'manufacturerDid', type: 'number'},
{name: 'categoryDid', type: 'number'},
{name: 'symptomCategoryDid', type: 'number'},
{name: 'symptomCodeDid', type: 'number'},
{name: 'claimTypeDid', type: 'number'},
{name: 'orderTypeDid', type: 'number'},
{name: 'modelDid', type: 'number'},
{name: 'ownerTypeDid', type: 'number'},
{name: 'Manufacturer', type: 'string'},
{name: 'Model', type: 'string'},
{name: 'ProductCode', type: 'string'},
{name: 'receivedfrom3rdparty', type: 'string'},
{name: 'originID', type: 'string'},
{name: 'ownerType', type: 'string'},
{name: 'ownerCode', type: 'string'},
{name: 'claimType', type: 'string'},
{name: 'pOPDate', type: 'date'},
{name: 'POPAttached', type: 'string'},
{name: 'override', type: 'string'},
{name: 'approvalCode', type: 'string'},
{name: 'SymptomCategory', type: 'string'},
{name: 'SymptomCode', type: 'string'},
{name: 'strType', type: 'string'},
{name: 'SymptomDetails', type: 'string'},
{name: 'cosmeticCondition', type: 'string'},
{name: 'status', type: 'string'},
{name: 'strManufacturerCriteria', type: 'string'}
]);

var SaveOrder = Ext.data.Record.create([
{name: 'itemID', type: 'string'},
{name: 'objectTypeDid', type: 'number'},
{name: 'ownerWhoDid', type: 'number'},
{name: 'strobjectDID', type: 'number'},
{name: 'manufacturerDid', type: 'number'},
{name: 'categoryDid', type: 'number'},
{name: 'symptomCodeDid', type: 'number'},
{name: 'claimTypeDid', type: 'number'},
{name: 'orderTypeDid', type: 'number'},
{name: 'modelDid', type: 'number'},
{name: 'ownerTypeDid', type: 'number'},
{name: 'receivedfrom3rdparty', type: 'string'},
{name: 'ProductCode', type: 'string'},
{name: 'originID', type: 'string'},
{name: 'ownerType', type: 'string'},
{name: 'ownerCode', type: 'string'},
{name: 'pOPDate', type: 'date'},
{name: 'POPAttached', type: 'string'},
{name: 'override', type: 'string'},
{name: 'approvalCode', type: 'string'},
{name: 'SymptomDetails', type: 'string'},
{name: 'cosmeticCondition', type: 'string'},
{name: 'status', type: 'string'},
{name: 'strManufacturerCriteria', type: 'string'}
]);




var orderStore = new Ext.data.GroupingStore({
autoDestroy: true,
reader: new Ext.data.JsonReader({fields: Order})

});

var editor = null;

var question_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufactureCriteria'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'questions',
id: 'objectQuizDID'
}, [
{name: 'objectQuizDID', mapping: 'objectQuizDID'},
{name: 'question', mapping: 'question'},
{name: 'serviceTypeDID', mapping: 'serviceTypeDID'},
{name: 'ordinal', mapping: 'ordinal'},
{name: 'helpI18nKey', mapping: 'helpI18nKey'}

])
});

var claimType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadServiceType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'serviceType_filter',
id: 'did'
}, [
{name: 'did', mapping: 'serviceType_did'},
{name: 'title', mapping: 'serviceType_type'}

])
});

var claimType_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadServiceType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'serviceType_filter',
id: 'did'
}, [
{name: 'did', mapping: 'serviceType_did'},
{name: 'title', mapping: 'serviceType_type'}

])
});

var symptomcategory_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCategories'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCategory',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCategory_did'},
{name: 'title', mapping: 'symptomCategory_type'}

])
});

var code_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCodes'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCodes',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCodes_did'},
{name: 'title', mapping: 'symptomCodes_type'}

])
});

var symptomcategory_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCategories'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCategory',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCategory_did'},
{name: 'title', mapping: 'symptomCategory_type'}

])
});

var code_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCodes'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCodes',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCodes_did'},
{name: 'title', mapping: 'symptomCodes_type'}

])
});

var orderType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadOrderCategory'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'orderCategory_filter',
id: 'did'
}, [
{name: 'did', mapping: 'orderCategory_did'},
{name: 'title', mapping: 'orderCategory_type'}

])
});

var ownerType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadRole'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'role_filter',
id: 'did'
}, [
{name: 'did', mapping: 'role_did'},
{name: 'title', mapping: 'role_type'}

])
});

var ownerType_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadRole'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'role_filter',
id: 'did'
}, [
{name: 'did', mapping: 'role_did'},
{name: 'title', mapping: 'role_type'}

])
});

var manufacturer_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufacturers'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'manufacturers',
id: 'did'
}, [
{name: 'did', mapping: 'manufacturers_type_did'},
{name: 'title', mapping: 'manufacturers_type'}

])
});

var type_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadProductType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_type_list_filter',
id: 'did'
}, [
{name: 'did', mapping: 'product_type_did'},
{name: 'title', mapping: 'product_type'}

])
});


var type_Store_row = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadProductType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_type_list_filter',
id: 'did'
}, [
{name: 'did', mapping: 'product_type_did'},
{name: 'title', mapping: 'product_type'}

])
});

var category_Store = new Ext.data.Store({
baseParams:{ajax_command:'loadProductGroupList'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_group_list',
id: 'product_group_did'
}, [
{name: 'did', mapping: 'product_group_did'},
{name: 'title', mapping: 'product_group'}

])
});

var category_Store_row = new Ext.data.Store({
baseParams:{ajax_command:'loadProductGroupList'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_group_list',
id: 'product_group_did'
}, [
{name: 'did', mapping: 'product_group_did'},
{name: 'title', mapping: 'product_group'}

])
});

var model_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadModel'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'model',
id: 'did'
}, [
{name: 'did', mapping: 'did'},
{name: 'title', mapping: 'model'}

])
});

var productCode_Store = new Ext.data.Store({
baseParams:{ajax_command:'loadProductCode'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'productCodes',
id: 'did'
}, [
{name: 'did', mapping: 'objectDid'},
{name: 'title', mapping: 'productCode'}

])
});

var model_RowStore = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadModel'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'model',
id: 'did'
}, [
{name: 'did', mapping: 'did'},
{name: 'title', mapping: 'model'}

])
});

var manufacturer_RowStore = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufacturers'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'manufacturers',
id: 'did'
}, [
{name: 'did', mapping: 'manufacturers_type_did'},
{name: 'title', mapping: 'manufacturers_type'}

])
});



function loadSymptomCategories(){

var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var categoryDid =Ext.getCmp('categoryDid').getValue();
var claimTypeDid =Ext.getCmp('claimTypeDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(categoryDid != null || categoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1)
){
symptomcategory_Store.load({params:{objectType:categoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

}

function loadSymptomCode(){

var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var claimTypeDid =Ext.getCmp('claimTypeDid').getValue();
var symptomcategoryDid =Ext.getCmp('symptomcategoryDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(symptomcategoryDid != null || symptomcategoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1) ){
code_Store.load({params:{symptomCategory:symptomcategoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

}

function loadManufacturerCriteria(){
var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var serviceType =Ext.getCmp('claimTypeDid').getValue();
var productType =Ext.getCmp('categoryDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(productType != null || productType != -1 )&&
(serviceType != null || serviceType != -1) ){

question_Store.removeAll();
question_Store.load({
params:{productType:productType,manufacturerDid:manufacturerDid,serviceType:serviceType}
});

}

}

function createManufacturerCriteria(){
comps.removeAll(true);

question_Store.each(function(r) {
var did = r.data['objectQuizDID'] ;
var question = r.data['question'] ;
var val = r.data['ordinal'] ;
comps.add(createRadioButtonGroup(did,question,val) ) ;

});
comps.doLayout();
form.doLayout();
}

function createRadioButtonGroup(did,question,val) {
var grp = new Ext.form.RadioGroup({
fieldLabel: question,
id: did,
columns:2,
height: 20,
labelWidth:100,
labelSeparator :'',
margins :{top:0, right:0, bottom:0, left:0},
items: [
{ boxLabel: 'Yes',name: did ,value:val },
{ boxLabel: 'No',name: did ,value:val}]

});

return grp;

}

function validateMandatoryFields(){
var flag = false ;

if (Ext.getCmp('claimTypeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('claimTypeDid').markInvalid('');
}
if(Ext.getCmp('orderTypeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('orderTypeDid').markInvalid('');
}
if(Ext.getCmp('categoryDid').getValue() == '' ){
flag = true ;
Ext.getCmp('categoryDid').markInvalid('');
}
if( Ext.getCmp('typeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('typeDid').markInvalid('');
}
if(Ext.getCmp('manufacturerDid').getValue() == '' ){
flag = true ;
Ext.getCmp('manufacturerDid').markInvalid('');
}

return flag;
}

function productCodeValidator(){
var objectType= Ext.getCmp('categoryDid').getValue();
var productCode= Ext.getCmp('productCode').getValue();
if(objectType == 212 ){
if(productCode.length != 15 ){
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>',
'<%=i18NHelper.getString("ebaftersales.error.batchCreate.length.fifteen","ebaftersales")%>', function() {
});
}
}

}


function validateProductCode(productCode){

var objectDid = null;
var manufacturer_Model = Ext.getCmp('modelDid').getValue();
var objectType= Ext.getCmp('categoryDid').getValue();

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}else{
strobjectDID = objectDid ;
}
},
failure: function() {
Ext.getCmp('productCode').reset() ;
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}
});

}

function isValidProductCode(productCode){

var objectDid = null;
var manufacturer_Model = Ext.getCmp('modelDid').getValue();
var objectType= Ext.getCmp('categoryDid').getValue();

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
return false;
}else{
strobjectDID = objectDid ;
return true;
}
},
failure: function() {
return false;
}
});

}

function validateOrganization(id,fieldName){

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'validateOrganization',
ajax_ieCacheFix: new Date().getTime(),
id: id
},
success: function(responseObj) {
var validOrganization = Ext.decode(responseObj.responseText).validOrganization;
if(!validOrganization){
if(fieldName =='ownerCode') {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.ownerCode","ebaftersales")%>', function() {
Ext.getCmp('ownerCode').reset() ;
});
}
if(fieldName =='originID') {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.originID","ebaftersales")%>', function() {
Ext.getCmp('originID').reset() ;
});
}
}else{
var owner = Ext.decode(responseObj.responseText).siteDid;
if(owner != null ){
ownerWhoDid = owner ;
}
}

},
failure: function() {
Ext.getCmp('productCode').reset() ;
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.ownerCode","ebaftersales")%>', function() {
});
}
});

}

function validateProductCodeInEditedRow(productCode){

var objectDid = null;
var orderRecord= orderStore.getAt(orderStoreIndex);
var manufacturer_Model = orderRecord.data.manufacturerDid;
var objectType= orderRecord.data.categoryDid;

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
productCodeText.setValue('');
productCodeText.markInvalid( '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>');

}else{
strobjectDID = objectDid ;
}
},
failure: function() {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}
});

}

function clearForm(){
Ext.getCmp('productCode').reset() ;
Ext.getCmp('ownerCode').reset() ;
Ext.getCmp('originID').reset() ;
Ext.getCmp('cosmeticCondition').reset() ;
Ext.getCmp('details').reset() ;
comps.removeAll(true);
Ext.getCmp('POPAttached').reset() ;
Ext.getCmp('ownerTypeDid').reset() ;
Ext.getCmp('symptomcategoryDid').reset() ;
Ext.getCmp('codeDid').reset() ;
Ext.getCmp('claimTypeDid').reset() ;
Ext.getCmp('orderTypeDid').reset() ;
Ext.getCmp('manufacturerDid').reset() ;
Ext.getCmp('typeDid').reset() ;
Ext.getCmp('categoryDid').reset() ;
Ext.getCmp('modelDid').reset() ;
Ext.getCmp('itemID').reset() ;
}

function addOrder(){

var errorCount = validateRadioGroup() ;
var mandatoryFieldsMissing = validateMandatoryFields() ;

if(! message_valid_IMEI){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.closedOrder","ebaftersales")%>', function() {
Ext.getCmp('itemID').markInvalid('');
Ext.getCmp('itemID').focus();
});
}
if(mandatoryFieldsMissing){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.mandatoryFields","ebaftersales")%>', function() {
});

}
if(errorCount >0 ){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.ManufacturerCriteria","ebaftersales")%>', function() {
});
}

isValidProductCode(Ext.getCmp('productCode').getValue());

if(! mandatoryFieldsMissing && errorCount <1 && message_valid_IMEI){
var e = new Order({
itemID: Ext.getCmp('itemID').getValue(),
Category: strCategory,
Manufacturer: strManufacturer,
Model: strModel,
ProductCode: strProductCode,
receivedfrom3rdparty:Ext.getCmp('receivedfrom3rdparty').getValue(),
originID: Ext.getCmp('originID').getValue(),
ownerType:strOwnerType,
ownerCode: Ext.getCmp('ownerCode').getValue(),
claimType: strClaimType,
pOPDate: '',
POPAttached: Ext.getCmp('POPAttached').getValue(),
override: 'override',
approvalCode: '',
ownerWhoDid: ownerWhoDid,
strobjectDID: Ext.getCmp('productCode').getValue(),
SymptomCategory: strSymptomCategory,
SymptomCode: strSymptomCode,
SymptomDetails: Ext.getCmp('details').getValue(),
cosmeticCondition: Ext.getCmp('cosmeticCondition').getValue() ,
strType: strType ,
status: 'true',
manufacturerDid: Ext.getCmp('manufacturerDid').getValue(),
symptomCategoryDid: Ext.getCmp('symptomcategoryDid').getValue(),
symptomCodeDid: Ext.getCmp('codeDid').getValue(),
claimTypeDid: Ext.getCmp('claimTypeDid').getValue(),
orderTypeDid: Ext.getCmp('orderTypeDid').getValue(),
ownerTypeDid: Ext.getCmp('ownerTypeDid').getValue(),
categoryDid: Ext.getCmp('categoryDid').getValue(),
modelDid: Ext.getCmp('modelDid').getValue(),
objectTypeDid: Ext.getCmp('typeDid').getValue(),
strManufacturerCriteria:strManufacturerCriteria
});


orderStore.insert(0, e);
grid.getView().refresh();
strManufacturerCriteria = null ;
ownerWhoDid = null ;


}
message_valid_IMEI = false ;
}

function OrderDecription(orderRecord){

var saveOrder = new SaveOrder({
itemID:orderRecord.itemID,
objectTypeDid: orderRecord.objectTypeDid,
ownerWhoDid :orderRecord.ownerWhoDid,
strobjectDID :orderRecord.strobjectDID,
manufacturerDid :orderRecord.manufacturerDid,
ProductCode :orderRecord.ProductCode,
categoryDid :orderRecord.categoryDid,
symptomCodeDid:orderRecord.symptomCodeDid,
claimTypeDid:orderRecord.claimTypeDid,
orderTypeDid :orderRecord.orderTypeDid,
modelDid:orderRecord.modelDid,
ownerTypeDid:orderRecord.ownerTypeDid,
receivedfrom3rdparty:orderRecord.receivedfrom3rdparty.boxLabel,
originID:orderRecord.originID,
ownerType:orderRecord.ownerType,
ownerCode:orderRecord.ownerCode,
pOPDate:orderRecord.pOPDate,
POPAttached:orderRecord.POPAttached.boxLabel,
override:orderRecord.override,
approvalCode:orderRecord.approvalCode,
SymptomDetails:orderRecord.SymptomDetails,
cosmeticCondition:orderRecord.cosmeticCondition,
status:orderRecord.status,
strManufacturerCriteria:orderRecord.strManufacturerCriteria
});

return saveOrder.data;

}


function createOrders(){
jsonData = "[";
var flag= false;
for(var i=0;i<orderStore.getCount();i++) {
var orderRecord = orderStore.getAt(i);

flag = true;
jsonData += Ext.util.JSON.encode(OrderDecription(orderRecord.data)) + ",";
}
jsonData = jsonData.substring(0,jsonData.length-1) + "]";

if(flag){
var conn = new Ext.data.Connection();
conn.request({
url:'/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'saveOrderBatch',
ajax_ieCacheFix: new Date().getTime(),
data: jsonData
},
success: function(responseObj) {
orderStore.removeAll();
},
failure: function() {
}
});
}

}

function validateIMEI(imei,objectType,productType){
var message = "" ;

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'validateIMEI',
ajax_ieCacheFix: new Date().getTime(),
IMEI: imei,
productType: productType,
objectType: objectType
},
success: function(responseObj) {
message = Ext.decode(responseObj.responseText).validateIMEI;

},
failure: function() {
message = Ext.decode(responseObj.responseText).validateIMEI;
}
});

conn.on({
'requestcomplete':{
fn: function(conn, response, options) {
message = Ext.decode(response.responseText).validateIMEI;
if(message == 'Valid'){
message_valid_IMEI = true;
}else {
message_valid_IMEI = false;
}
}
}
});
}

function validateRadioGroup(){
var errors = 0 ;
var checkCount = 0;
if(comps.items.getCount() > 0){
for (var x = 0; x < comps.items.length; x++) {
var tempRadioGroup = comps.items.items[x];
for(var y = 0; y < tempRadioGroup.items.length; y++){
var tempRadio = tempRadioGroup.items.items[y];

var passed = true;
if(tempRadio.checked){
checkCount = checkCount +1 ;
if(tempRadio.value == 1 ){
if(tempRadio.boxLabel != 'Yes'){
tempRadio.setValue(false);
errors = errors + 1;
passed = false;
}
} else{
if(tempRadio.boxLabel != 'No'){
tempRadio.setValue(false);
errors = errors + 1;
passed = false;
}
}
if(passed){
if(strManufacturerCriteria != null){
strManufacturerCriteria = strManufacturerCriteria + strSeparator1+tempRadioGroup.id+strSeparator2+tempRadio.value;

}else {
strManufacturerCriteria = '';
strManufacturerCriteria = tempRadioGroup.id+strSeparator2+tempRadio.value;

}
}
}


}
}
}
if(comps.items.getCount() > 0 && checkCount < comps.items.getCount()){
errors = errors + 1;
}
return errors ;
}

function startEditing(rowIndex){
orderStoreIndex = rowIndex ;

var orderRecord= orderStore.getAt(rowIndex);
category_Store_row.load();
ownerType_RW_Store.load();
claimType_RW_Store.load();

type_Store_row.load({params:{productType:orderRecord.data.categoryDid}});
manufacturer_RowStore.load({params:{accessoryTypeDid:orderRecord.data.objectTypeDid}});
model_RowStore.load({params:{objectTypeDid:orderRecord.data.categoryDid,manufacturerActorDid:orderRecord.data.manufacturerDid}});
code_RW_Store.load({params:{symptomCategory:orderRecord.data.symptomCategoryDid,manufacturerDID:orderRecord.data.manufacturerDid,serviceType:orderRecord.data.claimTypeDid}});
symptomcategory_RW_Store.load({params:{objectType:orderRecord.data.categoryDid,manufacturerDID:orderRecord.data.manufacturerDid,serviceType:orderRecord.data.claimTypeDid}});

}

function markInValid(val, record,data) {
if(val =""){
return '<span style="color:red;">' + val + '%</span>';
}
return val;
}

function viewOrder(val, record,data) {
var order_Did = data.data.order_did;
var order_ID = data.data.order_id + '';
return '<a tabindex="20" class="smtxt" href="javascript:goToOrderView('+order_Did+');">'+order_ID+' </a>';
}


function validateRowAfterEdit(orderRecord,rowIndex){
var flag = false ;
if (orderRecord.data.claimTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.orderTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.categoryDid == '-1' ){
flag = true ;
}
if( orderRecord.data.objectTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.manufacturerDid == '-1' ){
flag = true ;
}
if(orderRecord.data.manufacturerDid == '-1' ){
flag = true ;
}
if(orderRecord.data.modelDid == '-1' ){
flag = true ;
}
if(orderRecord.data.itemID == '' ){
flag = true ;
}
if(orderRecord.data.ProductCode == '' ){
flag = true ;
}

if(flag){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.mandatoryFields","ebaftersales")%>', function() {
orderRecord.data.status='invalid';
grid.getView().refresh();
editor.startEditing(rowIndex);
});

}else{
orderRecord.data.status='valid';
grid.getView().refresh();
editor.startEditing(rowIndex);
}




}



var productCodeText = new Ext.form.TextField({
xtype: 'textfield',
id: 'productCodeText',
name: 'productCodeTextName',
allowBlank:false,
invalidText :'<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>',
listeners: {
change :function(newValue,oldValue ){
validateProductCodeInEditedRow(newValue.getValue());
}

}
});


var itemIDText = new Ext.form.TextField({
xtype: 'numberfield',
id: 'itemIDText',
name: 'itemIDTextName',
allowBlank:false,
invalidText :'<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>',
listeners: {
change :function(newValue,oldValue ){
var orderRecord= orderStore.getAt(orderStoreIndex);

validateIMEI(newValue.getValue(),orderRecord.data.objectTypeDid,orderRecord.data.categoryDid);
if(message_valid_IMEI){

}else{
itemIDText.markInvalid('');
}
}

}
});

var symptomCategoryComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'symptomCategoryDid_row',
name: 'symptomCategory_row',
store: symptomcategory_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {

var orderRecord= orderStore.getAt(orderStoreIndex);

orderStore.data.items[orderStoreIndex].data.symptomCategoryDid = symptomCategoryComboBox.value;

var symptomCategoryDid =symptomCategoryComboBox.value;
var claimTypeDid =orderRecord.data.claimTypeDid;
var manufacturerDid =orderRecord.data.manufacturerDid;

if((manufacturerDid != null || manufacturerDid != -1) &&
(symptomCategoryDid != null || symptomCategoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1) ){
code_RW_Store.load({params:{symptomCategory:symptomCategoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

grid.view.refresh();
}
}

});

var symptomCodeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'symptomCodeDid_row',
name: 'symptomCode_row',
store: code_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.symptomCodeDid = symptomCodeComboBox.value;
grid.view.refresh();
}
}

});

var categoryComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'categoryDid_row',
name: 'category_row',
store: category_Store_row,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.categoryDid = categoryComboBox.value;
grid.view.refresh();
},
change:function(field,newValue,oldValue){
typeComboBox.reset();
manufacturerComboBox.reset();
modelComboBox.reset();
itemIDText.reset();
}
}

});

var typeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'typeDid_row',
store: type_Store_row,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Object Type ...',
allowBlank:false,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.objectTypeDid = typeComboBox.value;
grid.view.refresh();
}
}

});



var manufacturerComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'manufacturerDid_row',
store: manufacturer_RowStore,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
allowBlank:false,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.manufacturerDid = manufacturerComboBox.value;
grid.view.refresh();

var orderRecord= orderStore.getAt(orderStoreIndex);
model_RowStore.load({params:{objectTypeDid:orderRecord.data.categoryDid,manufacturerActorDid:manufacturerComboBox.value}});


}
}

});


var modelComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'modelDid_row',
name: 'model_row',
store: model_RowStore,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.modelDid = modelComboBox.value;
grid.view.refresh();
}
}

});

var ownerTypeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'ownerTypeDid_row',
name: 'ownerType_row',
store: ownerType_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.ownerTypeDid = ownerTypeComboBox.value;
grid.view.refresh();
}
}

});

var claimTypeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'claimTypeDid_row',
name: 'claimType_row',
store: claimType_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.claimTypeDid = claimTypeComboBox.value;
grid.view.refresh();
}
}

});


question_Store.on({
'load':{
fn: function(store, options) {
createManufacturerCriteria();
}
}
});

function rendererCombo(v,meta,value){
if(v == -1){
meta.css = 'print_underline';
}
return value;
}


Ext.onReady(function(){
noSplash(); // remove the Splash

category_Store.load();
ownerType_Store.load();
orderType_Store.load();
claimType_Store.load();

comps =new Ext.Panel({
layout:'form',
border:false ,
xtype:'form',
labelAlign:'left',
height: 250,
width:200,
monitorResize: true,
autoScroll:true,
overflow:'auto'
});

editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'

});

editor.on({
'beforeedit':{
fn: function(roweditor, rowIndex) {
startEditing(rowIndex);
}
},
'canceledit':function (roweditor, value, startValue) {

},
'validateedit': function(roweditor, changes, record, rowIndex) {
validateRowAfterEdit(record,rowIndex);
},
'afteredit': function(roweditor, changes, record, rowIndex) {

}
});



form = new Ext.FormPanel({
id: 'preProcess_form',
title:'<%=i18NHelper.getString("ebaftersales.batch.title","ebaftersales")%>',
xtype:'form',
width:800,
height:300,
labelAlign:'left',
layout:'fit',
frame:false,
border:false,
autoScroll:true,
overflow:'auto' ,
validate:false,

items:[
{
layout:'column',
defaults:{
layout:'form',
border:false,
labelAlign :'right'
},
items:[
{
// first column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.productInfo","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.23,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'categoryDid',
name: 'category',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Category","ebaftersales")%>',
store: category_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
type_Store.load({params:{productType:record.data.did}});
strCategory = record.get('title') ;
loadManufacturerCriteria();
loadSymptomCategories();
}

}
}) ,

new Ext.form.ComboBox({
id: 'typeDid',
name: 'type',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Type","ebaftersales")%>',
store: type_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
manufacturer_Store.load({params:{accessoryTypeDid:record.data.did}});
strType = record.get('title') ;
}

}
}) ,
new Ext.form.ComboBox({
id: 'manufacturerDid',
name: 'manufacturer',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Manufacturer","ebaftersales")%>',
store: manufacturer_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Manufacturer ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
model_Store.load({params:{objectTypeDid:Ext.getCmp('categoryDid').getValue(),manufacturerActorDid:Ext.getCmp('manufacturerDid').getValue()}});
strManufacturer = record.get('title') ;
loadManufacturerCriteria();
loadSymptomCategories();

}

}
}) ,
new Ext.form.ComboBox({
id: 'modelDid',
name: 'model',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Model","ebaftersales")%>',
store: model_Store,
displayField: 'title',
typeAhead: true,
valueField: 'did',
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Model ...',
resizable:true,
minListWidth:150,
allowBlank:true ,
forceSelection: true,
selectOnFocus:true,
listeners: {
scope:this,
select: function(combo, record,index) {
productCode_Store.load({params:{modelDid:Ext.getCmp('modelDid').getValue(),objectDid:Ext.getCmp('categoryDid').getValue()}});
strModel = record.get('title') ;
}
}
}) ,
new Ext.form.ComboBox({
id: 'productCode',
name: 'productCode_name',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.ProductCode","ebaftersales")%>',
store: productCode_Store,
displayField: 'title',
typeAhead: true,
valueField: 'did',
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Product Code ...',
resizable:true,
minListWidth:150,
allowBlank:true ,
forceSelection: true,
selectOnFocus:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strProductCode = record.get('title') ;
}
}
})
]

}
,{
// second column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.orderInfo","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.23,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'orderTypeDid',
name: 'orderType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.orderType","ebaftersales")%>',
store: orderType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Order Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strOrderType = record.get('title') ;
}
}
}) ,
new Ext.form.ComboBox({
id: 'claimTypeDid',
name: 'claimType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.claimType","ebaftersales")%>',
store: claimType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Claim Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
loadManufacturerCriteria();
loadSymptomCategories();
strClaimType = record.get('title') ;
}
}
}) ,
{
xtype: 'radiogroup',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.POPAttached","ebaftersales")%>',
columns: 2,
id:'POPAttached',
items: [
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.yes","ebaftersales")%>', name: 'rb-POPAttached', inputValue: 'yes'},
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.no","ebaftersales")%>', name: 'rb-POPAttached', inputValue: 'no' }
]
},
{
xtype: 'radiogroup',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.receivedfrom3rdparty","ebaftersales")%>',
columns: 2,
id:'receivedfrom3rdparty',
items: [
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.yes","ebaftersales")%>', name: 'rb-receivedfrom3rdparty', inputValue: 'yes'},
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.no","ebaftersales")%>', name: 'rb-receivedfrom3rdparty', inputValue: 'no',checked:true}
] ,
listeners: {
change :function(newValue,checked ){
if(checked.boxLabel == 'Yes'){
Ext.getCmp('originID').setDisabled(false) ;
}else{
Ext.getCmp('originID').setDisabled(true) ;
Ext.getCmp('originID').reset() ;
}
}

}
},
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.originID","ebaftersales")%>',
allowBlank:true,
id:'originID' ,
listeners: {
change :function(newValue,oldValue ){
validateOrganization(newValue.getValue(),'originID');
}

}
},
new Ext.form.ComboBox({
id: 'ownerTypeDid',
name: 'ownerType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerType","ebaftersales")%>',
store: ownerType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Owner Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strOwnerType = record.get('title') ;
}
}
}) ,
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.ownerCode","ebaftersales")%>',
allowBlank:true,
id:'ownerCode',
listeners: {
change :function(newValue,oldValue ){
validateOrganization(newValue.getValue(),'ownerCode');
}

}
}
]

}
,{
// third column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.symptom","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.24,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'symptomcategoryDid',
name: 'symptomcategory',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.symptomcategory","ebaftersales")%>',
store: symptomcategory_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Symptom category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strSymptomCategory= record.get('title') ;

loadSymptomCode();
}
}
}) ,
new Ext.form.ComboBox({
id: 'codeDid',
name: 'code',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.code","ebaftersales")%>',
store: code_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Code ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strSymptomCode= record.get('title') ;
}
}
}) ,

{
xtype:'textarea',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.details","ebaftersales")%>',
allowBlank:true,
id:'details'

},
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.cosmeticCondition","ebaftersales")%>',
allowBlank:true,
id:'cosmeticCondition'
}
]
}
,{
// fourth column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.manufacturerCriteria","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.30,
defaults:{anchor:'100%'},
items:comps
}

]
}

]
});

var form2 = new Ext.FormPanel({
id: 'preProcess_form2',
xtype:'form',
width:800,
height:30,
labelAlign:'left',
layout:'fit',
frame:false,
border:false,
autoScroll:true,
overflow:'auto' ,
validate:false,
items:[
{
layout:'column',
anchor: "0",
defaults:{
layout:'form',
border:false

},
items:[
{
// first column
// defaults for fields
buttonAlign:'left',
labelWidth:100,
columnWidth:0.32,
defaults:{anchor:'75%'},
items:[
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.itemID","ebaftersales")%>',
allowBlank:true,
id:'itemID',
tabIndex :2,
maskRe:/[0-9]/,
validator:function (validateValue){
var objectType= Ext.getCmp('categoryDid').getValue();
if(objectType == 212 ){
if(validateValue.length != 15 ){
Ext.getCmp('itemID').focus();
return false;
}else {
return true;
}
}else {
return true;
}

},
listeners: {
change :function(newValue,oldValue ){
validateIMEI(Ext.getCmp('itemID').getValue(),Ext.getCmp('categoryDid').getValue(),Ext.getCmp('typeDid').getValue());
}
}


}
]
} ,{
// second column
// defaults for fields
columnWidth:0.10,
items:[
{
id:'addButton',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.add","ebaftersales")%>',
xtype: 'button',
type: 'submit',
buttonAlign:'left',
handler: function(btn, e) {
addOrder();
}
}
]

}
,{
// third column
// defaults for fields
buttonAlign:'left',
columnWidth:0.10,
items:[
{
id:'addButton2',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.clear","ebaftersales")%>',
xtype: 'button',
type: 'submit',
handler: function(btn, e) {
clearForm();
}
}
]
}
,{
// fourth column
// defaults for fields
buttonAlign:'left',
labelWidth:0,
columnWidth:0.10,
items:[
{
id:'addButton3',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.create","ebaftersales")%>',
xtype: 'button',
type: 'submit',
handler: function(grid, rowIndex, e) {
createOrders();

}
}

]
} ,{
// fifth column
// defaults for fields
buttonAlign:'left',
labelWidth:0,
columnWidth:0.43

}

]
}
]

});


grid = new Ext.grid.GridPanel({
xtype: 'grid',

cm: new Ext.grid.ColumnModel([

{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.itemID","ebaftersales")%>',
dataIndex: 'itemID',
id: 'itemID',
width: 100,

editor: itemIDText,
renderer: function(v,meta, record,data){
var itemID = record.data.itemID;
if(itemID == ''){
meta.css = 'print_underline';
}
return v;
}

},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Category","ebaftersales")%>',
dataIndex: 'Category',
id: 'Category',
width: 100,
editor: categoryComboBox,
renderer:function(value,meta, record,data) {
var category = record.data.Category;
var record1 = categoryComboBox.findRecord(categoryComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(categoryComboBox.displayField)): rendererCombo(value,meta,category);
}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Type","ebaftersales")%>',
dataIndex: 'Type',
id: 'Type',
width: 100,
editor: typeComboBox,
renderer:function(value,meta, record,data) {
var type = record.data.strType;
var record1 = typeComboBox.findRecord(typeComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(typeComboBox.displayField)): rendererCombo(value,meta,type);
}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Manufacturer","ebaftersales")%>',
id: 'Manufacturer',
dataIndex: 'Manufacturer',
width: 100,

editor: manufacturerComboBox,
renderer:function(value,meta, record,data) {
var manufacturer = record.data.Manufacturer;
var record1 = manufacturerComboBox.findRecord(manufacturerComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(manufacturerComboBox.displayField)): rendererCombo(value,meta,manufacturer);

}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Model","ebaftersales")%>',
dataIndex: 'Model',
id: 'Model',
width: 100,

editor: modelComboBox,
renderer:function(value,meta, record,data) {
var Model = record.data.Model;
var record1 = modelComboBox.findRecord(modelComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(modelComboBox.displayField)): rendererCombo(value,meta,Model);

}
},
{
id: 'ProductCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ProductCode","ebaftersales")%>',
dataIndex: 'ProductCode',
width: 100,

editor: productCodeText,
renderer: function(v,meta, record,data){
var ProductCode = record.data.ProductCode;
if(ProductCode == ''){
meta.css = 'print_underline';
}
return v;
}

},

{
xtype: 'booleancolumn',
id: 'receivedfrom3rdparty',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.receivedfrom3rdparty","ebaftersales")%>',
dataIndex: 'receivedfrom3rdparty',
align: 'center',
width: 50,
trueText: 'Yes',
falseText: 'No',
editor: {
xtype: 'checkbox'
}
},
{
id: 'originID',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.originID","ebaftersales")%>',
dataIndex: 'originID',
width: 100,
editor: {
xtype: 'textfield'
}

},
{
id: 'ownerType',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerType","ebaftersales")%>',
dataIndex: 'ownerType',
width: 100,
editor: ownerTypeComboBox,
renderer:function(value,meta, record,data) {
var ownerCode = record.data.ownerCode;
var record1 = ownerTypeComboBox.findRecord(ownerTypeComboBox.valueField, value);
return record1 ? record1.get(ownerTypeComboBox.displayField):ownerCode;
}

},
{
id: 'ownerCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerCode","ebaftersales")%>',
dataIndex: 'ownerCode',
width: 100,

editor: {
xtype: 'textfield'
}

},
{
id: 'claimType',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.claimType","ebaftersales")%>',
dataIndex: 'claimType',
width: 100,

editor: claimTypeComboBox,
renderer:function(value,meta, record,data) {
var claimType = record.data.claimType;
var record1 = claimTypeComboBox.findRecord(claimTypeComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(claimTypeComboBox.displayField)): rendererCombo(value,meta,claimType);

}

},
{
xtype: 'datecolumn',
id: 'pOPDate',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.pOPDate","ebaftersales")%>',
dataIndex: 'pOPDate',
format: 'm/d/Y',
width: 100,
sortable: true,
// groupRenderer: Ext.util.Format.dateRenderer('M y'),
editor: {
xtype: 'datefield',
minValue: '01/01/2006',
maxValue: (new Date()).format('m/d/Y')
}
},
{
xtype: 'booleancolumn',
id: 'POPAttached',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.POPAttached","ebaftersales")%>',
dataIndex: 'POPAttached',
align: 'center',
width: 50,
trueText: 'Yes',
falseText: 'No',
editor: {
xtype: 'checkbox'
}
},

{
id: 'insuranceNumber',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.insuranceNumber","ebaftersales")%>',
dataIndex: 'insuranceNumber',
width: 100,

editor: {
xtype: 'textfield'//,
}

}
, {
id: 'override',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.override","ebaftersales")%>',
dataIndex: 'override',
width: 100,
align: 'left' ,
editor: {
xtype: 'textfield'
}

}
, {
id: 'approvalCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.approvalCode","ebaftersales")%>',
dataIndex: 'approvalCode',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'SymptomCategory',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomCategory","ebaftersales")%>',
dataIndex: 'SymptomCategory',
width: 100,
editor: symptomCategoryComboBox,
renderer:function(value, record,data) {
var symptomCategoryDid = data.data.SymptomCategory;
var record1 = symptomCategoryComboBox.findRecord(symptomCategoryComboBox.valueField, value);
return record1 ? record1.get(symptomCategoryComboBox.displayField):symptomCategoryDid;
}

}
, {
id: 'SymptomCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomCode","ebaftersales")%>',
dataIndex: 'SymptomCode',
width: 100,
editor: symptomCodeComboBox,
renderer:function(value, record,data) {
var SymptomCode = data.data.SymptomCode;
var record1 = symptomCodeComboBox.findRecord(symptomCodeComboBox.valueField, value);
return record1 ? record1.get(symptomCodeComboBox.displayField):SymptomCode;
}


}
, {
id: 'SymptomDetails',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomDetails","ebaftersales")%>',
dataIndex: 'SymptomDetails',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'cosmeticCondition',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.cosmeticCondition","ebaftersales")%>',
dataIndex: 'cosmeticCondition',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'status',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.status","ebaftersales")%>',
dataIndex: 'status',
width: 100
}
]),
store: orderStore,
autoWidth: true,
overflow:'auto' ,
plugins: [editor],
view: new Ext.grid.GroupingView({
markDirty: false
})


});

Ext.getCmp('originID').setDisabled(true) ;

var panel = new Ext.Panel({
id:'ta-panel',
baseCls:'x-plain',

style: {
marginRight: '5px',
marginLeft: '5px'
},
renderTo: 'orderBatchProcess',
layout:'vbox',
layoutConfig: {
align : 'stretch',
pack : 'start'
},
autoScroll:true,
overflow:'auto' ,
// applied to child components
defaults: {frame:false,footer:false, border: true,bodyBorder:true,collapsible:false,shadowOffset:6},
items:[form,form2,grid] ,

resized : function() {
var width = (Ext.isIE) ? document.body.clientWidth : window.innerWidth;
var height = (Ext.isIE) ? document.body.clientHeight : window.innerHeight;
var grid_width = 800;
var grid_height = 448;
if (height > base_height_size) {
height = height - (base_height_size - grid_height); //grid height is set by the last number
}
else
{
height = grid_height;
}

if (width > base_width_size) {
width = Math.floor(width * 0.93)-10;
}
else
{
width = grid_width;
}

panel.setSize(width, height);
grid.setHeight(height - 330);
panel.doLayout('false', 'true');
//grid.getView().fitColumns();
grid.syncSize();



}
});

panel.resized();
Ext.EventManager.onWindowResize( panel.resized, panel );


});


</script>

shanika
15 Dec 2010, 1:58 AM
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="se.marakanda.mwaf.util.presentation.CachedResourceVersionHandler" %>
<%@ page import="se.marakanda.maccess.entity.model.UserProfileDTO" %>
<%@ page import="se.marakanda.mutil.i18n.I18NHelper" %>
<script type="text/javascript" src="/ebaftersales/scripts/AfterSalesCommon.js"></script>
<script type="text/javascript" src="/ebaftersales/scripts/RowEditor.js"></script>
<link rel="stylesheet" type="text/css" href="/ebaftersales/css/afterSales.css" />
<link rel="stylesheet" type="text/css" href="/ebaftersales/css/RowEditor.css" />

<jsp:include page="/ebaftersales/scripts/AfterSalesCommon.jsp"/>
<%
UserProfileDTO userProfileDto = (UserProfileDTO) session.getAttribute("CURRENT_USER_PROFILE");
I18NHelper i18NHelper = new I18NHelper();
i18NHelper.setLocale(userProfileDto.getLocale());
%>

<div id="orderBatchProcess"></div>
<style type="text/css">
.other-cell-color{
colour:'red'
}

.print_underline
{
display: inline-block;
/*height: 1em;*/
border-bottom: 1px solid #FF0000;
}


</style>
<script type="text/javascript">

base_width_size = 900;
base_height_size = 622;
var paramsObj = new Object();
var form = null ;
var grid = null ;

var comps = null ;
var orderStoreIndex = -1 ;
var strManufacturerCriteria = null ;
var strSeparator1 = '#' ;
var strSeparator2 = '_' ;


var strCategory = null ;
var strModel = null ;
var strProductCode = null ;
var strOwnerType = null ;
var strManufacturer = null ;
var strMode= null ;
var strClaimType = null ;
var strSymptomCategory = null ;
var strSymptomCode = null ;
var strType = null ;
var strOrderType = null ;
var ownerWhoDid = null ;
var strobjectDID = null ;
var message_valid_IMEI = false ;
var originID_disabled = true ;



var Order = Ext.data.Record.create([
{name: 'itemID', type: 'string'},
{name: 'Category', type: 'string'},
{name: 'objectTypeDid', type: 'number'},
{name: 'ownerWhoDid', type: 'number'},
{name: 'strobjectDID', type: 'number'},
{name: 'manufacturerDid', type: 'number'},
{name: 'categoryDid', type: 'number'},
{name: 'symptomCategoryDid', type: 'number'},
{name: 'symptomCodeDid', type: 'number'},
{name: 'claimTypeDid', type: 'number'},
{name: 'orderTypeDid', type: 'number'},
{name: 'modelDid', type: 'number'},
{name: 'ownerTypeDid', type: 'number'},
{name: 'Manufacturer', type: 'string'},
{name: 'Model', type: 'string'},
{name: 'ProductCode', type: 'string'},
{name: 'receivedfrom3rdparty', type: 'string'},
{name: 'originID', type: 'string'},
{name: 'ownerType', type: 'string'},
{name: 'ownerCode', type: 'string'},
{name: 'claimType', type: 'string'},
{name: 'pOPDate', type: 'date'},
{name: 'POPAttached', type: 'string'},
{name: 'override', type: 'string'},
{name: 'approvalCode', type: 'string'},
{name: 'SymptomCategory', type: 'string'},
{name: 'SymptomCode', type: 'string'},
{name: 'strType', type: 'string'},
{name: 'SymptomDetails', type: 'string'},
{name: 'cosmeticCondition', type: 'string'},
{name: 'status', type: 'string'},
{name: 'strManufacturerCriteria', type: 'string'}
]);

var SaveOrder = Ext.data.Record.create([
{name: 'itemID', type: 'string'},
{name: 'objectTypeDid', type: 'number'},
{name: 'ownerWhoDid', type: 'number'},
{name: 'strobjectDID', type: 'number'},
{name: 'manufacturerDid', type: 'number'},
{name: 'categoryDid', type: 'number'},
{name: 'symptomCodeDid', type: 'number'},
{name: 'claimTypeDid', type: 'number'},
{name: 'orderTypeDid', type: 'number'},
{name: 'modelDid', type: 'number'},
{name: 'ownerTypeDid', type: 'number'},
{name: 'receivedfrom3rdparty', type: 'string'},
{name: 'ProductCode', type: 'string'},
{name: 'originID', type: 'string'},
{name: 'ownerType', type: 'string'},
{name: 'ownerCode', type: 'string'},
{name: 'pOPDate', type: 'date'},
{name: 'POPAttached', type: 'string'},
{name: 'override', type: 'string'},
{name: 'approvalCode', type: 'string'},
{name: 'SymptomDetails', type: 'string'},
{name: 'cosmeticCondition', type: 'string'},
{name: 'status', type: 'string'},
{name: 'strManufacturerCriteria', type: 'string'}
]);




var orderStore = new Ext.data.GroupingStore({
autoDestroy: true,
reader: new Ext.data.JsonReader({fields: Order})

});

var editor = null;

var question_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufactureCriteria'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'questions',
id: 'objectQuizDID'
}, [
{name: 'objectQuizDID', mapping: 'objectQuizDID'},
{name: 'question', mapping: 'question'},
{name: 'serviceTypeDID', mapping: 'serviceTypeDID'},
{name: 'ordinal', mapping: 'ordinal'},
{name: 'helpI18nKey', mapping: 'helpI18nKey'}

])
});

var claimType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadServiceType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'serviceType_filter',
id: 'did'
}, [
{name: 'did', mapping: 'serviceType_did'},
{name: 'title', mapping: 'serviceType_type'}

])
});

var claimType_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadServiceType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'serviceType_filter',
id: 'did'
}, [
{name: 'did', mapping: 'serviceType_did'},
{name: 'title', mapping: 'serviceType_type'}

])
});

var symptomcategory_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCategories'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCategory',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCategory_did'},
{name: 'title', mapping: 'symptomCategory_type'}

])
});

var code_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCodes'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCodes',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCodes_did'},
{name: 'title', mapping: 'symptomCodes_type'}

])
});

var symptomcategory_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCategories'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCategory',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCategory_did'},
{name: 'title', mapping: 'symptomCategory_type'}

])
});

var code_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadSymptomCodes'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'symptomCodes',
id: 'did'
}, [
{name: 'did', mapping: 'symptomCodes_did'},
{name: 'title', mapping: 'symptomCodes_type'}

])
});

var orderType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadOrderCategory'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'orderCategory_filter',
id: 'did'
}, [
{name: 'did', mapping: 'orderCategory_did'},
{name: 'title', mapping: 'orderCategory_type'}

])
});

var ownerType_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadRole'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'role_filter',
id: 'did'
}, [
{name: 'did', mapping: 'role_did'},
{name: 'title', mapping: 'role_type'}

])
});

var ownerType_RW_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadRole'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'role_filter',
id: 'did'
}, [
{name: 'did', mapping: 'role_did'},
{name: 'title', mapping: 'role_type'}

])
});

var manufacturer_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufacturers'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'manufacturers',
id: 'did'
}, [
{name: 'did', mapping: 'manufacturers_type_did'},
{name: 'title', mapping: 'manufacturers_type'}

])
});

var type_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadProductType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_type_list_filter',
id: 'did'
}, [
{name: 'did', mapping: 'product_type_did'},
{name: 'title', mapping: 'product_type'}

])
});


var type_Store_row = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadProductType'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_type_list_filter',
id: 'did'
}, [
{name: 'did', mapping: 'product_type_did'},
{name: 'title', mapping: 'product_type'}

])
});

var category_Store = new Ext.data.Store({
baseParams:{ajax_command:'loadProductGroupList'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_group_list',
id: 'product_group_did'
}, [
{name: 'did', mapping: 'product_group_did'},
{name: 'title', mapping: 'product_group'}

])
});

var category_Store_row = new Ext.data.Store({
baseParams:{ajax_command:'loadProductGroupList'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'product_group_list',
id: 'product_group_did'
}, [
{name: 'did', mapping: 'product_group_did'},
{name: 'title', mapping: 'product_group'}

])
});

var model_Store = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadModel'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'model',
id: 'did'
}, [
{name: 'did', mapping: 'did'},
{name: 'title', mapping: 'model'}

])
});

var productCode_Store = new Ext.data.Store({
baseParams:{ajax_command:'loadProductCode'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'productCodes',
id: 'did'
}, [
{name: 'did', mapping: 'objectDid'},
{name: 'title', mapping: 'productCode'}

])
});

var model_RowStore = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadModel'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'model',
id: 'did'
}, [
{name: 'did', mapping: 'did'},
{name: 'title', mapping: 'model'}

])
});

var manufacturer_RowStore = new Ext.data.Store({
baseParams:{ajax_command:'batchLoadManufacturers'},
proxy: new Ext.data.HttpProxy({
url:'/ebaftersales/Search.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'manufacturers',
id: 'did'
}, [
{name: 'did', mapping: 'manufacturers_type_did'},
{name: 'title', mapping: 'manufacturers_type'}

])
});



function loadSymptomCategories(){

var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var categoryDid =Ext.getCmp('categoryDid').getValue();
var claimTypeDid =Ext.getCmp('claimTypeDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(categoryDid != null || categoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1)
){
symptomcategory_Store.load({params:{objectType:categoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

}

function loadSymptomCode(){

var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var claimTypeDid =Ext.getCmp('claimTypeDid').getValue();
var symptomcategoryDid =Ext.getCmp('symptomcategoryDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(symptomcategoryDid != null || symptomcategoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1) ){
code_Store.load({params:{symptomCategory:symptomcategoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

}

function loadManufacturerCriteria(){
var manufacturerDid =Ext.getCmp('manufacturerDid').getValue();
var serviceType =Ext.getCmp('claimTypeDid').getValue();
var productType =Ext.getCmp('categoryDid').getValue();

if((manufacturerDid != null || manufacturerDid != -1) &&
(productType != null || productType != -1 )&&
(serviceType != null || serviceType != -1) ){

question_Store.removeAll();
question_Store.load({
params:{productType:productType,manufacturerDid:manufacturerDid,serviceType:serviceType}
});

}

}

function createManufacturerCriteria(){
comps.removeAll(true);

question_Store.each(function(r) {
var did = r.data['objectQuizDID'] ;
var question = r.data['question'] ;
var val = r.data['ordinal'] ;
comps.add(createRadioButtonGroup(did,question,val) ) ;

});
comps.doLayout();
form.doLayout();
}

function createRadioButtonGroup(did,question,val) {
var grp = new Ext.form.RadioGroup({
fieldLabel: question,
id: did,
columns:2,
height: 20,
labelWidth:100,
labelSeparator :'',
margins :{top:0, right:0, bottom:0, left:0},
items: [
{ boxLabel: 'Yes',name: did ,value:val },
{ boxLabel: 'No',name: did ,value:val}]

});

return grp;

}

function validateMandatoryFields(){
var flag = false ;

if (Ext.getCmp('claimTypeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('claimTypeDid').markInvalid('');
}
if(Ext.getCmp('orderTypeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('orderTypeDid').markInvalid('');
}
if(Ext.getCmp('categoryDid').getValue() == '' ){
flag = true ;
Ext.getCmp('categoryDid').markInvalid('');
}
if( Ext.getCmp('typeDid').getValue() == '' ){
flag = true ;
Ext.getCmp('typeDid').markInvalid('');
}
if(Ext.getCmp('manufacturerDid').getValue() == '' ){
flag = true ;
Ext.getCmp('manufacturerDid').markInvalid('');
}

return flag;
}

function productCodeValidator(){
var objectType= Ext.getCmp('categoryDid').getValue();
var productCode= Ext.getCmp('productCode').getValue();
if(objectType == 212 ){
if(productCode.length != 15 ){
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>',
'<%=i18NHelper.getString("ebaftersales.error.batchCreate.length.fifteen","ebaftersales")%>', function() {
});
}
}

}


function validateProductCode(productCode){

var objectDid = null;
var manufacturer_Model = Ext.getCmp('modelDid').getValue();
var objectType= Ext.getCmp('categoryDid').getValue();

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}else{
strobjectDID = objectDid ;
}
},
failure: function() {
Ext.getCmp('productCode').reset() ;
Ext.getCmp('productCode').focus();
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}
});

}

function isValidProductCode(productCode){

var objectDid = null;
var manufacturer_Model = Ext.getCmp('modelDid').getValue();
var objectType= Ext.getCmp('categoryDid').getValue();

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
return false;
}else{
strobjectDID = objectDid ;
return true;
}
},
failure: function() {
return false;
}
});

}

function validateOrganization(id,fieldName){

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'validateOrganization',
ajax_ieCacheFix: new Date().getTime(),
id: id
},
success: function(responseObj) {
var validOrganization = Ext.decode(responseObj.responseText).validOrganization;
if(!validOrganization){
if(fieldName =='ownerCode') {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.ownerCode","ebaftersales")%>', function() {
Ext.getCmp('ownerCode').reset() ;
});
}
if(fieldName =='originID') {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.originID","ebaftersales")%>', function() {
Ext.getCmp('originID').reset() ;
});
}
}else{
var owner = Ext.decode(responseObj.responseText).siteDid;
if(owner != null ){
ownerWhoDid = owner ;
}
}

},
failure: function() {
Ext.getCmp('productCode').reset() ;
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.invalid.ownerCode","ebaftersales")%>', function() {
});
}
});

}

function validateProductCodeInEditedRow(productCode){

var objectDid = null;
var orderRecord= orderStore.getAt(orderStoreIndex);
var manufacturer_Model = orderRecord.data.manufacturerDid;
var objectType= orderRecord.data.categoryDid;

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'productCodeValidation',
ajax_ieCacheFix: new Date().getTime(),
productCode: productCode,
modelDid: manufacturer_Model,
objectType: objectType
},
success: function(responseObj) {
var objectDid = Ext.decode(responseObj.responseText).objectDID;
if(objectDid == undefined ){
productCodeText.setValue('');
productCodeText.markInvalid( '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>');

}else{
strobjectDID = objectDid ;
}
},
failure: function() {
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>', function() {
});
}
});

}

function clearForm(){
Ext.getCmp('productCode').reset() ;
Ext.getCmp('ownerCode').reset() ;
Ext.getCmp('originID').reset() ;
Ext.getCmp('cosmeticCondition').reset() ;
Ext.getCmp('details').reset() ;
comps.removeAll(true);
Ext.getCmp('POPAttached').reset() ;
Ext.getCmp('ownerTypeDid').reset() ;
Ext.getCmp('symptomcategoryDid').reset() ;
Ext.getCmp('codeDid').reset() ;
Ext.getCmp('claimTypeDid').reset() ;
Ext.getCmp('orderTypeDid').reset() ;
Ext.getCmp('manufacturerDid').reset() ;
Ext.getCmp('typeDid').reset() ;
Ext.getCmp('categoryDid').reset() ;
Ext.getCmp('modelDid').reset() ;
Ext.getCmp('itemID').reset() ;
}

function addOrder(){

var errorCount = validateRadioGroup() ;
var mandatoryFieldsMissing = validateMandatoryFields() ;

if(! message_valid_IMEI){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.closedOrder","ebaftersales")%>', function() {
Ext.getCmp('itemID').markInvalid('');
Ext.getCmp('itemID').focus();
});
}
if(mandatoryFieldsMissing){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.mandatoryFields","ebaftersales")%>', function() {
});

}
if(errorCount >0 ){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.ManufacturerCriteria","ebaftersales")%>', function() {
});
}

isValidProductCode(Ext.getCmp('productCode').getValue());

if(! mandatoryFieldsMissing && errorCount <1 && message_valid_IMEI){
var e = new Order({
itemID: Ext.getCmp('itemID').getValue(),
Category: strCategory,
Manufacturer: strManufacturer,
Model: strModel,
ProductCode: strProductCode,
receivedfrom3rdparty:Ext.getCmp('receivedfrom3rdparty').getValue(),
originID: Ext.getCmp('originID').getValue(),
ownerType:strOwnerType,
ownerCode: Ext.getCmp('ownerCode').getValue(),
claimType: strClaimType,
pOPDate: '',
POPAttached: Ext.getCmp('POPAttached').getValue(),
override: 'override',
approvalCode: '',
ownerWhoDid: ownerWhoDid,
strobjectDID: Ext.getCmp('productCode').getValue(),
SymptomCategory: strSymptomCategory,
SymptomCode: strSymptomCode,
SymptomDetails: Ext.getCmp('details').getValue(),
cosmeticCondition: Ext.getCmp('cosmeticCondition').getValue() ,
strType: strType ,
status: 'true',
manufacturerDid: Ext.getCmp('manufacturerDid').getValue(),
symptomCategoryDid: Ext.getCmp('symptomcategoryDid').getValue(),
symptomCodeDid: Ext.getCmp('codeDid').getValue(),
claimTypeDid: Ext.getCmp('claimTypeDid').getValue(),
orderTypeDid: Ext.getCmp('orderTypeDid').getValue(),
ownerTypeDid: Ext.getCmp('ownerTypeDid').getValue(),
categoryDid: Ext.getCmp('categoryDid').getValue(),
modelDid: Ext.getCmp('modelDid').getValue(),
objectTypeDid: Ext.getCmp('typeDid').getValue(),
strManufacturerCriteria:strManufacturerCriteria
});


orderStore.insert(0, e);
grid.getView().refresh();
strManufacturerCriteria = null ;
ownerWhoDid = null ;


}
message_valid_IMEI = false ;
}

function OrderDecription(orderRecord){

var saveOrder = new SaveOrder({
itemID:orderRecord.itemID,
objectTypeDid: orderRecord.objectTypeDid,
ownerWhoDid :orderRecord.ownerWhoDid,
strobjectDID :orderRecord.strobjectDID,
manufacturerDid :orderRecord.manufacturerDid,
ProductCode :orderRecord.ProductCode,
categoryDid :orderRecord.categoryDid,
symptomCodeDid:orderRecord.symptomCodeDid,
claimTypeDid:orderRecord.claimTypeDid,
orderTypeDid :orderRecord.orderTypeDid,
modelDid:orderRecord.modelDid,
ownerTypeDid:orderRecord.ownerTypeDid,
receivedfrom3rdparty:orderRecord.receivedfrom3rdparty.boxLabel,
originID:orderRecord.originID,
ownerType:orderRecord.ownerType,
ownerCode:orderRecord.ownerCode,
pOPDate:orderRecord.pOPDate,
POPAttached:orderRecord.POPAttached.boxLabel,
override:orderRecord.override,
approvalCode:orderRecord.approvalCode,
SymptomDetails:orderRecord.SymptomDetails,
cosmeticCondition:orderRecord.cosmeticCondition,
status:orderRecord.status,
strManufacturerCriteria:orderRecord.strManufacturerCriteria
});

return saveOrder.data;

}


function createOrders(){
jsonData = "[";
var flag= false;
for(var i=0;i<orderStore.getCount();i++) {
var orderRecord = orderStore.getAt(i);

flag = true;
jsonData += Ext.util.JSON.encode(OrderDecription(orderRecord.data)) + ",";
}
jsonData = jsonData.substring(0,jsonData.length-1) + "]";

if(flag){
var conn = new Ext.data.Connection();
conn.request({
url:'/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'saveOrderBatch',
ajax_ieCacheFix: new Date().getTime(),
data: jsonData
},
success: function(responseObj) {
orderStore.removeAll();
},
failure: function() {
}
});
}

}

function validateIMEI(imei,objectType,productType){
var message = "" ;

var conn = new Ext.data.Connection();
conn.request({
url: '/ebaftersales/Search.ajax',
method: 'POST',
params: {
ajax_command: 'validateIMEI',
ajax_ieCacheFix: new Date().getTime(),
IMEI: imei,
productType: productType,
objectType: objectType
},
success: function(responseObj) {
message = Ext.decode(responseObj.responseText).validateIMEI;

},
failure: function() {
message = Ext.decode(responseObj.responseText).validateIMEI;
}
});

conn.on({
'requestcomplete':{
fn: function(conn, response, options) {
message = Ext.decode(response.responseText).validateIMEI;
if(message == 'Valid'){
message_valid_IMEI = true;
}else {
message_valid_IMEI = false;
}
}
}
});
}

function validateRadioGroup(){
var errors = 0 ;
var checkCount = 0;
if(comps.items.getCount() > 0){
for (var x = 0; x < comps.items.length; x++) {
var tempRadioGroup = comps.items.items[x];
for(var y = 0; y < tempRadioGroup.items.length; y++){
var tempRadio = tempRadioGroup.items.items[y];

var passed = true;
if(tempRadio.checked){
checkCount = checkCount +1 ;
if(tempRadio.value == 1 ){
if(tempRadio.boxLabel != 'Yes'){
tempRadio.setValue(false);
errors = errors + 1;
passed = false;
}
} else{
if(tempRadio.boxLabel != 'No'){
tempRadio.setValue(false);
errors = errors + 1;
passed = false;
}
}
if(passed){
if(strManufacturerCriteria != null){
strManufacturerCriteria = strManufacturerCriteria + strSeparator1+tempRadioGroup.id+strSeparator2+tempRadio.value;

}else {
strManufacturerCriteria = '';
strManufacturerCriteria = tempRadioGroup.id+strSeparator2+tempRadio.value;

}
}
}


}
}
}
if(comps.items.getCount() > 0 && checkCount < comps.items.getCount()){
errors = errors + 1;
}
return errors ;
}

function startEditing(rowIndex){
orderStoreIndex = rowIndex ;

var orderRecord= orderStore.getAt(rowIndex);
category_Store_row.load();
ownerType_RW_Store.load();
claimType_RW_Store.load();

type_Store_row.load({params:{productType:orderRecord.data.categoryDid}});
manufacturer_RowStore.load({params:{accessoryTypeDid:orderRecord.data.objectTypeDid}});
model_RowStore.load({params:{objectTypeDid:orderRecord.data.categoryDid,manufacturerActorDid:orderRecord.data.manufacturerDid}});
code_RW_Store.load({params:{symptomCategory:orderRecord.data.symptomCategoryDid,manufacturerDID:orderRecord.data.manufacturerDid,serviceType:orderRecord.data.claimTypeDid}});
symptomcategory_RW_Store.load({params:{objectType:orderRecord.data.categoryDid,manufacturerDID:orderRecord.data.manufacturerDid,serviceType:orderRecord.data.claimTypeDid}});

}

function markInValid(val, record,data) {
if(val =""){
return '<span style="color:red;">' + val + '%</span>';
}
return val;
}

function viewOrder(val, record,data) {
var order_Did = data.data.order_did;
var order_ID = data.data.order_id + '';
return '<a tabindex="20" class="smtxt" href="javascript:goToOrderView('+order_Did+');">'+order_ID+' </a>';
}


function validateRowAfterEdit(orderRecord,rowIndex){
var flag = false ;
if (orderRecord.data.claimTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.orderTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.categoryDid == '-1' ){
flag = true ;
}
if( orderRecord.data.objectTypeDid == '-1' ){
flag = true ;
}
if(orderRecord.data.manufacturerDid == '-1' ){
flag = true ;
}
if(orderRecord.data.manufacturerDid == '-1' ){
flag = true ;
}
if(orderRecord.data.modelDid == '-1' ){
flag = true ;
}
if(orderRecord.data.itemID == '' ){
flag = true ;
}
if(orderRecord.data.ProductCode == '' ){
flag = true ;
}

if(flag){
Ext.MessageBox.alert('<%=i18NHelper.getString("mwaf.error.title","mwaf")%>', '<%=i18NHelper.getString("ebaftersales.batch.ui.error.mandatoryFields","ebaftersales")%>', function() {
orderRecord.data.status='invalid';
grid.getView().refresh();
editor.startEditing(rowIndex);
});

}else{
orderRecord.data.status='valid';
grid.getView().refresh();
editor.startEditing(rowIndex);
}




}



var productCodeText = new Ext.form.TextField({
xtype: 'textfield',
id: 'productCodeText',
name: 'productCodeTextName',
allowBlank:false,
invalidText :'<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>',
listeners: {
change :function(newValue,oldValue ){
validateProductCodeInEditedRow(newValue.getValue());
}

}
});


var itemIDText = new Ext.form.TextField({
xtype: 'numberfield',
id: 'itemIDText',
name: 'itemIDTextName',
allowBlank:false,
invalidText :'<%=i18NHelper.getString("ebaftersales.error.processrepair.invalidproductcode","ebaftersales")%>',
listeners: {
change :function(newValue,oldValue ){
var orderRecord= orderStore.getAt(orderStoreIndex);

validateIMEI(newValue.getValue(),orderRecord.data.objectTypeDid,orderRecord.data.categoryDid);
if(message_valid_IMEI){

}else{
itemIDText.markInvalid('');
}
}

}
});

var symptomCategoryComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'symptomCategoryDid_row',
name: 'symptomCategory_row',
store: symptomcategory_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {

var orderRecord= orderStore.getAt(orderStoreIndex);

orderStore.data.items[orderStoreIndex].data.symptomCategoryDid = symptomCategoryComboBox.value;

var symptomCategoryDid =symptomCategoryComboBox.value;
var claimTypeDid =orderRecord.data.claimTypeDid;
var manufacturerDid =orderRecord.data.manufacturerDid;

if((manufacturerDid != null || manufacturerDid != -1) &&
(symptomCategoryDid != null || symptomCategoryDid != -1 )&&
(claimTypeDid != null || claimTypeDid != -1) ){
code_RW_Store.load({params:{symptomCategory:symptomCategoryDid,manufacturerDID:manufacturerDid,serviceType:claimTypeDid}});
}

grid.view.refresh();
}
}

});

var symptomCodeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'symptomCodeDid_row',
name: 'symptomCode_row',
store: code_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.symptomCodeDid = symptomCodeComboBox.value;
grid.view.refresh();
}
}

});

var categoryComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'categoryDid_row',
name: 'category_row',
store: category_Store_row,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.categoryDid = categoryComboBox.value;
grid.view.refresh();
},
change:function(field,newValue,oldValue){
typeComboBox.reset();
manufacturerComboBox.reset();
modelComboBox.reset();
itemIDText.reset();
}
}

});

var typeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'typeDid_row',
store: type_Store_row,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Object Type ...',
allowBlank:false,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.objectTypeDid = typeComboBox.value;
grid.view.refresh();
}
}

});



var manufacturerComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'manufacturerDid_row',
store: manufacturer_RowStore,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
allowBlank:false,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.manufacturerDid = manufacturerComboBox.value;
grid.view.refresh();

var orderRecord= orderStore.getAt(orderStoreIndex);
model_RowStore.load({params:{objectTypeDid:orderRecord.data.categoryDid,manufacturerActorDid:manufacturerComboBox.value}});


}
}

});


var modelComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'modelDid_row',
name: 'model_row',
store: model_RowStore,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.modelDid = modelComboBox.value;
grid.view.refresh();
}
}

});

var ownerTypeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'ownerTypeDid_row',
name: 'ownerType_row',
store: ownerType_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.ownerTypeDid = ownerTypeComboBox.value;
grid.view.refresh();
}
}

});

var claimTypeComboBox = new Ext.form.ComboBox({
xtype: 'combo',
id: 'claimTypeDid_row',
name: 'claimType_row',
store: claimType_RW_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true,
listeners: {
scope:this,
select: function(combo, record, index) {
orderStore.data.items[orderStoreIndex].data.claimTypeDid = claimTypeComboBox.value;
grid.view.refresh();
}
}

});


question_Store.on({
'load':{
fn: function(store, options) {
createManufacturerCriteria();
}
}
});

function rendererCombo(v,meta,value){
if(v == -1){
meta.css = 'print_underline';
}
return value;
}


Ext.onReady(function(){
noSplash(); // remove the Splash

category_Store.load();
ownerType_Store.load();
orderType_Store.load();
claimType_Store.load();

comps =new Ext.Panel({
layout:'form',
border:false ,
xtype:'form',
labelAlign:'left',
height: 250,
width:200,
monitorResize: true,
autoScroll:true,
overflow:'auto'
});

editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'

});

editor.on({
'beforeedit':{
fn: function(roweditor, rowIndex) {
startEditing(rowIndex);
}
},
'canceledit':function (roweditor, value, startValue) {

},
'validateedit': function(roweditor, changes, record, rowIndex) {
validateRowAfterEdit(record,rowIndex);
},
'afteredit': function(roweditor, changes, record, rowIndex) {

}
});



form = new Ext.FormPanel({
id: 'preProcess_form',
title:'<%=i18NHelper.getString("ebaftersales.batch.title","ebaftersales")%>',
xtype:'form',
width:800,
height:300,
labelAlign:'left',
layout:'fit',
frame:false,
border:false,
autoScroll:true,
overflow:'auto' ,
validate:false,

items:[
{
layout:'column',
defaults:{
layout:'form',
border:false,
labelAlign :'right'
},
items:[
{
// first column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.productInfo","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.23,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'categoryDid',
name: 'category',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Category","ebaftersales")%>',
store: category_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
type_Store.load({params:{productType:record.data.did}});
strCategory = record.get('title') ;
loadManufacturerCriteria();
loadSymptomCategories();
}

}
}) ,

new Ext.form.ComboBox({
id: 'typeDid',
name: 'type',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Type","ebaftersales")%>',
store: type_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
manufacturer_Store.load({params:{accessoryTypeDid:record.data.did}});
strType = record.get('title') ;
}

}
}) ,
new Ext.form.ComboBox({
id: 'manufacturerDid',
name: 'manufacturer',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Manufacturer","ebaftersales")%>',
store: manufacturer_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Manufacturer ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
model_Store.load({params:{objectTypeDid:Ext.getCmp('categoryDid').getValue(),manufacturerActorDid:Ext.getCmp('manufacturerDid').getValue()}});
strManufacturer = record.get('title') ;
loadManufacturerCriteria();
loadSymptomCategories();

}

}
}) ,
new Ext.form.ComboBox({
id: 'modelDid',
name: 'model',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.Model","ebaftersales")%>',
store: model_Store,
displayField: 'title',
typeAhead: true,
valueField: 'did',
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Model ...',
resizable:true,
minListWidth:150,
allowBlank:true ,
forceSelection: true,
selectOnFocus:true,
listeners: {
scope:this,
select: function(combo, record,index) {
productCode_Store.load({params:{modelDid:Ext.getCmp('modelDid').getValue(),objectDid:Ext.getCmp('categoryDid').getValue()}});
strModel = record.get('title') ;
}
}
}) ,
new Ext.form.ComboBox({
id: 'productCode',
name: 'productCode_name',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.ProductCode","ebaftersales")%>',
store: productCode_Store,
displayField: 'title',
typeAhead: true,
valueField: 'did',
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Product Code ...',
resizable:true,
minListWidth:150,
allowBlank:true ,
forceSelection: true,
selectOnFocus:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strProductCode = record.get('title') ;
}
}
})
]

}
,{
// second column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.orderInfo","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.23,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'orderTypeDid',
name: 'orderType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.orderType","ebaftersales")%>',
store: orderType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Order Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strOrderType = record.get('title') ;
}
}
}) ,
new Ext.form.ComboBox({
id: 'claimTypeDid',
name: 'claimType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.claimType","ebaftersales")%>',
store: claimType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Claim Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
loadManufacturerCriteria();
loadSymptomCategories();
strClaimType = record.get('title') ;
}
}
}) ,
{
xtype: 'radiogroup',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.POPAttached","ebaftersales")%>',
columns: 2,
id:'POPAttached',
items: [
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.yes","ebaftersales")%>', name: 'rb-POPAttached', inputValue: 'yes'},
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.no","ebaftersales")%>', name: 'rb-POPAttached', inputValue: 'no' }
]
},
{
xtype: 'radiogroup',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.receivedfrom3rdparty","ebaftersales")%>',
columns: 2,
id:'receivedfrom3rdparty',
items: [
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.yes","ebaftersales")%>', name: 'rb-receivedfrom3rdparty', inputValue: 'yes'},
{boxLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.no","ebaftersales")%>', name: 'rb-receivedfrom3rdparty', inputValue: 'no',checked:true}
] ,
listeners: {
change :function(newValue,checked ){
if(checked.boxLabel == 'Yes'){
Ext.getCmp('originID').setDisabled(false) ;
}else{
Ext.getCmp('originID').setDisabled(true) ;
Ext.getCmp('originID').reset() ;
}
}

}
},
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.originID","ebaftersales")%>',
allowBlank:true,
id:'originID' ,
listeners: {
change :function(newValue,oldValue ){
validateOrganization(newValue.getValue(),'originID');
}

}
},
new Ext.form.ComboBox({
id: 'ownerTypeDid',
name: 'ownerType',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerType","ebaftersales")%>',
store: ownerType_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Owner Type ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strOwnerType = record.get('title') ;
}
}
}) ,
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.ownerCode","ebaftersales")%>',
allowBlank:true,
id:'ownerCode',
listeners: {
change :function(newValue,oldValue ){
validateOrganization(newValue.getValue(),'ownerCode');
}

}
}
]

}
,{
// third column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.symptom","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.24,
defaults:{anchor:'90%'},
items:[
new Ext.form.ComboBox({
id: 'symptomcategoryDid',
name: 'symptomcategory',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.symptomcategory","ebaftersales")%>',
store: symptomcategory_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Symptom category ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strSymptomCategory= record.get('title') ;

loadSymptomCode();
}
}
}) ,
new Ext.form.ComboBox({
id: 'codeDid',
name: 'code',
fieldLabel: '<%=i18NHelper.getString("ebaftersales.batch.ui.code","ebaftersales")%>',
store: code_Store,
displayField: 'title',
valueField: 'did',
editable: false,
mode: 'local',
triggerAction: 'all',
emptyText:'Choose Code ...',
selectOnFocus:false,
resizable:true,
minListWidth:150,
allowBlank:true ,
listeners: {
scope:this,
select: function(combo, record,index) {
strSymptomCode= record.get('title') ;
}
}
}) ,

{
xtype:'textarea',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.details","ebaftersales")%>',
allowBlank:true,
id:'details'

},
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.cosmeticCondition","ebaftersales")%>',
allowBlank:true,
id:'cosmeticCondition'
}
]
}
,{
// fourth column
// defaults for fields
title:'<%=i18NHelper.getString("ebaftersales.batch.ui.manufacturerCriteria","ebaftersales")%>',
buttonAlign:'left',
labelWidth:100,
columnWidth:0.30,
defaults:{anchor:'100%'},
items:comps
}

]
}

]
});

var form2 = new Ext.FormPanel({
id: 'preProcess_form2',
xtype:'form',
width:800,
height:30,
labelAlign:'left',
layout:'fit',
frame:false,
border:false,
autoScroll:true,
overflow:'auto' ,
validate:false,
items:[
{
layout:'column',
anchor: "0",
defaults:{
layout:'form',
border:false

},
items:[
{
// first column
// defaults for fields
buttonAlign:'left',
labelWidth:100,
columnWidth:0.32,
defaults:{anchor:'75%'},
items:[
{
xtype:'textfield',
fieldLabel:'<%=i18NHelper.getString("ebaftersales.batch.ui.itemID","ebaftersales")%>',
allowBlank:true,
id:'itemID',
tabIndex :2,
maskRe:/[0-9]/,
validator:function (validateValue){
var objectType= Ext.getCmp('categoryDid').getValue();
if(objectType == 212 ){
if(validateValue.length != 15 ){
Ext.getCmp('itemID').focus();
return false;
}else {
return true;
}
}else {
return true;
}

},
listeners: {
change :function(newValue,oldValue ){
validateIMEI(Ext.getCmp('itemID').getValue(),Ext.getCmp('categoryDid').getValue(),Ext.getCmp('typeDid').getValue());
}
}


}
]
} ,{
// second column
// defaults for fields
columnWidth:0.10,
items:[
{
id:'addButton',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.add","ebaftersales")%>',
xtype: 'button',
type: 'submit',
buttonAlign:'left',
handler: function(btn, e) {
addOrder();
}
}
]

}
,{
// third column
// defaults for fields
buttonAlign:'left',
columnWidth:0.10,
items:[
{
id:'addButton2',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.clear","ebaftersales")%>',
xtype: 'button',
type: 'submit',
handler: function(btn, e) {
clearForm();
}
}
]
}
,{
// fourth column
// defaults for fields
buttonAlign:'left',
labelWidth:0,
columnWidth:0.10,
items:[
{
id:'addButton3',
text:'<%=i18NHelper.getString("ebaftersales.batch.ui.create","ebaftersales")%>',
xtype: 'button',
type: 'submit',
handler: function(grid, rowIndex, e) {
createOrders();

}
}

]
} ,{
// fifth column
// defaults for fields
buttonAlign:'left',
labelWidth:0,
columnWidth:0.43

}

]
}
]

});


grid = new Ext.grid.GridPanel({
xtype: 'grid',

cm: new Ext.grid.ColumnModel([

{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.itemID","ebaftersales")%>',
dataIndex: 'itemID',
id: 'itemID',
width: 100,

editor: itemIDText,
renderer: function(v,meta, record,data){
var itemID = record.data.itemID;
if(itemID == ''){
meta.css = 'print_underline';
}
return v;
}

},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Category","ebaftersales")%>',
dataIndex: 'Category',
id: 'Category',
width: 100,
editor: categoryComboBox,
renderer:function(value,meta, record,data) {
var category = record.data.Category;
var record1 = categoryComboBox.findRecord(categoryComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(categoryComboBox.displayField)): rendererCombo(value,meta,category);
}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Type","ebaftersales")%>',
dataIndex: 'Type',
id: 'Type',
width: 100,
editor: typeComboBox,
renderer:function(value,meta, record,data) {
var type = record.data.strType;
var record1 = typeComboBox.findRecord(typeComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(typeComboBox.displayField)): rendererCombo(value,meta,type);
}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Manufacturer","ebaftersales")%>',
id: 'Manufacturer',
dataIndex: 'Manufacturer',
width: 100,

editor: manufacturerComboBox,
renderer:function(value,meta, record,data) {
var manufacturer = record.data.Manufacturer;
var record1 = manufacturerComboBox.findRecord(manufacturerComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(manufacturerComboBox.displayField)): rendererCombo(value,meta,manufacturer);

}
},
{
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.Model","ebaftersales")%>',
dataIndex: 'Model',
id: 'Model',
width: 100,

editor: modelComboBox,
renderer:function(value,meta, record,data) {
var Model = record.data.Model;
var record1 = modelComboBox.findRecord(modelComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(modelComboBox.displayField)): rendererCombo(value,meta,Model);

}
},
{
id: 'ProductCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ProductCode","ebaftersales")%>',
dataIndex: 'ProductCode',
width: 100,

editor: productCodeText,
renderer: function(v,meta, record,data){
var ProductCode = record.data.ProductCode;
if(ProductCode == ''){
meta.css = 'print_underline';
}
return v;
}

},

{
xtype: 'booleancolumn',
id: 'receivedfrom3rdparty',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.receivedfrom3rdparty","ebaftersales")%>',
dataIndex: 'receivedfrom3rdparty',
align: 'center',
width: 50,
trueText: 'Yes',
falseText: 'No',
editor: {
xtype: 'checkbox'
}
},
{
id: 'originID',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.originID","ebaftersales")%>',
dataIndex: 'originID',
width: 100,
editor: {
xtype: 'textfield'
}

},
{
id: 'ownerType',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerType","ebaftersales")%>',
dataIndex: 'ownerType',
width: 100,
editor: ownerTypeComboBox,
renderer:function(value,meta, record,data) {
var ownerCode = record.data.ownerCode;
var record1 = ownerTypeComboBox.findRecord(ownerTypeComboBox.valueField, value);
return record1 ? record1.get(ownerTypeComboBox.displayField):ownerCode;
}

},
{
id: 'ownerCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.ownerCode","ebaftersales")%>',
dataIndex: 'ownerCode',
width: 100,

editor: {
xtype: 'textfield'
}

},
{
id: 'claimType',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.claimType","ebaftersales")%>',
dataIndex: 'claimType',
width: 100,

editor: claimTypeComboBox,
renderer:function(value,meta, record,data) {
var claimType = record.data.claimType;
var record1 = claimTypeComboBox.findRecord(claimTypeComboBox.valueField, value);
return record1 ? rendererCombo(value,meta,record1.get(claimTypeComboBox.displayField)): rendererCombo(value,meta,claimType);

}

},
{
xtype: 'datecolumn',
id: 'pOPDate',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.pOPDate","ebaftersales")%>',
dataIndex: 'pOPDate',
format: 'm/d/Y',
width: 100,
sortable: true,
// groupRenderer: Ext.util.Format.dateRenderer('M y'),
editor: {
xtype: 'datefield',
minValue: '01/01/2006',
maxValue: (new Date()).format('m/d/Y')
}
},
{
xtype: 'booleancolumn',
id: 'POPAttached',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.POPAttached","ebaftersales")%>',
dataIndex: 'POPAttached',
align: 'center',
width: 50,
trueText: 'Yes',
falseText: 'No',
editor: {
xtype: 'checkbox'
}
},

{
id: 'insuranceNumber',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.insuranceNumber","ebaftersales")%>',
dataIndex: 'insuranceNumber',
width: 100,

editor: {
xtype: 'textfield'//,
}

}
, {
id: 'override',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.override","ebaftersales")%>',
dataIndex: 'override',
width: 100,
align: 'left' ,
editor: {
xtype: 'textfield'
}

}
, {
id: 'approvalCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.approvalCode","ebaftersales")%>',
dataIndex: 'approvalCode',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'SymptomCategory',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomCategory","ebaftersales")%>',
dataIndex: 'SymptomCategory',
width: 100,
editor: symptomCategoryComboBox,
renderer:function(value, record,data) {
var symptomCategoryDid = data.data.SymptomCategory;
var record1 = symptomCategoryComboBox.findRecord(symptomCategoryComboBox.valueField, value);
return record1 ? record1.get(symptomCategoryComboBox.displayField):symptomCategoryDid;
}

}
, {
id: 'SymptomCode',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomCode","ebaftersales")%>',
dataIndex: 'SymptomCode',
width: 100,
editor: symptomCodeComboBox,
renderer:function(value, record,data) {
var SymptomCode = data.data.SymptomCode;
var record1 = symptomCodeComboBox.findRecord(symptomCodeComboBox.valueField, value);
return record1 ? record1.get(symptomCodeComboBox.displayField):SymptomCode;
}


}
, {
id: 'SymptomDetails',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.SymptomDetails","ebaftersales")%>',
dataIndex: 'SymptomDetails',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'cosmeticCondition',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.cosmeticCondition","ebaftersales")%>',
dataIndex: 'cosmeticCondition',
width: 100,

editor: {
xtype: 'textfield'
}

}
, {
id: 'status',
header: '<%=i18NHelper.getString("ebaftersales.batch.ui.status","ebaftersales")%>',
dataIndex: 'status',
width: 100
}
]),
store: orderStore,
autoWidth: true,
overflow:'auto' ,
plugins: [editor],
view: new Ext.grid.GroupingView({
markDirty: false
})


});

Ext.getCmp('originID').setDisabled(true) ;

var panel = new Ext.Panel({
id:'ta-panel',
baseCls:'x-plain',

style: {
marginRight: '5px',
marginLeft: '5px'
},
renderTo: 'orderBatchProcess',
layout:'vbox',
layoutConfig: {
align : 'stretch',
pack : 'start'
},
autoScroll:true,
overflow:'auto' ,
// applied to child components
defaults: {frame:false,footer:false, border: true,bodyBorder:true,collapsible:false,shadowOffset:6},
items:[form,form2,grid] ,

resized : function() {
var width = (Ext.isIE) ? document.body.clientWidth : window.innerWidth;
var height = (Ext.isIE) ? document.body.clientHeight : window.innerHeight;
var grid_width = 800;
var grid_height = 448;
if (height > base_height_size) {
height = height - (base_height_size - grid_height); //grid height is set by the last number
}
else
{
height = grid_height;
}

if (width > base_width_size) {
width = Math.floor(width * 0.93)-10;
}
else
{
width = grid_width;
}

panel.setSize(width, height);
grid.setHeight(height - 330);
panel.doLayout('false', 'true');
//grid.getView().fitColumns();
grid.syncSize();



}
});

panel.resized();
Ext.EventManager.onWindowResize( panel.resized, panel );


});


</script>

shanika
15 Dec 2010, 3:23 AM
here I have attached my Code .