<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="theFrm">
        <input type="hidden" name="id" value="<?=$info->id?>">
        <tr>
            <td width="100" height="25" class="bg_tr">车牌号</td>
            <td height="25" class="td_bg">
                <input name="car_no" type="text" id="car_no" value="<?=$info->car_no?>" style="width:200px;"/>
            </td>
            <td width="100" height="25" class="bg_tr">厂牌型号</td>
            <td height="25" class="td_bg">
                <input name="factory_model" type="text" id="factory_model" value="<?=$info->factory_model?>" style="width:200px;"/>
            </td>
            <td width="100" height="25" class="bg_tr">品牌</td>
            <td height="25" class="td_bg">
                <select id="brand_id" name="brand_id">
                    <option value="0">---请选择---</option>
                    <?php
                    foreach($brand_items as $item) {
                        echo '<option value="'.$item->id.'"';
                        if($info->brand_id == $item->id)
                            echo ' selected ';
                        echo '>'.$item->name.'</option>';
                    }
                    ?>
                </select>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="bg_tr">发动机号</td>
            <td height="25" class="td_bg">
                <input name="engine_no" type="text" id="engine_no" value="<?=$info->engine_no?>" style="width:200px;"/>
            </td>
            <td width="100" height="25" class="bg_tr">车架号</td>
            <td height="25" class="td_bg">
                <input name="car_frame_no" type="text" id="car_frame_no" value="<?=$info->car_frame_no?>" style="width:200px;"/>
            </td>
            <td width="100" height="25" class="bg_tr">初登日期</td>
            <td height="25" class="td_bg">
                <input class="act_date" name="register_date" type="text" id="register_date" value="<?=$info->register_date?>" onclick="WdatePicker()"/>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="bg_tr">车辆类型</td>
            <td height="25" class="td_bg">
                <select id="car_type_id" name="car_type_id">
                    <option value="0">---请选择---</option>
                    <?php
                    foreach($car_type_items as $item) {
                        echo '<option value="'.$item->id.'"';
                        if($info->car_type_id == $item->id)
                            echo ' selected ';
                        echo '>'.$item->name.'</option>';
                    }
                    ?>
                </select>
            </td>
            <td width="100" height="25" class="bg_tr">运营性质</td>
            <td height="25" class="td_bg">
                <select name="car_use_id" id="car_use_id">
                    <option value="0">---请选择---</option>
                    <?php
                    foreach($car_use_items as $item) {
                        echo '<option value="'.$item->id.'"';
                        if($info->car_use_id == $item->id)
                            echo ' selected ';
                        echo '>'.$item->name.'</option>';
                    }
                    ?>
                </select>
            </td>
            <td width="100" height="25" class="bg_tr">座位数</td>
            <td height="25" class="td_bg">
                <input name="seats" type="text" id="seats" value="<?=$info->seats?>" style="width:50px;"/>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="bg_tr">车系</td>
            <td height="25" class="td_bg">
                <select name="series_id" id="series_id">
                    <option value="0">---请选择---</option>
                    <?php
                    foreach($series_items as $item) {
                        echo '<option value="'.$item->id.'"';
                        if($info->series_id == $item->id)
                            echo ' selected ';
                        echo '>'.$item->name.'</option>';
                    }
                    ?>
                </select>
            </td>
            <td width="100" height="25" class="bg_tr">排量</td>
            <td height="25" class="td_bg">
                <select name="displacement_id" id="displacement_id">
                    <option value="0">---请选择---</option>
                    <?php
                    foreach($displacement_items as $item) {
                        echo '<option value="'.$item->id.'"';
                        if($info->displacement_id == $item->id)
                            echo ' selected ';
                        echo '>'.$item->name.'</option>';
                    }
                    ?>
                </select>
            </td>
            <td width="100" height="25" class="bg_tr">年份</td>
            <td height="25" class="td_bg">
                <input type="text" id="car_year" name="car_year" value="<?=$info->car_year?>" style="width:100px;">
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="bg_tr">车主</td>
            <td height="25" class="td_bg">
                <input type="text" id="car_man" name="car_man" value="<?=$info->car_man?>" style="width:200px;" >
            </td>
            <td width="100" height="25" class="bg_tr">联系电话</td>
            <td height="25" class="td_bg">
                <input type="text" id="phone" name="phone" value="<?=$info->phone?>" style="width:200px;" >
            </td>
            <td width="100" height="25" class="bg_tr"></td>
            <td height="25" class="td_bg"></td>
        </tr>
        <tr>
            <td width="100" height="25" class="bg_tr">备注</td>
            <td colspan="5" height="25" class="td_bg">
                <textarea style="width:97%; height: 50px;" name="remark" id="remark"><?=$info->remark?></textarea>
            </td>
        </tr>
    </form>
    <tr>
        <td height="22" colspan="6" align="center" class="td_bg">
            <input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 保存 "/>
            <input id="back-btn" type=button class="ACT_btn" name=Submit1 value=" 返回 "/>
        </td>
    </tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        //提交按钮
        $("#submit-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#theFrm").serialize();
                $.post('/car/save',params,function(obj){
                    alert(obj.msg);
                },'json');
            }
        });

        //返回按钮
        $('#back-btn').click(function(){
            history.go(-1);
        });

        $('#brand_id').change(function(){
            var brand_id = $(this).val();
            $('#series_id').html('<option value="0">---请选择---</option>');
            $('#displacement_id').html('<option value="0">---请选择---</option>');
            if(brand_id > 0) {
                $.get('/car/series',{brand_id:brand_id},function(obj){
                    if(obj.success) {
                        $('#series_id').html(obj.html);
                    }
                },'json');
            }
        });
        $('#series_id').change(function(){
            var series_id = $(this).val();
            $('#displacement_id').html('<option value="0">---请选择---</option>');
            if(series_id > 0) {
                $.get('/car/displacement',{series_id:series_id},function(obj){
                    if(obj.success) {
                        $('#displacement_id').html(obj.html);
                    }
                },'json');
            }
        });
    })
</script>
