define(function(require){
	var $ = require('jquery');
	require('grid')($);
    require('uriTemplate')($);
    require('dialog')($);
    require('datepicker')($);
	var IFA = require('util');
	require("../../../styles/cim/jquery-ui-1.8.14.custom.css");
	require('../../../styles/cim/cim-grid.css');   
	$(function(){
		search();
		$("#creationdate").datepicker({
			stepMinute:15,
			showSecond:true,
		    onSelect:function(date){
			var date=date.split("-").join("/");
			$("#creationdate").datetimepicker("option","minDate",new Date(date));
			}});
		$("#search").bind("click",search);
		$("#reset").bind("click",reset);
		$("#creationdate").Datepicker();
		$("#delete").click(function(){batchDelete();});
		$("#searchForm :input").bind("keydown",function(e){
			var e = e ? e : window.event;
			if(e.keyCode==13){
			   search();
			}
		});
	});
	//根据条件查询
	function search(){
		var url=$("#queryUrl").val().trim();
		
		$("#nonebillableList").grid({
			url:url,
			root:"nonebillable",
			pageTheme:'Theme1',
			isREST :false,
			method:"POST",
			defaultParams:{vehicleId:$("#vehicleId").val(),creatorName:$("#creatorName").val(),creationDate:$("#creationdate").val()},
			fields:[{id:"id",type:"checkbox",style:{width:"5%"}},
			       // {id:"vehicleId",name:i18n["Entity.vehicleid"],style:{width:"5%"}},
			        {id:"creationDate",name:i18n["Entity.creationdate"],style:{width:"5%"},render:function(data){
			        	data.creationDate = new Date(data.creationDate).format("yyyy-MM-dd hh:mm:ss");
			        	return data.creationDate;
			        }},
			        {id:"lockDate",name:i18n["Entity.lockdate"],style:{width:"5%"},render:function(data){
			        	data.lockDate = new Date(data.lockDate).format("yyyy-MM-dd hh:mm:ss");
			        	return data.lockDate;
			        }},
			        {id:"unlockDate",name:i18n["Entity.unlockdate"],style:{width:"5%"},render:function(data){
			        	data.unlockDate = new Date(data.unlockDate).format("yyyy-MM-dd hh:mm:ss");
			        	return data.unlockDate;
			        }},
			        {id:"modifierName",name:i18n["Entity.modifier"],style:{width:"5%"}},
			        {id:"creatorName",name:i18n["Entity.creator"],style:{width:"5%"}},
			        {id:"remark",name:i18n["Entity.remark"],style:{width:"5%"}},
			        	
			       // {id:"modificationDate",name:i18n["Entity.modificationdate"],style:{width:"5%"}},
			       // {id:"creationDate",name:i18n["Entity.creationdate"],style:{width:"5%"}},
			
			        ]
			});
	}
		

});