{layout name="layout"}
<div class="card">
    <div class="card-body">
        <form class="form-horizontal" action="__SELF__" method="post">
            <input type="hidden" name="id" value="{$row.id|null}" />
            {volist name="fields" id="vo"}
            <?php
                $fieldName = $field['name'];
                $fieldComment = $field['comment'] ?? $fieldName;
                $fieldType = $field['type'] ?? 'varchar';
            ?>
            {switch $fieldType}
            {case value='select'}
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <select name="{$fieldName}" class="form-control selectpicker">
                        {\\volist name="$vo.selectOptions" id="cvo"}
                            <option value="{\\$cvo.id}" {\\if $row['{$fieldName}']== $cvo.id}selected{\\/if}>{\\$cvo.title}</option>
                        {\\/volist}
                    </select>
                </div>
            </div>
            {/case}
            {case value='radio'}
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    {\\volist name="$vo.selectOptions" id="cvo"}
                    <label class="lyear-radio radio-primary radio-inline">
                        <input type="radio" name="{$fieldName}" {\\if $row.{$fieldName} == $key} checked{\\/if} value="{\\$key}">
                        <span>{\\$rvo}</span>
                    </label>
                    {\\/volist}
                </div>
            </div>
            {/case}
            {case value='time'}
            <div class="form-group">
                <label for="type" class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <input type="password" name="{$fieldName}" placeholder="请输入{$fieldComment}" value="{\$row.{$fieldName}|null}" class="form-control" />
                </div>
            </div>
            {/case}
            {case value='image'}
            <div class="form-group">
                <label for="type" class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <input id="c-{$fieldName}" class="form-control" size="50" name="{$fieldName}" type="hidden" value="{\$row.{$fieldName}|default=''}" data-tip="image">
                    <ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-{$fieldName}">
                        <li nodelete class="col-xs-4 col-sm-3 col-md-2">
                            <a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
                            <a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
                        </li>
                    </ul>
                </div>
            </div>
            {/case}
            {case value='file'}
            <div class="form-group">
                <label for="type" class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <input id="c-{$fieldName}" class="form-control" size="50" name="{$fieldName}" type="hidden" value="{\$row.{$fieldName}|default=''}" data-tip="image">
                    <ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-{$fieldName}">
                        <li nodelete class="col-xs-4 col-sm-3 col-md-2">
                            <a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
                            <a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
                        </li>
                    </ul>
                </div>
            </div>
            {/case}
            {case value='password'}
            <div class="form-group">
                <label for="type" class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <input type="password" name="{$fieldName}" placeholder="请输入{$fieldComment}" value="{\$row.{$fieldName}|null}" class="form-control" />
                </div>
            </div>
            {/case}
            {default /}
            <div class="form-group">
                <label for="type" class="control-label col-xs-12 col-sm-2">{$fieldComment}</label>
                <div class="col-xs-12 col-sm-8 col-md-6">
                    <input type="text" name="{$fieldName}" placeholder="请输入{$fieldComment}" value="{\$row.{$fieldName}|null}" class="form-control" />
                </div>
            </div>
            {/switch}
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"></label>
                <div class="col-xs-12 col-sm-8 col-md-6 layer-footer">
                    <button type="submit" class="btn btn-primary m-r-5">提交</button>
                    <button type="reset" class="btn btn-warning m-r-5">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>