{% extends 'obj_form.html' %}
{% load i18n %}
{% load tj_filters %}

{% block subtitle-1 %}
{% trans "分享配置" %}
{% endblock %}
{% block subtitle-2 %}
{% trans "分享人" %}
{% endblock %}


{% block form_content %}
{{ block.super }}

<style>
    input[type=radio],
    input[type=checkbox] {
        display: inline-block;
        width: auto;
        height: auto;
        border: none;
        box-shadow: none;
    }

    .input-num {
        display: inline-block;
        width: 100px;
        border: none;
        border-bottom: 1px solid gray;
    }
</style>

<div class="alert alert-success" role="alert" style="display: none">保存成功！</div>
<input type="hidden" name="company" value="{{request.user.ancestor_id}}">
<input type="hidden" name="consumer" value="{{form.instance.consumer_id}}">

<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'status' %}</label>
    <div class="col-sm-10">
        {{ form.status }}
	</div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'rebate_amount' %} </label>
    <div class="col-sm-10">
		{{ form.rebate_amount }}
	</div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'can_share_num' %} </label>
    <div class="col-sm-10">
		{{ form.can_share_num }}
	</div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'tm_start' %} </label>
    <div class="col-sm-10">
		{{ form.tm_start }}
	</div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'tm_end' %} </label>
    <div class="col-sm-10">
		{{ form.tm_end }}
	</div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label ">{% get_verbose_field_name form.instance 'remark' %} </label>
    <div class="col-sm-10">{{ form.remark }}</div>
</div>

<div>
    <a class="btn btn-primary btn-save" type="submit" style="float:right;">{% trans '保存' %}</a>
</div>


<script>
    $(document).ready(function () {
	
		setDatePickerZh();
        $('.datetimepicker').datetimepicker({
            i18n:{
                zh:{
                    months:['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月',],
                    dayOfWeek:["一", "二", "三", "四","五", "六", "日",]
                }
            },
            //timepicker:true,
            format:'Y-m-d H:i:s',        
        });
		
        $('.btn-save').click(function () {
            $.SubmitForm('#obj_form form', '{{request.path}}', function(){
                $('.alert').fadeIn();
                setTimeout(() => {
                    $('.alert').hide();
                }, 3000);
            });
        });
    })

</script>
{% endblock %}