Ext.ns("org.piercecountywa.salaryclassification.model");

org.piercecountywa.salaryclassification.model.SalarySearchModel = function(){
	
	org.piercecountywa.salaryclassification.model.SalarySearchModel.superclass.constructor.call(this);

	this.proj_name = null;
	this.jobTitle = null;
	this.jobClass = null;
	this.bargUnit = null;
	this.anywhereTitle = null;
	this.storeId = 'SalClassSearch';
	this.title = 'SalClassSearch';
	this.parentURI = '/HRMS/SalClassPlan/';	
	this.resource = 'SalaryClassPlan';
    this.setProjName = function setProjName(id){ this.proj_name = id;};
    this.getProjName = function getProjName(){ return this.proj_name;};
};
Ext.extend(org.piercecountywa.salaryclassification.model.SalarySearchModel, pcwa.ext.model.ModelComponent,
{
	createStore : function createStore(storeId){
		return new pcwa.ext.model.JsonGroupingStore({
			url: this.getUrl(),
   //   	    sortInfo : {field: 'job_title', direction: "ASC"},
	        root: 'query',
//			id: 'doc_sys_id',
			fields: ['job_class',
					 'job_title',
					 'eeo_cd',
                     'type_cd',
					 'bargain_unit', 
					 'bargain_unit_name',
					 'pay_range',
					 'first_pay_step',
					 'merit_step',
					 'steps_to_increase',
                     'med_aid_cd',
                     'empl_group',
					 {name:'rate1',  mapping:'rate1', type: 'float'},
					 {name:'rate2',  mapping:'rate2', type: 'float'},
					 {name:'rate3',  mapping:'rate3', type: 'float'},
					 {name:'rate4',  mapping:'rate4', type: 'float'},
					 {name:'rate5',  mapping:'rate5', type: 'float'},
					 {name:'rate6',  mapping:'rate6', type: 'float'},
					 {name:'rate7',  mapping:'rate7', type: 'float'},
					 {name:'rate8',  mapping:'rate8', type: 'float'},
					 {name:'rate9',  mapping:'rate9', type: 'float'},
					 {name:'rate10', mapping:'rate10',type: 'float'},
					 {name:'rate11', mapping:'rate11',type: 'float'},
					 {name:'rate12', mapping:'rate12',type: 'float'},
					 {name:'rate13', mapping:'rate13',type: 'float'},
					 'range_eff_dt'                      
            ],
			storeId: this.storeId
		});
	},
	setJobTitle:function(val){
		this.jobTitle = val;
	},
	getJobTitle:function(){
	 return this.jobTitle;
	},
	setJobClass:function(val){
		this.jobClass = val;
	},
	getJobClass:function(){
	 return this.jobClass;
	},
	setBargUnit:function(val){
		this.bargUnit = val;
	},
	getBargUnit:function(){
	 return this.bargUnit;
	},
	setAnywhereTitle:function(val){
		this.anywhereTitle = val;
	},
	getAnywhereTitle:function(){
	 return this.anywhereTitle;
	},
	setExternalUser:function(val){
		this.externalUser = val;
	},
	getExternalUser:function(){
	 return this.externalUser;
	},
	getUrl : function getUrl(){
		//debugger;
		var url = org.piercecountywa.salaryclassification.model.SalarySearchModel.superclass.getUrl.call(this);
		if(this.getJobTitle() || this.getJobClass() || this.getBargUnit() || this.getAnywhereTitle() ){
		 url += '?job_class='+this.getJobClass()+'&job_title='+this.getJobTitle()+'&barg_unit='+this.getBargUnit()+'&anywhere_Title='+this.getAnywhereTitle();
		}
		return url;
	}
});
