{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% trans "选择样式" %}</title>
</head>
<body style="text-align:center">
    <form id="exportform"  method="GET" target="_blank">
        <table width="330" border="0" cellspacing="0" cellpadding="2" class="table">
            <tr>
                <td valign="middle" bgcolor="#f1fcfe">{% trans '导出样式' %}</td>
                <td background="#f1fcfe">
                    <select  name="format" class="export_style" >
                        {% for key,value in ex_styles.items %}
                            <option value="{{key}}">{{value}}</option>
                        {% endfor %}
                    </select>
                </td>
                <td>
                    <td><input type="checkbox" id="id_per_page">{% trans 'Per Page' %}</td>
                </td>
            </tr>
            <tr>
                <td><input type="radio" name="has_break_time" value="0" checked>{% trans 'Without Break Time' %}</td>
                <td><input type="radio" name="has_break_time" value="1">{% trans 'With Break Time' %}</td>
                <td></td>
            </tr>
        </table>
        <div class="btns_class">
            <input type="button" value={% trans "导出" %}  id="flex_btnExport" class="btn" />
            <input type="button" value={% trans "退出" %}  id="flex_btnReturn" class="btn" />
        </div>
    </form>
</body>
<script>
    $("#flex_btnReturn").unbind().click(function(){
        $("#id_export_dialog").find("#id_close").click();
    });
    $("#flex_btnExport").unbind().click(function(){
        var m_util = get_cur_util();
        var ex_style = $(".export_style").val();
        var per_page = 0;
        if($("#id_per_page").attr('checked')){
            per_page = 1;
        }
        var has_break_time = $("input[name=has_break_time]:checked").val();
        if(m_util.bg_params.indexOf('reportname') == -1){
            m_util.bg_params = m_util.bg_params+"&reportname="+$("#verbose_name").val()+"&";
        }
        var url = m_util.bg_params+"format={{ format }}"+"&hide="+m_util.hide_index.join(',')
                +"&"+m_util.cur_param+"&style="+ex_style+"&per_page="+per_page+"&has_break_time="+has_break_time;
        window.open(url);
    });
</script>
</html>