<?php

$role = function()
{
    $info = Dever::db('setting/role')->select();
    return $info;
};

$type = array
(
    1 => '代理商合同',
    2 => '代理商解除合同',
    3 => '软件服务合同',
    4 => '市场管理培训师承诺书',
    5 => '5000合同',
    6 => '期权合同',
);

return array
(
    # 表名
    'name' => 'agreement',
    # 显示给用户看的名称
    'lang' => '合同模板',
    'order' => 3,
    'config_type' => $type,
    # 数据结构
    'struct' => array
    (
    
        'id'        => array
        (
            'type'      => 'int-11',
            'name'      => 'ID',
            'default'   => '',
            'desc'      => '',
            'match'     => 'is_numeric',
            'search'    => 'order',
            'update'    => 'hidden',
            //'list'        => true,
        ),

        'type'        => array
        (
            'type'      => 'tinyint-1',
            'name'      => '合同类型',
            'default'   => '1',
            'desc'      => '合同类型',
            'match'     => 'is_numeric',
            'update'    => 'radio',
            'option'    => $type,
            'search'    => 'select',
            'list'      => true,
            //'control'   => 'type',
        ),

        'name'      => array
        (
            'type'      => 'varchar-500',
            'name'      => '合同名称-变量说明：{name}是代理商姓名，{role}代理商角色，{area}签署地区，{date}签署时间',
            'default'   => '',
            'desc'      => '合同名称',
            'match'     => 'is_string',
            'update'    => 'text',
            'search'    => 'fulltext',
            'list'      => 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})',
        ),
    ),

    'default' => array
    (
        'col' => 'id,name,type,state,cdate',
        'value' => array
        (
            '1,"{name}{role}{area}代理商合作协议.{date}.pdf", 1, 1,' . DEVER_TIME,

            '2,"{name}代理商合同解除协议.{date}.pdf", 2, 1,' . DEVER_TIME,

            '3,"{name}市场管理培训师承诺书.{date}.pdf", 4, 1,' . DEVER_TIME,

            '4,"5000合同.pdf", 5, 1,' . DEVER_TIME,

            '5,"{name}期权交付合同.{date}.pdf", 6, 1,' . DEVER_TIME,

            '6,"{name}软件服务合同.{date}.pdf", 3, 1,' . DEVER_TIME,
        ),
    ),

    'manage' => array
    (
        //'insert' => false,
        'delete' => false,
    ),

    'request' => array
    (
        'getData' => array
        (
            # 匹配的正则或函数 选填项
            'option' => array
            (
                'state' => 1,
            ),
            'order' => array('id' => 'desc'),
            'type' => 'all',
            'col' => '*|type',
        ),
    ),
);
