{% extends "data_opform.html" %} {% load i18n %} {% block addjs %} var selectcount=0 function before_submit() { var hascheck=false $(".div_time_select").find("input[type='checkbox']").each(function(){ if($(this).attr("checked")) { hascheck=true; return false; } }); if(!hascheck) { alert(gettext("请选择时段")); return false; } var hastt=false $("input[name='days']").each(function(){ if($(this).attr("checked")) { hastt=true; return false; } }); if(!hastt) { alert(gettext("选择日期")); return false; } return true } $(function(){ $.ajax({ url:"{{request.surl}}../../../att/getmodeldata/att/SchClass/?fields=SchclassID,SchName,StartTime,EndTime", type:"POST", dataType:"json", success:function(sdata){ var html=""; for(var i =0;i"; html+=" "+ data[1] +"("+ data[2] +"--"+ data[3] +")"; html+=""; }; $("#id_add_time_table").append(html); } }); $("#id_selectcount").html("("+gettext("已选择")+selectcount+")"); $("#id_chk_selectall").click(function(){ var bln=$(this).attr("checked"); $(".div_chk_date").find("input[type='checkbox']").each(function(){ $(this).attr("checked",bln); }); if (bln) { selectcount=$(".div_chk_date").find("input[type='checkbox']").length } else { selectcount=0 } $("#id_selectcount").html("("+gettext("已选择")+selectcount+")"); }) $(".div_chk_date").find("input[type='checkbox']").click(function(){ var t=$(this).attr("checked"); if(t) {selectcount=selectcount+1} else { if (selectcount>0) selectcount=selectcount-1 } $("#id_selectcount").html("("+gettext("已选择")+selectcount+")"); }); }); {% endblock %} {% block form %} {% autoescape off %}
{% for i,k in form.errors.items %} {{i}}{{k}} {% endfor %}
{% trans '请选择时段:' %}
{% trans '是否需要加班' %}{{ form.if_overtime.as_widget }}
{% trans '加班时间(分钟)' %}{{ form.overtime.as_widget }}
{% trans '选择日期:' %}
{{ form.days.as_widget }}
{% endautoescape %} {% endblock %}