<?php

$type = function()
{
	$array = array();
	$data = Dever::load('scm/unit_type-state');
	if($data)
	{
		$array += $data;
	}
	return $array;
};

return array
(
	# 表名
	'name' => 'unit',
	# 显示给用户看的名称
	'lang' => '单位设置',
	# 是否显示在后台菜单
	'order' => 10,
	'config_type' => $type,

	# 数据结构
	'struct' => array
	(
		'id' 		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> 'ID',
			'default' 	=> '',
			'desc' 		=> '',
			'match' 	=> 'is_numeric',
			'list'		=> true,
			'order'		=> 'asc',
		),

		'name'		=> array
		(
			'type' 		=> 'varchar-150',
			'name' 		=> '单位名称',
			'default' 	=> '',
			'desc' 		=> '单位名称',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
			'edit'		=> true,
		),

		'en_name'		=> array
		(
			'type' 		=> 'varchar-150',
			'name' 		=> '单位英文名称',
			'default' 	=> '',
			'desc' 		=> '单位英文名称',
			'match' 	=> 'is_string',
			'update'	=> 'text',
			'search'	=> 'fulltext',
			'list'		=> true,
			'edit'		=> true,
		),

		'type_id'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '单位分类',
			'default' 	=> '1',
			'desc' 		=> '单位分类',
			'match' 	=> 'is_numeric',
			'update'	=> 'radio',
			'option'	=> $type,
			'search'	=> 'select',
			'list'		=> true,
		),

		'reorder'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '排序(数值越大越靠前)',
			'default' 	=> '1',
			'desc' 		=> '请输入排序',
			'match' 	=> 'option',
			//'update'	=> 'text',
			'search'	=> 'order',
			'list_name' => '排序',
			'list'		=> true,
			'order'		=> 'desc',
			'edit'		=> true,
		),
		
		'state'		=> array
		(
			'type' 		=> 'tinyint-1',
			'name' 		=> '状态',
			'default' 	=> '1',
			'desc' 		=> '请选择状态',
			'match' 	=> 'is_numeric',
		),
		
		'cdate'		=> array
		(
			'type' 		=> 'int-11',
			'name' 		=> '录入时间',
			'match' 	=> array('is_numeric', time()),
			'desc' 		=> '',
			# 只有insert时才生效
			'insert'	=> true,
			//'search'	=> 'date',
			//'list'		=> 'date("Y-m-d H:i:s", {cdate})',
		),
	),

	'manage' => array
	(
		'insert' => false,
        'edit' => false,

        'button' => array
        (
        	'新增' => array('fast'),
        	'分类设置' => array('list', 'unit_type&oper_parent=unit'),
        ),
        
		'list_button' => array
        (
        	'edit' => array('编辑'),
        )
	),

	'default' => array
	(
		'col' => 'name,en_name,type_id,reorder,state,cdate',
		'value' => array
		(
			# 重量单位Weight
			'"千克","kilogram",1,2199,1,' . DEVER_TIME,
			'"克","gram",1,2198,1,' . DEVER_TIME,
			'"吨","ton",1,197,1,' . DEVER_TIME,
			'"公吨","metricton",1,196,1,' . DEVER_TIME,
			'"长吨","longton",1,195,1,' . DEVER_TIME,
			'"短吨","shortton",1,194,1,' . DEVER_TIME,
			'"盎司","ounce",1,193,1,' . DEVER_TIME,

			# 数量单位Number
			'"个","pcs",2,2399,1,' . DEVER_TIME,
			'"袋","bag",2,2299,1,' . DEVER_TIME,
			'"件","piece",2,2298,1,' . DEVER_TIME,
			'"箱","box",2,2297,1,' . DEVER_TIME,
			'"双","pair",2,296,1,' . DEVER_TIME,
			'"套","set",2,295,1,' . DEVER_TIME,
			'"打","dozen",2,294,1,' . DEVER_TIME,
			'"罗","gross",2,293,1,' . DEVER_TIME,
			'"桶","drum",2,292,1,' . DEVER_TIME,
			'"包","bale",2,291,1,' . DEVER_TIME,
			'"卷","roll",2,290,1,' . DEVER_TIME,

			# 长度单位Length
			'"米","meter",3,1399,1,' . DEVER_TIME,
			'"英尺","foot",3,398,1,' . DEVER_TIME,
			'"码","yard",3,399,1,' . DEVER_TIME,

			# 面积单位Area
			'"平方米","squaremeter",4,499,1,' . DEVER_TIME,
			'"平方英尺","squarefeet",4,498,1,' . DEVER_TIME,
			'"平方码","squareyard",4,497,1,' . DEVER_TIME,

			# 体积单位Voiume
			'"立方米","cubicmeter",5,599,1,' . DEVER_TIME,
			'"立方英尺","cubicfoot",5,598,1,' . DEVER_TIME,
			'"立方码","cubicyard",5,597,1,' . DEVER_TIME,

			# 容积单位Capality
			'"公升","litre",6,699,1,' . DEVER_TIME,
			'"加仑","gallon",6,698,1,' . DEVER_TIME,
			'"蒲式耳","bushel",6,697,1,' . DEVER_TIME,
		),
	),

	'request' => array
	(
		'getAll' => array
		(
			# 匹配的正则或函数 选填项
			'option' => array
			(
				'type_id' => 'yes',
				'state' => 1,
			),
			'type' => 'all',
			'order' => array('reorder' => 'desc', 'id' => 'desc'),
			'col' => 'id,id as value, name',
		),
	)
);